91 INTEGER,
INTENT(IN) :: context
92 TYPE(t_region
),
DIMENSION(:),
POINTER :: regions
98 CHARACTER(CHRLEN) :: rcsidentstring
99 INTEGER :: errorflag,
ic,ie,ipatch,ireg,it,iv,ivg,niter,patchcheckcounter, &
101 REAL(RFREAL) :: nx,ny,nz,sfact,
term,volmaxglob,volmaxloc,volminglob, &
103 REAL(RFREAL) :: dxyz(xcoord:zcoord)
104 REAL(RFREAL),
DIMENSION(:,:),
POINTER :: prhs,pxyz,pxyzold
106 TYPE(t_grid),
POINTER :: pgrid,pgridold
107 TYPE(t_patch),
POINTER :: ppatch
108 TYPE(t_region
),
POINTER :: pregion
114 rcsidentstring =
'$RCSfile: RFLU_MoveGridXyz.F90,v $ $Revision: 1.9 $'
116 global => regions(1)%global
119 'RFLU_MoveGridXyz.F90')
121 IF ( global%myProcid == masterproc .AND. &
122 global%verbLevel /= verbose_low )
THEN
123 WRITE(stdout,
'(A,1X,A)') solver_name,
'Moving grid based on coordinates...'
130 niter = regions(1)%mixtInput%moveGridNIter
131 sfact = regions(1)%mixtInput%moveGridSFact
141 DO ireg = 1,global%nRegionsLocal
142 pgrid => regions(ireg)%grid
143 pgridold => regions(ireg)%gridOld
145 IF ( context == movegrid_context_movesmooth )
THEN
146 DO ic = 1,pgrid%nCellsTot
147 pgridold%vol(
ic) = pgrid%vol(
ic)
151 DO iv = 1,pgrid%nVertTot
152 pgridold%xyz(xcoord,iv) = pgrid%xyz(xcoord,iv)
153 pgridold%xyz(ycoord,iv) = pgrid%xyz(ycoord,iv)
154 pgridold%xyz(zcoord,iv) = pgrid%xyz(zcoord,iv)
162 DO ireg = 1,global%nRegionsLocal
163 pgrid => regions(ireg)%grid
165 ALLOCATE(pgrid%degr(pgrid%nVertTot),stat=errorflag)
166 global%error = errorflag
167 IF ( global%error /= err_none )
THEN
168 CALL
errorstop(global,err_allocate,__line__,
'pGrid%degr')
171 IF ( pgrid%nTetsTot == pgrid%nCellsTot )
THEN
172 ALLOCATE(pgrid%volMin(pgrid%nVertTot),stat=errorflag)
173 global%error = errorflag
174 IF ( global%error /= err_none )
THEN
175 CALL
errorstop(global,err_allocate,__line__,
'pGrid%volMin')
191 DO ireg = 1,global%nRegionsLocal
192 pgrid => regions(ireg)%grid
194 DO iv = 1,pgrid%nVertTot
198 DO ie = 1,pgrid%nEdgesTot
202 pgrid%degr(v1) = pgrid%degr(v1) + 1
203 pgrid%degr(v2) = pgrid%degr(v2) + 1
213 DO ireg = 1,global%nRegionsLocal
214 pgrid => regions(ireg)%grid
216 IF ( pgrid%nTetsTot == pgrid%nCellsTot )
THEN
217 volminloc = minval(pgrid%vol(1:pgrid%nTets))
218 volmaxloc = maxval(pgrid%vol(1:pgrid%nTets))
222 volminglob = volminloc
223 volmaxglob = volmaxloc
226 DO iv = 1,pgrid%nVertTot
227 pgrid%volMin(iv) = huge(1.0_rfreal)
230 DO ic = 1,pgrid%nTetsTot
231 v1 = pgrid%tet2v(1,
ic)
232 v2 = pgrid%tet2v(2,
ic)
233 v3 = pgrid%tet2v(3,
ic)
234 v4 = pgrid%tet2v(4,
ic)
236 pgrid%volMin(v1) =
min(pgrid%volMin(v1),pgrid%vol(
ic))
237 pgrid%volMin(v2) =
min(pgrid%volMin(v2),pgrid%vol(
ic))
238 pgrid%volMin(v3) =
min(pgrid%volMin(v3),pgrid%vol(
ic))
239 pgrid%volMin(v4) =
min(pgrid%volMin(v4),pgrid%vol(
ic))
242 DO iv = 1,pgrid%nVert
243 pgrid%degr(iv) = pgrid%degr(iv) &
244 + (volmaxglob - volminglob)/pgrid%volMin(iv)
253 DO ireg = 1,global%nRegionsLocal
254 pgrid => regions(ireg)%grid
255 pgridold => regions(ireg)%gridOld
258 pxyzold => pgridold%xyz
260 IF ( context == movegrid_context_movesmooth )
THEN
261 DO ipatch = 1,pgrid%nPatches
262 ppatch => regions(ireg)%patches(ipatch)
264 IF ( ppatch%movePatchDir /= movepatch_dir_none )
THEN
265 DO iv = 1,ppatch%nBVert
268 pxyz(xcoord,ivg) = pxyzold(xcoord,ivg) + ppatch%dXyz(xcoord,iv)
269 pxyz(ycoord,ivg) = pxyzold(ycoord,ivg) + ppatch%dXyz(ycoord,iv)
270 pxyz(zcoord,ivg) = pxyzold(zcoord,ivg) + ppatch%dXyz(zcoord,iv)
274 ELSE IF ( context == movegrid_context_onlysmooth )
THEN
275 DO ipatch = 1,pgrid%nPatches
276 ppatch => regions(ireg)%patches(ipatch)
278 IF ( ppatch%movePatchDir /= movepatch_dir_none )
THEN
279 DO iv = 1,ppatch%nBVert
282 pxyz(xcoord,ivg) = pxyzold(xcoord,ivg)
283 pxyz(ycoord,ivg) = pxyzold(ycoord,ivg)
284 pxyz(zcoord,ivg) = pxyzold(zcoord,ivg)
301 DO ireg = 1,global%nRegionsLocal
302 pgrid => regions(ireg)%grid
310 DO iv = 1,pgrid%nVertTot
311 prhs(xcoord,iv) = 0.0_rfreal
312 prhs(ycoord,iv) = 0.0_rfreal
313 prhs(zcoord,iv) = 0.0_rfreal
322 DO ie = 1,pgrid%nEdges
326 term = 1.0_rfreal/(
REAL(pGrid%e2rDegr(ie),kind=rfreal))
328 dxyz(xcoord) =
term*(pxyz(xcoord,v2) - pxyz(xcoord,v1))
329 dxyz(ycoord) =
term*(pxyz(ycoord,v2) - pxyz(ycoord,v1))
330 dxyz(zcoord) =
term*(pxyz(zcoord,v2) - pxyz(zcoord,v1))
332 prhs(xcoord,v1) = prhs(xcoord,v1) + dxyz(xcoord)
333 prhs(ycoord,v1) = prhs(ycoord,v1) + dxyz(ycoord)
334 prhs(zcoord,v1) = prhs(zcoord,v1) + dxyz(zcoord)
336 prhs(xcoord,v2) = prhs(xcoord,v2) - dxyz(xcoord)
337 prhs(ycoord,v2) = prhs(ycoord,v2) - dxyz(ycoord)
338 prhs(zcoord,v2) = prhs(zcoord,v2) - dxyz(zcoord)
345 patchcheckcounter = 0
347 IF ( context == movegrid_context_movesmooth )
THEN
351 DO ipatch = 1,pgrid%nPatches
352 ppatch => regions(ireg)%patches(ipatch)
354 IF ( ppatch%movePatchDir /= movepatch_dir_none )
THEN
355 patchcheckcounter = patchcheckcounter + 1
357 DO iv = 1,ppatch%nBVert
360 prhs(xcoord,ivg) = 0.0_rfreal
361 prhs(ycoord,ivg) = 0.0_rfreal
362 prhs(zcoord,ivg) = 0.0_rfreal
369 DO ipatch = 1,pgrid%nPatches
370 ppatch => regions(ireg)%patches(ipatch)
372 IF ( ppatch%movePatchDir == movepatch_dir_none )
THEN
373 patchcheckcounter = patchcheckcounter + 1
375 SELECT CASE ( ppatch%moveBcType )
379 CASE ( movegrid_bctype_neumann )
380 DO iv = 1,ppatch%nBVert
383 nx = ppatch%bvn(xcoord,iv)
384 ny = ppatch%bvn(ycoord,iv)
385 nz = ppatch%bvn(zcoord,iv)
387 term = prhs(xcoord,ivg)*nx &
388 + prhs(ycoord,ivg)*ny &
389 + prhs(zcoord,ivg)*nz
391 prhs(xcoord,ivg) = prhs(xcoord,ivg) -
term*nx
392 prhs(ycoord,ivg) = prhs(ycoord,ivg) -
term*ny
393 prhs(zcoord,ivg) = prhs(zcoord,ivg) -
term*nz
398 CASE ( movegrid_bctype_dirichx, &
399 movegrid_bctype_dirichy, &
400 movegrid_bctype_dirichz )
401 DO iv = 1,ppatch%nBVert
404 prhs(ppatch%moveBcType,ivg) = 0.0_rfreal
409 CASE ( movegrid_bctype_none )
410 IF ( ppatch%smoothGrid .EQV. .false. )
THEN
411 DO iv = 1,ppatch%nBVert
414 prhs(xcoord,ivg) = 0.0_rfreal
415 prhs(ycoord,ivg) = 0.0_rfreal
416 prhs(zcoord,ivg) = 0.0_rfreal
419 CALL
errorstop(global,err_reached_default,__line__)
423 CALL
errorstop(global,err_reached_default,__line__)
429 ELSE IF ( context == movegrid_context_onlysmooth )
THEN
430 DO ipatch = 1,pgrid%nPatches
431 ppatch => regions(ireg)%patches(ipatch)
433 patchcheckcounter = patchcheckcounter + 1
435 DO iv = 1,ppatch%nBVert
438 prhs(xcoord,ivg) = 0.0_rfreal
439 prhs(ycoord,ivg) = 0.0_rfreal
440 prhs(zcoord,ivg) = 0.0_rfreal
452 IF ( patchcheckcounter /= pgrid%nPatches )
THEN
453 CALL
errorstop(global,err_movepatch_bc_notset,__line__)
464 DO ireg = 1,global%nRegionsLocal
465 pgrid => regions(ireg)%grid
469 DO iv = 1,pgrid%nVert
470 term = sfact/
REAL(pGrid%degr(iv),RFREAL)
472 pxyz(xcoord,iv) = pxyz(xcoord,iv) +
term*prhs(xcoord,iv)
473 pxyz(ycoord,iv) = pxyz(ycoord,iv) +
term*prhs(ycoord,iv)
474 pxyz(zcoord,iv) = pxyz(zcoord,iv) +
term*prhs(zcoord,iv)
487 DO ireg = 1,global%nRegionsLocal
488 pgrid => regions(ireg)%grid
490 DEALLOCATE(pgrid%degr,stat=errorflag)
491 global%error = errorflag
492 IF ( global%error /= err_none )
THEN
493 CALL
errorstop(global,err_deallocate,__line__,
'pGrid%degr')
496 IF ( pgrid%nTetsTot == pgrid%nCellsTot )
THEN
497 DEALLOCATE(pgrid%volMin,stat=errorflag)
498 global%error = errorflag
499 IF ( global%error /= err_none )
THEN
500 CALL
errorstop(global,err_deallocate,__line__,
'pGrid%volMin')
509 IF ( global%myProcid == masterproc .AND. &
510 global%verbLevel /= verbose_low )
THEN
511 WRITE(stdout,
'(A,1X,A)') solver_name, &
512 'Moving grid based on coordinates done.'
subroutine registerfunction(global, funName, fileName)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ic
subroutine rflu_movegridxyz(regions, context)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)