Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two changes to fpmix indexing #320

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/parameterizations/vertical/MOM_CVMix_KPP.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ subroutine KPP_compute_BLD(CS, G, GV, US, h, Temp, Salt, u, v, tv, uStar, buoyFl
StokesVt_1d(k) = StokesXI

! average temperature, salinity, u and v over surface layer starting at ksfc
delH = SLdepth_0d + iFaceHeight(ksfc-1)
delH = SLdepth_0d + iFaceHeight(ksfc)
surfHtemp = Temp(i,j,ksfc) * delH
surfHsalt = Salt(i,j,ksfc) * delH
surfHu = (uE_H(ksfc) + uSbar_SLD) * delH
Expand Down Expand Up @@ -1368,7 +1368,7 @@ subroutine KPP_compute_BLD(CS, G, GV, US, h, Temp, Salt, u, v, tv, uStar, buoyFl
CS%OBLdepth(i,j) = US%m_to_Z * KPP_OBL_depth

if (CS%StokesMOST) then
kbl = nint(CS%kOBL(i,j))
kbl = int(CS%kOBL(i,j))
SLdepth_0d = CS%surf_layer_ext*CS%OBLdepth(i,j)
surfBuoyFlux = surfBuoyFlux2(kbl)
! find ksfc for cell where "surface layer" sits
Expand Down
80 changes: 44 additions & 36 deletions src/parameterizations/vertical/MOM_vert_friction.F90
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ subroutine vertFPmix(ui, vi, uold, vold, hbl_h, h, forces, dt, lpost, Cemp_NL, G
real, dimension(SZI_(G),SZJB_(G)) :: hbl_v !< boundary layer depth (v-pts) [H ~> m]
real, dimension(SZIB_(G),SZJ_(G)) :: taux_u !< kinematic zonal wind stress (u-pts) [L2 T-2 ~> m2 s-2]
real, dimension(SZI_(G),SZJB_(G)) :: tauy_v !< kinematic merid wind stress (v-pts) [L2 T-2 ~> m2 s-2]
real, dimension(SZI_(G),SZJB_(G)) :: uS0 !< surface zonal Stokes drift [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G)) :: vS0 !< surface zonal Stokes drift [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G)) :: uS0 !< surface zonal Stokes drift h-pts [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G)) :: vS0 !< surface zonal Stokes drift h-pts [L T-1 ~> m s-1]
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)) :: uE_u !< zonal Eulerian u-pts [L T-1 ~> m s-1]
real, dimension(SZI_(G) ,SZJ_(G),SZK_(GV)) :: uE_h !< zonal Eulerian h-pts [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)) :: vE_v !< merid Eulerian v-pts [L T-1 ~> m s-1]
Expand Down Expand Up @@ -264,25 +264,29 @@ subroutine vertFPmix(ui, vi, uold, vold, hbl_h, h, forces, dt, lpost, Cemp_NL, G
! h to u-pts
tmp_u = MAX (1.0 ,(G%mask2dT(i,j) + G%mask2dT(i+1,j) ) )
hbl_u(I,j) = (G%mask2dT(i,j)* hbl_h(i,j) + G%mask2dT(i+1,j) * hbl_h(i+1,j)) / tmp_u
endif
depth = 0.
Gat1 = 0.
do k=1, nz
! cell center
depth = depth + 0.5*CS%h_u(I,j,k)
uE_u(I,j,k) = ui(I,j,k) - waves%Us_x(I,j,k)
if ( depth < hbl_u(I,j) ) then
sigma = depth / hbl_u(i,j)
! cell bottom
depth = 0.
Gat1 = 0.
do k=1, nz
! cell center
depth = depth + 0.5*CS%h_u(I,j,k)
call cvmix_kpp_composite_Gshape(sigma,Gat1,Gsig,dGdsig)
! nonlocal boundary-layer increment
uInc_u(I,j,k) = dt * Cemp_NL * taux_u(I,j) * dGdsig / hbl_u(I,j)
ui(I,j,k) = ui(I,j,k) + uInc_u(I,j,k)
else
uE_u(I,j,k) = ui(I,j,k) - waves%Us_x(I,j,k)
if ( depth < hbl_u(I,j) ) then
sigma = depth / hbl_u(i,j)
! cell bottom
depth = depth + 0.5*CS%h_u(I,j,k)
call cvmix_kpp_composite_Gshape(sigma,Gat1,Gsig,dGdsig)
! nonlocal boundary-layer increment
uInc_u(I,j,k) = dt * Cemp_NL * taux_u(I,j) * dGdsig / hbl_u(I,j)
ui(I,j,k) = ui(I,j,k) + uInc_u(I,j,k)
else
uInc_u(I,j,k) = 0.0
endif
enddo
else
do k=1, nz
uInc_u(I,j,k) = 0.0
endif
enddo
enddo
endif
enddo
enddo

Expand All @@ -294,25 +298,29 @@ subroutine vertFPmix(ui, vi, uold, vold, hbl_h, h, forces, dt, lpost, Cemp_NL, G
! h to v-pts
tmp_v = max( 1.0 ,(G%mask2dT(i,j) + G%mask2dT(i,j+1)))
hbl_v(i,J) = (G%mask2dT(i,j) * hbl_h(i,J) + G%mask2dT(i,j+1) * hbl_h(i,j+1)) / tmp_v
endif
depth = 0.
Gat1 = 0.
do k=1, nz
! cell center
depth = depth + 0.5* CS%h_v(i,J,k)
vE_v(i,J,k) = vi(i,J,k) - waves%Us_y(i,J,k)
if ( depth < hbl_v(i,J) ) then
sigma = depth / hbl_v(i,J)
! cell bottom
depth = 0.
Gat1 = 0.
do k=1, nz
! cell center
depth = depth + 0.5* CS%h_v(i,J,k)
call cvmix_kpp_composite_Gshape(sigma,Gat1,Gsig,dGdsig)
! nonlocal boundary-layer increment
vInc_v(i,J,k) = dt * Cemp_NL * tauy_v(i,J) * dGdsig / hbl_v(i,J)
vi(i,J,k) = vi(i,J,k) + vInc_v(i,J,k)
else
vE_v(i,J,k) = vi(i,J,k) - waves%Us_y(i,J,k)
if ( depth < hbl_v(i,J) ) then
sigma = depth / hbl_v(i,J)
! cell bottom
depth = depth + 0.5* CS%h_v(i,J,k)
call cvmix_kpp_composite_Gshape(sigma,Gat1,Gsig,dGdsig)
! nonlocal boundary-layer increment
vInc_v(i,J,k) = dt * Cemp_NL * tauy_v(i,J) * dGdsig / hbl_v(i,J)
vi(i,J,k) = vi(i,J,k) + vInc_v(i,J,k)
else
vInc_v(i,J,k) = 0.0
endif
enddo
else
do k=1, nz
vInc_v(i,J,k) = 0.0
endif
enddo
enddo
endif
enddo
enddo

Expand Down
Loading