Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/shared/cvmix_kpp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3450,11 +3450,11 @@ subroutine cvmix_kpp_compute_StokesXi (zi, zk, kSL, SLDepth, surf_buoy_force,
real(cvmix_r8), parameter :: CempCGs = 4.7_cvmix_r8 ! Coeff. relating non-local scalar flux to sfc flux [nondim]
real(cvmix_r8) :: PBfact ! Ratio of TKE surface layer production to w*^3 [nondim]
real(cvmix_r8) :: PU, PS , PB ! Surface layer TKE production terms increments [m3 s-3]
real(cvmix_r8) :: ustar, delH, delU, delV, omega_E2x, cosOmega, sinOmega
real(cvmix_r8) :: ustar, delH, delU, delV, delz, omega_E2x, cosOmega, sinOmega
real(cvmix_r8) :: BLDepth, TauMAG, TauCG, TauDG, taux0, tauy0, Stk0 , Pinc
real(cvmix_r8) :: dtop, tauEtop, tauxtop, tauytop ! Cell top values
real(cvmix_r8) :: dbot, tauEbot, tauxbot, tauybot, sigbot, Gbot ! Cell bottom values
integer :: ktmp ! vertical loop
integer :: ktmp ! vertical loop index

CVmix_kpp_params_in => CVmix_kpp_params_saved
if (present(CVmix_kpp_params_user)) then
Expand All @@ -3480,14 +3480,16 @@ subroutine cvmix_kpp_compute_StokesXi (zi, zk, kSL, SLDepth, surf_buoy_force,
dtop = 0.0
delU = uE(1) - uE(2)
delV = vE(1) - vE(2)
tauEtop = (taux0 * delU + tauy0 * delV ) / (zk(1) - zk(2) )
delz = zk(1) - zk(2)
tauEtop = (taux0 * delU + tauy0 * delV ) / delz
tauxtop = taux0
tauytop = tauy0

! Integrate Both Shear Production Terms from Surface to top of surface layer cell
do ktmp = 1, kSL-1
delU = uE(ktmp) - uE(ktmp+1)
delV = vE(ktmp) - vE(ktmp+1)
delz = zk(ktmp) - zk(ktmp+1)
Omega_E2x= atan2( delV , delU )
cosOmega = cos(Omega_E2x)
sinOmega = sin(Omega_E2x)
Expand All @@ -3502,7 +3504,7 @@ subroutine cvmix_kpp_compute_StokesXi (zi, zk, kSL, SLDepth, surf_buoy_force,
tauDG = TauMAG ! E
tauxbot = tauDG * cosOmega - tauCG * sinOmega
tauybot = tauDG * sinOmega + tauCG * cosOmega
tauEbot = (tauxbot * delU + tauybot * delV) / (zk(ktmp) - zk(ktmp+1) )
tauEbot = (tauxbot * delU + tauybot * delV) / delz

! Increment Eulerian Shear Production
Pinc = 0.5_cvmix_r8 * (tauEbot + tauEtop) * delH
Expand All @@ -3521,7 +3523,7 @@ subroutine cvmix_kpp_compute_StokesXi (zi, zk, kSL, SLDepth, surf_buoy_force,
enddo

! Integrate from top of surface layer cell to Surface layer Depth
delH = SLDepth + zi(ktmp)
delH = SLDepth + zi(kSL)
sigbot = CVmix_kpp_params_in%surf_layer_ext
Gbot = cvmix_kpp_composite_shape(sigbot)
TauMAG = ustar * ustar * Gbot / sigbot
Expand All @@ -3530,13 +3532,18 @@ subroutine cvmix_kpp_compute_StokesXi (zi, zk, kSL, SLDepth, surf_buoy_force,
tauDG = TauMAG ! E
tauxbot = tauDG * cosOmega - tauCG * sinOmega
tauybot = tauDG * sinOmega + tauCG * cosOmega
tauEbot = (tauxbot * delU + tauybot * delV) / (zk(ktmp) - zk(ktmp+1) )
if( (kSL > 1) .and. (kSL < size(zk) ) .and. ( SLDepth > -zk(kSL) ) ) then
delU = uE(kSL) - uE(kSL+1)
delV = vE(kSL) - vE(kSL+1)
delz = zk(kSL) - zk(kSL+1)
endif
tauEbot = (tauxbot * delU + tauybot * delV) / delz
! Increment Eulerian Shear Production
Pinc = 0.5_cvmix_r8 * (tauEbot + tauEtop) * delH
PU = PU + MAX( Pinc , cvmix_zero )

! Increment Stokes Shear Production
Pinc = tauxtop*uS(ktmp) - tauxbot*uS_SL + tauytop*vS(ktmp) - tauybot*vS_SL
Pinc = tauxtop*uS(kSL) - tauxbot*uS_SL + tauytop*vS(kSL) - tauybot*vS_SL
Pinc = Pinc - (tauxtop-tauxbot) * uSb_SL - (tauytop-tauybot) * vSb_SL
PS = PS + MAX( Pinc , cvmix_zero )

Expand Down
Loading