From 5cd90c6332ff112b8d7e718aa9bb5058b19ff0d1 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Mon, 28 Oct 2024 11:58:02 -0600 Subject: [PATCH] Two changes to fpmix indexing 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 --- src/parameterizations/vertical/MOM_CVMix_KPP.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parameterizations/vertical/MOM_CVMix_KPP.F90 b/src/parameterizations/vertical/MOM_CVMix_KPP.F90 index 816d5d7498..9a7b997299 100644 --- a/src/parameterizations/vertical/MOM_CVMix_KPP.F90 +++ b/src/parameterizations/vertical/MOM_CVMix_KPP.F90 @@ -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 @@ -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