64 CHARACTER(CHRLEN),
PRIVATE :: &
65 RCSIdentString =
'$RCSfile: RFLU_ModInCellTest.F90,v $ $Revision: 1.4 $'
104 TYPE(t_region
),
POINTER :: pregion
110 INTEGER :: ifg,ifl,ipatch,ivg,ivl
111 REAL(RFREAL) :: eps,epsmax,nx,ny,nz,safetyfactor,xc,yc,zc
113 TYPE(t_grid),
POINTER :: pgrid
114 TYPE(t_patch),
POINTER :: ppatch
120 global => pregion%global
123 'RFLU_ModInCellTest.F90')
125 IF ( global%myProcid == masterproc .AND. &
126 global%verbLevel > verbose_low )
THEN
127 WRITE(stdout,
'(A,1X,A)') solver_name, &
128 'Computing tolerance for in-cell test...'
129 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
130 pregion%iRegionGlobal
137 pgrid => pregion%grid
139 epsmax = -huge(1.0_rfreal)
141 safetyfactor = 2.0_rfreal
147 DO ifg = 1,pgrid%nFaces
148 IF ( pgrid%f2v(4,ifg) /= vert_none )
THEN
149 xc = pgrid%fc(xcoord,ifg)
150 yc = pgrid%fc(ycoord,ifg)
151 zc = pgrid%fc(zcoord,ifg)
153 nx = pgrid%fn(xcoord,ifg)
154 ny = pgrid%fn(ycoord,ifg)
155 nz = pgrid%fn(zcoord,ifg)
158 ivg = pgrid%f2v(ivl,ifg)
160 eps = (pgrid%xyz(xcoord,ivg) - xc)*nx &
161 + (pgrid%xyz(ycoord,ivg) - yc)*ny &
162 + (pgrid%xyz(zcoord,ivg) - zc)*nz
164 epsmax =
max(eps,epsmax)
169 DO ipatch = 1,pgrid%nPatches
170 ppatch => pregion%patches(ipatch)
172 DO ifl = 1,ppatch%nBFaces
173 IF ( ppatch%bf2v(4,ifl) /= vert_none )
THEN
174 xc = ppatch%fc(xcoord,ifl)
175 yc = ppatch%fc(ycoord,ifl)
176 zc = ppatch%fc(zcoord,ifl)
178 nx = ppatch%fn(xcoord,ifl)
179 ny = ppatch%fn(ycoord,ifl)
180 nz = ppatch%fn(zcoord,ifl)
183 ivg = ppatch%bv(ppatch%bf2v(ivl,ifl))
185 eps = (pgrid%xyz(xcoord,ivg) - xc)*nx &
186 + (pgrid%xyz(ycoord,ivg) - yc)*ny &
187 + (pgrid%xyz(zcoord,ivg) - zc)*nz
189 epsmax =
max(eps,epsmax)
199 IF ( global%myProcid == masterproc .AND. &
200 global%verbLevel > verbose_low )
THEN
201 WRITE(stdout,
'(A,3X,A,1X,E13.6)') solver_name, &
202 'Maximum face planarity defect:',epsmax
209 IF ( epsmax > pregion%mixtInput%tolerICT )
THEN
210 pregion%mixtInput%tolerICT = safetyfactor*epsmax
212 IF ( global%myProcid == masterproc .AND. &
213 global%verbLevel > verbose_low )
THEN
214 WRITE(stdout,
'(A,3X,A,12X,E13.6)') solver_name,
'Tolerance reset to:', &
215 pregion%mixtInput%tolerICT
223 IF ( global%myProcid == masterproc .AND. &
224 global%verbLevel > verbose_low )
THEN
225 WRITE(stdout,
'(A,1X,A)') solver_name, &
226 'Computing tolerance for in-cell test done.'
274 INTEGER,
INTENT(IN) :: icg,ifg,ipatch
275 REAL(RFREAL),
INTENT(IN) :: xloc,yloc,zloc
276 REAL(RFREAL),
INTENT(OUT) :: dotp
277 TYPE(t_region
),
POINTER :: pregion
284 REAL(RFREAL) :: fnx,fny,fnz,xcofg,ycofg,zcofg
286 TYPE(t_grid),
POINTER :: pgrid
287 TYPE(t_patch),
POINTER :: ppatch
293 global => pregion%global
296 'RFLU_ModInCellTest.F90')
302 pgrid => pregion%grid
308 IF ( ipatch == 0 )
THEN
309 c1 = pgrid%f2c(1,ifg)
310 c2 = pgrid%f2c(2,ifg)
312 xcofg = pgrid%fc(xcoord,ifg)
313 ycofg = pgrid%fc(ycoord,ifg)
314 zcofg = pgrid%fc(zcoord,ifg)
316 IF ( c1 == icg )
THEN
317 fnx = pgrid%fn(xcoord,ifg)
318 fny = pgrid%fn(ycoord,ifg)
319 fnz = pgrid%fn(zcoord,ifg)
320 ELSE IF ( c2 == icg )
THEN
321 fnx = -pgrid%fn(xcoord,ifg)
322 fny = -pgrid%fn(ycoord,ifg)
323 fnz = -pgrid%fn(zcoord,ifg)
325 CALL
errorstop(global,err_reached_default,__line__)
328 ppatch => pregion%patches(ipatch)
330 xcofg = ppatch%fc(xcoord,ifg)
331 ycofg = ppatch%fc(ycoord,ifg)
332 zcofg = ppatch%fc(zcoord,ifg)
334 fnx = ppatch%fn(xcoord,ifg)
335 fny = ppatch%fn(ycoord,ifg)
336 fnz = ppatch%fn(zcoord,ifg)
339 dotp = (xcofg-xloc)*fnx + (ycofg-yloc)*fny + (zcofg-zloc)*fnz
391 INTEGER,
INTENT(IN) :: ifg,ipatch
392 REAL(RFREAL),
INTENT(IN) :: xloc,yloc,zloc
393 REAL(RFREAL),
INTENT(OUT) :: dotp
394 TYPE(t_region
),
POINTER :: pregion
400 INTEGER :: v1,v2,v3,v4
401 REAL(RFREAL) :: ax,ay,az,bx,
by,bz,cx,cy,cz,
dx,
dy,
dz,nx,ny,nz,u,
v,
x,x1,x2, &
402 x3,x4,
y,y1,y2,y3,y4,
z,z1,z2,z3,z4
404 TYPE(t_grid),
POINTER :: pgrid
405 TYPE(t_patch),
POINTER :: ppatch
411 global => pregion%global
414 'RFLU_ModInCellTest.F90')
420 pgrid => pregion%grid
426 IF ( ipatch == 0 )
THEN
427 v1 = pgrid%f2v(1,ifg)
428 v2 = pgrid%f2v(2,ifg)
429 v3 = pgrid%f2v(3,ifg)
430 v4 = pgrid%f2v(4,ifg)
432 IF ( v4 == vert_none )
THEN
439 ppatch => pregion%patches(ipatch)
441 v1 = ppatch%bv(ppatch%bf2v(1,ifg))
442 v2 = ppatch%bv(ppatch%bf2v(2,ifg))
443 v3 = ppatch%bv(ppatch%bf2v(3,ifg))
445 IF ( ppatch%bf2v(4,ifg) == vert_none )
THEN
452 v4 = ppatch%bv(ppatch%bf2v(4,ifg))
455 x1 = pgrid%xyz(xcoord,v1)
456 x2 = pgrid%xyz(xcoord,v2)
457 x3 = pgrid%xyz(xcoord,v3)
458 x4 = pgrid%xyz(xcoord,v4)
460 y1 = pgrid%xyz(ycoord,v1)
461 y2 = pgrid%xyz(ycoord,v2)
462 y3 = pgrid%xyz(ycoord,v3)
463 y4 = pgrid%xyz(ycoord,v4)
465 z1 = pgrid%xyz(zcoord,v1)
466 z2 = pgrid%xyz(zcoord,v2)
467 z3 = pgrid%xyz(zcoord,v3)
468 z4 = pgrid%xyz(zcoord,v4)
474 ax = x1 - x2 - x4 + x3
475 ay = y1 - y2 - y4 + y3
476 az = z1 - z2 - z4 + z3
494 CALL
rflu_blin_findclosestpoint(global,ax,ay,az,bx,
by,bz,cx,cy,cz, &
495 dx,
dy,
dz,xloc,yloc,zloc,u,
v,
x,
y,
z)
501 IF ( (u < 0.0_rfreal .OR. u > 1.0_rfreal) .OR. &
502 (
v < 0.0_rfreal .OR.
v > 1.0_rfreal) )
THEN
503 dotp = crazy_value_int
505 CALL
rflu_blin_computenormal(global,ax,ay,az,bx,
by,bz,cx,cy,cz, &
508 dotp = (
x-xloc)*nx + (
y-yloc)*ny + (
z-zloc)*nz
556 INTEGER,
INTENT(IN) :: icg
557 REAL(RFREAL),
INTENT(IN) :: xloc,yloc,zloc
558 TYPE(t_region
),
POINTER :: pregion
564 INTEGER :: cntr,icl,ict,ifg,ifl,ipatch,
nfaces,v4
565 REAL(RFREAL) :: dotp,toler
567 TYPE(t_grid),
POINTER :: pgrid
568 TYPE(t_patch),
POINTER :: ppatch
574 global => pregion%global
577 'RFLU_ModInCellTest.F90')
583 pgrid => pregion%grid
587 toler = -pregion%mixtInput%tolerICT
593 ict = pgrid%cellGlob2Loc(1,icg)
594 icl = pgrid%cellGlob2Loc(2,icg)
604 CASE ( cell_type_tet )
608 ipatch = pgrid%tet2f(1,ifl,icl)
609 ifg = pgrid%tet2f(2,ifl,icl)
613 IF ( dotp >= toler )
THEN
625 CASE ( cell_type_hex )
629 ipatch = pgrid%hex2f(1,ifl,icl)
630 ifg = pgrid%hex2f(2,ifl,icl)
638 IF ( dotp > toler )
THEN
650 CASE ( cell_type_pri )
654 ipatch = pgrid%pri2f(1,ifl,icl)
655 ifg = pgrid%pri2f(2,ifl,icl)
657 IF ( ipatch == 0 )
THEN
658 v4 = pgrid%f2v(4,ifg)
659 ELSE IF ( ipatch > 0 )
THEN
660 ppatch => pregion%patches(ipatch)
662 v4 = ppatch%bf2v(4,ifg)
664 CALL
errorstop(global,err_reached_default,__line__)
667 IF ( v4 == vert_none )
THEN
679 IF ( dotp > toler )
THEN
691 CASE ( cell_type_pyr )
695 ipatch = pgrid%pyr2f(1,ifl,icl)
696 ifg = pgrid%pyr2f(2,ifl,icl)
698 IF ( ipatch == 0 )
THEN
699 v4 = pgrid%f2v(4,ifg)
700 ELSE IF ( ipatch > 0 )
THEN
701 ppatch => pregion%patches(ipatch)
703 v4 = ppatch%bf2v(4,ifg)
705 CALL
errorstop(global,err_reached_default,__line__)
708 IF ( v4 == vert_none )
THEN
720 IF ( dotp > toler )
THEN
733 CALL
errorstop(global,err_reached_default,__line__)
740 IF ( cntr ==
nfaces )
THEN
793 LOGICAL,
INTENT(OUT) :: testincell
794 INTEGER,
INTENT(IN) :: icg
795 INTEGER,
INTENT(OUT) :: ipatchout,ifgout
796 REAL(RFREAL),
INTENT(IN) :: xloc,yloc,zloc
797 TYPE(t_region
),
POINTER :: pregion
803 INTEGER :: cntr,icl,ict,ifg,ifl,ipatch,
nfaces
804 REAL(RFREAL) :: dotp,toler
806 TYPE(t_grid),
POINTER :: pgrid
812 global => pregion%global
815 'RFLU_ModInCellTest.F90')
821 pgrid => pregion%grid
825 toler = -pregion%mixtInput%tolerICT
831 ict = pgrid%cellGlob2Loc(1,icg)
832 icl = pgrid%cellGlob2Loc(2,icg)
837 CASE ( cell_type_tet )
841 ipatch = pgrid%tet2f(1,ifl,icl)
842 ifg = pgrid%tet2f(2,ifl,icl)
846 IF ( dotp > toler )
THEN
856 CASE ( cell_type_hex )
860 ipatch = pgrid%hex2f(1,ifl,icl)
861 ifg = pgrid%hex2f(2,ifl,icl)
865 IF ( dotp > toler )
THEN
875 CASE ( cell_type_pri )
879 ipatch = pgrid%pri2f(1,ifl,icl)
880 ifg = pgrid%pri2f(2,ifl,icl)
884 IF ( dotp > toler )
THEN
894 CASE ( cell_type_pyr )
898 ipatch = pgrid%pyr2f(1,ifl,icl)
899 ifg = pgrid%pyr2f(2,ifl,icl)
903 IF ( dotp > toler )
THEN
914 CALL
errorstop(global,err_reached_default,__line__)
921 IF ( cntr ==
nfaces )
THEN
924 ipatchout = crazy_value_int
925 ifgout = crazy_value_int
979 LOGICAL,
INTENT(OUT) :: testincell
980 INTEGER,
INTENT(IN) :: icg
981 INTEGER,
INTENT(OUT) :: ipatchout,ifgout
982 REAL(RFREAL),
INTENT(IN) :: xloc,yloc,zloc
983 TYPE(t_region
),
POINTER :: pregion
989 INTEGER :: cntr,icl,ict,ifg,ifl,ipatch,
nfaces
990 INTEGER,
DIMENSION(1) :: idotpmin
991 INTEGER,
DIMENSION(:,:),
POINTER :: pc2f
992 REAL(RFREAL) :: toler
993 REAL(RFREAL),
DIMENSION(6) :: dotp
995 TYPE(t_grid),
POINTER :: pgrid
1001 global => pregion%global
1004 'RFLU_ModInCellTest.F90')
1010 pgrid => pregion%grid
1012 testincell = .false.
1014 toler = -pregion%mixtInput%tolerICT
1020 ict = pgrid%cellGlob2Loc(1,icg)
1021 icl = pgrid%cellGlob2Loc(2,icg)
1024 CASE ( cell_type_tet )
1025 pc2f => pgrid%tet2f(:,:,icl)
1026 CASE ( cell_type_hex )
1027 pc2f => pgrid%hex2f(:,:,icl)
1028 CASE ( cell_type_pri )
1029 pc2f => pgrid%pri2f(:,:,icl)
1030 CASE ( cell_type_pyr )
1031 pc2f => pgrid%pyr2f(:,:,icl)
1033 CALL
errorstop(global,err_reached_default,__line__)
1049 ipatch = pc2f(1,ifl)
1055 IF ( dotp(ifl) > toler )
THEN
1062 dotp(ifl) = huge(1.0_rfreal)
1070 IF ( cntr ==
nfaces )
THEN
1073 ipatchout = crazy_value_int
1074 ifgout = crazy_value_int
1076 idotpmin = minloc(dotp(:))
1078 ipatchout = pc2f(1,idotpmin(1))
1079 ifgout = pc2f(2,idotpmin(1))
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed by
subroutine, public rflu_blin_computenormal(global, ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, u, v, nx, ny, nz)
subroutine, public rflu_ict_testfacequadbilinear(pRegion, xLoc, yLoc, zLoc, iPatch, ifg, dotp)
void int int REAL REAL * y
subroutine, public rflu_ict_testincellfancy(pRegion, xLoc, yLoc, zLoc, icg, testInCell, iPatchOut, ifgOut)
subroutine, public rflu_ict_testincelllohner(pRegion, xLoc, yLoc, zLoc, icg, testInCell, iPatchOut, ifgOut)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
subroutine registerfunction(global, funName, fileName)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS 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 v
subroutine, public rflu_ict_computetolerance(pRegion)
void int int int REAL REAL REAL * z
LOGICAL function, public rflu_ict_testincell(pRegion, xLoc, yLoc, zLoc, icg)
subroutine, public rflu_blin_findclosestpoint(global, ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, xq, yq, zq, u, v, x, y, z)
subroutine, public rflu_ict_testfaceplanar(pRegion, xLoc, yLoc, zLoc, icg, iPatch, ifg, dotp)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)