Skip to content

Commit afac94a

Browse files
committed
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]))
1 parent ac9c75b commit afac94a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/shared/cvmix_kpp.F90

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ subroutine cvmix_init_kpp(ri_crit, minOBLdepth, maxOBLdepth, minVtsqr, &
456456
call cvmix_put_kpp('lavg_N_or_Nsqr', lavg_N_or_Nsqr, &
457457
CVmix_kpp_params_user)
458458
else
459-
call cvmix_put_kpp('lavg_N_or_Nsqr', .false., CVmix_kpp_params_user)
459+
call cvmix_put_kpp('lavg_N_or_Nsqr', .true., CVmix_kpp_params_user)
460460
end if
461461

462462
!EOC
@@ -2136,9 +2136,8 @@ function cvmix_kpp_compute_unresolved_shear(zt_cntr, ws_cntr, N_iface, &
21362136
end if
21372137
do kt=1,nlev
21382138
if (CVmix_kpp_params_in%lavg_N_or_Nsqr) then
2139-
N_cntr(kt)=sqrt((max(Nsqr_iface(kt),cvmix_zero) + &
2140-
max(Nsqr_iface(kt+1),cvmix_zero)) * &
2141-
0.5_cvmix_r8)
2139+
N_cntr(kt)=0.5_cvmix_r8*(sqrt(max(Nsqr_iface(kt),cvmix_zero)) + &
2140+
sqrt(max(Nsqr_iface(kt+1),cvmix_zero)))
21422141
else
21432142
N_cntr(kt)=sqrt(max(Nsqr_iface(kt+1),cvmix_zero))
21442143
end if

0 commit comments

Comments
 (0)