Skip to content

Commit

Permalink
Two changes to fpmix indexing
Browse files Browse the repository at this point in the history
There were two instances of indexing arrays out of bounds:

1. kfsc>=1, but we were looking for iFaceHeight(ksfc-1); I changed this to ksfc
   instead
2. kbl was set to nint(CS%kOBL(i,j)), and nint() would round up to ke+1 in some
   instances so I changed this to int(CS%kOBL(i,j,)) instead
  • Loading branch information
mnlevy1981 committed Oct 28, 2024
1 parent ad7cf38 commit 5cd90c6
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 5cd90c6

Please sign in to comment.