21 integer(kind=intType),
dimension(:, :),
allocatable ::
connvisc
22 real(kind=realtype),
dimension(:, :),
allocatable ::
coorvisc
50 integer(kind=intType) :: nn, level, sps
53 integer(kind=intType) :: i, j, k, ii, ind(4)
54 real(kind=realtype) :: xp(3), xc(3), u, v
56 #ifdef TAPENADE_REVERSE
58 do ii = 0,
nx *
ny *
nz - 1
60 j = mod(ii /
nx,
ny) + 2
61 k = ii / (
nx *
ny) + 2
68 if (flowdoms(nn, level, sps)%surfNodeIndices(1, i, j, k) == 0)
then
78 ind = flowdoms(nn, level, sps)%surfNodeIndices(:, i, j, k)
79 u = flowdoms(nn, level, sps)%uv(1, i, j, k)
80 v = flowdoms(nn, level, sps)%uv(2, i, j, k)
86 (
one - u) * (
one - v) *
xsurf(3 * (ind(1) - 1) + 1:3 * ind(1)) + &
87 (u) * (
one - v) *
xsurf(3 * (ind(2) - 1) + 1:3 * ind(2)) + &
88 (u) * (v) *
xsurf(3 * (ind(3) - 1) + 1:3 * ind(3)) + &
89 (
one - u) * (v) *
xsurf(3 * (ind(4) - 1) + 1:3 * ind(4))
92 xc(1) =
eighth * (
x(i - 1, j - 1, k - 1, 1) +
x(i, j - 1, k - 1, 1) &
93 +
x(i - 1, j, k - 1, 1) +
x(i, j, k - 1, 1) &
94 +
x(i - 1, j - 1, k, 1) +
x(i, j - 1, k, 1) &
95 +
x(i - 1, j, k, 1) +
x(i, j, k, 1))
97 xc(2) =
eighth * (
x(i - 1, j - 1, k - 1, 2) +
x(i, j - 1, k - 1, 2) &
98 +
x(i - 1, j, k - 1, 2) +
x(i, j, k - 1, 2) &
99 +
x(i - 1, j - 1, k, 2) +
x(i, j - 1, k, 2) &
100 +
x(i - 1, j, k, 2) +
x(i, j, k, 2))
102 xc(3) =
eighth * (
x(i - 1, j - 1, k - 1, 3) +
x(i, j - 1, k - 1, 3) &
103 +
x(i - 1, j, k - 1, 3) +
x(i, j, k - 1, 3) &
104 +
x(i - 1, j - 1, k, 3) +
x(i, j - 1, k, 3) &
105 +
x(i - 1, j, k, 3) +
x(i, j, k, 3))
111 (xc(1) - xp(1))**2 + (xc(2) - xp(2))**2 + (xc(3) - xp(3))**2)
112 #ifdef TAPENADE_REVERSE
151 integer(kind=intType),
intent(in) :: level
152 logical,
intent(in) :: allocMem
156 integer :: ierr, i, j, k, nn, ii, l
158 integer(kind=intType) :: sps, sps2, ll, nLevels
159 logical :: tempLogical
160 real(kind=alwaysrealtype) :: t0
161 character(len=3) :: integerString
191 write (integerstring,
"(i2)") level
192 integerstring = adjustl(integerstring)
211 "Deallocation error for communication buffers")
247 print
"(a)",
"# Warning!!!!"
248 print
"(a)",
"# No viscous boundary found. Wall &
249 &distances are set to infinity"
291 call vecgetarrayf90(xsurfvec(level, sps),
xsurf, ierr)
292 call echk(ierr, __file__, __line__)
299 call vecrestorearrayf90(xsurfvec(level, sps),
xsurf, ierr)
300 call echk(ierr, __file__, __line__)
313 "Memory allocation failure for comm buffers")
351 integer(kind=intType),
intent(in) :: level, sps
355 integer(kind=intType) :: nn, mm, i, j
356 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd
358 real(kind=realtype) :: nnx, nny, nnz, vecx, vecy, vecz, dot
360 real(kind=realtype),
dimension(:, :, :),
pointer :: xface, xint
361 real(kind=realtype),
dimension(:, :),
pointer :: dd2wall
365 domain:
do nn = 1, ndom
385 xface =>
x(1, 1:, 1:, :); xint =>
x(2, 1:, 1:, :)
386 dd2wall =>
d2wall(2, :, :)
389 xface =>
x(
il, 1:, 1:, :); xint =>
x(
nx, 1:, 1:, :)
393 xface =>
x(1:, 1, 1:, :); xint =>
x(1:, 2, 1:, :)
394 dd2wall =>
d2wall(:, 2, :)
397 xface =>
x(1:,
jl, 1:, :); xint =>
x(1:,
ny, 1:, :)
401 xface =>
x(1:, 1:, 1, :); xint =>
x(1:, 1:, 2, :)
402 dd2wall =>
d2wall(:, :, 2)
405 xface =>
x(1:, 1:,
kl, :); xint =>
x(1:, 1:,
nz, :)
423 nnx =
bcdata(mm)%norm(i, j, 1)
424 nny =
bcdata(mm)%norm(i, j, 2)
425 nnz =
bcdata(mm)%norm(i, j, 3)
430 vecx =
eighth * (xface(i - 1, j - 1, 1) + xface(i - 1, j, 1) &
431 + xface(i, j - 1, 1) + xface(i, j, 1) &
432 - xint(i - 1, j - 1, 1) - xint(i - 1, j, 1) &
433 - xint(i, j - 1, 1) - xint(i, j, 1))
435 vecy =
eighth * (xface(i - 1, j - 1, 2) + xface(i - 1, j, 2) &
436 + xface(i, j - 1, 2) + xface(i, j, 2) &
437 - xint(i - 1, j - 1, 2) - xint(i - 1, j, 2) &
438 - xint(i, j - 1, 2) - xint(i, j, 2))
440 vecz =
eighth * (xface(i - 1, j - 1, 3) + xface(i - 1, j, 3) &
441 + xface(i, j - 1, 3) + xface(i, j, 3) &
442 - xint(i - 1, j - 1, 3) - xint(i - 1, j, 3) &
443 - xint(i, j - 1, 3) - xint(i, j, 3))
450 dot = nnx * vecx + nny * vecy + nnz * vecz
459 dd2wall(i - 1, j - 1) = abs(dot)
482 integer(kind=intType),
intent(in) :: level, sps
483 logical,
intent(in) :: allocMem
489 integer(kind=intType) :: nn, il, jl, kl
493 domain:
do nn = 1, ndom
499 il = flowdoms(nn, level, sps)%il
500 jl = flowdoms(nn, level, sps)%jl
501 kl = flowdoms(nn, level, sps)%kl
503 allocate (flowdoms(nn, level, sps)%d2Wall(2:il, 2:jl, 2:kl), &
507 "Memory allocation failure for d2Wall")
512 flowdoms(nn, level, sps)%d2Wall =
large
525 use blockpointers,
only:
x, flowdoms,
kl,
jl,
il, ndom,
nx,
ny,
nz, &
535 integer(kind=intType),
intent(in) :: level, sps
540 character(len=10),
parameter :: viscAdt =
"ViscousADT"
546 integer,
dimension(:),
allocatable :: procID
548 integer(kind=intType) :: nCell, nCellPer, nTria
550 integer(kind=intType),
dimension(1, 1) :: connTria
551 real(kind=realtype),
dimension(3, 2) :: dummy
553 integer(kind=intType),
dimension(:),
allocatable :: elementID
555 real(kind=realtype),
dimension(:),
allocatable :: dist2
556 real(kind=realtype),
dimension(:),
allocatable :: dist2per
557 real(kind=realtype),
dimension(:, :),
allocatable :: coor, uvw
558 real(kind=realtype),
dimension(:, :),
allocatable :: coorper
560 integer(kind=adtElementType),
dimension(:),
allocatable :: &
563 integer(kind=intType) :: nn, mm, ll, ii, jj, i, j, k
565 real(kind=realtype),
dimension(3) :: xc
587 ll = flowdoms(nn, level, sps)%nx * flowdoms(nn, level, sps)%ny &
588 * flowdoms(nn, level, sps)%nz
591 mm = flowdoms(nn, level, sps)%sectionID
592 if (
sections(mm)%periodic) ncellper = ncellper + ll
597 allocate (coor(3, ncell), procid(ncell), elementtype(ncell), &
598 elementid(ncell), uvw(3, ncell), dist2(ncell), &
599 coorper(3, ncellper), dist2per(ncellper), stat=ierr)
602 "Memory allocation failure for the variables &
603 &needed by the adt.")
614 domains:
do nn = 1, ndom
629 xc(1) =
eighth * (
x(i - 1, j - 1, k - 1, 1) +
x(i, j - 1, k - 1, 1) &
630 +
x(i - 1, j, k - 1, 1) +
x(i, j, k - 1, 1) &
631 +
x(i - 1, j - 1, k, 1) +
x(i, j - 1, k, 1) &
632 +
x(i - 1, j, k, 1) +
x(i, j, k, 1)) &
635 xc(2) =
eighth * (
x(i - 1, j - 1, k - 1, 2) +
x(i, j - 1, k - 1, 2) &
636 +
x(i - 1, j, k - 1, 2) +
x(i, j, k - 1, 2) &
637 +
x(i - 1, j - 1, k, 2) +
x(i, j - 1, k, 2) &
638 +
x(i - 1, j, k, 2) +
x(i, j, k, 2)) &
641 xc(3) =
eighth * (
x(i - 1, j - 1, k - 1, 3) +
x(i, j - 1, k - 1, 3) &
642 +
x(i - 1, j, k - 1, 3) +
x(i, j, k - 1, 3) &
643 +
x(i - 1, j - 1, k, 3) +
x(i, j - 1, k, 3) &
644 +
x(i - 1, j, k, 3) +
x(i, j, k, 3)) &
670 dist2(mm) =
d2wall(i, j, k)
681 procid, elementtype, elementid, &
682 uvw, dist2, 0_inttype, &
705 domainsper1:
do nn = 1, ndom
706 jj = flowdoms(nn, level, sps)%nx * flowdoms(nn, level, sps)%ny &
707 * flowdoms(nn, level, sps)%nz
709 ll = flowdoms(nn, level, sps)%sectionID
724 xc(1) = coor(1, mm) -
sections(ll)%rotCenter(1)
725 xc(2) = coor(2, mm) -
sections(ll)%rotCenter(2)
726 xc(3) = coor(3, mm) -
sections(ll)%rotCenter(3)
728 coorper(1, ii) =
sections(ll)%rotMatrix(1, 1) * xc(1) &
729 +
sections(ll)%rotMatrix(1, 2) * xc(2) &
730 +
sections(ll)%rotMatrix(1, 3) * xc(3) &
734 coorper(2, ii) =
sections(ll)%rotMatrix(2, 1) * xc(1) &
735 +
sections(ll)%rotMatrix(2, 2) * xc(2) &
736 +
sections(ll)%rotMatrix(2, 3) * xc(3) &
740 coorper(3, ii) =
sections(ll)%rotMatrix(3, 1) * xc(1) &
741 +
sections(ll)%rotMatrix(3, 2) * xc(2) &
742 +
sections(ll)%rotMatrix(3, 3) * xc(3) &
746 dist2per(ii) = dist2(mm)
761 procid, elementtype, elementid, &
762 uvw, dist2per, 0_inttype, &
775 domainsper2:
do nn = 1, ndom
776 jj = flowdoms(nn, level, sps)%nx * flowdoms(nn, level, sps)%ny &
777 * flowdoms(nn, level, sps)%nz
779 ll = flowdoms(nn, level, sps)%sectionID
798 xc(1) = coor(1, mm) -
sections(ll)%rotCenter(1) &
800 xc(2) = coor(2, mm) -
sections(ll)%rotCenter(2) &
802 xc(3) = coor(3, mm) -
sections(ll)%rotCenter(3) &
805 coorper(1, ii) =
sections(ll)%rotMatrix(1, 1) * xc(1) &
806 +
sections(ll)%rotMatrix(2, 1) * xc(2) &
807 +
sections(ll)%rotMatrix(3, 1) * xc(3) &
810 coorper(2, ii) =
sections(ll)%rotMatrix(1, 2) * xc(1) &
811 +
sections(ll)%rotMatrix(2, 2) * xc(2) &
812 +
sections(ll)%rotMatrix(3, 2) * xc(3) &
815 coorper(3, ii) =
sections(ll)%rotMatrix(1, 3) * xc(1) &
816 +
sections(ll)%rotMatrix(2, 3) * xc(2) &
817 +
sections(ll)%rotMatrix(3, 3) * xc(3) &
833 procid, elementtype, elementid, &
834 uvw, dist2per, 0_inttype, &
842 domainsstore:
do nn = 1, ndom
865 dist2(j) = min(dist2(j), dist2per(ii))
893 "Deallocation error for the arrays &
898 deallocate (coor, procid, elementtype, elementid, uvw, dist2, &
899 coorper, dist2per, stat=ierr)
902 "Deallocation failure for the variables &
903 &needed by the adt.")
922 integer(kind=intType),
intent(in) :: level, sps
923 integer(kind=intType),
dimension(*),
intent(in) :: multSections
927 integer :: size, ierr
929 integer(kind=intType) :: nn, mm, i, j, k
930 integer(kind=intType) :: np, nq, npOld, np1, nqOld, mp, mq
931 integer(kind=intType) :: nq1, nq2, nq3, nq4, sec, row, col
932 integer(kind=intType) :: iBeg, jBeg, iEnd, jEnd
934 integer(kind=intType),
dimension(3) :: ind
936 real(kind=realtype) :: length, dot, xx, yy, zz, r1, r2, aaa, bbb
937 real(kind=realtype) :: theta, costheta, sintheta
939 real(kind=realtype),
dimension(3, 3) :: a
940 real(kind=realtype),
dimension(nSections) :: thetanmin, &
944 real(kind=realtype),
dimension(nSections, 3) :: rad1, rad2, axis
946 real(kind=realtype),
dimension(:, :, :),
pointer :: xface
953 if (
sections(nn)%nSlices == 1) cycle
961 ind(1) = 1; ind(2) = 2; ind(3) = 3
964 a(1, 2) =
sections(nn)%rotMatrix(1, 2)
965 a(1, 3) =
sections(nn)%rotMatrix(1, 3)
967 a(2, 1) =
sections(nn)%rotMatrix(2, 1)
969 a(2, 3) =
sections(nn)%rotMatrix(2, 3)
971 a(3, 1) =
sections(nn)%rotMatrix(3, 1)
972 a(3, 2) =
sections(nn)%rotMatrix(3, 2)
978 loopgauss:
do k = 1, 2
982 aaa = abs(a(k, k)); row = k; col = k
1020 a(i, j) = a(i, j) - bbb * a(k, j)
1032 axis(nn, ind(3)) =
one
1033 axis(nn, ind(2)) = -(a(2, 3) * axis(nn, ind(3))) / a(2, 2)
1034 axis(nn, ind(1)) = -(a(1, 3) * axis(nn, ind(3)) &
1035 + a(1, 2) * axis(nn, ind(2))) / a(1, 1)
1039 length =
one / sqrt(axis(nn, 1)**2 + axis(nn, 2)**2 + axis(nn, 3)**2)
1040 axis(nn, 1) = axis(nn, 1) * length
1041 axis(nn, 2) = axis(nn, 2) * length
1042 axis(nn, 3) = axis(nn, 3) * length
1049 dot = axis(nn, 1); length = abs(dot)
1050 if (abs(axis(nn, 2)) > length)
then
1051 dot = axis(nn, 2); length = abs(dot)
1053 if (abs(axis(nn, 3)) > length)
then
1054 dot = axis(nn, 3); length = abs(dot)
1057 if (dot <
zero)
then
1058 axis(nn, 1) = -axis(nn, 1)
1059 axis(nn, 2) = -axis(nn, 2)
1060 axis(nn, 3) = -axis(nn, 3)
1069 if (abs(axis(nn, 2)) < 0.707107_realtype)
then
1082 dot = rad1(nn, 1) * axis(nn, 1) + rad1(nn, 2) * axis(nn, 2) &
1083 + rad1(nn, 3) * axis(nn, 3)
1084 rad1(nn, 1) = rad1(nn, 1) - dot * axis(nn, 1)
1085 rad1(nn, 2) = rad1(nn, 2) - dot * axis(nn, 2)
1086 rad1(nn, 3) = rad1(nn, 3) - dot * axis(nn, 3)
1088 length =
one / (rad1(nn, 1)**2 + rad1(nn, 2)**2 + rad1(nn, 3)**2)
1089 rad1(nn, 1) = rad1(nn, 1) * length
1090 rad1(nn, 2) = rad1(nn, 2) * length
1091 rad1(nn, 3) = rad1(nn, 3) * length
1096 rad2(nn, 1) = axis(nn, 2) * rad1(nn, 3) - axis(nn, 3) * rad1(nn, 2)
1097 rad2(nn, 2) = axis(nn, 3) * rad1(nn, 1) - axis(nn, 1) * rad1(nn, 3)
1098 rad2(nn, 3) = axis(nn, 1) * rad1(nn, 2) - axis(nn, 2) * rad1(nn, 1)
1117 sec = flowdoms(nn, level, sps)%sectionID
1118 if (
sections(sec)%nSlices == 1) cycle
1128 nq1 = 0; nq2 = 0; nq3 = 0; nq4 = 0
1139 xx =
x(i, j, k, 1) -
sections(sec)%rotCenter(1)
1140 yy =
x(i, j, k, 2) -
sections(sec)%rotCenter(2)
1141 zz =
x(i, j, k, 3) -
sections(sec)%rotCenter(3)
1146 r1 = xx * rad1(sec, 1) + yy * rad1(sec, 2) + zz * rad1(sec, 3)
1147 r2 = xx * rad2(sec, 1) + yy * rad2(sec, 2) + zz * rad2(sec, 3)
1151 if ((abs(r1) >=
eps) .or. (abs(r2) >=
eps))
then
1153 theta = atan2(r2, r1)
1158 if (theta >=
zero)
then
1159 thetapmin(sec) = min(thetapmin(sec), theta)
1160 thetapmax(sec) = max(thetapmax(sec), theta)
1163 if (theta <=
zero)
then
1164 thetanmin(sec) = min(thetanmin(sec), theta)
1165 thetanmax(sec) = max(thetanmax(sec), theta)
1171 if (theta <= -
half *
pi)
then
1173 else if (theta <=
zero)
then
1175 else if (theta <=
half *
pi)
then
1190 if (nq1 > 0 .and. nq4 > 0)
then
1195 thetanmax(sec) =
zero
1196 thetapmin(sec) =
zero
1200 if (nq2 > 0 .and. nq3 > 0)
then
1205 thetanmin(sec) = -
pi
1216 call mpi_allreduce(thetanmax, tmp,
size, adflow_real, mpi_max, &
1220 call mpi_allreduce(thetapmax, tmp,
size, adflow_real, mpi_max, &
1224 call mpi_allreduce(thetanmin, tmp,
size, adflow_real, mpi_min, &
1228 call mpi_allreduce(thetapmin, tmp,
size, adflow_real, mpi_min, &
1237 call terminate(
"localViscousSurfaceMesh", &
1238 "Memory allocation failure for &
1239 &rotMatrixSections")
1248 testrot:
if (
sections(nn)%nSlices == 1 .or. &
1249 thetapmin(nn) ==
zero)
then
1277 if (thetanmin(nn) <
zero)
then
1283 mm = -thetanmax(nn) / theta + 1
1291 mm = -thetapmin(nn) / theta - 1
1299 costheta = cos(theta)
1300 sintheta = sin(theta)
1306 + costheta * (rad1(nn, 1) * rad1(nn, 1) + rad2(nn, 1) * rad2(nn, 1))
1308 + costheta * (rad1(nn, 1) * rad1(nn, 2) + rad2(nn, 1) * rad2(nn, 2)) &
1309 + sintheta * (rad1(nn, 2) * rad2(nn, 1) - rad1(nn, 1) * rad2(nn, 2))
1311 + costheta * (rad1(nn, 1) * rad1(nn, 3) + rad2(nn, 1) * rad2(nn, 3)) &
1312 + sintheta * (rad1(nn, 3) * rad2(nn, 1) - rad1(nn, 1) * rad2(nn, 3))
1315 + costheta * (rad1(nn, 1) * rad1(nn, 2) + rad2(nn, 1) * rad2(nn, 2)) &
1316 - sintheta * (rad1(nn, 2) * rad2(nn, 1) - rad1(nn, 1) * rad2(nn, 2))
1318 + costheta * (rad1(nn, 2) * rad1(nn, 2) + rad2(nn, 2) * rad2(nn, 2))
1320 + costheta * (rad1(nn, 2) * rad1(nn, 3) + rad2(nn, 2) * rad2(nn, 3)) &
1321 + sintheta * (rad1(nn, 3) * rad2(nn, 2) - rad1(nn, 2) * rad2(nn, 3))
1324 + costheta * (rad1(nn, 1) * rad1(nn, 3) + rad2(nn, 1) * rad2(nn, 3)) &
1325 - sintheta * (rad1(nn, 3) * rad2(nn, 1) - rad1(nn, 1) * rad2(nn, 3))
1327 + costheta * (rad1(nn, 2) * rad1(nn, 3) + rad2(nn, 2) * rad2(nn, 3)) &
1328 - sintheta * (rad1(nn, 3) * rad2(nn, 2) - rad1(nn, 2) * rad2(nn, 3))
1330 + costheta * (rad1(nn, 3) * rad1(nn, 3) + rad2(nn, 3) * rad2(nn, 3))
1341 loopdomains:
do nn = 1, ndom
1352 loopbocos:
do mm = 1,
nbocos
1362 xface =>
x(1, 1:, 1:, :)
1365 xface =>
x(
il, 1:, 1:, :)
1368 xface =>
x(1:, 1, 1:, :)
1371 xface =>
x(1:,
jl, 1:, :)
1374 xface =>
x(1:, 1:, 1, :)
1377 xface =>
x(1:, 1:,
kl, :)
1396 xx = xface(i, j, 1) -
sections(sec)%rotCenter(1)
1397 yy = xface(i, j, 2) -
sections(sec)%rotCenter(2)
1398 zz = xface(i, j, 3) -
sections(sec)%rotCenter(3)
1423 np1 = iend - ibeg + 1
1426 do j = (jbeg + 1), jend
1427 do i = (ibeg + 1), iend
1434 connvisc(1, nq) = npold + (j - jbeg - 1) * np1 + i - ibeg
1446 loopmultiplicity:
do k = 2, multsections(sec)
1456 do i = (npold + 1), mp
1471 +
sections(sec)%rotMatrix(1, 2) * yy &
1472 +
sections(sec)%rotMatrix(1, 3) * zz &
1477 +
sections(sec)%rotMatrix(2, 2) * yy &
1478 +
sections(sec)%rotMatrix(2, 3) * zz &
1483 +
sections(sec)%rotMatrix(3, 2) * yy &
1484 +
sections(sec)%rotMatrix(3, 3) * zz &
1493 do i = (nqold + 1), mq
1515 end do loopmultiplicity
1538 integer(kind=intType) :: nLevels, nn
1567 integer(kind=intType),
intent(in) :: level, sps
1573 integer(kind=intType) :: nn, mm, ii
1574 integer(kind=intType) :: ni, nj, nk
1576 integer(kind=intType),
dimension(nSections) :: multSections
1595 multsections(nn) =
sections(nn)%nSlices / mm
1596 if (
sections(nn)%nSlices > mm * multsections(nn)) &
1597 multsections(nn) = multsections(nn) + 1
1608 do mm = 1,
flowdoms(nn, level, 1)%nBocos
1615 ni =
flowdoms(nn, level, 1)%inEnd(mm) &
1617 nj =
flowdoms(nn, level, 1)%jnEnd(mm) &
1619 nk =
flowdoms(nn, level, 1)%knEnd(mm) &
1625 ii =
flowdoms(nn, level, 1)%sectionId
1626 ii = multsections(ii)
1633 * max(nj, 1_inttype) &
1634 * max(nk, 1_inttype)
1653 "Memory allocation failure for connVisc &
1669 use adtapi,
only: mindistancesearch
1687 integer(kind=intType),
intent(in) :: level, sps
1690 integer(kind=intType) :: i, j, k, l, ii, jj, kk, nn, mm, iNode, iCell, c
1691 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, ni, nj, nUnique, cellID, cellID2
1692 integer(kind=intType) :: ierr, iDim
1695 integer(kind=intType) :: nNodes, nCells
1696 logical :: gridHasOverset
1699 type(
oversetwall),
dimension(:),
allocatable,
target :: walls
1701 integer(kind=intType),
dimension(:),
allocatable :: link, indicesToGet
1704 integer(kind=intType) :: intInfo(3), intInfo2(3)
1705 real(kind=realtype) :: coor(4), uvw(5), uvw2(5)
1706 real(kind=realtype),
dimension(3, 2) :: dummy
1707 real(kind=realtype),
parameter :: tol = 1e-12
1708 integer(kind=intType),
dimension(:),
pointer :: frontLeaves, frontLeavesNew, &
1711 real(kind=realtype),
dimension(3) :: xp
1723 call buildclusterwalls(level, sps, .false., walls, wallfamlist,
size(wallfamlist))
1732 nnodes = nnodes + walls(i)%nNodes
1733 ncells = ncells + walls(i)%nCells
1736 allocate (fullwall%x(3, nnodes))
1737 allocate (fullwall%conn(4, ncells))
1738 allocate (fullwall%ind(nnodes))
1747 do j = 1, walls(i)%nNodes
1749 fullwall%x(:, nnodes) = walls(i)%x(:, j)
1750 fullwall%ind(nnodes) = walls(i)%ind(j)
1753 do j = 1, walls(i)%nCells
1755 fullwall%conn(:, ncells) = walls(i)%conn(:, j) + ii
1759 ii = ii + walls(i)%nNodes
1763 fullwall%nCells = ncells
1764 fullwall%nNodes = nnodes
1765 call buildserialquad(ncells, nnodes, fullwall%x, fullwall%conn, fullwall%ADT)
1770 allocate (
stack(100), bb(20), bbint(20), frontleaves(25), frontleavesnew(25))
1781 if (.not.
associated(flowdoms(nn, level, sps)%surfNodeIndices))
then
1782 allocate (flowdoms(nn, level, sps)%surfNodeIndices(4, 2:
il, 2:
jl, 2:
kl))
1783 allocate (flowdoms(nn, level, sps)%uv(2, 2:
il, 2:
jl, 2:
kl))
1794 coor(1) =
eighth * (
x(i - 1, j - 1, k - 1, 1) +
x(i, j - 1, k - 1, 1) &
1795 +
x(i - 1, j, k - 1, 1) +
x(i, j, k - 1, 1) &
1796 +
x(i - 1, j - 1, k, 1) +
x(i, j - 1, k, 1) &
1797 +
x(i - 1, j, k, 1) +
x(i, j, k, 1))
1799 coor(2) =
eighth * (
x(i - 1, j - 1, k - 1, 2) +
x(i, j - 1, k - 1, 2) &
1800 +
x(i - 1, j, k - 1, 2) +
x(i, j, k - 1, 2) &
1801 +
x(i - 1, j - 1, k, 2) +
x(i, j - 1, k, 2) &
1802 +
x(i - 1, j, k, 2) +
x(i, j, k, 2))
1804 coor(3) =
eighth * (
x(i - 1, j - 1, k - 1, 3) +
x(i, j - 1, k - 1, 3) &
1805 +
x(i - 1, j, k - 1, 3) +
x(i, j, k - 1, 3) &
1806 +
x(i - 1, j - 1, k, 3) +
x(i, j - 1, k, 3) &
1807 +
x(i - 1, j, k, 3) +
x(i, j, k, 3))
1817 uvw, dummy, 0, bb, frontleaves, frontleavesnew)
1820 if (cellid > 0)
then
1822 flowdoms(nn, level, sps)%surfNodeIndices(kk, i, j, k) = &
1823 walls(c)%ind(walls(c)%conn(kk, cellid))
1825 flowdoms(nn, level, sps)%uv(:, i, j, k) = uvw(1:2)
1828 flowdoms(nn, level, sps)%surfNodeIndices(:, i, j, k) = 0
1829 flowdoms(nn, level, sps)%uv(:, i, j, k) = 0
1844 intinfo, uvw, dummy, 0, bb, frontleaves, frontleavesnew)
1847 if (cellid > 0)
then
1852 if (uvw(4) >
nearwalldist**2 .or. walls(c)%nCells == 0)
then
1855 flowdoms(nn, level, sps)%surfNodeIndices(kk, i, j, k) = &
1856 fullwall%ind(fullwall%conn(kk, cellid))
1858 flowdoms(nn, level, sps)%uv(:, i, j, k) = uvw(1:2)
1867 intinfo2, uvw2, dummy, 0, bb, &
1868 frontleaves, frontleavesnew)
1869 cellid2 = intinfo2(3)
1875 flowdoms(nn, level, sps)%surfNodeIndices(kk, i, j, k) = &
1876 walls(c)%ind(walls(c)%conn(kk, cellid2))
1878 flowdoms(nn, level, sps)%uv(:, i, j, k) = uvw2(1:2)
1883 flowdoms(nn, level, sps)%surfNodeIndices(kk, i, j, k) = &
1884 fullwall%ind(fullwall%conn(kk, cellid))
1886 flowdoms(nn, level, sps)%uv(:, i, j, k) = uvw(1:2)
1896 flowdoms(nn, level, sps)%surfNodeIndices(:, i, j, k) = 0
1897 flowdoms(nn, level, sps)%uv(:, i, j, k) = 0
1915 indicestoget(mm) = flowdoms(nn, level, sps)%surfNodeIndices(kk, i, j, k)
1934 flowdoms(nn, level, sps)%surfNodeIndices(kk, i, j, k) = link(mm)
1946 allocate (link(nunique * 3))
1948 link((i - 1) * 3 + 1) = indicestoget(i) * 3
1949 link((i - 1) * 3 + 2) = indicestoget(i) * 3 + 1
1950 link((i - 1) * 3 + 3) = indicestoget(i) * 3 + 2
1953 call iscreategeneral(
adflow_comm_world, nunique * 3, link, petsc_copy_values, is1, ierr)
1954 call echk(ierr, __file__, __line__)
1962 petsc_determine, xvolumevec(level), ierr)
1963 call echk(ierr, __file__, __line__)
1968 xsurfvec(level, sps), ierr)
1969 call echk(ierr, __file__, __line__)
1971 call vecgetownershiprange(xsurfvec(level, sps), i, j, ierr)
1972 call echk(ierr, __file__, __line__)
1975 call echk(ierr, __file__, __line__)
1978 call vecscattercreate(xvolumevec(level), is1, xsurfvec(level, sps), is2, &
1979 wallscatter(level, sps), ierr)
1980 call echk(ierr, __file__, __line__)
1982 call isdestroy(is1, ierr)
1983 call echk(ierr, __file__, __line__)
1985 call isdestroy(is2, ierr)
1986 call echk(ierr, __file__, __line__)
1989 deallocate (
stack, bb, frontleaves, frontleavesnew, bbint)
1992 deallocate (walls(i)%x, walls(i)%conn, walls(i)%ind)
1998 deallocate (fullwall%x, fullwall%conn, fullwall%ind)
2012 integer(kind=intType),
intent(in) :: level
2015 integer(kind=intType) :: ii, i, j, k, l, nn, sps, ierr
2018 call vecgetarrayf90(xvolumevec(level),
xvolume, ierr)
2019 call echk(ierr, __file__, __line__)
2037 call vecrestorearrayf90(xvolumevec(level),
xvolume, ierr)
2038 call echk(ierr, __file__, __line__)
2042 call vecscatterbegin(wallscatter(level, sps), xvolumevec(level), &
2043 xsurfvec(level, sps), insert_values, scatter_forward, ierr)
2044 call echk(ierr, __file__, __line__)
2046 call vecscatterend(wallscatter(level, sps), xvolumevec(level), &
2047 xsurfvec(level, sps), insert_values, scatter_forward, ierr)
2048 call echk(ierr, __file__, __line__)
2060 integer(kind=intType) :: level, nLevels, l
2067 deallocate (xsurfvec, xvolumevec, wallscatter)
2080 integer(kind=intType),
intent(in) :: level
2083 integer(kind=intType) :: ierr, sps
2088 call vecdestroy(xvolumevec(level), ierr)
2089 call echk(ierr, __file__, __line__)
2092 call vecdestroy(xsurfvec(level, sps), ierr)
2093 call echk(ierr, __file__, __line__)
2095 call vecscatterdestroy(wallscatter(level, sps), ierr)
2096 call echk(ierr, __file__, __line__)
subroutine buildclusterwalls(level, sps, useDual, walls, famList, nFamList)
integer(kind=inttype), dimension(maxlevels) ncellslocal
integer(kind=inttype), dimension(maxlevels) nnodeslocal
subroutine adtbuildsurfaceadt(nTria, nQuads, nNodes, coor, triaConn, quadsConn, BBox, useBBox, comm, adtID)
subroutine adtdeallocateadts(adtID)
subroutine adtmindistancesearch(nCoor, coor, adtID, procID, elementType, elementID, uvw, dist2, nInterpol, arrDonor, arrInterpol)
subroutine destroyserialquad(ADT)
subroutine buildserialquad(nQuad, nNodes, coor, quadsConn, ADT)
subroutine mindistancetreesearchsinglepoint(ADT, coor, intInfo, uvw, arrDonor, nInterpol, BB, frontLeaves, frontLeavesNew)
integer(kind=inttype), dimension(:), pointer stack
integer(kind=inttype) ndom
type(blocktype), dimension(:, :, :), allocatable, target flowdoms
integer(kind=inttype) nviscbocos
real(kind=realtype), dimension(:, :, :), pointer d2wall
integer(kind=inttype), dimension(:), pointer bcfaceid
integer(kind=inttype) nbocos
integer(kind=inttype) sectionid
integer(kind=inttype), dimension(:), pointer bctype
real(kind=realtype), dimension(:, :, :, :), pointer x
integer(kind=inttype) sendbuffersize
real(kind=realtype), dimension(:), allocatable recvbuffer
real(kind=realtype), dimension(:), allocatable sendbuffer
integer(kind=inttype) recvbuffersize
integer adflow_comm_world
real(kind=realtype), parameter zero
integer(kind=inttype), parameter imax
integer(kind=inttype), parameter kmin
real(kind=realtype), parameter pi
integer(kind=inttype), parameter jmax
real(kind=realtype), parameter eps
real(kind=realtype), parameter eighth
integer(kind=inttype), parameter nswalladiabatic
real(kind=realtype), parameter one
real(kind=realtype), parameter half
integer(kind=inttype), parameter imin
real(kind=realtype), parameter two
integer(kind=inttype), parameter nswallisothermal
integer(kind=inttype), parameter ibcgroupwalls
real(kind=realtype), parameter large
integer(kind=inttype), parameter kmax
integer(kind=inttype), parameter ransequations
integer(kind=inttype), parameter jmin
integer(kind=inttype) groundlevel
integer(kind=inttype) nclusters
integer(kind=inttype), dimension(:), allocatable cumdomproc
integer(kind=inttype), dimension(:), allocatable clusters
integer(kind=inttype) nsections
type(sectiontype), dimension(:), allocatable sections
subroutine unique(arr, nn, n_unique, inverse)
type(bcgrouptype), dimension(nfamexchange) bcfamgroups
subroutine deallocatetempmemory(resNeeded)
subroutine allocatetempmemory(resNeeded)
subroutine echk(errorcode, file, line)
subroutine setpointers(nn, mm, ll)
subroutine terminate(routineName, errorMessage)
subroutine localviscoussurfacemesh(multSections, level, sps)
real(kind=realtype), dimension(:, :, :), allocatable rotmatrixsections
subroutine viscoussurfacemesh(level, sps)
subroutine initwalldistance(level, sps, allocMem)
subroutine computenormalspacing(level, sps)
integer(kind=inttype) nquadviscglob
integer(kind=inttype) nquadvisc
integer(kind=inttype) nnodevisc
subroutine destroywalldistancedata
subroutine determinedistance(level, sps)
subroutine destroywalldistancedatalevel(level)
subroutine computewalldistance(level, allocMem)
subroutine updatexsurf(level)
subroutine updatewalldistancesquickly(nn, level, sps)
real(kind=realtype), dimension(:, :), allocatable coorvisc
subroutine updatewalldistancealllevels
subroutine determinewallassociation(level, sps)
integer(kind=inttype), dimension(:, :), allocatable connvisc
real(kind=realtype), dimension(:), pointer xvolume
real(kind=realtype), dimension(:), pointer xsurf
logical, dimension(:), allocatable walldistancedataallocated
logical, dimension(:), allocatable updatelevelwallassociation