From 0197ae9352a5fb56815613a651207e1dd8fa0320 Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Wed, 23 Oct 2024 14:17:41 -0600 Subject: [PATCH] Fix surface layer average for Stokes Most --- .../vertical/MOM_CVMix_KPP.F90 | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/parameterizations/vertical/MOM_CVMix_KPP.F90 b/src/parameterizations/vertical/MOM_CVMix_KPP.F90 index f0ef355374..70a63bcdf1 100644 --- a/src/parameterizations/vertical/MOM_CVMix_KPP.F90 +++ b/src/parameterizations/vertical/MOM_CVMix_KPP.F90 @@ -1158,14 +1158,17 @@ subroutine KPP_compute_BLD(CS, G, GV, US, h, Temp, Salt, u, v, tv, uStar, buoyFl surfHu = (uE_H(ksfc) + uSbar_SLD) * delH surfHv = (vE_H(ksfc) + vSbar_SLD) * delH hTot = delH - do ktmp = 1,ksfc-1 ! if ksfc >=2 - delH = h(i,j,ktmp)*GV%H_to_Z - hTot = hTot + delH - surfHtemp = surfHtemp + Temp(i,j,ktmp) * delH - surfHsalt = surfHsalt + Salt(i,j,ktmp) * delH - surfHu = surfHu + (uE_H(ktmp) + uSbar_H(ktmp)) * delH - surfHv = surfHv + (vE_H(ktmp) + vSbar_H(ktmp)) * delH - enddo + ! only loop if ksfc >=2 + if (ksfc >=2) then + do ktmp = 1,ksfc-1 + delH = h(i,j,ktmp)*GV%H_to_Z + hTot = hTot + delH + surfHtemp = surfHtemp + Temp(i,j,ktmp) * delH + surfHsalt = surfHsalt + Salt(i,j,ktmp) * delH + surfHu = surfHu + (uE_H(ktmp) + uSbar_H(ktmp)) * delH + surfHv = surfHv + (vE_H(ktmp) + vSbar_H(ktmp)) * delH + enddo + endif I_hTot = 1./hTot surfTemp = surfHtemp * I_hTot surfSalt = surfHsalt * I_hTot