From afac94a2fa9f6d0bea787e2c8230ea0bbfa1e81d Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 10 Mar 2015 16:47:08 -0600 Subject: [PATCH] Correct bug in Nsqr_iface averaging Two updates: 1) Change in default behavior: now the unresolved shear computation finds N at the cell center by averaging N at interface above and interface below; previously, the default was to use the value from the deeper interface. 2) Whether you pass N or N^2, averaging is done on N; previously if you passed N^2, CVMix computed sqrt(avg(N^2[above],N^2[below])) and now it computes avg(sqrt(N^2[above]),sqrt(N^2[below])) --- src/shared/cvmix_kpp.F90 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/shared/cvmix_kpp.F90 b/src/shared/cvmix_kpp.F90 index 1f8d46b6d..9ef71e25b 100644 --- a/src/shared/cvmix_kpp.F90 +++ b/src/shared/cvmix_kpp.F90 @@ -456,7 +456,7 @@ subroutine cvmix_init_kpp(ri_crit, minOBLdepth, maxOBLdepth, minVtsqr, & call cvmix_put_kpp('lavg_N_or_Nsqr', lavg_N_or_Nsqr, & CVmix_kpp_params_user) else - call cvmix_put_kpp('lavg_N_or_Nsqr', .false., CVmix_kpp_params_user) + call cvmix_put_kpp('lavg_N_or_Nsqr', .true., CVmix_kpp_params_user) end if !EOC @@ -2136,9 +2136,8 @@ function cvmix_kpp_compute_unresolved_shear(zt_cntr, ws_cntr, N_iface, & end if do kt=1,nlev if (CVmix_kpp_params_in%lavg_N_or_Nsqr) then - N_cntr(kt)=sqrt((max(Nsqr_iface(kt),cvmix_zero) + & - max(Nsqr_iface(kt+1),cvmix_zero)) * & - 0.5_cvmix_r8) + N_cntr(kt)=0.5_cvmix_r8*(sqrt(max(Nsqr_iface(kt),cvmix_zero)) + & + sqrt(max(Nsqr_iface(kt+1),cvmix_zero))) else N_cntr(kt)=sqrt(max(Nsqr_iface(kt+1),cvmix_zero)) end if