Skip to content

Commit

Permalink
Make CEMP_NL an user-defined parameter
Browse files Browse the repository at this point in the history
Changed the empirical coefficient for non-local momentum mixing (Cemp_NL)
from a hardcoded value to a user-defined parameter.
  • Loading branch information
gustavo-marques committed Aug 24, 2024
1 parent db4f712 commit 688f11f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
12 changes: 9 additions & 3 deletions src/core/MOM_dynamics_split_RK2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ module MOM_dynamics_split_RK2
!! the extent to which the treatment of gravity waves
!! is forward-backward (0) or simulated backward
!! Euler (1) [nondim]. 0 is often used.
logical :: debug !< If true, write verbose checksums for debugging purposes.
real :: Cemp_NL !< Empirical coefficient of non-local momentum mixing [nondim]
logical :: debug !< If true, write verbose checksums for debugging purposes.
logical :: debug_OBC !< If true, do debugging calls for open boundary conditions.
logical :: fpmix !< If true, add non-local momentum flux increments and diffuse down the Eulerian gradient.
logical :: module_is_initialized = .false. !< Record whether this module has been initialized.
Expand Down Expand Up @@ -722,7 +723,7 @@ subroutine step_MOM_dyn_split_RK2(u, v, h, tv, visc, Time_local, dt, forces, p_s

! lFPpost must be false in the predictor step to avoid averaging into the diagnostics
lFPpost = .false.
call vertFPmix(up, vp, uold, vold, hbl, h, forces, dt_pred, lFPpost, &
call vertFPmix(up, vp, uold, vold, hbl, h, forces, dt_pred, CS%Cemp_NL, lFPpost, &
G, GV, US, CS%vertvisc_CSp, CS%OBC, waves=waves)
call vertvisc(up, vp, h, forces, visc, dt_pred, CS%OBC, CS%AD_pred, CS%CDp, G, &
GV, US, CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot, fpmix=CS%fpmix, waves=waves)
Expand Down Expand Up @@ -972,7 +973,7 @@ subroutine step_MOM_dyn_split_RK2(u, v, h, tv, visc, Time_local, dt, forces, p_s

if (CS%fpmix) then
lFPpost = .true.
call vertFPmix(u, v, uold, vold, hbl, h, forces, dt, lFPpost, &
call vertFPmix(u, v, uold, vold, hbl, h, forces, dt, CS%Cemp_NL, lFPpost, &
G, GV, US, CS%vertvisc_CSp, CS%OBC, Waves=Waves)
call vertvisc(u, v, h, forces, visc, dt, CS%OBC, CS%ADp, CS%CDp, G, GV, US, &
CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot, fpmix=CS%fpmix, waves=waves)
Expand Down Expand Up @@ -1419,6 +1420,11 @@ subroutine initialize_dyn_split_RK2(u, v, h, uh, vh, eta, Time, G, GV, US, param
call get_param(param_file, mdl, "FPMIX", CS%fpmix, &
"If true, add non-local momentum flux increments and diffuse down the Eulerian gradient.", &
default=.false.)
if (CS%fpmix) then
call get_param(param_file, "MOM", "CEMP_NL", CS%Cemp_NL, &
"Empirical coefficient of non-local momentum mixing.", &
units="nondim", default=3.6)
endif
call get_param(param_file, mdl, "REMAP_AUXILIARY_VARS", CS%remap_aux, &
"If true, apply ALE remapping to all of the auxiliary 3-dimensional "//&
"variables that are needed to reproduce across restarts, similarly to "//&
Expand Down
23 changes: 11 additions & 12 deletions src/parameterizations/vertical/MOM_vert_friction.F90
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ module MOM_vert_friction
contains

!> Add nonlocal stress increments to ui^n and vi^n.
subroutine vertFPmix(ui, vi, uold, vold, hbl_h, h, forces, dt, lpost, G, GV, US, CS, OBC, Waves)
subroutine vertFPmix(ui, vi, uold, vold, hbl_h, h, forces, dt, lpost, Cemp_NL, G, GV, US, CS, OBC, Waves)
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< Ocean vertical grid structure
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), &
Expand All @@ -209,15 +209,16 @@ subroutine vertFPmix(ui, vi, uold, vold, hbl_h, h, forces, dt, lpost, G, GV, US,
intent(inout) :: vold !< Old Meridional velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G)), intent(inout) :: hbl_h !< boundary layer depth [H ~> m]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
intent(in) :: h !< Layer thicknesses [H ~> m or kg m-2]
type(mech_forcing), intent(in) :: forces !< A structure with the driving mechanical forces
real, intent(in) :: dt !< Time increment [T ~> s]
logical, intent(in) :: lpost !< Compute and make available FPMix diagnostics
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(vertvisc_CS), pointer :: CS !< Vertical viscosity control structure
type(ocean_OBC_type), pointer :: OBC !< Open boundary condition structure
intent(in) :: h !< Layer thicknesses [H ~> m or kg m-2]
type(mech_forcing), intent(in) :: forces !< A structure with the driving mechanical forces
real, intent(in) :: dt !< Time increment [T ~> s]
real, intent(in) :: Cemp_NL !< empirical coefficient of non-local momentum mixing [nondim]
logical, intent(in) :: lpost !< Compute and make available FPMix diagnostics
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(vertvisc_CS), pointer :: CS !< Vertical viscosity control structure
type(ocean_OBC_type), pointer :: OBC !< Open boundary condition structure
type(wave_parameters_CS), &
optional, pointer :: Waves !< Container for wave/Stokes information
optional, pointer :: Waves !< Container for wave/Stokes information

! local variables
real, dimension(SZIB_(G),SZJ_(G)) :: hbl_u !< boundary layer depth (u-pts) [H ~> m]
Expand All @@ -241,7 +242,7 @@ subroutine vertFPmix(ui, vi, uold, vold, hbl_h, h, forces, dt, lpost, G, GV, US,
real, dimension(SZI_(G) ,SZJ_(G),SZK_(GV)+1) :: omega_tau2s !< angle stress to shear (h-pts) [rad]
real, dimension(SZI_(G) ,SZJ_(G),SZK_(GV)+1) :: omega_tau2w !< angle stress to wind (h-pts) [rad]

real :: pi, Cemp_NL, tmp_u, tmp_v, omega_tmp, Irho0, fexp !< constants and dummy variables
real :: pi, tmp_u, tmp_v, omega_tmp, Irho0, fexp !< constants and dummy variables
real :: sigma,Gat1,Gsig,dGdsig !< Shape parameters
real :: du, dv, depth, Wind_x, Wind_y !< intermediate variables
real :: taux, tauy, tauxDG, tauyDG, tauxDGup, tauyDGup, ustar2, ustar2min, tauh !< intermediate variables
Expand All @@ -254,8 +255,6 @@ subroutine vertFPmix(ui, vi, uold, vold, hbl_h, h, forces, dt, lpost, G, GV, US,
Isq = G%IscB ; Ieq = G%IecB ; Jsq = G%JscB ; Jeq = G%JecB ; nz = GV%ke

pi = 4. * atan2(1.,1.)
! empirical coefficient of non-local momentum mixing
Cemp_NL = 3.6
Irho0 = 1.0 / GV%Rho0

call pass_var(hbl_h , G%Domain, halo=1)
Expand Down

0 comments on commit 688f11f

Please sign in to comment.