61 CHARACTER(CHRLEN),
PRIVATE :: &
62 RCSIdentString =
'$RCSfile: RFLU_ModBilinearPatch.F90,v $ $Revision: 1.5 $'
99 SUBROUTINE rflu_blin_computenormal(global,ax,ay,az,bx,by,bz,cx,cy,cz,dx,dy,dz, &
112 REAL(RFREAL),
INTENT(IN) :: ax,ay,az,bx,
by,bz,cx,cy,cz,
dx,
dy,
dz,u,
v
113 REAL(RFREAL),
INTENT(OUT) :: nx,ny,nz
127 'RFLU_ModBilinearPatch.F90')
133 nx =
v*(ay*cz - az*cy) - u*(ay*bz - az*
by) +
by*cz - bz*cy
134 ny =
v*(az*cx - ax*cz) - u*(az*bx - ax*bz) + bz*cx - bx*cz
135 nz =
v*(ax*cy - ay*cx) - u*(ax*
by - ay*bx) + bx*cy -
by*cx
137 imag = 1.0_rfreal/
sqrt(nx*nx + ny*ny + nz*nz)
203 INTEGER,
INTENT(IN) :: icg,ifg,ipatch
204 INTEGER,
INTENT(INOUT) :: nt
205 REAL(RFREAL),
INTENT(IN) :: ex,ey,ez
206 REAL(RFREAL),
INTENT(IN) :: xloc,yloc,zloc
207 REAL(RFREAL),
INTENT(OUT) :: t(2)
208 TYPE(t_region
),
POINTER :: pregion
214 INTEGER :: iv,nv,v1g,v1l,v2g,v2l,v3g,v3l,v4g,v4l
215 REAL(RFREAL) ::
a,ae,ax,ay,az,a1,a2,
b,be,bx,
by,bz,b1,b2,
c,ce,cx,cy,cz,c1, &
216 c2,
d,de,denom1,denom2,disc,dotp,
dx,
dy,
dz,d1,d2, &
217 fuzzytolerance,px,py,pz,
q,re,u,xcofg,x1,x2,x3,x4, &
218 ycofg,y1,y2,y3,y4,zcofg,z1,z2,z3,z4
219 REAL(RFREAL),
DIMENSION(2) ::
v
221 TYPE(t_grid),
POINTER :: pgrid
222 TYPE(t_patch),
POINTER :: ppatch
226 REAL(RFREAL) :: nx,ny,nz,a3,b3,c3,d3
233 global => pregion%global
236 'RFLU_ModBilinearPatch.F90')
242 pgrid => pregion%grid
246 fuzzytolerance = -pregion%mixtInput%tolerICT
248 t(1:2) =
REAL(crazy_value_int,kind=rfreal)
255 WRITE(0,*)
'###100',pregion%iRegionGlobal,ipatch,ifg
256 WRITE(0,*)
'###110',pregion%iRegionGlobal,xloc,yloc,zloc
257 WRITE(0,*)
'###120',pregion%iRegionGlobal,ex,ey,ez
264 IF ( ipatch == 0 )
THEN
265 v1g = pgrid%f2v(1,ifg)
266 v2g = pgrid%f2v(2,ifg)
267 v3g = pgrid%f2v(3,ifg)
268 v4g = pgrid%f2v(4,ifg)
270 IF ( v4g == vert_none )
THEN
271 CALL
errorstop(global,err_reached_default,__line__)
273 ELSE IF ( ipatch > 0 )
THEN
274 ppatch => pregion%patches(ipatch)
276 v1l = ppatch%bf2v(1,ifg)
277 v2l = ppatch%bf2v(2,ifg)
278 v3l = ppatch%bf2v(3,ifg)
279 v4l = ppatch%bf2v(4,ifg)
281 IF ( v4l == vert_none )
THEN
282 CALL
errorstop(global,err_reached_default,__line__)
290 CALL
errorstop(global,err_reached_default,__line__)
294 WRITE(0,*)
'###130',pregion%iRegionGlobal,v1g,v2g,v3g,v4g
297 x1 = pgrid%xyz(xcoord,v1g)
298 x2 = pgrid%xyz(xcoord,v2g)
299 x3 = pgrid%xyz(xcoord,v3g)
300 x4 = pgrid%xyz(xcoord,v4g)
302 y1 = pgrid%xyz(ycoord,v1g)
303 y2 = pgrid%xyz(ycoord,v2g)
304 y3 = pgrid%xyz(ycoord,v3g)
305 y4 = pgrid%xyz(ycoord,v4g)
307 z1 = pgrid%xyz(zcoord,v1g)
308 z2 = pgrid%xyz(zcoord,v2g)
309 z3 = pgrid%xyz(zcoord,v3g)
310 z4 = pgrid%xyz(zcoord,v4g)
313 WRITE(0,*)
'@@@131a',pregion%iRegionGlobal,x1,x2,x3,x4
314 WRITE(0,*)
'@@@131b',pregion%iRegionGlobal,y1,y2,y3,y4
315 WRITE(0,*)
'@@@131c',pregion%iRegionGlobal,z1,z2,z3,z4
322 re = xloc*ex + yloc*ey + zloc*ez
324 ax = x3 - x2 - x4 + x1
325 ay = y3 - y2 - y4 + y1
326 az = z3 - z2 - z4 + z1
327 ae = ax*ex + ay*ey + az*ez
332 be = bx*ex +
by*ey + bz*ez
337 ce = cx*ex + cy*ey + cz*ez
342 de =
dx*ex +
dy*ey +
dz*ez
344 a1 = az - ay - ae*(ez - ey)
345 a2 = az - ax - ae*(ez - ex)
348 b1 = bz -
by - be*(ez - ey)
349 b2 = bz - bx - be*(ez - ex)
352 c1 = cz - cy - ce*(ez - ey)
353 c2 = cz - cx - ce*(ez - ex)
356 d1 =
dz -
dy - (zloc - yloc) - (de - re)*(ez - ey)
357 d2 =
dz -
dx - (zloc - xloc) - (de - re)*(ez - ex)
361 b = a1*d2 - a2*d1 + b1*c2 - b2*c1
365 WRITE(0,*)
'a:',ax,ay,az,ae
366 WRITE(0,*)
'b:',bx,
by,bz,be
367 WRITE(0,*)
'c:',cx,cy,cz,ce
368 WRITE(0,*)
'd:',
dx,
dy,
dz,de
369 WRITE(0,*)
'A-D1:',a1,b1,c1,d1
370 WRITE(0,*)
'A-D2:',a2,b2,c2,d2
371 WRITE(0,*)
'A-D3:',a3,b3,c3,d3
372 WRITE(0,*)
'a-c:',
a,
b,
c
379 IF ( abs(
a) > 0.0_rfreal )
THEN
380 disc =
b*
b - 4.0_rfreal*
a*
c
383 WRITE(0,*)
'disc=',disc
386 IF ( disc > 0.0_rfreal )
THEN
389 IF ( abs(
c) > 0.0_rfreal )
THEN
390 q = -0.5_rfreal*(
b +
sign(1.0_rfreal,
b)*
sqrt(disc))
398 ELSE IF ( disc < 0.0_rfreal )
THEN
401 v(1) =
REAL(CRAZY_VALUE_INT,KIND=RFREAL)
402 v(2) =
REAL(CRAZY_VALUE_INT,KIND=RFREAL)
406 v(1) = -0.5_rfreal*
b/
a
407 v(2) =
REAL(crazy_value_int,kind=rfreal)
409 ELSE IF ( abs(
b) > 0.0_rfreal )
THEN
418 WRITE(0,*)
'###132',pregion%iRegionGlobal,
v(:)
432 IF ( (
v(iv) < 0.0_rfreal) .OR. (
v(iv) > 1.0_rfreal) )
THEN
440 denom1 =
v(iv)*a2 + b2
441 denom2 = denom1 - (
v(iv)*a1 + b1)
443 IF ( abs(denom2) > abs(denom1) )
THEN
444 u = (
v(iv)*(c1 - c2) + d1 - d2)/denom2
446 u = -(
v(iv)*c2 + d2)/denom1
450 WRITE(0,*)
'###134',pregion%iRegionGlobal,iv,
v(iv),u
453 IF ( (u < 0.0_rfreal) .OR. (u > 1.0_rfreal) )
THEN
461 px = u*
v(iv)*ax + u*bx +
v(iv)*cx +
dx
462 py = u*
v(iv)*ay + u*
by +
v(iv)*cy +
dy
463 pz = u*
v(iv)*az + u*bz +
v(iv)*cz +
dz
466 WRITE(0,*)
'###135',pregion%iRegionGlobal,px,py,pz
473 CALL
rflu_blin_computenormal(global,ax,ay,az,bx,
by,bz,cx,cy,cz, &
476 xcofg = pgrid%cofg(xcoord,icg)
477 ycofg = pgrid%cofg(ycoord,icg)
478 zcofg = pgrid%cofg(zcoord,icg)
480 dotp = (px - xcofg)*nx + (py - ycofg)*ny + (pz - zcofg)*nz
483 WRITE(0,*)
'###136',pregion%iRegionGlobal,nx,ny,nz,dotp
486 IF ( dotp < 0.0_rfreal )
THEN
497 dotp = (px - xloc)*nx + (py - yloc)*ny + (pz - zloc)*nz
500 WRITE(0,*)
'###137',pregion%iRegionGlobal,dotp
503 IF ( dotp > fuzzytolerance )
THEN
505 WRITE(0,*)
'###138',pregion%iRegionGlobal,ex*nx + ey*ny + ez*nz
508 IF ( ex*nx + ey*ny + ez*nz > 0.0_rfreal )
THEN
511 t(nt) = (px - xloc)*ex + (py - yloc)*ey + (pz - zloc)*ez
521 IF ( abs(t(2)) < abs(t(1)) )
THEN
527 WRITE(0,*)
'###140',pregion%iRegionGlobal,nt,t(1:2)
570 SUBROUTINE rflu_blin_findclosestpoint(global,ax,ay,az,bx,by,bz,cx,cy,cz, &
571 dx,
dy,
dz,xq,yq,zq,u,
v,
x,
y,
z)
583 REAL(RFREAL),
INTENT(OUT) :: u,
v,
x,
y,
z
584 REAL(RFREAL),
INTENT(IN) :: ax,ay,az,bx,
by,bz,cx,cy,cz,
dx,
dy,
dz,xq,yq,zq
591 INTEGER :: loopcounter
592 REAL(RFREAL) :: dfdu,dfdv,dgdu,dgdv,du,dv,dxdu,dxdv,dydu,dydv,dzdu,dzdv, &
593 d2,d2xduv,d2yduv,d2zduv,f,
g,idet,tol
600 'RFLU_ModBilinearPatch.F90')
619 loopcounter = loopcounter + 1
621 x = u*
v*ax + u*bx +
v*cx +
dx
623 z = u*
v*az + u*bz +
v*cz +
dz
637 d2 = (
x-xq)*(
x-xq) + (
y-yq)*(
y-yq) + (
z-zq)*(
z-zq)
639 f = (
x-xq)*dxdu + (
y-yq)*dydu + (
z-zq)*dzdu
640 g = (
x-xq)*dxdv + (
y-yq)*dydv + (
z-zq)*dzdv
642 dfdu = dxdu*dxdu + dydu*dydu + dzdu*dzdu
643 dfdv = dxdu*dxdv + dydu*dydv + dzdu*dzdv &
644 + (
x-xq)*d2xduv + (
y-yq)*d2yduv + (
z-zq)*d2zduv
647 dgdv = dxdv*dxdv + dydv*dydv + dzdv*dzdv
649 idet = 1.0_rfreal/(dfdu*dgdv - dfdv*dgdu)
651 du = -idet*(dgdv*f - dgdu*
g)
652 dv = -idet*(dfdu*
g - dfdv*f)
654 IF ( abs(du) < tol .AND. abs(dv) < tol )
THEN
656 ELSE IF ( loopcounter > limit_infinite_loop )
THEN
657 CALL
errorstop(global,err_infinite_loop,__line__)
*********************************************************************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)
static SURF_BEGIN_NAMESPACE double sign(double x)
void int int REAL REAL * y
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_blin_computexsectline(pRegion, xLoc, yLoc, zLoc, ex, ey, ez, icg, iPatch, ifg, nt, t)
void int int int REAL REAL REAL * z
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 errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)