diff --git a/src/adjoint/outputForward/sa_d.f90 b/src/adjoint/outputForward/sa_d.f90 index 7d076aa76..9aeb520dd 100644 --- a/src/adjoint/outputForward/sa_d.f90 +++ b/src/adjoint/outputForward/sa_d.f90 @@ -40,6 +40,7 @@ subroutine sasource_d() real(kind=realtype), parameter :: f23=two*third ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cv13, kar2inv, cw36, cb3inv real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: fv1d, fv2d, ft2d real(kind=realtype) :: ss, sst, nu, dist2inv, chi, chi2, chi3 @@ -491,6 +492,7 @@ subroutine sasource() real(kind=realtype), parameter :: f23=two*third ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cv13, kar2inv, cw36, cb3inv real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: ss, sst, nu, dist2inv, chi, chi2, chi3 real(kind=realtype) :: rr, gg, gg6, termfw, fwsa, term1, term2 @@ -684,6 +686,7 @@ subroutine saviscous_d() implicit none ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cb3inv real(kind=realtype) :: nu real(kind=realtype) :: nud real(kind=realtype) :: fv1, fv2, ft2 @@ -700,10 +703,7 @@ subroutine saviscous_d() real(kind=realtype) :: temp real(kind=realtype) :: temp0 real(kind=realtype) :: temp1 -! set model constants - cv13 = rsacv1**3 - kar2inv = one/rsak**2 - cw36 = rsacw3**6 +! set model constant cb3inv = one/rsacb3 ! ! viscous terms in k-direction. @@ -1092,6 +1092,7 @@ subroutine saviscous() implicit none ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cb3inv real(kind=realtype) :: nu real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: voli, volmi, volpi, xm, ym, zm, xp, yp, zp @@ -1099,10 +1100,7 @@ subroutine saviscous() real(kind=realtype) :: nutm, nutp, num, nup, cdm, cdp real(kind=realtype) :: c1m, c1p, c10, b1, c1, d1, qs intrinsic max -! set model constants - cv13 = rsacv1**3 - kar2inv = one/rsak**2 - cw36 = rsacw3**6 +! set model constant cb3inv = one/rsacb3 ! ! viscous terms in k-direction. diff --git a/src/adjoint/outputReverse/sa_b.f90 b/src/adjoint/outputReverse/sa_b.f90 index e960263e3..8e87c8523 100644 --- a/src/adjoint/outputReverse/sa_b.f90 +++ b/src/adjoint/outputReverse/sa_b.f90 @@ -42,6 +42,7 @@ subroutine sasource_b() real(kind=realtype), parameter :: f23=two*third ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cv13, kar2inv, cw36, cb3inv real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: fv1d, fv2d, ft2d real(kind=realtype) :: ss, sst, nu, dist2inv, chi, chi2, chi3 @@ -511,6 +512,7 @@ subroutine sasource() real(kind=realtype), parameter :: f23=two*third ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cv13, kar2inv, cw36, cb3inv real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: ss, sst, nu, dist2inv, chi, chi2, chi3 real(kind=realtype) :: rr, gg, gg6, termfw, fwsa, term1, term2 @@ -706,6 +708,7 @@ subroutine saviscous_b() implicit none ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cb3inv real(kind=realtype) :: nu real(kind=realtype) :: nud real(kind=realtype) :: fv1, fv2, ft2 @@ -725,7 +728,7 @@ subroutine saviscous_b() real(kind=realtype) :: temp0 real(kind=realtype) :: tempd0 integer :: branch -! set model constants +! set model constant cb3inv = one/rsacb3 !$bwd-of ii-loop do ii=0,nx*ny*nz-1 @@ -1198,6 +1201,7 @@ subroutine saviscous() implicit none ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cb3inv real(kind=realtype) :: nu real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: voli, volmi, volpi, xm, ym, zm, xp, yp, zp @@ -1206,10 +1210,7 @@ subroutine saviscous() real(kind=realtype) :: c1m, c1p, c10, b1, c1, d1, qs intrinsic mod intrinsic max -! set model constants - cv13 = rsacv1**3 - kar2inv = one/rsak**2 - cw36 = rsacw3**6 +! set model constant cb3inv = one/rsacb3 !$ad ii-loop ! diff --git a/src/adjoint/outputReverseFast/sa_fast_b.f90 b/src/adjoint/outputReverseFast/sa_fast_b.f90 index a19e6d3de..f55eb7736 100644 --- a/src/adjoint/outputReverseFast/sa_fast_b.f90 +++ b/src/adjoint/outputReverseFast/sa_fast_b.f90 @@ -37,6 +37,7 @@ subroutine sasource_fast_b() real(kind=realtype), parameter :: f23=two*third ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cv13, kar2inv, cw36, cb3inv real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: fv1d, fv2d, ft2d real(kind=realtype) :: ss, sst, nu, dist2inv, chi, chi2, chi3 @@ -444,6 +445,7 @@ subroutine sasource() real(kind=realtype), parameter :: f23=two*third ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cv13, kar2inv, cw36, cb3inv real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: ss, sst, nu, dist2inv, chi, chi2, chi3 real(kind=realtype) :: rr, gg, gg6, termfw, fwsa, term1, term2 @@ -635,6 +637,7 @@ subroutine saviscous_fast_b() implicit none ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cb3inv real(kind=realtype) :: nu real(kind=realtype) :: nud real(kind=realtype) :: fv1, fv2, ft2 @@ -652,7 +655,7 @@ subroutine saviscous_fast_b() real(kind=realtype) :: tempd real(kind=realtype) :: tempd0 integer :: branch -! set model constants +! set model constant cb3inv = one/rsacb3 !$bwd-of ii-loop do ii=0,nx*ny*nz-1 @@ -1020,6 +1023,7 @@ subroutine saviscous() implicit none ! local variables. integer(kind=inttype) :: i, j, k, nn, ii + real(kind=realtype) :: cb3inv real(kind=realtype) :: nu real(kind=realtype) :: fv1, fv2, ft2 real(kind=realtype) :: voli, volmi, volpi, xm, ym, zm, xp, yp, zp @@ -1028,10 +1032,7 @@ subroutine saviscous() real(kind=realtype) :: c1m, c1p, c10, b1, c1, d1, qs intrinsic mod intrinsic max -! set model constants - cv13 = rsacv1**3 - kar2inv = one/rsak**2 - cw36 = rsacw3**6 +! set model constant cb3inv = one/rsacb3 !$ad ii-loop ! diff --git a/src/turbulence/sa.F90 b/src/turbulence/sa.F90 index 94cf1dfbe..8232231b1 100644 --- a/src/turbulence/sa.F90 +++ b/src/turbulence/sa.F90 @@ -107,6 +107,7 @@ subroutine saSource ! Local variables. integer(kind=intType) :: i, j, k, nn, ii + real(kind=realType) :: cv13, kar2Inv, cw36, cb3Inv real(kind=realType) :: fv1, fv2, ft2 real(kind=realType) :: ss, sst, nu, dist2Inv, chi, chi2, chi3 real(kind=realType) :: rr, gg, gg6, termFw, fwSa, term1, term2 @@ -354,6 +355,7 @@ subroutine saViscous implicit none ! Local variables. integer(kind=intType) :: i, j, k, nn, ii + real(kind=realType) :: cb3Inv real(kind=realType) :: nu real(kind=realType) :: fv1, fv2, ft2 real(kind=realType) :: voli, volmi, volpi, xm, ym, zm, xp, yp, zp @@ -362,10 +364,7 @@ subroutine saViscous real(kind=realType) :: c1m, c1p, c10, b1, c1, d1, qs - ! Set model constants - cv13 = rsaCv1**3 - kar2Inv = one / (rsaK**2) - cw36 = rsaCw3**6 + ! Set model constant cb3Inv = one / rsaCb3 ! @@ -720,6 +719,7 @@ subroutine saSolve ! original Spalart-Allmaras model in a decoupled manner using ! a diagonal dominant ADI-scheme. use blockPointers + use constants use inputIteration use inputPhysics use paramTurb @@ -728,6 +728,7 @@ subroutine saSolve implicit none integer(kind=intType) :: i, j, k, nn, ii + real(kind=realType) :: cb3Inv real(kind=realType), dimension(2:max(kl, il, jl)) :: bb, cc, dd, ff real(kind=realType) :: voli, volmi, volpi, xm, ym, zm, xp, yp, zp real(kind=realType) :: xa, ya, za, ttm, ttp, cnud, cam, cap @@ -740,6 +741,8 @@ subroutine saSolve logical, dimension(2:il, 2:jl), target :: flagK2, flagKl logical, dimension(:, :), pointer :: flag + ! Set model constant + cb3Inv = one / rsaCb3 ! Initialize the wall function flags to .false.