24 integer(kind=intType),
allocatable,
dimension(:) ::
zonenumbers
25 character(len=maxCGNSNameLen),
allocatable,
dimension(:) ::
zonenames
26 character(len=maxCGNSNameLen),
allocatable,
dimension(:) ::
varnames
58 character(len=maxStringLen),
dimension(:),
allocatable ::
solfiles
69 real(kind=cgnsrealtype),
dimension(:, :, :),
allocatable ::
buffer
70 real(kind=cgnsrealtype),
dimension(:, :, :),
allocatable ::
buffervertex
93 integer(kind=intType),
intent(inout) :: nTypeMismatch
97 integer :: realTypeCGNS
99 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
100 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
125 ntypemismatch = ntypemismatch + 1
156 "Not able to retrieve density from the &
157 &variables in the restart file.")
182 integer(kind=intType),
intent(inout) :: nTypeMismatch
186 integer :: realTypeCGNS
188 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
189 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
191 real(kind=realtype) :: vvx, vvy, vvz, dummyk, pres, rhoinv
211 testrhoepresent:
if (nn > 0)
then
217 ntypemismatch = ntypemismatch + 1
242 end if testrhoepresent
248 testpressure:
if (nn > 0)
then
254 ntypemismatch = ntypemismatch + 1
276 vvx =
w(ip, jp, kp,
imx) * rhoinv
277 vvy =
w(ip, jp, kp,
imy) * rhoinv
278 vvz =
w(ip, jp, kp,
imz) * rhoinv
280 call etot(
w(ip, jp, kp,
irho), vvx, vvy, vvz, pres, &
298 vvx =
w(ip, jp, kp,
imx) * rhoinv
299 vvy =
w(ip, jp, kp,
imy) * rhoinv
300 vvz =
w(ip, jp, kp,
imz) * rhoinv
302 call etot(
w(ip, jp, kp,
irho), vvx, vvy, vvz, pres, &
319 "Energy could not be created")
346 integer(kind=intType),
intent(inout) :: nTypeMismatch
350 integer :: realTypeCGNS
352 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
353 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
378 ntypemismatch = ntypemismatch + 1
416 ntypemismatch = ntypemismatch + 1
453 "Not able to retrieve the pressure from &
454 &the variables in the restart file.")
474 integer(kind=intType),
intent(inout) :: nTypeMismatch
475 logical,
intent(out) :: eddyVisPresent
479 integer :: realTypeCGNS
481 integer(kind=intType) :: i, j, k, nn
498 ntypemismatch = ntypemismatch + 1
502 eddyvispresent = .true.
534 ntypemismatch = ntypemismatch + 1
538 eddyvispresent = .true.
572 eddyvispresent = .false.
597 integer(kind=intType),
intent(inout) :: nTypeMismatch
601 integer :: realTypeCGNS
603 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
604 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
606 real(kind=realtype) :: nuscale, kscale, omegascale, val
608 logical :: turbKPresent, omegaPresent, eddyVisPresent
628 omegascale = kscale / nuscale
632 turbkpresent = .false.
642 ntypemismatch = ntypemismatch + 1
665 turbkpresent = .true.
671 omegapresent = .false.
681 ntypemismatch = ntypemismatch + 1
704 omegapresent = .true.
711 if (.not. omegapresent)
then
721 ntypemismatch = ntypemismatch + 1
740 w(ip, jp, kp,
itu2) = omegascale / max(
eps, val)
747 omegapresent = .true.
756 if (turbkpresent .and. omegapresent)
goto 1001
770 if (turbkpresent)
then
795 print
"(a)",
"# Warning"
796 print
"(a)",
"# Omega is not present in the restart file."
797 if (eddyvispresent)
then
798 print
"(a)",
"# It is initialized using the turbulent &
799 &kinetic energy and eddy viscosity."
801 print
"(a)",
"# It is initialized using the turbulent &
802 &kinetic energy and free stream eddy &
816 if (omegapresent)
then
830 /
w(ip, jp, kp,
irho)
841 print
"(a)",
"# Warning"
842 print
"(a)",
"# Turbulent kinetic energy is not present &
843 &in the restart file."
844 if (eddyvispresent)
then
845 print
"(a)",
"# It is initialized using omega and &
846 &the eddy viscosity."
848 print
"(a)",
"# It is initialized using omega and &
849 &the free stream eddy viscosity."
876 print
"(a)",
"# Warning"
877 print
"(a)",
"# The turbulent kinetic energy and omega are &
878 ¬ present in the restart file."
879 if (eddyvispresent)
then
880 print
"(a)",
"# They have been initialized using the &
883 print
"(a)",
"# The default initialization has been used."
932 integer(kind=intType),
intent(inout) :: nTypeMismatch
936 integer :: realTypeCGNS
938 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
939 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
941 real(kind=realtype) :: nuscale, ratio, nu
943 logical :: eddyVisPresent
966 nutildepresent:
if (nn > 0)
then
972 ntypemismatch = ntypemismatch + 1
997 end if nutildepresent
1005 eddypresent:
if (eddyvispresent)
then
1026 ratio =
rev(i, j, k) /
rlv(i, j, k)
1027 nu =
rlv(i, j, k) /
w(ip, jp, kp,
irho)
1040 print
"(a)",
"# Warning"
1041 print
"(a)",
"# Nu tilde for Spalart-Allmaras model not &
1042 &present in the restart file."
1043 print
"(a)",
"# Variable has been reconstructed from &
1044 &the eddy viscosity ratio."
1076 print
"(a)",
"# Warning"
1077 print
"(a)",
"# No turbulent info present in the restart file."
1078 print
"(a)",
"# Nu tilde for Spalart-Allmaras model has &
1079 &been set to the free stream value."
1103 integer(kind=intType),
intent(inout) :: nTypeMismatch
1107 integer :: realTypeCGNS, itu
1108 integer,
dimension(4) :: indW
1110 integer(kind=intType) :: i, j, k, ii, nn, po, ip, jp, kp
1111 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
1113 real(kind=realtype) :: nuscale, kscale, epsscale, fscale
1115 real(kind=realtype),
dimension(4) :: turbscale
1117 character(len=maxCGNSNameLen),
dimension(4) :: namesVar
1145 fscale = kscale / nuscale
1146 epsscale = kscale * fscale
1148 turbscale(1) = kscale
1149 turbscale(2) = epsscale
1150 turbscale(3) = kscale
1151 turbscale(4) = fscale
1155 varloop:
do ii = 1, 4
1167 if (realtypecgns /=
vartypes(nn)) &
1168 ntypemismatch = ntypemismatch + 1
1186 w(ip, jp, kp, itu) = turbscale(ii) *
buffer(i, j, k)
1196 testpresent:
if (ii <= 4)
then
1208 w(ip, jp, kp, ii) =
winf(ii)
1220 print
"(a)",
"# Warning"
1221 print
"(a)",
"# Not all turbulence variables are present &
1222 &for the v2f model."
1223 print
"(a)",
"# They have been initialized to the free &
1247 integer(kind=intType),
intent(inout) :: nTypeMismatch
1279 call terminate(
"readTurbvar",
"Restart not implemented &
1280 &for this turbulence model.")
1310 integer(kind=intType),
intent(inout) :: nTypeMismatch
1314 integer :: realTypeCGNS
1316 integer(kind=intType) :: i, j, k, nn, mm, po, ip, jp, kp
1317 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
1319 real(kind=realtype) :: momscale
1341 testmxpresent:
if (nn > 0)
then
1346 if (realtypecgns /=
vartypes(nn)) &
1347 ntypemismatch = ntypemismatch + 1
1363 w(ip, jp, kp,
imx) =
buffer(i, j, k) * momscale
1372 end if testmxpresent
1378 testvxpresent:
if (nn > 0)
then
1383 if (realtypecgns /=
vartypes(nn)) &
1384 ntypemismatch = ntypemismatch + 1
1410 end if testvxpresent
1415 "X-Momentum could not be created")
1440 integer(kind=intType),
intent(inout) :: nTypeMismatch
1444 integer :: realTypeCGNS
1446 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
1447 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
1449 real(kind=realtype) :: scale
1473 if (realtypecgns /=
vartypes(nn)) &
1474 ntypemismatch = ntypemismatch + 1
1510 if (realtypecgns /=
vartypes(nn)) &
1511 ntypemismatch = ntypemismatch + 1
1546 "Not able to retrieve x-velocity from the &
1547 &variables in the restart file.")
1573 integer(kind=intType),
intent(inout) :: nTypeMismatch
1577 integer :: realTypeCGNS
1579 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
1580 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
1582 real(kind=realtype) :: momscale
1604 testmypresent:
if (nn > 0)
then
1609 if (realtypecgns /=
vartypes(nn)) &
1610 ntypemismatch = ntypemismatch + 1
1626 w(ip, jp, kp,
imy) =
buffer(i, j, k) * momscale
1635 end if testmypresent
1641 testvypresent:
if (nn > 0)
then
1646 if (realtypecgns /=
vartypes(nn)) &
1647 ntypemismatch = ntypemismatch + 1
1673 end if testvypresent
1678 "Y-Momentum could not be created")
1705 integer(kind=intType),
intent(inout) :: nTypeMismatch
1709 integer :: realTypeCGNS
1711 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
1712 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
1714 real(kind=realtype) :: scale
1738 if (realtypecgns /=
vartypes(nn)) &
1739 ntypemismatch = ntypemismatch + 1
1775 if (realtypecgns /=
vartypes(nn)) &
1776 ntypemismatch = ntypemismatch + 1
1811 "Not able to retrieve y-velocity from the &
1812 &variables in the restart file.")
1837 integer(kind=intType),
intent(inout) :: nTypeMismatch
1841 integer :: realTypeCGNS
1843 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
1844 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
1846 real(kind=realtype) :: momscale
1868 testmzpresent:
if (nn > 0)
then
1873 if (realtypecgns /=
vartypes(nn)) &
1874 ntypemismatch = ntypemismatch + 1
1890 w(ip, jp, kp,
imz) =
buffer(i, j, k) * momscale
1899 end if testmzpresent
1905 testvzpresent:
if (nn > 0)
then
1910 if (realtypecgns /=
vartypes(nn)) &
1911 ntypemismatch = ntypemismatch + 1
1937 end if testvzpresent
1942 "Z-Momentum could not be created")
1967 integer(kind=intType),
intent(inout) :: nTypeMismatch
1971 integer :: realTypeCGNS
1973 integer(kind=intType) :: i, j, k, nn, po, ip, jp, kp
1974 integer(kind=intType) :: iBeg, iEnd, jBeg, jEnd, kBeg, kEnd
1976 real(kind=realtype) :: scale
2000 if (realtypecgns /=
vartypes(nn)) &
2001 ntypemismatch = ntypemismatch + 1
2037 if (realtypecgns /=
vartypes(nn)) &
2038 ntypemismatch = ntypemismatch + 1
2073 "Not able to retrieve z-velocity from the &
2074 &variables in the restart file.")
2098 integer,
dimension(nSolsRead),
intent(in) :: fileIDs
2103 integer :: ierr, realTypeCGNS, dummyInt
2104 integer :: i, nConv, nDim
2105 integer(kind=cgsize_t) :: nSize(1)
2107 integer(kind=intType) :: j, ii, nn
2109 integer(kind=intType),
dimension(:),
allocatable :: ind
2111 character(len=maxCGNSNameLen) :: cgnsName
2112 character(len=maxCGNSNameLen),
allocatable,
dimension(:) :: &
2115 logical :: allConvInfo
2131 if (ierr /= all_ok)
then
2144 print
"(a)",
"# Warning"
2145 print
"(a)",
"# No time history found in restart file."
2146 print
"(a)",
"# Starting at timestep 1 on the finest level."
2161 "BaseIterativeData_t", 1,
"end")
2162 if (ierr /= all_ok) &
2164 "Something wrong when calling cg_goto_f")
2168 call cg_narrays_f(nconv, ierr)
2169 if (ierr /= all_ok) &
2171 "Something wrong when calling cg_narrays_f")
2175 allocate (convnames(nconv), tmpnames(nconv), ind(nconv), &
2179 "Memory allocation failure for convNames, etc.")
2186 call cg_array_info_f(i, convnames(i), dummyint, ndim, &
2188 if (ierr /= all_ok) &
2190 "Something wrong when calling cg_array_info_f")
2194 print
"(a)",
"# Warning"
2195 print
strings,
"# Dimension of time history for ", trim(convnames(i)),
" is not 1."
2196 print
"(a)",
"# Information is ignored."
2203 convnames(i) = convnames(i)//
"#$@&^!#$%!"
2208 print
"(a)",
"# Warning"
2209 print
strings,
"# Inconsistent time history for ", trim(convnames(i)),
"."
2210 print
"(a)",
"# Displayed information might be incorrect."
2216 tmpnames(i) = convnames(i)
2237 print
"(a)",
"# Warning"
2238 print
"(a)",
"# No time values found in the time history &
2239 &in the restart file."
2240 print
"(a)",
"# The rest of the time history is ignored."
2241 print
"(a)",
"# Starting at timestep 1 on the finest level."
2259 if (ii == 0)
goto 99
2264 call cg_array_read_as_f(i, realtypecgns,
timearray, ierr)
2265 if (ierr /= all_ok) &
2267 "Something wrong when calling &
2268 &cg_array_read_as_f")
2278 allconvinfo = .true.
2295 allconvinfo = .false.
2306 call cg_array_read_as_f(i, realtypecgns, &
2308 if (ierr /= all_ok) &
2310 "Something wrong when calling &
2311 &cg_array_read_as_f")
2319 if (.not. allconvinfo)
then
2322 print
"(a)",
"# Warning"
2323 print
"(a)",
"# Not all the time history could be &
2324 &retrieved from the restart file."
2325 print
"(a)",
"# Missing information is initialized to zero."
2334 deallocate (convnames, tmpnames, ind, stat=ierr)
2337 "Deallocation error for convNames, etc.")
2362 integer,
dimension(nSolsRead),
intent(in) :: fileIDs
2366 integer :: ierr, realTypeCGNS, typeCGNS
2367 integer :: i, nDim, nRef
2369 integer(kind=cgsize_t) :: nsize2(1)
2370 integer(kind=intType) :: ii, nn
2372 integer(kind=intType),
dimension(:),
allocatable :: ind
2374 real(kind=cgnsrealtype) :: tmpscale
2376 character(len=maxCGNSNameLen),
allocatable,
dimension(:) :: &
2379 logical :: muScalePresent
2403 if (ierr /= all_ok) &
2405 "Something wrong when calling cg_goto_f")
2411 "ReferenceState_t", 1,
"end")
2412 if (ierr /= all_ok)
then
2423 "Reference state not presented in restart &
2424 &file. Scaling factors cannot be determined.")
2435 "ReferenceState_t", 1,
"end")
2436 if (ierr /= all_ok) &
2438 "Something wrong when calling cg_goto_f")
2442 call cg_narrays_f(nref, ierr)
2443 if (ierr /= all_ok) &
2445 "Something wrong when calling cg_narrays_f")
2449 allocate (refnames(nref), tmpnames(nref), ind(nref), &
2453 "Memory allocation failure for refNames, etc.")
2459 call cg_array_info_f(i, refnames(i), typecgns, ndim, &
2461 if (ierr /= all_ok) &
2463 "Something wrong when calling cg_array_info_f")
2469 if (ndim /= 1 .or. nsize2(1) /= 1) &
2470 refnames(i) = refnames(i)//
"#$@&^!#$%!"
2474 tmpnames(i) = refnames(i)
2499 "No reference density found in restart file")
2507 call cg_array_read_as_f(i, realtypecgns, tmpscale, ierr)
2508 if (ierr /= all_ok) &
2510 "Something wrong when calling &
2511 &cg_array_read_as_f")
2520 "No reference pressure found in &
2529 call cg_array_read_as_f(i, realtypecgns, tmpscale, ierr)
2530 if (ierr /= all_ok) &
2532 "Something wrong when calling &
2533 &cg_array_read_as_f")
2542 "No reference velocity found in &
2551 call cg_array_read_as_f(i, realtypecgns, tmpscale, ierr)
2552 if (ierr /= all_ok) &
2554 "Something wrong when calling &
2555 &cg_array_read_as_f")
2561 muscalepresent = .true.
2569 call cg_array_read_as_f(i, realtypecgns, tmpscale, ierr)
2570 if (ierr /= all_ok) &
2572 "Something wrong when calling &
2573 &cg_array_read_as_f")
2587 call cg_array_read_as_f(i, realtypecgns, tmpscale, ierr)
2588 if (ierr /= all_ok) &
2590 "Something wrong when calling &
2591 &cg_array_read_as_f")
2606 call cg_array_read_as_f(i, realtypecgns, tmpscale, ierr)
2607 if (ierr /= all_ok) &
2609 "Something wrong when calling &
2610 &cg_array_read_as_f")
2618 muscalepresent = .false.
2637 deallocate (refnames, tmpnames, ind, stat=ierr)
2640 "Deallocation error for convNames, etc.")
2657 character(len=*),
intent(in) :: cgnsVarName
2661 integer :: ierr, realTypeCGNS
2663 integer(kind=intType) :: i, j, k
2671 locationtest:
if (
location == cellcenter)
then
2676 cgnsvarname, realtypecgns,
rangemin, &
2678 if (ierr /= all_ok) &
2680 "Something wrong when calling cg_field_read_f")
2687 cgnsvarname, realtypecgns,
rangemin, &
2689 if (ierr /= all_ok) &
2691 "Something wrong when calling cg_field_read_f")
real(kind=realtype), dimension(:, :, :, :), pointer w
integer(kind=inttype) nbklocal
real(kind=realtype), dimension(:, :, :), pointer rlv
real(kind=realtype), dimension(:, :, :), pointer rev
character(len=maxcgnsnamelen), parameter cgnsmomz
character(len=maxcgnsnamelen), parameter cgnsturbomega
character(len=maxcgnsnamelen), parameter cgnsdensity
character(len=maxcgnsnamelen), parameter cgnsturbtau
character(len=maxcgnsnamelen), parameter cgnsvelocity
character(len=maxcgnsnamelen), parameter cgnsvelz
character(len=maxcgnsnamelen), parameter cgnseddyratio
character(len=maxcgnsnamelen), parameter cgnsmomy
character(len=maxcgnsnamelen), parameter cgnsvely
character(len=maxcgnsnamelen), parameter cgnseddy
character(len=maxcgnsnamelen), parameter cgnslength
character(len=maxcgnsnamelen), parameter cgnsvelx
character(len=maxcgnsnamelen), parameter cgnsturbepsilon
character(len=maxcgnsnamelen), parameter cgnsmomx
character(len=maxcgnsnamelen), parameter cgnsviscmol
character(len=maxcgnsnamelen), parameter cgnsvisckin
character(len=maxcgnsnamelen), parameter cgnsturbk
character(len=maxcgnsnamelen), parameter cgnsenergy
character(len=maxcgnsnamelen), parameter cgnsturbsanu
character(len=maxcgnsnamelen), parameter cgnsturbf
character(len=maxcgnsnamelen), parameter cgnspressure
character(len=maxcgnsnamelen), parameter cgnsturbv2
character(len=maxcgnsnamelen), parameter cgnstimevalue
integer adflow_comm_world
integer(kind=inttype), parameter spalartallmarasedwards
integer(kind=inttype), parameter spalartallmaras
real(kind=realtype), parameter zero
real(kind=realtype), parameter eps
real(kind=realtype), parameter eighth
integer(kind=inttype), parameter ktau
real(kind=realtype), parameter one
integer, parameter maxstringlen
integer, parameter maxcgnsnamelen
integer(kind=inttype), parameter ransequations
subroutine computepressure(iBeg, iEnd, jBeg, jEnd, kBeg, kEnd, pointerOffset)
subroutine etot(rho, u, v, w, p, k, etotal, correctForK)
integer(kind=inttype) nt1
real(kind=realtype) muref
real(kind=realtype) rhoref
real(kind=realtype), dimension(:), allocatable winf
real(kind=realtype) muinf
integer(kind=inttype) nt2
type(iotype), dimension(:, :), allocatable iovar
real(kind=cgnsrealtype), dimension(:), allocatable timearray
character(len=maxcgnsnamelen), dimension(:), allocatable monnames
real(kind=realtype) timeunsteadyrestart
integer(kind=inttype) ntimestepsrestart
real(kind=cgnsrealtype), dimension(:, :), allocatable timedataarray
integer(kind=inttype) function bsearchstrings(key, base)
subroutine qsortstrings(arr, nn)
subroutine initkomega(pOffset)
real(kind=realtype) function sanuknowneddyratio(eddyRatio, nuLam)
subroutine alloctimearrays(nTimeTot)
integer function setcgnsrealtype()
subroutine terminate(routineName, errorMessage)
real(kind=cgnsrealtype), dimension(:, :, :), allocatable buffer
subroutine readturbeddyvis(nTypeMismatch, eddyVisPresent)
subroutine readymomentum(nTypeMismatch)
subroutine readturbv2f(nTypeMismatch)
integer(kind=inttype) nsolsread
subroutine readyvelocity(nTypeMismatch)
integer(kind=inttype) solid
subroutine readtimehistory(fileIDs)
subroutine readturbvar(nTypeMismatch)
real(kind=realtype) muscale
integer, dimension(:), allocatable vartypes
subroutine readzvelocity(nTypeMismatch)
integer(kind=inttype), dimension(:), allocatable zonenumbers
real(kind=realtype) rhoscale
real(kind=cgnsrealtype), dimension(:, :, :), allocatable buffervertex
subroutine readdensity(nTypeMismatch)
subroutine readzmomentum(nTypeMismatch)
character(len=maxstringlen), dimension(:), allocatable solfiles
subroutine readxvelocity(nTypeMismatch)
subroutine readpressure(nTypeMismatch)
subroutine readenergy(nTypeMismatch)
character(len=maxcgnsnamelen), dimension(:), allocatable zonenames
real(kind=realtype) velscale
subroutine readrestartvariable(cgnsVarName)
subroutine readturbkwtype(nTypeMismatch)
real(kind=realtype) pscale
subroutine readxmomentum(nTypeMismatch)
subroutine readturbsa(nTypeMismatch)
integer(kind=cgsize_t), dimension(3) rangemax
character(len=maxcgnsnamelen), dimension(:), allocatable varnames
integer(kind=cgsize_t), dimension(3) rangemin
subroutine scalefactors(fileIDs)