Skip to content

Commit

Permalink
Add MOM_kappa_shear bug fix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
minghangli-uni committed Feb 20, 2025
1 parent 00e8d34 commit c1188de
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MOM6/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ target_sources(OM3_mom6 PRIVATE
MOM6/src/parameterizations/vertical/MOM_full_convection.F90
MOM6/src/parameterizations/vertical/MOM_geothermal.F90
MOM6/src/parameterizations/vertical/MOM_internal_tide_input.F90
MOM6/src/parameterizations/vertical/MOM_kappa_shear.F90
# MOM6/src/parameterizations/vertical/MOM_kappa_shear.F90
MOM6/src/parameterizations/vertical/MOM_opacity.F90
MOM6/src/parameterizations/vertical/MOM_regularize_layers.F90
MOM6/src/parameterizations/vertical/MOM_set_diffusivity.F90
Expand Down Expand Up @@ -381,6 +381,7 @@ add_patched_source(OM3_mom6 MOM6/src/tracer/MOM_generic_tracer.F90)
add_patched_source(OM3_mom6 MOM6/src/core/MOM_forcing_type.F90)
add_patched_source(OM3_mom6 MOM6/config_src/infra/FMS2/MOM_io_infra.F90)
add_patched_source(OM3_mom6 MOM6/src/diagnostics/MOM_PointAccel.F90)
add_patched_source(OM3_mom6 MOM6/src/parameterizations/vertical/MOM_kappa_shear.F90)
### Install and Export

## Library
Expand Down
46 changes: 46 additions & 0 deletions MOM6/patches/MOM_kappa_shear.F90.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/src/parameterizations/vertical/MOM_kappa_shear.F90 b/src/parameterizations/vertical/MOM_kappa_shear.F90.new
index f2c47ab21..ce10c84cf 100644
--- a/src/parameterizations/vertical/MOM_kappa_shear.F90
+++ b/src/parameterizations/vertical/MOM_kappa_shear.F90
@@ -97,6 +97,8 @@ type, public :: Kappa_shear_CS ; private
!! time average TKE when there is mass in all layers. Otherwise always
!! report the time-averaged TKE, as is currently done when there
!! are some massless layers.
+ logical :: VS_viscosity_bug !< If true, use a bug in the calculation of the viscosity that sets
+ !! it to zero for all vertices that are on a coastline.
logical :: restrictive_tolerance_check !< If false, uses the less restrictive tolerance check to
!! determine if a timestep is acceptable for the KS_it outer iteration
!! 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_
enddo
endif ; enddo ! i-loop

- do K=1,nz+1 ; do I=IsB,IeB
- tke_io(I,J,K) = G%mask2dBu(I,J) * tke_2d(I,K)
- kv_io(I,J,K) = ( G%mask2dBu(I,J) * kappa_2d(I,K,J2) ) * CS%Prandtl_turb
- enddo ; enddo
+ if (CS%VS_viscosity_bug) then
+ do K=1,nz+1 ; do I=IsB,IeB
+ tke_io(I,J,K) = G%mask2dBu(I,J) * tke_2d(I,K)
+ kv_io(I,J,K) = ( G%mask2dBu(I,J) * kappa_2d(I,K,J2) ) * CS%Prandtl_turb
+ enddo; enddo
+ else
+ do K=1,nz+1 ; do I=IsB,IeB
+ tke_io(I,J,K) = tke_2d(I,K)
+ kv_io(I,J,K) = kappa_2d(I,K,J2) * CS%Prandtl_turb
+ enddo; enddo
+ endif
if (J>=G%jsc) then ; do K=1,nz+1 ; do i=G%isc,G%iec
! Set the diffusivities in tracer columns from the values at vertices.
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)
"If true, do the calculations of the shear-driven mixing "//&
"at the cell vertices (i.e., the vorticity points).", &
default=.false., do_not_log=just_read)
+ call get_param(param_file, mdl, "VERTEX_SHEAR_VISCOSITY_BUG", CS%VS_viscosity_bug, &
+ "If true, use a bug in vertex shear that zeros out viscosities at "//&
+ "vertices on coastlines.", &
+ default=.true., do_not_log=just_read.or.(.not.CS%KS_at_vertex))
call get_param(param_file, mdl, "RINO_CRIT", CS%RiNo_crit, &
"The critical Richardson number for shear mixing.", &
units="nondim", default=0.25, do_not_log=just_read)

0 comments on commit c1188de

Please sign in to comment.