Skip to content

Commit

Permalink
Correct bug in Nsqr_iface averaging
Browse files Browse the repository at this point in the history
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]))
  • Loading branch information
mnlevy1981 committed Mar 10, 2015
1 parent ac9c75b commit afac94a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/shared/cvmix_kpp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit afac94a

Please sign in to comment.