79 CHARACTER(CHRLEN) :: &
80 RCSIdentString =
'$RCSfile: RFLU_ModGeometry.F90,v $ $Revision: 1.35 $'
121 TYPE(t_region
),
POINTER :: pregion
127 INTEGER :: errorflag,ibv,
ic,ifc,ipatch
129 REAL(RFREAL),
DIMENSION(:,:),
POINTER :: pbvn
131 TYPE(t_grid),
POINTER :: pgrid
132 TYPE(t_patch),
POINTER :: ppatch
138 global => pregion%global
141 'RFLU_ModGeometry.F90')
143 IF ( global%myProcid == masterproc .AND. &
144 global%verbLevel >= verbose_high )
THEN
145 WRITE(stdout,
'(A,1X,A)') solver_name
146 WRITE(stdout,
'(A,1X,A)') solver_name,
'Building boundary-vertex '// &
148 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
149 pregion%iRegionGlobal
152 pgrid => pregion%grid
158 DO ipatch = 1,pgrid%nPatches
159 ppatch => pregion%patches(ipatch)
166 DO ifc = 1,ppatch%nBFacesTot
168 ibv = ppatch%bf2v(
ic,ifc)
170 IF ( ibv /= vert_none )
THEN
171 pbvn(xcoord,ibv) = pbvn(xcoord,ibv) + ppatch%fn(xcoord,ifc)
172 pbvn(ycoord,ibv) = pbvn(ycoord,ibv) + ppatch%fn(ycoord,ifc)
173 pbvn(zcoord,ibv) = pbvn(zcoord,ibv) + ppatch%fn(zcoord,ifc)
182 DO ibv = 1,ppatch%nBVertTot
183 term = 1.0_rfreal/(
sqrt(pbvn(xcoord,ibv)*pbvn(xcoord,ibv) &
184 + pbvn(ycoord,ibv)*pbvn(ycoord,ibv) &
185 + pbvn(zcoord,ibv)*pbvn(zcoord,ibv)))
187 pbvn(xcoord,ibv) =
term*pbvn(xcoord,ibv)
188 pbvn(ycoord,ibv) =
term*pbvn(ycoord,ibv)
189 pbvn(zcoord,ibv) =
term*pbvn(zcoord,ibv)
192 IF ( global%myProcid == masterproc .AND. &
193 global%verbLevel >= verbose_high )
THEN
194 IF ( ppatch%nBVert > 0 )
THEN
195 WRITE(stdout,
'(A,3X,A)') solver_name,
'Normal component extrema:'
196 WRITE(stdout,
'(A,5X,A,1X,I3)') solver_name,
'Patch:',ipatch
197 WRITE(stdout,
'(A,7X,A,2(1X,E23.16))') solver_name,
'x-direction:', &
198 minval(pbvn(xcoord,1:ppatch%nBVert)), &
199 maxval(pbvn(xcoord,1:ppatch%nBVert))
200 WRITE(stdout,
'(A,7X,A,2(1X,E23.16))') solver_name,
'y-direction:', &
201 minval(pbvn(ycoord,1:ppatch%nBVert)), &
202 maxval(pbvn(ycoord,1:ppatch%nBVert))
203 WRITE(stdout,
'(A,7X,A,2(1X,E23.16))') solver_name,
'z-direction:', &
204 minval(pbvn(zcoord,1:ppatch%nBVert)), &
205 maxval(pbvn(zcoord,1:ppatch%nBVert))
210 #ifdef CHECK_DATASTRUCT
215 IF ( pgrid%nPatches > 0 )
THEN
216 WRITE(stdout,
'(A)') solver_name
217 WRITE(stdout,
'(A,1X,A)') solver_name,
'### START CHECK OUTPUT ###'
218 WRITE(stdout,
'(A,1X,A)') solver_name,
'Boundary vertex normals:'
220 DO ipatch = 1,pgrid%nPatches
221 ppatch => pregion%patches(ipatch)
222 WRITE(stdout,
'(A,1X,A,1X,I3,3X,A)') solver_name,
'Patch:', &
224 WRITE(stdout,
'(A,1X,A,1X,A,1X,I7))') solver_name,
'Number of actual', &
225 'vertices:',ppatch%nBVert
226 WRITE(stdout,
'(A,1X,A,1X,A,1X,I7))') solver_name,
'Number of total', &
227 'vertices:',ppatch%nBVertTot
229 DO ibv = 1,ppatch%nBVertTot
230 WRITE(stdout,
'(A,1X,I7,3(1X,E18.9))') solver_name,ibv, &
231 ppatch%bvn(xcoord:zcoord,ibv)
235 WRITE(stdout,
'(A,1X,A)') solver_name,
'### END CHECK OUTPUT ###'
236 WRITE(stdout,
'(A)') solver_name
244 IF ( global%myProcid == masterproc .AND. &
245 global%verbLevel >= verbose_high )
THEN
246 WRITE(stdout,
'(A,1X,A)') solver_name,
'Building boundary-vertex '// &
248 WRITE(stdout,
'(A,1X,A)') solver_name
302 LOGICAL,
OPTIONAL :: sypefaceflag
303 TYPE (t_region
),
POINTER :: pregion
309 LOGICAL :: ignoresypefaces
310 CHARACTER(CHRLEN) :: errorstring
311 INTEGER :: c1,c1k,c1t,c2,c2k,c2t,errorflag,ibv,
ic,icl,icg,ifc,ifk, &
312 ipatch,iv,v1,v2,v3,v4
313 INTEGER,
DIMENSION(:) :: dummyloc(1),volloc(2,min_val:max_val)
314 REAL(RFREAL) :: facesummax,fcenx,fceny,fcenz,fsumlimit,fvecm,fvecmsum, &
315 fvecx,fvecy,fvecz,patchfacesum,
term,volerr,volsum1,volsum2
316 REAL(RFREAL),
PARAMETER :: thrd = 1.0_rfreal/3.0_rfreal, &
317 vol_err_limit = 1.0e-10_rfreal
318 REAL(RFREAL),
DIMENSION(:),
ALLOCATABLE :: fndummy,voldummy
319 REAL(RFREAL),
DIMENSION(:,:),
ALLOCATABLE :: facesum
320 REAL(RFREAL) :: xyzavg(xcoord:zcoord),xyznodes(xcoord:zcoord,4)
321 TYPE(t_grid),
POINTER :: pgrid,pgridold
322 TYPE(t_patch),
POINTER :: ppatch
329 global => pregion%global
332 'RFLU_ModGeometry.F90')
334 IF ( global%myProcid == masterproc .AND. &
335 global%verbLevel >= verbose_high )
THEN
336 WRITE(stdout,
'(A,1X,A)') solver_name,
'Building geometry...'
337 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
338 pregion%iRegionGlobal
341 pgrid => pregion%grid
343 IF ( .NOT. present(sypefaceflag) )
THEN
344 ignoresypefaces = .true.
346 ignoresypefaces = sypefaceflag
353 DO ic = 1,pgrid%nCellsTot
354 pgrid%vol(
ic) = 0.0_rfreal
355 pgrid%cofg(xcoord,
ic) = 0.0_rfreal
356 pgrid%cofg(ycoord,
ic) = 0.0_rfreal
357 pgrid%cofg(zcoord,
ic) = 0.0_rfreal
360 DO ifc = 1,pgrid%nFacesTot
361 pgrid%fn(xcoord,ifc) = 0.0_rfreal
362 pgrid%fn(ycoord,ifc) = 0.0_rfreal
363 pgrid%fn(zcoord,ifc) = 0.0_rfreal
364 pgrid%fn(xyzmag,ifc) = 0.0_rfreal
365 pgrid%fc(xcoord,ifc) = 0.0_rfreal
366 pgrid%fc(ycoord,ifc) = 0.0_rfreal
367 pgrid%fc(zcoord,ifc) = 0.0_rfreal
370 DO ipatch = 1,pgrid%nPatches
371 ppatch => pregion%patches(ipatch)
373 ppatch%pc(xcoord) = 0.0_rfreal
374 ppatch%pc(ycoord) = 0.0_rfreal
375 ppatch%pc(zcoord) = 0.0_rfreal
377 DO ifc = 1,ppatch%nBFacesTot
378 ppatch%fn(xcoord,ifc) = 0.0_rfreal
379 ppatch%fn(ycoord,ifc) = 0.0_rfreal
380 ppatch%fn(zcoord,ifc) = 0.0_rfreal
381 ppatch%fn(xyzmag,ifc) = 0.0_rfreal
383 ppatch%fc(xcoord,ifc) = 0.0_rfreal
384 ppatch%fc(ycoord,ifc) = 0.0_rfreal
385 ppatch%fc(zcoord,ifc) = 0.0_rfreal
388 IF ( pregion%mixtInput%moveGrid .EQV. .true. )
THEN
389 DO ibv = 1,ppatch%nBVertTot
390 ppatch%bvn(xcoord,ibv) = 0.0_rfreal
391 ppatch%bvn(ycoord,ibv) = 0.0_rfreal
392 ppatch%bvn(zcoord,ibv) = 0.0_rfreal
408 IF ( global%myProcid == masterproc .AND. &
409 global%verbLevel >= verbose_high )
THEN
410 WRITE(stdout,
'(A,3X,A)') solver_name,
'Non-boundary faces...'
413 DO ifc = 1,pgrid%nFacesTot
414 v1 = pgrid%f2v(1,ifc)
415 v2 = pgrid%f2v(2,ifc)
416 v3 = pgrid%f2v(3,ifc)
418 c1 = pgrid%f2c(1,ifc)
419 c2 = pgrid%f2c(2,ifc)
425 IF ( pgrid%f2v(4,ifc) == vert_none )
THEN
426 xyznodes(xcoord:zcoord,1) = pgrid%xyz(xcoord:zcoord,v1)
427 xyznodes(xcoord:zcoord,2) = pgrid%xyz(xcoord:zcoord,v2)
428 xyznodes(xcoord:zcoord,3) = pgrid%xyz(xcoord:zcoord,v3)
430 CALL
facevectortria(xyznodes(xcoord:zcoord,1:3),fvecx,fvecy,fvecz)
433 v4 = pgrid%f2v(4,ifc)
435 xyznodes(xcoord:zcoord,1) = pgrid%xyz(xcoord:zcoord,v1)
436 xyznodes(xcoord:zcoord,2) = pgrid%xyz(xcoord:zcoord,v2)
437 xyznodes(xcoord:zcoord,3) = pgrid%xyz(xcoord:zcoord,v3)
438 xyznodes(xcoord:zcoord,4) = pgrid%xyz(xcoord:zcoord,v4)
440 CALL
facevectorquad(xyznodes(xcoord:zcoord,1:4),fvecx,fvecy,fvecz)
444 fvecm =
sqrt(fvecx*fvecx + fvecy*fvecy + fvecz*fvecz)
445 term = 1.0_rfreal/fvecm
447 pgrid%fn(xcoord,ifc) = fvecx*
term
448 pgrid%fn(ycoord,ifc) = fvecy*
term
449 pgrid%fn(zcoord,ifc) = fvecz*
term
450 pgrid%fn(xyzmag,ifc) = fvecm
452 pgrid%fc(xcoord,ifc) = fcenx
453 pgrid%fc(ycoord,ifc) = fceny
454 pgrid%fc(zcoord,ifc) = fcenz
460 IF ( c1 /= cell_type_ext .AND. c1 /= cell_type_bnd )
THEN
461 term = (fcenx - pgrid%cofgApp(xcoord,c1))*fvecx &
462 + (fceny - pgrid%cofgApp(ycoord,c1))*fvecy &
463 + (fcenz - pgrid%cofgApp(zcoord,c1))*fvecz
465 pgrid%vol(c1) = pgrid%vol(c1) +
term
467 term = fcenx*fvecx + fceny*fvecy + fcenz*fvecz
469 pgrid%cofg(xcoord,c1) = pgrid%cofg(xcoord,c1) +
term*fcenx
470 pgrid%cofg(ycoord,c1) = pgrid%cofg(ycoord,c1) +
term*fceny
471 pgrid%cofg(zcoord,c1) = pgrid%cofg(zcoord,c1) +
term*fcenz
474 IF ( c2 /= cell_type_ext .AND. c2 /= cell_type_bnd )
THEN
475 term = (fcenx - pgrid%cofgApp(xcoord,c2))*fvecx &
476 + (fceny - pgrid%cofgApp(ycoord,c2))*fvecy &
477 + (fcenz - pgrid%cofgApp(zcoord,c2))*fvecz
479 pgrid%vol(c2) = pgrid%vol(c2) -
term
481 term = fcenx*fvecx + fceny*fvecy + fcenz*fvecz
483 pgrid%cofg(xcoord,c2) = pgrid%cofg(xcoord,c2) -
term*fcenx
484 pgrid%cofg(ycoord,c2) = pgrid%cofg(ycoord,c2) -
term*fceny
485 pgrid%cofg(zcoord,c2) = pgrid%cofg(zcoord,c2) -
term*fcenz
493 IF ( global%myProcid == masterproc .AND. &
494 global%verbLevel >= verbose_high )
THEN
495 WRITE(stdout,
'(A,3X,A)') solver_name,
'Boundary faces...'
498 DO ipatch = 1,pgrid%nPatches
499 ppatch => pregion%patches(ipatch)
501 IF ( global%myProcid == masterproc .AND. &
502 global%verbLevel >= verbose_high )
THEN
503 WRITE(stdout,
'(A,5X,A,I3)') solver_name,
'Patch: ',ipatch
506 fvecmsum = 0.0_rfreal
512 DO ifc = 1,ppatch%nBFacesTot
513 v1 = ppatch%bv(ppatch%bf2v(1,ifc))
514 v2 = ppatch%bv(ppatch%bf2v(2,ifc))
515 v3 = ppatch%bv(ppatch%bf2v(3,ifc))
517 c1 = ppatch%bf2c(ifc)
523 IF ( ppatch%bf2v(4,ifc) == vert_none )
THEN
524 xyznodes(xcoord:zcoord,1) = pgrid%xyz(xcoord:zcoord,v1)
525 xyznodes(xcoord:zcoord,2) = pgrid%xyz(xcoord:zcoord,v2)
526 xyznodes(xcoord:zcoord,3) = pgrid%xyz(xcoord:zcoord,v3)
528 CALL
facevectortria(xyznodes(xcoord:zcoord,1:3),fvecx,fvecy,fvecz)
531 v4 = ppatch%bv(ppatch%bf2v(4,ifc))
533 xyznodes(xcoord:zcoord,1) = pgrid%xyz(xcoord:zcoord,v1)
534 xyznodes(xcoord:zcoord,2) = pgrid%xyz(xcoord:zcoord,v2)
535 xyznodes(xcoord:zcoord,3) = pgrid%xyz(xcoord:zcoord,v3)
536 xyznodes(xcoord:zcoord,4) = pgrid%xyz(xcoord:zcoord,v4)
538 CALL
facevectorquad(xyznodes(xcoord:zcoord,1:4),fvecx,fvecy,fvecz)
542 fvecm =
sqrt(fvecx*fvecx + fvecy*fvecy + fvecz*fvecz)
543 term = 1.0_rfreal/fvecm
545 ppatch%fn(xcoord,ifc) = fvecx*
term
546 ppatch%fn(ycoord,ifc) = fvecy*
term
547 ppatch%fn(zcoord,ifc) = fvecz*
term
548 ppatch%fn(xyzmag,ifc) = fvecm
550 ppatch%fc(xcoord,ifc) = fcenx
551 ppatch%fc(ycoord,ifc) = fceny
552 ppatch%fc(zcoord,ifc) = fcenz
558 fvecmsum = fvecmsum + fvecm
560 ppatch%pc(xcoord) = ppatch%pc(xcoord) + fcenx*fvecm
561 ppatch%pc(ycoord) = ppatch%pc(ycoord) + fceny*fvecm
562 ppatch%pc(zcoord) = ppatch%pc(zcoord) + fcenz*fvecm
569 IF ( ignoresypefaces .EQV. .true. )
THEN
570 IF ( ppatch%bcType /= bc_symmetry .AND. &
571 ppatch%bcType /= bc_periodic )
THEN
572 term = (fcenx - pgrid%cofgApp(xcoord,c1))*fvecx &
573 + (fceny - pgrid%cofgApp(ycoord,c1))*fvecy &
574 + (fcenz - pgrid%cofgApp(zcoord,c1))*fvecz
576 pgrid%vol(c1) = pgrid%vol(c1) +
term
578 term = fcenx*fvecx + fceny*fvecy + fcenz*fvecz
580 pgrid%cofg(xcoord,c1) = pgrid%cofg(xcoord,c1) +
term*fcenx
581 pgrid%cofg(ycoord,c1) = pgrid%cofg(ycoord,c1) +
term*fceny
582 pgrid%cofg(zcoord,c1) = pgrid%cofg(zcoord,c1) +
term*fcenz
585 term = (fcenx - pgrid%cofgApp(xcoord,c1))*fvecx &
586 + (fceny - pgrid%cofgApp(ycoord,c1))*fvecy &
587 + (fcenz - pgrid%cofgApp(zcoord,c1))*fvecz
589 pgrid%vol(c1) = pgrid%vol(c1) +
term
591 term = fcenx*fvecx + fceny*fvecy + fcenz*fvecz
593 pgrid%cofg(xcoord,c1) = pgrid%cofg(xcoord,c1) +
term*fcenx
594 pgrid%cofg(ycoord,c1) = pgrid%cofg(ycoord,c1) +
term*fceny
595 pgrid%cofg(zcoord,c1) = pgrid%cofg(zcoord,c1) +
term*fcenz
603 term = 1.0_rfreal/fvecmsum
605 ppatch%pc(xcoord) =
term*ppatch%pc(xcoord)
606 ppatch%pc(ycoord) =
term*ppatch%pc(ycoord)
607 ppatch%pc(zcoord) =
term*ppatch%pc(zcoord)
614 DO ic = 1,pgrid%nCellsTot
615 pgrid%vol(
ic) = thrd*pgrid%vol(
ic)
617 term = 1.0_rfreal/(4.0_rfreal*pgrid%vol(
ic))
619 pgrid%cofg(xcoord,
ic) =
term*pgrid%cofg(xcoord,
ic)
620 pgrid%cofg(ycoord,
ic) =
term*pgrid%cofg(ycoord,
ic)
621 pgrid%cofg(zcoord,
ic) =
term*pgrid%cofg(zcoord,
ic)
638 IF ( global%myProcid == masterproc .AND. &
639 global%verbLevel >= verbose_high )
THEN
640 dummyloc = minloc(pgrid%vol(1:pgrid%nCells))
641 volloc(1,min_val) = dummyloc(1)
642 volloc(1,max_val) = dummyloc(1)
644 dummyloc = maxloc(pgrid%vol(1:pgrid%nCells))
645 volloc(2,min_val) = dummyloc(1)
646 volloc(2,max_val) = dummyloc(1)
648 WRITE(stdout,
'(A,3X,A)') solver_name,
'Statistics (actual cells only):'
649 WRITE(stdout,
'(A,5X,A,7X,E23.16,1X,I8)') solver_name, &
650 'Minimum volume:',minval(pgrid%vol(1:pgrid%nCells)),volloc(1,min_val)
651 WRITE(stdout,
'(A,5X,A,7X,E23.16,1X,I8)') solver_name, &
652 'Maximum volume:',maxval(pgrid%vol(1:pgrid%nCells)),volloc(2,max_val)
655 output_mode_master_only)
658 IF ( minval(pgrid%vol(1:pgrid%nCells)) <= 0.0_rfreal )
THEN
659 CALL
errorstop(global,err_volume_negative,__line__)
662 IF ( global%myProcid == masterproc .AND. &
663 global%verbLevel >= verbose_high )
THEN
664 IF (
ASSOCIATED(pregion%gridOld%vol) .EQV. .true. )
THEN
665 IF ( minval(pregion%gridOld%vol(1:pgrid%nCells)) > 0.0_rfreal )
THEN
666 pgridold => pregion%gridOld
668 WRITE(stdout,
'(A,5X,A,1X,E23.16,2(1X,I8))') solver_name, &
669 'Minimum volume ratio:', &
670 minval(pgrid%vol(1:pgrid%nCells))/ &
671 minval(pgridold%vol(1:pgrid%nCells)), &
672 minloc(pgrid%vol(1:pgrid%nCells)), &
673 minloc(pgridold%vol(1:pgrid%nCells))
674 WRITE(stdout,
'(A,5X,A,1X,E23.16,2(1X,I8))') solver_name, &
675 'Maximum volume ratio:',&
676 maxval(pgrid%vol(1:pgrid%nCells))/ &
677 maxval(pgridold%vol(1:pgrid%nCells)), &
678 maxloc(pgrid%vol(1:pgrid%nCells)), &
679 maxloc(pgridold%vol(1:pgrid%nCells))
688 IF ( global%myProcid == masterproc .AND. &
689 global%verbLevel >= verbose_high )
THEN
690 WRITE(stdout,
'(A,5X,A,1X,A)') solver_name,
'Boundary patch areas', &
691 '(actual faces only):'
693 DO ipatch = 1,pgrid%nPatches
694 ppatch => pregion%patches(ipatch)
696 ALLOCATE(fndummy(ppatch%nBFaces),stat=errorflag)
697 global%error = errorflag
698 IF ( global%error /= err_none )
THEN
699 CALL
errorstop(global,err_allocate,__line__,
'fnDummy')
702 DO ifc = 1,ppatch%nBFaces
703 fndummy(ifc) = ppatch%fn(xyzmag,ifc)
706 IF ( ppatch%nBFaces > 0 )
THEN
710 patchfacesum = 0.0_rfreal
712 DO ifc = 1,ppatch%nBFaces
713 patchfacesum = patchfacesum + fndummy(ifc)
716 DEALLOCATE(fndummy,stat=errorflag)
717 global%error = errorflag
718 IF ( global%error /= err_none )
THEN
719 CALL
errorstop(global,err_deallocate,__line__,
'fnDummy')
722 WRITE(stdout,
'(A,7X,A,1X,I3,3X,E23.16)') solver_name,
'Patch:', &
731 IF ( global%checkLevel > check_none )
THEN
732 IF ( global%myProcid == masterproc .AND. &
733 global%verbLevel >= verbose_high )
THEN
734 WRITE(stdout,
'(A,3X,A,1X,A)') solver_name,
'Check total volume', &
735 '(actual cells only):'
747 ALLOCATE(voldummy(pgrid%nCells),stat=errorflag)
748 global%error = errorflag
749 IF ( global%error /= err_none )
THEN
750 CALL
errorstop(global,err_allocate,__line__,
'volDummy')
753 IF ( pgrid%nTets > 0 )
THEN
754 DO icl = 1,pgrid%nTets
755 icg = pgrid%tet2CellGlob(icl)
756 voldummy(icg) = pgrid%vol(icg)
760 IF ( pgrid%nHexs > 0 )
THEN
761 DO icl = 1,pgrid%nHexs
762 icg = pgrid%hex2CellGlob(icl)
763 voldummy(icg) = pgrid%vol(icg)
767 IF ( pgrid%nPris > 0 )
THEN
768 DO icl = 1,pgrid%nPris
769 icg = pgrid%pri2CellGlob(icl)
770 voldummy(icg) = pgrid%vol(icg)
774 IF ( pgrid%nPyrs > 0 )
THEN
775 DO icl = 1,pgrid%nPyrs
776 icg = pgrid%pyr2CellGlob(icl)
777 voldummy(icg) = pgrid%vol(icg)
783 DO ic = 1,pgrid%nCells
784 volsum1 = volsum1 + voldummy(
ic)
787 IF ( global%myProcid == masterproc .AND. &
788 global%verbLevel >= verbose_high )
THEN
789 WRITE(stdout,
'(A,5X,A,1X,E23.16)') solver_name,&
790 'Total volume from sum of control volumes:',volsum1
793 DEALLOCATE(voldummy,stat=errorflag)
794 global%error = errorflag
795 IF ( global%error /= err_none )
THEN
796 CALL
errorstop(global,err_deallocate,__line__,
'volDummy')
807 xyzavg(xcoord) = 0.0_rfreal
808 xyzavg(ycoord) = 0.0_rfreal
809 xyzavg(zcoord) = 0.0_rfreal
811 DO iv = 1,pgrid%nVertTot
812 xyzavg(xcoord) = xyzavg(xcoord) + pgrid%xyz(xcoord,iv)
813 xyzavg(ycoord) = xyzavg(ycoord) + pgrid%xyz(ycoord,iv)
814 xyzavg(zcoord) = xyzavg(zcoord) + pgrid%xyz(zcoord,iv)
817 term = 1.0_rfreal/
REAL(pgrid%nverttot,kind=rfreal)
819 xyzavg(xcoord) =
term*xyzavg(xcoord)
820 xyzavg(ycoord) =
term*xyzavg(ycoord)
821 xyzavg(zcoord) =
term*xyzavg(zcoord)
830 DO ipatch = 1,pgrid%nPatches
831 ppatch => pregion%patches(ipatch)
833 IF ( ignoresypefaces .EQV. .true. )
THEN
834 IF ( ppatch%bcType /= bc_symmetry .AND. &
835 ppatch%bcType /= bc_periodic )
THEN
836 DO ifc = 1,ppatch%nBFaces
837 fvecx = ppatch%fn(xcoord,ifc)
838 fvecy = ppatch%fn(ycoord,ifc)
839 fvecz = ppatch%fn(zcoord,ifc)
840 fvecm = ppatch%fn(xyzmag,ifc)
842 fcenx = ppatch%fc(xcoord,ifc)
843 fceny = ppatch%fc(ycoord,ifc)
844 fcenz = ppatch%fc(zcoord,ifc)
846 volsum2 = volsum2 + ((fcenx - xyzavg(xcoord))*fvecx &
847 + (fceny - xyzavg(ycoord))*fvecy &
848 + (fcenz - xyzavg(zcoord))*fvecz)*fvecm
852 DO ifc = 1,ppatch%nBFaces
853 fvecx = ppatch%fn(xcoord,ifc)
854 fvecy = ppatch%fn(ycoord,ifc)
855 fvecz = ppatch%fn(zcoord,ifc)
856 fvecm = ppatch%fn(xyzmag,ifc)
858 fcenx = ppatch%fc(xcoord,ifc)
859 fceny = ppatch%fc(ycoord,ifc)
860 fcenz = ppatch%fc(zcoord,ifc)
862 volsum2 = volsum2 + ((fcenx - xyzavg(xcoord))*fvecx &
863 + (fceny - xyzavg(ycoord))*fvecy &
864 + (fcenz - xyzavg(zcoord))*fvecz)*fvecm
878 DO ifc = 1,pgrid%nFacesTot
879 c1 = pgrid%f2c(1,ifc)
880 c2 = pgrid%f2c(2,ifc)
886 IF ( (ifk == face_kind_av) .OR. (ifk == face_kind_ab) )
THEN
887 fvecx = pgrid%fn(xcoord,ifc)
888 fvecy = pgrid%fn(ycoord,ifc)
889 fvecz = pgrid%fn(zcoord,ifc)
890 fvecm = pgrid%fn(xyzmag,ifc)
892 fcenx = pgrid%fc(xcoord,ifc)
893 fceny = pgrid%fc(ycoord,ifc)
894 fcenz = pgrid%fc(zcoord,ifc)
896 term = ((fcenx - xyzavg(xcoord))*fvecx &
897 + (fceny - xyzavg(ycoord))*fvecy &
898 + (fcenz - xyzavg(zcoord))*fvecz)*fvecm
900 IF ( c1k == cell_kind_actual )
THEN
901 volsum2 = volsum2 +
term
903 volsum2 = volsum2 -
term
908 volsum2 = thrd*volsum2
909 volerr = (volsum2-volsum1)/(0.5_rfreal*(volsum1+volsum2)*100.0_rfreal)
911 IF ( global%myProcid == masterproc .AND. &
912 global%verbLevel >= verbose_high )
THEN
913 WRITE(stdout,
'(A,5X,A,4X,E23.16)') solver_name,&
914 'Total volume from boundary polyhedron:',volsum2
915 WRITE(stdout,
'(A,5X,A,4X,E23.16)') solver_name,&
916 'Error (in % of average total volume): ',volerr
919 IF ( abs(volerr) > vol_err_limit )
THEN
920 WRITE(errorstring,
'(A,1X,E13.6)')
'Error:',volerr
921 CALL
errorstop(global,err_volume_diff,__line__,trim(errorstring))
931 IF ( global%checkLevel > check_none )
THEN
932 IF ( global%myProcid == masterproc .AND. &
933 global%verbLevel >= verbose_high )
THEN
934 WRITE(stdout,
'(A,3X,A)') solver_name,
'Check closedness of '// &
935 'control volumes (all cells):'
938 ALLOCATE(facesum(xcoord:zcoord,pgrid%nCellsTot),stat=errorflag)
939 global%error = errorflag
940 IF ( global%error /= err_none )
THEN
941 CALL
errorstop(global,err_allocate,__line__,
'faceSum')
944 DO ic = 1,pgrid%nCellsTot
945 facesum(xcoord,
ic) = 0.0_rfreal
946 facesum(ycoord,
ic) = 0.0_rfreal
947 facesum(zcoord,
ic) = 0.0_rfreal
954 DO ifc = 1,pgrid%nFacesTot
955 c1 = pgrid%f2c(1,ifc)
956 c2 = pgrid%f2c(2,ifc)
958 fvecx = pgrid%fn(xcoord,ifc)
959 fvecy = pgrid%fn(ycoord,ifc)
960 fvecz = pgrid%fn(zcoord,ifc)
961 fvecm = pgrid%fn(xyzmag,ifc)
963 IF ( c1 /= cell_type_ext .AND. c1 /= cell_type_bnd )
THEN
964 facesum(xcoord,c1) = facesum(xcoord,c1) + fvecx*fvecm
965 facesum(ycoord,c1) = facesum(ycoord,c1) + fvecy*fvecm
966 facesum(zcoord,c1) = facesum(zcoord,c1) + fvecz*fvecm
969 IF ( c2 /= cell_type_ext .AND. c2 /= cell_type_bnd )
THEN
970 facesum(xcoord,c2) = facesum(xcoord,c2) - fvecx*fvecm
971 facesum(ycoord,c2) = facesum(ycoord,c2) - fvecy*fvecm
972 facesum(zcoord,c2) = facesum(zcoord,c2) - fvecz*fvecm
980 DO ipatch = 1,pgrid%nPatches
981 ppatch => pregion%patches(ipatch)
983 IF ( ignoresypefaces .EQV. .true. )
THEN
984 IF ( ppatch%bcType /= bc_symmetry .AND. &
985 ppatch%bcType /= bc_periodic )
THEN
986 DO ifc = 1,ppatch%nBFacesTot
987 c1 = ppatch%bf2c(ifc)
989 fvecx = ppatch%fn(xcoord,ifc)
990 fvecy = ppatch%fn(ycoord,ifc)
991 fvecz = ppatch%fn(zcoord,ifc)
992 fvecm = ppatch%fn(xyzmag,ifc)
994 facesum(xcoord,c1) = facesum(xcoord,c1) + fvecx*fvecm
995 facesum(ycoord,c1) = facesum(ycoord,c1) + fvecy*fvecm
996 facesum(zcoord,c1) = facesum(zcoord,c1) + fvecz*fvecm
1000 DO ifc = 1,ppatch%nBFacesTot
1001 c1 = ppatch%bf2c(ifc)
1003 fvecx = ppatch%fn(xcoord,ifc)
1004 fvecy = ppatch%fn(ycoord,ifc)
1005 fvecz = ppatch%fn(zcoord,ifc)
1006 fvecm = ppatch%fn(xyzmag,ifc)
1008 facesum(xcoord,c1) = facesum(xcoord,c1) + fvecx*fvecm
1009 facesum(ycoord,c1) = facesum(ycoord,c1) + fvecy*fvecm
1010 facesum(zcoord,c1) = facesum(zcoord,c1) + fvecz*fvecm
1015 IF ( global%myProcid == masterproc .AND. &
1016 global%verbLevel >= verbose_high )
THEN
1017 WRITE(stdout,
'(A,5X,A)') solver_name,
'Minimum/maximum value of '// &
1018 'sum of face vectors:'
1019 WRITE(stdout,
'(A,7X,A,2(1X,E23.16),2(1X,I8))') solver_name, &
1021 minval(facesum(xcoord,1:pgrid%nCellsTot)), &
1022 maxval(facesum(xcoord,1:pgrid%nCellsTot)), &
1023 minloc(facesum(xcoord,1:pgrid%nCellsTot)), &
1024 maxloc(facesum(xcoord,1:pgrid%nCellsTot))
1025 WRITE(stdout,
'(A,7X,A,2(1X,E23.16),2(1X,I8))') solver_name, &
1027 minval(facesum(ycoord,1:pgrid%nCellsTot)), &
1028 maxval(facesum(ycoord,1:pgrid%nCellsTot)), &
1029 minloc(facesum(ycoord,1:pgrid%nCellsTot)), &
1030 maxloc(facesum(ycoord,1:pgrid%nCellsTot))
1031 WRITE(stdout,
'(A,7X,A,2(1X,E23.16),2(1X,I8))') solver_name, &
1033 minval(facesum(zcoord,1:pgrid%nCellsTot)), &
1034 maxval(facesum(zcoord,1:pgrid%nCellsTot)), &
1035 minloc(facesum(zcoord,1:pgrid%nCellsTot)), &
1036 maxloc(facesum(zcoord,1:pgrid%nCellsTot))
1039 facesummax =
max(abs(minval(facesum(xcoord,1:pgrid%nCellsTot))), &
1040 abs(maxval(facesum(xcoord,1:pgrid%nCellsTot))), &
1041 abs(minval(facesum(ycoord,1:pgrid%nCellsTot))), &
1042 abs(maxval(facesum(ycoord,1:pgrid%nCellsTot))), &
1043 abs(minval(facesum(zcoord,1:pgrid%nCellsTot))), &
1044 abs(maxval(facesum(zcoord,1:pgrid%nCellsTot))))
1046 IF ( facesummax > minval(pgrid%fn(xyzmag,1:pgrid%nFacesTot)) )
THEN
1047 WRITE(errorstring,
'(A,1X,E13.6)')
'Error:',facesummax
1048 CALL
errorstop(global,err_facesum,__line__,trim(errorstring))
1051 DEALLOCATE(facesum,stat=errorflag)
1052 global%error = errorflag
1053 IF ( global%error /= err_none )
THEN
1054 CALL
errorstop(global,err_deallocate,__line__,
'faceSum')
1058 #ifdef CHECK_DATASTRUCT
1063 WRITE(stdout,
'(A)') solver_name
1064 WRITE(stdout,
'(A,1X,A)') solver_name,
'### START CHECK OUTPUT ###'
1065 WRITE(stdout,
'(A,1X,A)') solver_name,
'Cell centroid locations'
1066 WRITE(stdout,
'(A,1X,A,1X,I6)') solver_name,
'Number of actual cells: ', &
1068 WRITE(stdout,
'(A,1X,A,1X,I6)') solver_name,
'Number of virtual cells:', &
1069 pgrid%nCellsTot-pgrid%nCells
1071 DO ic = 1,pgrid%nCellsTot
1072 WRITE(stdout,
'(A,1X,I6,3(1X,E18.9))') solver_name,
ic, &
1073 pgrid%cofg(xcoord,
ic), &
1074 pgrid%cofg(ycoord,
ic), &
1075 pgrid%cofg(zcoord,
ic)
1078 WRITE(stdout,
'(A,1X,A)') solver_name,
'### END CHECK OUTPUT ###'
1079 WRITE(stdout,
'(A)') solver_name
1080 WRITE(stdout,
'(A,1X,A)') solver_name,
'### START CHECK OUTPUT ###'
1081 WRITE(stdout,
'(A,1X,A)') solver_name,
'Cell volumes'
1082 WRITE(stdout,
'(A,1X,A,1X,I6)') solver_name,
'Number of actual cells: ', &
1084 WRITE(stdout,
'(A,1X,A,1X,I6)') solver_name,
'Number of virtual cells:', &
1085 pgrid%nCellsTot-pgrid%nCells
1087 DO ic = 1,pgrid%nCellsTot
1088 WRITE(stdout,
'(A,1X,I6,1X,E18.9)') solver_name,
ic,pgrid%vol(
ic)
1091 WRITE(stdout,
'(A,1X,A)') solver_name,
'### END CHECK OUTPUT ###'
1092 WRITE(stdout,
'(A)') solver_name
1093 WRITE(stdout,
'(A,1X,A)') solver_name,
'### START CHECK OUTPUT ###'
1094 WRITE(stdout,
'(A,1X,A)') solver_name,
'Face centroid locations'
1096 DO ifc = 1,pgrid%nFacesTot
1097 WRITE(stdout,
'(A,1X,I6,3(1X,E18.9))') solver_name,ifc, &
1098 pgrid%fc(xcoord,ifc), &
1099 pgrid%fc(ycoord,ifc), &
1100 pgrid%fc(zcoord,ifc)
1103 WRITE(stdout,
'(A,1X,A)') solver_name,
'### END CHECK OUTPUT ###'
1104 WRITE(stdout,
'(A)') solver_name
1105 WRITE(stdout,
'(A,1X,A)') solver_name,
'### START CHECK OUTPUT ###'
1106 WRITE(stdout,
'(A,1X,A)') solver_name,
'Face normals'
1108 DO ifc = 1,pgrid%nFacesTot
1109 WRITE(stdout,
'(A,1X,I6,3(1X,E18.9))') solver_name,ifc, &
1110 pgrid%fn(xcoord,ifc), &
1111 pgrid%fn(ycoord,ifc), &
1112 pgrid%fn(zcoord,ifc)
1115 WRITE(stdout,
'(A,1X,A)') solver_name,
'### END CHECK OUTPUT ###'
1116 WRITE(stdout,
'(A)') solver_name
1117 WRITE(stdout,
'(A,1X,A)') solver_name,
'### START CHECK OUTPUT ###'
1118 WRITE(stdout,
'(A,1X,A)') solver_name,
'Boundary face centroid locations'
1120 DO ipatch = 1,pgrid%nPatches
1121 ppatch => pregion%patches(ipatch)
1122 WRITE(stdout,
'(A,3X,A,1X,I7)') solver_name,
'Patch:',ipatch
1123 WRITE(stdout,
'(A,3X,A,1X,I7)') solver_name, &
1124 'Actual number of faces:', &
1126 WRITE(stdout,
'(A,3X,A,1X,I7)') solver_name, &
1127 'Total number of faces: ', &
1130 DO ifc = 1,ppatch%nBFacesTot
1131 WRITE(stdout,
'(A,1X,I6,3(1X,E18.9))') solver_name,ifc, &
1132 ppatch%fc(xcoord,ifc), &
1133 ppatch%fc(ycoord,ifc), &
1134 ppatch%fc(zcoord,ifc)
1138 WRITE(stdout,
'(A,1X,A)') solver_name,
'### END CHECK OUTPUT ###'
1139 WRITE(stdout,
'(A)') solver_name
1140 WRITE(stdout,
'(A,1X,A)') solver_name,
'### START CHECK OUTPUT ###'
1141 WRITE(stdout,
'(A,1X,A)') solver_name,
'Boundary face normals'
1143 DO ipatch = 1,pgrid%nPatches
1144 ppatch => pregion%patches(ipatch)
1145 WRITE(stdout,
'(A,3X,A,1X,I7)') solver_name,
'Patch:',ipatch
1146 WRITE(stdout,
'(A,3X,A,1X,I7)') solver_name, &
1147 'Actual number of faces:', &
1149 WRITE(stdout,
'(A,3X,A,1X,I7)') solver_name, &
1150 'Total number of faces: ', &
1153 DO ifc = 1,ppatch%nBFacesTot
1154 WRITE(stdout,
'(A,1X,I6,3(1X,E18.9))') solver_name,ifc, &
1155 ppatch%fn(xcoord,ifc), &
1156 ppatch%fn(ycoord,ifc), &
1157 ppatch%fn(zcoord,ifc)
1161 WRITE(stdout,
'(A,1X,A)') solver_name,
'### END CHECK OUTPUT ###'
1162 WRITE(stdout,
'(A)') solver_name
1169 IF ( pregion%mixtInput%moveGrid .EQV. .true. )
THEN
1177 IF ( global%myProcid == masterproc .AND. &
1178 global%verbLevel >= verbose_high )
THEN
1179 WRITE(stdout,
'(A,1X,A)') solver_name,
'Building geometry done.'
1218 TYPE(t_region
),
POINTER :: pregion
1224 INTEGER :: icl,icg,v1,v2,v3,v4,v5,v6,v7,v8
1225 REAL(RFREAL) ::
term,x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8, &
1226 z1,z2,z3,z4,z5,z6,z7,z8
1227 TYPE(t_grid),
POINTER :: pgrid
1234 global => pregion%global
1237 'RFLU_ModGeometry.F90')
1239 IF ( global%myProcid == masterproc .AND. &
1240 global%verbLevel >= verbose_high )
THEN
1241 WRITE(stdout,
'(A,1X,A,A)') solver_name,
'Computing approximate ', &
1243 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
1244 pregion%iRegionGlobal
1247 pgrid => pregion%grid
1257 term = 1.0_rfreal/4.0_rfreal
1259 DO icl = 1,pgrid%nTetsTot
1260 v1 = pgrid%tet2v(1,icl)
1261 v2 = pgrid%tet2v(2,icl)
1262 v3 = pgrid%tet2v(3,icl)
1263 v4 = pgrid%tet2v(4,icl)
1265 x1 = pgrid%xyz(xcoord,v1)
1266 x2 = pgrid%xyz(xcoord,v2)
1267 x3 = pgrid%xyz(xcoord,v3)
1268 x4 = pgrid%xyz(xcoord,v4)
1270 y1 = pgrid%xyz(ycoord,v1)
1271 y2 = pgrid%xyz(ycoord,v2)
1272 y3 = pgrid%xyz(ycoord,v3)
1273 y4 = pgrid%xyz(ycoord,v4)
1275 z1 = pgrid%xyz(zcoord,v1)
1276 z2 = pgrid%xyz(zcoord,v2)
1277 z3 = pgrid%xyz(zcoord,v3)
1278 z4 = pgrid%xyz(zcoord,v4)
1280 icg = pgrid%tet2CellGlob(icl)
1282 pgrid%cofgApp(xcoord,icg) =
term*(x1 + x2 + x3 + x4)
1283 pgrid%cofgApp(ycoord,icg) =
term*(y1 + y2 + y3 + y4)
1284 pgrid%cofgApp(zcoord,icg) =
term*(z1 + z2 + z3 + z4)
1291 term = 1.0_rfreal/8.0_rfreal
1293 DO icl = 1,pgrid%nHexsTot
1294 v1 = pgrid%hex2v(1,icl)
1295 v2 = pgrid%hex2v(2,icl)
1296 v3 = pgrid%hex2v(3,icl)
1297 v4 = pgrid%hex2v(4,icl)
1298 v5 = pgrid%hex2v(5,icl)
1299 v6 = pgrid%hex2v(6,icl)
1300 v7 = pgrid%hex2v(7,icl)
1301 v8 = pgrid%hex2v(8,icl)
1303 x1 = pgrid%xyz(xcoord,v1)
1304 x2 = pgrid%xyz(xcoord,v2)
1305 x3 = pgrid%xyz(xcoord,v3)
1306 x4 = pgrid%xyz(xcoord,v4)
1307 x5 = pgrid%xyz(xcoord,v5)
1308 x6 = pgrid%xyz(xcoord,v6)
1309 x7 = pgrid%xyz(xcoord,v7)
1310 x8 = pgrid%xyz(xcoord,v8)
1312 y1 = pgrid%xyz(ycoord,v1)
1313 y2 = pgrid%xyz(ycoord,v2)
1314 y3 = pgrid%xyz(ycoord,v3)
1315 y4 = pgrid%xyz(ycoord,v4)
1316 y5 = pgrid%xyz(ycoord,v5)
1317 y6 = pgrid%xyz(ycoord,v6)
1318 y7 = pgrid%xyz(ycoord,v7)
1319 y8 = pgrid%xyz(ycoord,v8)
1321 z1 = pgrid%xyz(zcoord,v1)
1322 z2 = pgrid%xyz(zcoord,v2)
1323 z3 = pgrid%xyz(zcoord,v3)
1324 z4 = pgrid%xyz(zcoord,v4)
1325 z5 = pgrid%xyz(zcoord,v5)
1326 z6 = pgrid%xyz(zcoord,v6)
1327 z7 = pgrid%xyz(zcoord,v7)
1328 z8 = pgrid%xyz(zcoord,v8)
1330 icg = pgrid%hex2CellGlob(icl)
1332 pgrid%cofgApp(xcoord,icg) =
term*(x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8)
1333 pgrid%cofgApp(ycoord,icg) =
term*(y1 + y2 + y3 + y4 + y5 + y6 + y7 + y8)
1334 pgrid%cofgApp(zcoord,icg) =
term*(z1 + z2 + z3 + z4 + z5 + z6 + z7 + z8)
1341 term = 1.0_rfreal/6.0_rfreal
1343 DO icl = 1,pgrid%nPrisTot
1344 v1 = pgrid%pri2v(1,icl)
1345 v2 = pgrid%pri2v(2,icl)
1346 v3 = pgrid%pri2v(3,icl)
1347 v4 = pgrid%pri2v(4,icl)
1348 v5 = pgrid%pri2v(5,icl)
1349 v6 = pgrid%pri2v(6,icl)
1351 x1 = pgrid%xyz(xcoord,v1)
1352 x2 = pgrid%xyz(xcoord,v2)
1353 x3 = pgrid%xyz(xcoord,v3)
1354 x4 = pgrid%xyz(xcoord,v4)
1355 x5 = pgrid%xyz(xcoord,v5)
1356 x6 = pgrid%xyz(xcoord,v6)
1358 y1 = pgrid%xyz(ycoord,v1)
1359 y2 = pgrid%xyz(ycoord,v2)
1360 y3 = pgrid%xyz(ycoord,v3)
1361 y4 = pgrid%xyz(ycoord,v4)
1362 y5 = pgrid%xyz(ycoord,v5)
1363 y6 = pgrid%xyz(ycoord,v6)
1365 z1 = pgrid%xyz(zcoord,v1)
1366 z2 = pgrid%xyz(zcoord,v2)
1367 z3 = pgrid%xyz(zcoord,v3)
1368 z4 = pgrid%xyz(zcoord,v4)
1369 z5 = pgrid%xyz(zcoord,v5)
1370 z6 = pgrid%xyz(zcoord,v6)
1372 icg = pgrid%pri2CellGlob(icl)
1374 pgrid%cofgApp(xcoord,icg) =
term*(x1 + x2 + x3 + x4 + x5 + x6)
1375 pgrid%cofgApp(ycoord,icg) =
term*(y1 + y2 + y3 + y4 + y5 + y6)
1376 pgrid%cofgApp(zcoord,icg) =
term*(z1 + z2 + z3 + z4 + z5 + z6)
1383 term = 1.0_rfreal/5.0_rfreal
1385 DO icl = 1,pgrid%nPyrsTot
1386 v1 = pgrid%pyr2v(1,icl)
1387 v2 = pgrid%pyr2v(2,icl)
1388 v3 = pgrid%pyr2v(3,icl)
1389 v4 = pgrid%pyr2v(4,icl)
1390 v5 = pgrid%pyr2v(5,icl)
1392 x1 = pgrid%xyz(xcoord,v1)
1393 x2 = pgrid%xyz(xcoord,v2)
1394 x3 = pgrid%xyz(xcoord,v3)
1395 x4 = pgrid%xyz(xcoord,v4)
1396 x5 = pgrid%xyz(xcoord,v5)
1398 y1 = pgrid%xyz(ycoord,v1)
1399 y2 = pgrid%xyz(ycoord,v2)
1400 y3 = pgrid%xyz(ycoord,v3)
1401 y4 = pgrid%xyz(ycoord,v4)
1402 y5 = pgrid%xyz(ycoord,v5)
1404 z1 = pgrid%xyz(zcoord,v1)
1405 z2 = pgrid%xyz(zcoord,v2)
1406 z3 = pgrid%xyz(zcoord,v3)
1407 z4 = pgrid%xyz(zcoord,v4)
1408 z5 = pgrid%xyz(zcoord,v5)
1410 icg = pgrid%pyr2CellGlob(icl)
1412 pgrid%cofgApp(xcoord,icg) =
term*(x1 + x2 + x3 + x4 + x5)
1413 pgrid%cofgApp(ycoord,icg) =
term*(y1 + y2 + y3 + y4 + y5)
1414 pgrid%cofgApp(zcoord,icg) =
term*(z1 + z2 + z3 + z4 + z5)
1421 IF ( global%myProcid == masterproc .AND. &
1422 global%verbLevel >= verbose_high )
THEN
1423 WRITE(stdout,
'(A,1X,A,A)') solver_name,
'Computing approximate '// &
1463 TYPE(t_region
),
POINTER :: pregion
1469 INTEGER :: c1,c2,errorflag,ifc,ipatch
1471 TYPE(t_grid),
POINTER :: pgrid
1472 TYPE(t_patch),
POINTER :: ppatch
1478 global => pregion%global
1481 'RFLU_ModGeometry.F90')
1483 IF ( global%myProcid == masterproc .AND. &
1484 global%verbLevel >= verbose_high )
THEN
1485 WRITE(stdout,
'(A,1X,A)') solver_name,
'Computing face distance...'
1486 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
1487 pregion%iRegionGlobal
1490 pgrid => pregion%grid
1500 DO ifc = 1,pgrid%nFaces
1501 c1 = pgrid%f2c(1,ifc)
1502 c2 = pgrid%f2c(2,ifc)
1504 pgrid%cofgDist(1,ifc) =
dot_product(pgrid%fc(:,ifc)-pgrid%cofg(:,c1), &
1506 pgrid%cofgDist(2,ifc) =
dot_product(pgrid%cofg(:,c2)-pgrid%fc(:,ifc), &
1514 DO ipatch = 1,pgrid%nPatches
1515 ppatch => pregion%patches(ipatch)
1517 DO ifc = 1,ppatch%nBFaces
1518 c1 = ppatch%bf2c(ifc)
1520 ppatch%cofgDist(ifc) =
dot_product(ppatch%fc(:,ifc)-pgrid%cofg(:,c1), &
1529 IF ( global%myProcid == masterproc .AND. &
1530 global%verbLevel >= verbose_high )
THEN
1531 WRITE(stdout,
'(A,1X,A)') solver_name,
'Computing face distance done.'
1570 TYPE(t_region
),
POINTER :: pregion
1576 INTEGER :: errorflag
1577 TYPE(t_grid),
POINTER :: pgrid
1584 global => pregion%global
1587 'RFLU_ModGeometry.F90')
1589 IF ( global%myProcid == masterproc .AND. &
1590 global%verbLevel >= verbose_high )
THEN
1591 WRITE(stdout,
'(A,1X,A)') solver_name,
'Creating approximate centroids...'
1592 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
1593 pregion%iRegionGlobal
1596 pgrid => pregion%grid
1608 ALLOCATE(pgrid%cofgApp(xcoord:zcoord,pgrid%nCellsTot),stat=errorflag)
1609 global%error = errorflag
1610 IF ( global%error /= err_none )
THEN
1611 CALL
errorstop(global,err_allocate,__line__,
'pGrid%cofgApp')
1618 IF ( global%myProcid == masterproc .AND. &
1619 global%verbLevel >= verbose_high )
THEN
1620 WRITE(stdout,
'(A,1X,A,A)') solver_name,
'Creating approximate '// &
1660 TYPE(t_region
),
POINTER :: pregion
1666 INTEGER :: errorflag,ipatch
1667 TYPE(t_grid),
POINTER :: pgrid
1668 TYPE(t_patch),
POINTER :: ppatch
1675 global => pregion%global
1678 'RFLU_ModGeometry.F90')
1680 IF ( global%myProcid == masterproc .AND. &
1681 global%verbLevel >= verbose_high )
THEN
1682 WRITE(stdout,
'(A,1X,A)') solver_name,
'Creating face distance...'
1683 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
1684 pregion%iRegionGlobal
1687 pgrid => pregion%grid
1699 ALLOCATE(pgrid%cofgDist(2,pgrid%nFaces),stat=errorflag)
1700 global%error = errorflag
1701 IF ( global%error /= err_none )
THEN
1702 CALL
errorstop(global,err_allocate,__line__,
'pGrid%cofgDist')
1705 DO ipatch = 1,pgrid%nPatches
1706 ppatch => pregion%patches(ipatch)
1708 IF ( global%myProcid == masterproc .AND. &
1709 global%verbLevel >= verbose_high )
THEN
1710 WRITE(stdout,
'(A,5X,A,1X,I3)') solver_name,
'Patch:',ipatch
1713 ALLOCATE(ppatch%cofgDist(ppatch%nBFaces),stat=errorflag)
1714 global%error = errorflag
1715 IF ( global%error /= err_none )
THEN
1716 CALL
errorstop(global,err_allocate,__line__,
'pPatch%cofgDist')
1724 IF ( global%myProcid == masterproc .AND. &
1725 global%verbLevel >= verbose_high )
THEN
1726 WRITE(stdout,
'(A,1X,A,A)') solver_name,
'Creating face distance done.'
1766 TYPE(t_region
),
POINTER :: pregion
1772 INTEGER :: errorflag,ibv,
ic,ifc,ipatch
1773 TYPE(t_grid),
POINTER :: pgrid
1774 TYPE(t_patch),
POINTER :: ppatch
1781 global => pregion%global
1784 'RFLU_ModGeometry.F90')
1786 IF ( global%myProcid == masterproc .AND. &
1787 global%verbLevel >= verbose_high )
THEN
1788 WRITE(stdout,
'(A,1X,A)') solver_name,
'Creating geometry...'
1789 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
1790 pregion%iRegionGlobal
1793 pgrid => pregion%grid
1805 IF ( global%myProcid == masterproc .AND. &
1806 global%verbLevel >= verbose_high )
THEN
1807 WRITE(stdout,
'(A,3X,A)') solver_name,
'Interior geometry...'
1814 ALLOCATE(pgrid%vol(pgrid%nCellsTot),stat=errorflag)
1815 global%error = errorflag
1816 IF ( global%error /= err_none )
THEN
1817 CALL
errorstop(global,err_allocate,__line__,
'pGrid%vol')
1820 ALLOCATE(pgrid%cofg(xcoord:zcoord,pgrid%nCellsTot),stat=errorflag)
1821 global%error = errorflag
1822 IF ( global%error /= err_none )
THEN
1823 CALL
errorstop(global,err_allocate,__line__,
'pGrid%cofg')
1826 DO ic = 1,pgrid%nCellsTot
1827 pgrid%vol(
ic) = 0.0_rfreal
1828 pgrid%cofg(xcoord,
ic) = 0.0_rfreal
1829 pgrid%cofg(ycoord,
ic) = 0.0_rfreal
1830 pgrid%cofg(zcoord,
ic) = 0.0_rfreal
1837 ALLOCATE(pgrid%fn(xcoord:xyzmag,pgrid%nFacesTot),stat=errorflag)
1838 global%error = errorflag
1839 IF ( global%error /= err_none )
THEN
1840 CALL
errorstop(global,err_allocate,__line__,
'pGrid%fn')
1843 ALLOCATE(pgrid%fc(xcoord:zcoord,pgrid%nFacesTot),stat=errorflag)
1844 global%error = errorflag
1845 IF ( global%error /= err_none )
THEN
1846 CALL
errorstop(global,err_allocate,__line__,
'pGrid%fc')
1849 DO ifc = 1,pgrid%nFacesTot
1850 pgrid%fn(xcoord,ifc) = 0.0_rfreal
1851 pgrid%fn(ycoord,ifc) = 0.0_rfreal
1852 pgrid%fn(zcoord,ifc) = 0.0_rfreal
1853 pgrid%fn(xyzmag,ifc) = 0.0_rfreal
1855 pgrid%fc(xcoord,ifc) = 0.0_rfreal
1856 pgrid%fc(ycoord,ifc) = 0.0_rfreal
1857 pgrid%fc(zcoord,ifc) = 0.0_rfreal
1864 IF ( global%myProcid == masterproc .AND. &
1865 global%verbLevel >= verbose_high )
THEN
1866 WRITE(stdout,
'(A,3X,A)') solver_name,
'Patch geometry...'
1869 DO ipatch = 1,pgrid%nPatches
1870 ppatch => pregion%patches(ipatch)
1872 IF ( global%myProcid == masterproc .AND. &
1873 global%verbLevel >= verbose_high )
THEN
1874 WRITE(stdout,
'(A,5X,A,1X,I3)') solver_name,
'Patch:',ipatch
1881 ALLOCATE(ppatch%fn(xcoord:xyzmag,ppatch%nBFacesTot),stat=errorflag)
1882 global%error = errorflag
1883 IF ( global%error /= err_none )
THEN
1884 CALL
errorstop(global,err_allocate,__line__,
'region%patches%fn')
1887 ALLOCATE(ppatch%fc(xcoord:zcoord,ppatch%nBFacesTot),stat=errorflag)
1888 global%error = errorflag
1889 IF ( global%error /= err_none )
THEN
1890 CALL
errorstop(global,err_allocate,__line__,
'region%patches%fc')
1893 DO ifc = 1,ppatch%nBFacesTot
1894 ppatch%fn(xcoord,ifc) = 0.0_rfreal
1895 ppatch%fn(ycoord,ifc) = 0.0_rfreal
1896 ppatch%fn(zcoord,ifc) = 0.0_rfreal
1897 ppatch%fn(xyzmag,ifc) = 0.0_rfreal
1899 ppatch%fc(xcoord,ifc) = 0.0_rfreal
1900 ppatch%fc(ycoord,ifc) = 0.0_rfreal
1901 ppatch%fc(zcoord,ifc) = 0.0_rfreal
1908 IF ( pregion%mixtInput%moveGrid .EQV. .true. )
THEN
1909 ALLOCATE(ppatch%bvn(xcoord:zcoord,ppatch%nBVertTot),stat=errorflag)
1910 global%error = errorflag
1911 IF ( global%error /= err_none )
THEN
1912 CALL
errorstop(global,err_allocate,__line__,
'pPatch%bvn')
1915 DO ibv = 1,ppatch%nBVertTot
1916 ppatch%bvn(xcoord,ibv) = 0.0_rfreal
1917 ppatch%bvn(ycoord,ibv) = 0.0_rfreal
1918 ppatch%bvn(zcoord,ibv) = 0.0_rfreal
1929 IF ( global%myProcid == masterproc .AND. &
1930 global%verbLevel >= verbose_high )
THEN
1931 WRITE(stdout,
'(A,1X,A)') solver_name,
'Creating geometry done.'
1972 TYPE(t_region
),
POINTER :: pregion
1978 INTEGER :: errorflag
1979 TYPE(t_grid),
POINTER :: pgrid
1986 global => pregion%global
1989 'RFLU_ModGeometry.F90')
1991 IF ( global%myProcid == masterproc .AND. &
1992 global%verbLevel >= verbose_high )
THEN
1993 WRITE(stdout,
'(A,1X,A,A)') solver_name,
'Destroying approximate ', &
1995 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
1996 pregion%iRegionGlobal
1999 pgrid => pregion%grid
2005 DEALLOCATE(pgrid%cofgApp,stat=errorflag)
2006 global%error = errorflag
2007 IF ( global%error /= err_none )
THEN
2008 CALL
errorstop(global,err_deallocate,__line__,
'pGrid%cofgApp')
2021 IF ( global%myProcid == masterproc .AND. &
2022 global%verbLevel >= verbose_high )
THEN
2023 WRITE(stdout,
'(A,1X,A,A)') solver_name,
'Destroying approximate '// &
2063 TYPE(t_region
),
POINTER :: pregion
2069 INTEGER :: errorflag,ipatch
2070 TYPE(t_grid),
POINTER :: pgrid
2071 TYPE(t_patch),
POINTER :: ppatch
2078 global => pregion%global
2081 'RFLU_ModGeometry.F90')
2083 IF ( global%myProcid == masterproc .AND. &
2084 global%verbLevel >= verbose_high )
THEN
2085 WRITE(stdout,
'(A,1X,A)') solver_name,
'Destroying face distance...'
2086 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
2087 pregion%iRegionGlobal
2090 pgrid => pregion%grid
2096 DEALLOCATE(pgrid%cofgDist,stat=errorflag)
2097 global%error = errorflag
2098 IF ( global%error /= err_none )
THEN
2099 CALL
errorstop(global,err_deallocate,__line__,
'pGrid%cofgDist')
2102 DO ipatch = 1,pgrid%nPatches
2103 ppatch => pregion%patches(ipatch)
2105 IF ( global%myProcid == masterproc .AND. &
2106 global%verbLevel >= verbose_high )
THEN
2107 WRITE(stdout,
'(A,5X,A,1X,I3)') solver_name,
'Patch:',ipatch
2110 DEALLOCATE(ppatch%cofgDist,stat=errorflag)
2111 global%error = errorflag
2112 IF ( global%error /= err_none )
THEN
2113 CALL
errorstop(global,err_deallocate,__line__,
'pPatch%cofgDist')
2127 IF ( global%myProcid == masterproc .AND. &
2128 global%verbLevel >= verbose_high )
THEN
2129 WRITE(stdout,
'(A,1X,A,A)') solver_name,
'Destroying face distance done.'
2167 TYPE(t_region
),
POINTER :: pregion
2173 INTEGER :: errorflag,ipatch
2174 TYPE(t_grid),
POINTER :: pgrid
2175 TYPE(t_patch),
POINTER :: ppatch
2182 global => pregion%global
2185 'RFLU_ModGeometry.F90')
2187 IF ( global%myProcid == masterproc .AND. &
2188 global%verbLevel >= verbose_high )
THEN
2189 WRITE(stdout,
'(A,1X,A)') solver_name,
'Destroying geometry...'
2190 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
2191 pregion%iRegionGlobal
2194 pgrid => pregion%grid
2200 DEALLOCATE(pgrid%vol,stat=errorflag)
2201 global%error = errorflag
2202 IF ( global%error /= err_none )
THEN
2203 CALL
errorstop(global,err_deallocate,__line__,
'region%grid%vol')
2206 DEALLOCATE(pgrid%fn,stat=errorflag)
2207 global%error = errorflag
2208 IF ( global%error /= err_none )
THEN
2209 CALL
errorstop(global,err_deallocate,__line__,
'region%grid%fn')
2212 IF (
ASSOCIATED(pgrid%fc) .EQV. .true. )
THEN
2213 DEALLOCATE(pgrid%fc,stat=errorflag)
2214 global%error = errorflag
2215 IF ( global%error /= err_none )
THEN
2216 CALL
errorstop(global,err_deallocate,__line__,
'region%grid%fc')
2220 IF (
ASSOCIATED(pgrid%cofg) .EQV. .true. )
THEN
2221 DEALLOCATE(pgrid%cofg,stat=errorflag)
2222 global%error = errorflag
2223 IF ( global%error /= err_none )
THEN
2224 CALL
errorstop(global,err_deallocate,__line__,
'region%grid%cofg')
2232 DO ipatch = 1,pgrid%nPatches
2233 ppatch => pregion%patches(ipatch)
2235 DEALLOCATE(ppatch%fn,stat=errorflag)
2236 global%error = errorflag
2237 IF ( global%error /= err_none )
THEN
2238 CALL
errorstop(global,err_deallocate,__line__,
'region%patches%fn')
2241 IF (
ASSOCIATED(ppatch%fc) .EQV. .true. )
THEN
2242 DEALLOCATE(ppatch%fc,stat=errorflag)
2243 global%error = errorflag
2244 IF ( global%error /= err_none )
THEN
2245 CALL
errorstop(global,err_deallocate,__line__,
'region%patches%fc')
2249 IF (
ASSOCIATED(ppatch%bvn) .EQV. .true. )
THEN
2250 DEALLOCATE(ppatch%bvn,stat=errorflag)
2251 global%error = errorflag
2252 IF ( global%error /= err_none )
THEN
2253 CALL
errorstop(global,err_deallocate,__line__,
'pPatch%bvn')
2268 IF ( global%myProcid == masterproc .AND. &
2269 global%verbLevel >= verbose_high )
THEN
2270 WRITE(stdout,
'(A,1X,A)') solver_name,
'Destroying geometry done.'
2308 TYPE(t_region
),
POINTER :: pregion
2314 TYPE(t_grid),
POINTER :: pgrid
2321 global => pregion%global
2324 'RFLU_ModGeometry.F90')
2326 IF ( global%myProcid == masterproc .AND. &
2327 global%verbLevel >= verbose_high )
THEN
2328 WRITE(stdout,
'(A,1X,A)') solver_name, &
2329 'Nullifying approximate centroids...'
2330 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
2331 pregion%iRegionGlobal
2334 pgrid => pregion%grid
2340 nullify(pgrid%cofgApp)
2346 IF ( global%myProcid == masterproc .AND. &
2347 global%verbLevel >= verbose_high )
THEN
2348 WRITE(stdout,
'(A,1X,A,A)') solver_name, &
2349 'Nullifying approximate centroids done.'
2388 TYPE(t_region
),
POINTER :: pregion
2395 TYPE(t_grid),
POINTER :: pgrid
2396 TYPE(t_patch),
POINTER :: ppatch
2403 global => pregion%global
2406 'RFLU_ModGeometry.F90')
2408 IF ( global%myProcid == masterproc .AND. &
2409 global%verbLevel >= verbose_high )
THEN
2410 WRITE(stdout,
'(A,1X,A)') solver_name, &
2411 'Nullifying face distance...'
2412 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
2413 pregion%iRegionGlobal
2416 pgrid => pregion%grid
2422 nullify(pgrid%cofgDist)
2424 DO ipatch = 1,pgrid%nPatches
2425 ppatch => pregion%patches(ipatch)
2427 nullify(ppatch%cofgDist)
2434 IF ( global%myProcid == masterproc .AND. &
2435 global%verbLevel >= verbose_high )
THEN
2436 WRITE(stdout,
'(A,1X,A,A)') solver_name, &
2437 'Nullifying face distance done.'
2476 TYPE(t_region
),
POINTER :: pregion
2483 TYPE(t_grid),
POINTER :: pgrid
2484 TYPE(t_patch),
POINTER :: ppatch
2491 global => pregion%global
2494 'RFLU_ModGeometry.F90')
2496 IF ( global%myProcid == masterproc .AND. &
2497 global%verbLevel >= verbose_high )
THEN
2498 WRITE(stdout,
'(A,1X,A)') solver_name,
'Nullifying geometry...'
2499 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
2500 pregion%iRegionGlobal
2503 pgrid => pregion%grid
2519 DO ipatch = 1,pgrid%nPatches
2520 ppatch => pregion%patches(ipatch)
2531 IF ( global%myProcid == masterproc .AND. &
2532 global%verbLevel >= verbose_high )
THEN
2533 WRITE(stdout,
'(A,1X,A)') solver_name,
'Nullifying geometry done.'
subroutine, public rflu_nullifygeometry(pRegion)
subroutine facevectortria(xyzNodes, fVecX, fVecY, fVecZ)
INTEGER function, public rflu_getglobalcellkind(global, pGrid, icg)
subroutine, public rflu_computefacedist(pRegion)
subroutine, public rflu_destroyapproxcentroids(pRegion)
subroutine, public rflu_createfacedist(pRegion)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
subroutine, public rflu_destroygeometry(pRegion)
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, public rflu_buildgeometry(pRegion, sypeFaceFlag)
subroutine rflu_nullifyfacedist(pRegion)
subroutine, public rflu_nullifyapproxcentroids(pRegion)
INTEGER function, public rflu_getfacekind(global, c1k, c2k)
subroutine quicksortrfreal(a, n)
subroutine rflu_printlocinfo(pRegion, locUnsorted, nLocUnsorted, locInfoMode, outputMode)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine, public rflu_computeapproxcentroids(pRegion)
long double dot_product(pnt vec1, pnt vec2)
subroutine facevectorquad(xyzNodes, fVecX, fVecY, fVecZ)
subroutine deregisterfunction(global)
subroutine, public rflu_destroyfacedist(pRegion)
subroutine, public rflu_creategeometry(pRegion)
subroutine, public rflu_buildbvertexnormals(pRegion)
subroutine, public rflu_createapproxcentroids(pRegion)
subroutine facecentroidtria(xyz, fCenX, fCenY, fCenZ)
subroutine facecentroidquad(xyz, fCenX, fCenY, fCenZ)