69 CHARACTER(CHRLEN) :: RCSIdentString = &
70 '$RCSfile: RFLU_ModStencilsVert.F90,v $ $Revision: 1.5 $'
109 TYPE(t_region
),
POINTER :: pregion
115 INTEGER :: degr,errorflag,icg,icl,ict,ilayer,iloc,isl,ivg,ivl,iv2c, &
116 nbfacemembsmax,nbfacemembsmaxtemp,ncellmembsinfomax, &
117 ncellmembsinfomaxloc,ncellmembsinfomin,ncellmembsinfominloc, &
118 nlayersinfomax,nlayersinfomaxloc,nlayersinfomin, &
119 nlayersinfominloc,nlayersmax,nrows,
order,ordernominal,scount, &
120 stencilsizemax,stencilsizemin,v2csbeg,v2csend
121 INTEGER,
DIMENSION(:),
ALLOCATABLE :: v2cs
122 INTEGER,
DIMENSION(:,:),
ALLOCATABLE :: layerinfo
123 REAL(RFREAL),
DIMENSION(:,:),
ALLOCATABLE :: dr,wts
124 TYPE(t_grid),
POINTER :: pgrid
131 global => pregion%global
134 'RFLU_ModStencilsVert.F90')
136 IF ( global%myProcid == masterproc .AND. &
137 global%verbLevel > verbose_none )
THEN
138 WRITE(stdout,
'(A,1X,A)') solver_name, &
139 'Building vertex-to-cell stencil...'
146 pgrid => pregion%grid
152 ordernominal = pgrid%v2csInfo%orderNominal
153 nlayersmax = pgrid%v2csInfo%nLayersMax
154 nbfacemembsmax = pgrid%v2csInfo%nBFaceMembsMax
155 stencilsizemax = pgrid%v2csInfo%nCellMembsMax
156 stencilsizemin = pgrid%v2csInfo%nCellMembsMin
158 ncellmembsinfomax = 0
159 ncellmembsinfomin = huge(1)
162 nlayersinfomin = huge(1)
164 nbfacemembsmaxtemp = 2*nbfacemembsmax
170 ALLOCATE(v2cs(stencilsizemax),stat=errorflag)
171 global%error = errorflag
172 IF ( global%error /= err_none )
THEN
173 CALL
errorstop(global,err_allocate,__line__,
'v2cs')
176 ALLOCATE(layerinfo(x2cs_layer_beg:x2cs_layer_end,nlayersmax), &
178 global%error = errorflag
179 IF ( global%error /= err_none )
THEN
180 CALL
errorstop(global,err_allocate,__line__,
'layerInfo')
187 DO ivg = 1,pgrid%nVertTot
195 DO isl = 1,stencilsizemax
199 DO ilayer = 1,nlayersmax
200 layerinfo(x2cs_layer_beg,ilayer) = 0
201 layerinfo(x2cs_layer_end,ilayer) = 0
204 pgrid%v2cs(ivg)%nLayers = 1
210 DO iv2c = pgrid%v2cInfo(v2c_beg,ivg),pgrid%v2cInfo(v2c_end,ivg)
212 v2cs(degr) = pgrid%v2c(iv2c)
215 layerinfo(x2cs_layer_beg,1) = 1
216 layerinfo(x2cs_layer_end,1) = degr
222 DO ilayer = 2,nlayersmax
230 IF ( degr >= 4 )
THEN
233 ALLOCATE(dr(xcoord:zcoord,nrows),stat=errorflag)
234 global%error = errorflag
235 IF ( global%error /= err_none )
THEN
236 CALL
errorstop(global,err_allocate,__line__,
'dr')
239 ALLOCATE(wts(1,nrows),stat=errorflag)
240 global%error = errorflag
241 IF ( global%error /= err_none )
THEN
242 CALL
errorstop(global,err_allocate,__line__,
'wts')
248 dr(xcoord,isl) = pgrid%cofg(xcoord,icg) - pgrid%xyz(xcoord,ivg)
249 dr(ycoord,isl) = pgrid%cofg(ycoord,icg) - pgrid%xyz(ycoord,ivg)
250 dr(zcoord,isl) = pgrid%cofg(zcoord,icg) - pgrid%xyz(zcoord,ivg)
254 compwts_mode_fixed, &
255 compwts_scal_invdist,deriv_degree_0, &
256 order,nrows,dr,wts,scount)
258 DEALLOCATE(dr,stat=errorflag)
259 global%error = errorflag
260 IF ( global%error /= err_none )
THEN
261 CALL
errorstop(global,err_deallocate,__line__,
'dr')
264 DEALLOCATE(wts,stat=errorflag)
265 global%error = errorflag
266 IF ( global%error /= err_none )
THEN
267 CALL
errorstop(global,err_deallocate,__line__,
'wts')
279 IF ( scount /= 0 .OR. degr <= stencilsizemin )
THEN
280 v2csbeg = layerinfo(x2cs_layer_beg,ilayer-1)
281 v2csend = layerinfo(x2cs_layer_end,ilayer-1)
284 v2csbeg,v2csend,v2cs)
286 pgrid%v2cs(ivg)%nLayers = pgrid%v2cs(ivg)%nLayers + 1
288 layerinfo(x2cs_layer_beg,ilayer) = &
289 layerinfo(x2cs_layer_end,ilayer-1) + 1
290 layerinfo(x2cs_layer_end,ilayer) = degr
300 pgrid%v2cs(ivg)%nCellMembs = degr
302 ALLOCATE(pgrid%v2cs(ivg)%cellMembs(pgrid%v2cs(ivg)%nCellMembs), &
304 global%error = errorflag
305 IF ( global%error /= err_none )
THEN
306 CALL
errorstop(global,err_allocate,__line__,
'pGrid%v2cs%cellMembs')
309 DO isl = 1,pgrid%v2cs(ivg)%nCellMembs
310 pgrid%v2cs(ivg)%cellMembs(isl) = v2cs(isl)
313 ALLOCATE(pgrid%v2cs(ivg)%layerInfo(x2cs_layer_beg:x2cs_layer_end, &
314 pgrid%v2cs(ivg)%nLayers),stat=errorflag)
315 global%error = errorflag
316 IF ( global%error /= err_none )
THEN
317 CALL
errorstop(global,err_allocate,__line__,
'pGrid%v2cs%layerInfo')
320 DO ilayer = 1,pgrid%v2cs(ivg)%nLayers
321 pgrid%v2cs(ivg)%layerInfo(x2cs_layer_beg,ilayer) = &
322 layerinfo(x2cs_layer_beg,ilayer)
323 pgrid%v2cs(ivg)%layerInfo(x2cs_layer_end,ilayer) = &
324 layerinfo(x2cs_layer_end,ilayer)
331 IF ( pgrid%v2cs(ivg)%nLayers < nlayersinfomin )
THEN
332 nlayersinfomin = pgrid%v2cs(ivg)%nLayers
333 nlayersinfominloc = ivg
336 IF ( pgrid%v2cs(ivg)%nLayers > nlayersinfomax )
THEN
337 nlayersinfomax = pgrid%v2cs(ivg)%nLayers
338 nlayersinfomaxloc = ivg
341 IF ( pgrid%v2cs(ivg)%nCellMembs < ncellmembsinfomin )
THEN
342 ncellmembsinfomin = pgrid%v2cs(ivg)%nCellMembs
343 ncellmembsinfominloc = ivg
346 IF ( pgrid%v2cs(ivg)%nCellMembs > ncellmembsinfomax )
THEN
347 ncellmembsinfomax = pgrid%v2cs(ivg)%nCellMembs
348 ncellmembsinfomaxloc = ivg
356 IF ( global%myProcid == masterproc .AND. &
357 global%verbLevel > verbose_low )
THEN
358 WRITE(stdout,
'(A,3X,A)') solver_name,
'Statistics:'
359 WRITE(stdout,
'(A,5X,A,2(1X,I3),2(1X,I9))') solver_name, &
360 'Minimum/maximum number of cell layers: ',nlayersinfomin, &
361 nlayersinfomax,nlayersinfominloc,nlayersinfomaxloc
362 WRITE(stdout,
'(A,5X,A,2(1X,I3),2(1X,I9))') solver_name, &
363 'Minimum/maximum number of cell members:',ncellmembsinfomin, &
364 ncellmembsinfomax,ncellmembsinfominloc,ncellmembsinfomaxloc
371 DEALLOCATE(v2cs,stat=errorflag)
372 global%error = errorflag
373 IF ( global%error /= err_none )
THEN
374 CALL
errorstop(global,err_deallocate,__line__,
'v2cs')
377 DEALLOCATE(layerinfo,stat=errorflag)
378 global%error = errorflag
379 IF ( global%error /= err_none )
THEN
380 CALL
errorstop(global,err_deallocate,__line__,
'layerInfo')
383 #ifdef CHECK_DATASTRUCT
388 WRITE(stdout,
'(A)') solver_name
389 WRITE(stdout,
'(A,1X,A)') solver_name,
'### START CHECK OUTPUT ###'
390 WRITE(stdout,
'(A,1X,A)') solver_name,
'Vertex-to-cell stencils'
391 WRITE(stdout,
'(A,1X,A,1X,I6)') solver_name,
'Maximum number of layers:', &
392 pgrid%v2csInfo%nLayersMax
393 WRITE(stdout,
'(A,1X,A,1X,I6)') solver_name,
'Minimum stencil size:', &
394 pgrid%v2csInfo%nCellMembsMin
396 DO ivg = 1,pgrid%nVertTot
397 WRITE(stdout,
'(A,1X,I6,2(1X,I3),3X,20(1X,I6))') solver_name,ivg, &
398 pgrid%v2cs(ivg)%nLayers,pgrid%v2cs(ivg)%nCellMembs, &
399 pgrid%v2cs(ivg)%cellMembs(1:pgrid%v2cs(ivg)%nCellMembs)
402 WRITE(stdout,
'(A,1X,A)') solver_name,
'### END CHECK OUTPUT ###'
403 WRITE(stdout,
'(A)') solver_name
410 IF ( global%myProcid == masterproc .AND. &
411 global%verbLevel > verbose_none )
THEN
412 WRITE(stdout,
'(A,1X,A)') solver_name, &
413 'Building vertex-to-cell stencil done.'
453 TYPE(t_region
),
POINTER :: pregion
459 INTEGER :: errorflag,ivg
460 TYPE(t_grid),
POINTER :: pgrid
467 global => pregion%global
470 'RFLU_ModStencilsVert.F90')
472 IF ( global%myProcid == masterproc .AND. &
473 global%verbLevel > verbose_none )
THEN
474 WRITE(stdout,
'(A,1X,A)') solver_name, &
475 'Creating vertex-to-cell stencil...'
488 pgrid => pregion%grid
494 ALLOCATE(pgrid%v2cs(pgrid%nVertTot),stat=errorflag)
495 global%error = errorflag
496 IF ( global%error /= err_none )
THEN
497 CALL
errorstop(global,err_allocate,__line__,
'pGrid%v2cs')
500 DO ivg = 1,pgrid%nVertTot
501 pgrid%v2cs(ivg)%nCellMembs = 0
502 pgrid%v2cs(ivg)%nBFaceMembs = 0
509 IF ( global%myProcid == masterproc .AND. &
510 global%verbLevel > verbose_none )
THEN
511 WRITE(stdout,
'(A,1X,A)') solver_name, &
512 'Creating vertex-to-cell stencil done.'
553 TYPE(t_region
),
POINTER :: pregion
559 INTEGER :: errorflag,ivg
560 TYPE(t_grid),
POINTER :: pgrid
567 global => pregion%global
570 'RFLU_ModStencilsVert.F90')
572 IF ( global%myProcid == masterproc .AND. &
573 global%verbLevel > verbose_none )
THEN
574 WRITE(stdout,
'(A,1X,A)') solver_name, &
575 'Destroying vertex-to-cell stencil...'
582 pgrid => pregion%grid
588 DO ivg = 1,pgrid%nVertTot
589 DEALLOCATE(pgrid%v2cs(ivg)%cellMembs,stat=errorflag)
590 global%error = errorflag
591 IF ( global%error /= err_none )
THEN
592 CALL
errorstop(global,err_deallocate,__line__,
'pGrid%v2cs%cellMembs')
596 DEALLOCATE(pgrid%v2cs,stat=errorflag)
597 global%error = errorflag
598 IF ( global%error /= err_none )
THEN
599 CALL
errorstop(global,err_deallocate,__line__,
'pGrid%v2cs')
612 IF ( global%myProcid == masterproc .AND. &
613 global%verbLevel > verbose_none )
THEN
614 WRITE(stdout,
'(A,1X,A)') solver_name, &
615 'Destroying vertex-to-cell stencil done.'
654 TYPE(t_region
),
POINTER :: pregion
660 TYPE(t_grid),
POINTER :: pgrid
667 global => pregion%global
670 'RFLU_ModStencilsVert.F90')
672 IF ( global%myProcid == masterproc .AND. &
673 global%verbLevel > verbose_none )
THEN
674 WRITE(stdout,
'(A,1X,A)') solver_name, &
675 'Nullifying vertex-to-cell stencil...'
682 pgrid => pregion%grid
694 IF ( global%myProcid == masterproc .AND. &
695 global%verbLevel > verbose_none )
THEN
696 WRITE(stdout,
'(A,1X,A)') solver_name, &
697 'Nullifying vertex-to-cell stencil done.'
736 INTEGER,
INTENT(IN) :: ordernominal
737 TYPE(t_region
),
POINTER :: pregion
743 INTEGER :: nbfacemembsmax,nlayersmax,stencilsizemax,stencilsizemin
744 TYPE(t_grid),
POINTER :: pgrid
751 global => pregion%global
754 'RFLU_ModStencilsVert.F90')
756 IF ( global%myProcid == masterproc .AND. &
757 global%verbLevel > verbose_none )
THEN
758 WRITE(stdout,
'(A,1X,A)') solver_name, &
759 'Setting vert-to-cell stencil information...'
766 pgrid => pregion%grid
779 stencilsizemax = 10*stencilsizemin
781 pgrid%v2csInfo%orderNominal = ordernominal
782 pgrid%v2csInfo%nLayersMax = nlayersmax
783 pgrid%v2csInfo%nBFaceMembsMax = nbfacemembsmax
784 pgrid%v2csInfo%nCellMembsMax = stencilsizemax
785 pgrid%v2csInfo%nCellMembsMin = stencilsizemin
791 IF ( global%myProcid == masterproc .AND. &
792 global%verbLevel > verbose_low )
THEN
793 WRITE(stdout,
'(A,3X,A,1X,I3)') solver_name, &
794 'Maximum allowed number of cell layers: ',nlayersmax
795 WRITE(stdout,
'(A,3X,A,1X,I3)') solver_name, &
796 'Minimum required number of cell members:',stencilsizemin
797 WRITE(stdout,
'(A,3X,A,1X,I3)') solver_name, &
798 'Maximum allowed number of cell members: ',stencilsizemax
805 IF ( global%myProcid == masterproc .AND. &
806 global%verbLevel > verbose_none )
THEN
807 WRITE(stdout,
'(A,1X,A)') solver_name, &
808 'Setting vertex-to-cell stencil information done.'
subroutine, public rflu_computestencilweights(global, dimens, wtsMode, scalMode, derivDegree, orderNominal, nRows, dr, wts, sCount)
subroutine, public rflu_addcelllayer(global, pGrid, stencilSizeMax, ixg, degr, x2csBeg, x2csEnd, x2cs)
Size order() const
Degree of the element. 1 for linear and 2 for quadratic.
subroutine, public rflu_setinfostencilvert2cell(pRegion, orderNominal)
subroutine registerfunction(global, funName, fileName)
subroutine, public rflu_createstencilvert2cell(pRegion)
subroutine, public rflu_buildstencilvert2cell(pRegion)
subroutine, public rflu_destroystencilvert2cell(pRegion)
INTEGER function rflu_computestencilsize(global, factor, order)
subroutine, public rflu_nullifystencilvert2cell(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)