Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few minor changes in vertical viscosity #838

Merged
merged 2 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/core/MOM_variables.F90
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ module MOM_variables

!> Vertical viscosities, drag coefficients, and related fields.
type, public :: vertvisc_type
real :: Prandtl_turb !< The Prandtl number for the turbulent diffusion
!! that is captured in Kd_shear [nondim].
real, allocatable, dimension(:,:) :: &
bbl_thick_u, & !< The bottom boundary layer thickness at the u-points [Z ~> m].
bbl_thick_v, & !< The bottom boundary layer thickness at the v-points [Z ~> m].
Expand Down
2 changes: 1 addition & 1 deletion src/parameterizations/vertical/MOM_kappa_shear.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ function kappa_shear_init(Time, G, GV, US, param_file, diag, CS)
default=13, do_not_log=just_read)
call get_param(param_file, mdl, "PRANDTL_TURB", CS%Prandtl_turb, &
"The turbulent Prandtl number applied to shear instability.", &
units="nondim", default=1.0, do_not_log=.true.)
units="nondim", default=1.0, do_not_log=just_read)
call get_param(param_file, mdl, "VEL_UNDERFLOW", CS%vel_underflow, &
"A negligibly small velocity magnitude below which velocity components are set "//&
"to 0. A reasonable value might be 1e-30 m/s, which is less than an "//&
Expand Down
44 changes: 16 additions & 28 deletions src/parameterizations/vertical/MOM_set_viscosity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, pbv)

if (.not.use_BBL_EOS) Rml_vel(:,:) = 0.0

! Resetting Ray_[uv] is required by body force drag.
if (allocated(visc%Ray_u)) visc%Ray_u(:,:,:) = 0.0
if (allocated(visc%Ray_v)) visc%Ray_v(:,:,:) = 0.0

Expand Down Expand Up @@ -582,6 +583,21 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, pbv)
endif
endif ; endif

! Set the "back ground" friction velocity scale to either the tidal amplitude or place-holder constant
if (CS%BBL_use_tidal_bg) then
do i=is,ie ; if (do_i(i)) then ; if (m==1) then
u2_bg(I) = 0.5*( G%mask2dT(i,j)*(CS%tideamp(i,j)*CS%tideamp(i,j))+ &
G%mask2dT(i+1,j)*(CS%tideamp(i+1,j)*CS%tideamp(i+1,j)) )
else
u2_bg(i) = 0.5*( G%mask2dT(i,j)*(CS%tideamp(i,j)*CS%tideamp(i,j))+ &
G%mask2dT(i,j+1)*(CS%tideamp(i,j+1)*CS%tideamp(i,j+1)) )
endif ; endif ; enddo
else
do i=is,ie ; if (do_i(i)) then
u2_bg(i) = CS%drag_bg_vel * CS%drag_bg_vel
endif ; enddo
endif

if (use_BBL_EOS .or. CS%body_force_drag .or. .not.CS%linear_drag) then
! Calculate the mean velocity magnitude over the bottommost CS%Hbbl of
! the water column for determining the quadratic bottom drag.
Expand All @@ -591,18 +607,6 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, pbv)
dztot_vel = 0.0 ; dzwtot = 0.0
Thtot = 0.0 ; Shtot = 0.0 ; SpV_htot = 0.0

! Set the "back ground" friction velocity scale to either the tidal amplitude or place-holder constant
if (CS%BBL_use_tidal_bg) then
if (m==1) then
u2_bg(I) = 0.5*( G%mask2dT(i,j)*(CS%tideamp(i,j)*CS%tideamp(i,j))+ &
G%mask2dT(i+1,j)*(CS%tideamp(i+1,j)*CS%tideamp(i+1,j)) )
else
u2_bg(i) = 0.5*( G%mask2dT(i,j)*(CS%tideamp(i,j)*CS%tideamp(i,j))+ &
G%mask2dT(i,j+1)*(CS%tideamp(i,j+1)*CS%tideamp(i,j+1)) )
endif
else
u2_bg(i) = CS%drag_bg_vel * CS%drag_bg_vel
endif
do k=nz,1,-1

if (htot_vel>=CS%Hbbl) exit ! terminate the k loop
Expand Down Expand Up @@ -802,19 +806,6 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, pbv)
if (m==1) then ; C2f = G%CoriolisBu(I,J-1) + G%CoriolisBu(I,J)
else ; C2f = G%CoriolisBu(I-1,J) + G%CoriolisBu(I,J) ; endif

! Set the "back ground" friction velocity scale to either the tidal amplitude or place-holder constant
if (CS%BBL_use_tidal_bg) then
if (m==1) then
u2_bg(I) = 0.5*( G%mask2dT(i,j)*(CS%tideamp(i,j)*CS%tideamp(i,j))+ &
G%mask2dT(i+1,j)*(CS%tideamp(i+1,j)*CS%tideamp(i+1,j)) )
else
u2_bg(i) = 0.5*( G%mask2dT(i,j)*(CS%tideamp(i,j)*CS%tideamp(i,j))+ &
G%mask2dT(i,j+1)*(CS%tideamp(i,j+1)*CS%tideamp(i,j+1)) )
endif
else
u2_bg(i) = CS%drag_bg_vel * CS%drag_bg_vel
endif

! The thickness of a rotation limited BBL ignoring stratification is
! h_f ~ Cn u* / f (limit of KW99 eq. 2.20 for N->0).
! The buoyancy limit of BBL thickness (h_N) is already in the variable htot from above.
Expand Down Expand Up @@ -2956,9 +2947,6 @@ subroutine set_visc_init(Time, G, GV, US, param_file, diag, visc, CS, restart_CS
CS%RiNo_mix = kappa_shear_is_used(param_file)
endif

call get_param(param_file, mdl, "PRANDTL_TURB", visc%Prandtl_turb, &
"The turbulent Prandtl number applied to shear "//&
"instability.", units="nondim", default=1.0)
call get_param(param_file, mdl, "DEBUG", CS%debug, default=.false.)

call get_param(param_file, mdl, "DYNAMIC_VISCOUS_ML", CS%dynamic_viscous_ML, &
Expand Down
6 changes: 1 addition & 5 deletions src/parameterizations/vertical/MOM_vert_friction.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2105,11 +2105,7 @@ subroutine find_coupling_coef(a_cpl, hvel, do_i, h_harm, bbl_thick, kv_bbl, z_i,
dhc = hvel(i,nz)*0.5
! These expressions assume that Kv_tot(i,nz+1) = CS%Kv, consistent with
! the suppression of turbulent mixing by the presence of a solid boundary.
if (dhc < bbl_thick(i)) then
a_cpl(i,nz+1) = kv_bbl(i) / ((dhc+h_neglect) + I_amax*kv_bbl(i))
else
a_cpl(i,nz+1) = kv_bbl(i) / ((bbl_thick(i)+h_neglect) + I_amax*kv_bbl(i))
endif
a_cpl(i,nz+1) = kv_bbl(i) / ((min(dhc, bbl_thick(i)) + h_neglect) + I_amax*kv_bbl(i))
endif ; enddo
do K=nz,2,-1 ; do i=is,ie ; if (do_i(i)) then
! botfn determines when a point is within the influence of the bottom
Expand Down