Skip to content

Commit d4770e8

Browse files
authored
Correct bug in kappa shear viscosity with vertex shear option. (#824)
* Correct bug in kappa shear viscosity with vertex shear option. - Viscosities at vertices along the coast were incorrectly zero'd out. This commit removes that mask so the non-zero shear driven viscosities can be interpolated from in the model. This bug caused diffusivities to be very large in channels and potentially near coastlines. - A bugfix flag is added with an option to use the current behavior for legacy purposes. * Fix missing paranthesis in previous commit (VS_viscosity_bug) * Update logging of vertex shear viscosity bug parameter
1 parent bb66d8a commit d4770e8

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/parameterizations/vertical/MOM_kappa_shear.F90

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ module MOM_kappa_shear
9797
!! time average TKE when there is mass in all layers. Otherwise always
9898
!! report the time-averaged TKE, as is currently done when there
9999
!! are some massless layers.
100+
logical :: VS_viscosity_bug !< If true, use a bug in the calculation of the viscosity that sets
101+
!! it to zero for all vertices that are on a coastline.
100102
logical :: restrictive_tolerance_check !< If false, uses the less restrictive tolerance check to
101103
!! determine if a timestep is acceptable for the KS_it outer iteration
102104
!! loop, as the code was originally written. True uses the more
@@ -607,10 +609,17 @@ subroutine Calc_kappa_shear_vertex(u_in, v_in, h, T_in, S_in, tv, p_surf, kappa_
607609
enddo
608610
endif ; enddo ! i-loop
609611

610-
do K=1,nz+1 ; do I=IsB,IeB
611-
tke_io(I,J,K) = G%mask2dBu(I,J) * tke_2d(I,K)
612-
kv_io(I,J,K) = ( G%mask2dBu(I,J) * kappa_2d(I,K,J2) ) * CS%Prandtl_turb
613-
enddo ; enddo
612+
if (CS%VS_viscosity_bug) then
613+
do K=1,nz+1 ; do I=IsB,IeB
614+
tke_io(I,J,K) = G%mask2dBu(I,J) * tke_2d(I,K)
615+
kv_io(I,J,K) = ( G%mask2dBu(I,J) * kappa_2d(I,K,J2) ) * CS%Prandtl_turb
616+
enddo; enddo
617+
else
618+
do K=1,nz+1 ; do I=IsB,IeB
619+
tke_io(I,J,K) = tke_2d(I,K)
620+
kv_io(I,J,K) = kappa_2d(I,K,J2) * CS%Prandtl_turb
621+
enddo; enddo
622+
endif
614623
if (J>=G%jsc) then ; do K=1,nz+1 ; do i=G%isc,G%iec
615624
! Set the diffusivities in tracer columns from the values at vertices.
616625
kappa_io(i,j,K) = G%mask2dT(i,j) * 0.25 * &
@@ -1873,6 +1882,10 @@ function kappa_shear_init(Time, G, GV, US, param_file, diag, CS)
18731882
"If true, do the calculations of the shear-driven mixing "//&
18741883
"at the cell vertices (i.e., the vorticity points).", &
18751884
default=.false., do_not_log=just_read)
1885+
call get_param(param_file, mdl, "VERTEX_SHEAR_VISCOSITY_BUG", CS%VS_viscosity_bug, &
1886+
"If true, use a bug in vertex shear that zeros out viscosities at "//&
1887+
"vertices on coastlines.", &
1888+
default=.true., do_not_log=just_read.or.(.not.CS%KS_at_vertex))
18761889
call get_param(param_file, mdl, "RINO_CRIT", CS%RiNo_crit, &
18771890
"The critical Richardson number for shear mixing.", &
18781891
units="nondim", default=0.25, do_not_log=just_read)

0 commit comments

Comments
 (0)