Skip to content

Commit

Permalink
Update name to bclModeSpeed
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-petersen committed Mar 20, 2022
1 parent db5982a commit 6ab06ba
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 33 deletions.
4 changes: 2 additions & 2 deletions components/mpas-ocean/bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,8 @@ add_default($nl, 'config_Redi_N2_based_taper_limit_term1');
add_default($nl, 'config_use_GM');
add_default($nl, 'config_GM_closure');
add_default($nl, 'config_GM_constant_kappa');
add_default($nl, 'config_GM_gravWaveSpeed');
add_default($nl, 'config_GM_constant_gravWaveSpeed');
add_default($nl, 'config_GM_constant_bclModeSpeed');
add_default($nl, 'config_GM_minBclModeSpeed_method');
add_default($nl, 'config_GM_spatially_variable_min_kappa');
add_default($nl, 'config_GM_spatially_variable_max_kappa');
add_default($nl, 'config_GM_spatially_variable_baroclinic_mode');
Expand Down
4 changes: 2 additions & 2 deletions components/mpas-ocean/bld/build-namelist-section
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ add_default($nl, 'config_Redi_N2_based_taper_limit_term1');
add_default($nl, 'config_use_GM');
add_default($nl, 'config_GM_closure');
add_default($nl, 'config_GM_constant_kappa');
add_default($nl, 'config_GM_gravWaveSpeed');
add_default($nl, 'config_GM_constant_gravWaveSpeed');
add_default($nl, 'config_GM_constant_bclModeSpeed');
add_default($nl, 'config_GM_minBclModeSpeed_method');
add_default($nl, 'config_GM_spatially_variable_min_kappa');
add_default($nl, 'config_GM_spatially_variable_max_kappa');
add_default($nl, 'config_GM_spatially_variable_baroclinic_mode');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
<config_GM_constant_kappa ocn_forcing="datm_forced_restoring" ocn_grid="WCAtl12to45E2r4">600.0</config_GM_constant_kappa>
<config_GM_constant_kappa ocn_forcing="datm_forced_restoring" ocn_grid="SOwISC12to60E2r4">600.0</config_GM_constant_kappa>
<config_GM_constant_kappa ocn_forcing="datm_forced_restoring" ocn_grid="ECwISC30to60E2r1">600.0</config_GM_constant_kappa>
<config_GM_gravWaveSpeed>'constant'</config_GM_gravWaveSpeed>
<config_GM_constant_gravWaveSpeed>0.3</config_GM_constant_gravWaveSpeed>
<config_GM_constant_bclModeSpeed>0.3</config_GM_constant_bclModeSpeed>
<config_GM_minBclModeSpeed_method>'constant'</config_GM_minBclModeSpeed_method>
<config_GM_spatially_variable_min_kappa>300.0</config_GM_spatially_variable_min_kappa>
<config_GM_spatially_variable_max_kappa>1800.0</config_GM_spatially_variable_max_kappa>
<config_GM_spatially_variable_baroclinic_mode>3.0</config_GM_spatially_variable_baroclinic_mode>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,19 +520,19 @@ Valid values: MISSING POSSIBLE VALUES
Default: Defined in namelist_defaults.xml
</entry>

<entry id="config_GM_gravWaveSpeed" type="char*1024"
<entry id="config_GM_constant_bclModeSpeed" type="real"
category="GM_eddy_parameterization" group="GM_eddy_parameterization">
Determines how GM gravity wave speed is computed. If 'constant' then use config_GM_constant_gravWaveSpeed. If 'computed' then compute at every edge at every time step using the Brunt-Vaisala frequency
Gravity wave speed for the vertical stream function boundary value problem. This appears as $c$ in eqn 16a of Ferrari et al. 2010 (https://doi.org/10.1016/j.ocemod.2010.01.004).

Valid values: 'constant', 'computed'
Valid values: Positive real numbers
Default: Defined in namelist_defaults.xml
</entry>

<entry id="config_GM_constant_gravWaveSpeed" type="real"
<entry id="config_GM_minBclModeSpeed_method" type="char*1024"
category="GM_eddy_parameterization" group="GM_eddy_parameterization">
Gravity wave speed for the vertical stream function boundary value problem. This appears as $c$ in eqn 16a of Ferrari et al. 2010 (https://doi.org/10.1016/j.ocemod.2010.01.004).
Determines how the GM setting for the minimum of the first baroclinic mode speed is computed. If 'constant' then use config_GM_constant_bclModeSpeed. If 'computed' then compute at every edge at every time step using the Brunt-Vaisala frequency.

Valid values: Positive real numbers
Valid values: 'constant', 'computed'
Default: Defined in namelist_defaults.xml
</entry>

Expand Down
12 changes: 6 additions & 6 deletions components/mpas-ocean/src/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@
<nml_option name="config_GM_constant_kappa" type="real" default_value="600.0" units="m^2 s^{-1}"
description="Coefficient of standard GM parametrization of eddy transport (Bolus component), $\kappa$. Only used when config_GM_closure is set to constant."
/>
<nml_option name="config_GM_gravWaveSpeed" type="character" default_value="constant" units="NA"
description="Determines how GM gravity wave speed is computed. If 'constant' then use config_GM_constant_gravWaveSpeed. If 'computed' then compute at every edge at every time step using the Brunt-Vaisala frequency"
possible_values="'constant' and 'computed'"
/>
<nml_option name="config_GM_constant_gravWaveSpeed" type="real" default_value="0.3" units="m/s"
description="Gravity wave speed for the vertical stream function boundary value problem. This appears as $c$ in eqn 16a of Ferrari et al. 2010 (https://doi.org/10.1016/j.ocemod.2010.01.004)."
<nml_option name="config_GM_constant_bclModeSpeed" type="real" default_value="0.3" units="m/s"
description="The parameter setting for the first baroclinic mode speed for the vertical stream function boundary value problem. This appears as $c$ in eqn 16a of Ferrari et al. 2010 (https://doi.org/10.1016/j.ocemod.2010.01.004)."
possible_values="Positive real numbers"
/>
<nml_option name="config_GM_minBclModeSpeed_method" type="character" default_value="constant" units="NA"
description="Determines how the GM setting for the minimum of the first baroclinic mode speed is computed. If 'constant' then use config_GM_constant_bclModeSpeed. If 'computed' then compute at every edge at every time step using the Brunt-Vaisala frequency"
possible_values="'constant' and 'computed'"
/>
<nml_option name="config_GM_spatially_variable_min_kappa" type="real" default_value="300.0" units="m^2 s^{-1}"
description="minimum value of bolus diffusivity for spatially variable GM schemes. Used for all choices of config_GM_closure other than 'constant'."
possible_values="values around 100s"
Expand Down
35 changes: 21 additions & 14 deletions components/mpas-ocean/src/shared/mpas_ocn_gm.F
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ module ocn_gm
logical :: local_config_GM_kappa_lat_depth_variable
logical :: local_config_GM_compute_EdenGreatbatch
real(kind=RKIND) :: slopeTaperFactor, sfcTaperFactor, rediGMinitValue
real(kind=RKIND) :: gm_constant_gravWaveSpeed, gm_computed_gravWaveSpeed_on
real(kind=RKIND) :: local_config_GM_constant_bclModeSpeed
real(kind=RKIND) :: gm_minBclModeSpeed_constant, gm_minBclModeSpeed_compute_on

!***********************************************************************

Expand Down Expand Up @@ -543,10 +544,10 @@ subroutine ocn_GM_compute_Bolus_velocity(statePool, &
! spatially variable baroclinic phase speed, the mode can be specified by
! config_GM_spatially_variable_baroclinic_mode
if (local_config_GM_lat_variable_c2) then
!$omp parallel
!$omp do schedule(runtime) private(k, cell1, cell2, sumN2, lt1, lt2, ltSum, c_min)
lt1 = 0.0_RKIND
lt2 = 0.0_RKIND
!$omp parallel
!$omp do schedule(runtime) private(k, cell1, cell2, sumN2, lt1, lt2, ltSum, c_min)
do iEdge = 1, nEdges
cell1 = cellsOnEdge(1, iEdge)
cell2 = cellsOnEdge(2, iEdge)
Expand All @@ -562,9 +563,13 @@ subroutine ocn_GM_compute_Bolus_velocity(statePool, &
ltSum = ltSum + 0.5*(lt1+lt2)
end do

! compute gravity wave speed, either a specified constant, or
! computed from the Brunt-Vaisala frequency.
c_min = gm_constant_gravWaveSpeed + gm_computed_gravWaveSpeed_on*max(0.01_RKIND,sumN2/ltSum*(0.5*(lt1+lt2)))
! Compute the minimum allowed speed of the first baroclinic mode.
! If config_GM_minBclModeSpeed_method='constant' use local_config_GM_constant_bclModeSpeed.
! If config_GM_minBclModeSpeed_method='computed' use Brunt-Vaisala frequency on this edge.
! See initialization of these variables in this modules init routine.
c_min = gm_minBclModeSpeed_constant + gm_minBclModeSpeed_compute_on*max(0.01_RKIND,sumN2/ltSum*(0.5*(lt1+lt2)))

! Compute the speed of the first baroclinic mode from the Brunt-Vaisala frequency.
cGMphaseSpeed(iEdge) = max(c_min, &
sumN2/(config_GM_spatially_variable_baroclinic_mode*3.141592_RKIND))

Expand All @@ -576,7 +581,7 @@ subroutine ocn_GM_compute_Bolus_velocity(statePool, &
!$omp parallel
!$omp do schedule(runtime)
do iEdge = 1, nEdges
cGMphaseSpeed(iEdge) = config_GM_constant_gravWaveSpeed
cGMphaseSpeed(iEdge) = local_config_GM_constant_bclModeSpeed
end do
!$omp end do
!$omp end parallel
Expand Down Expand Up @@ -917,14 +922,16 @@ subroutine ocn_GM_init(domain, err)!{{{
sfcTaperFactor = 0.0_RKIND
end if

if (config_gm_gravWaveSpeed=='constant') then
gm_constant_gravWaveSpeed = config_gm_constant_gravWaveSpeed
gm_computed_gravWaveSpeed_on = 0.0_RKIND
elseif (config_gm_gravWaveSpeed=='computed') then
gm_constant_gravWaveSpeed = 0.0_RKIND
gm_computed_gravWaveSpeed_on = 1.0_RKIND
local_config_GM_constant_bclModeSpeed = config_GM_constant_bclModeSpeed

if (config_GM_minBclModeSpeed_method=='constant') then
gm_minBclModeSpeed_compute_on = 0.0_RKIND
gm_minBclModeSpeed_constant = config_GM_constant_bclModeSpeed
elseif (config_GM_minBclModeSpeed_method=='computed') then
gm_minBclModeSpeed_compute_on = 1.0_RKIND
gm_minBclModeSpeed_constant = 0.0_RKIND
else
call mpas_log_write('config_gm_gravWaveSpeed must be constant or computed', &
call mpas_log_write('config_GM_minBclModeSpeed_method must be constant or computed', &
MPAS_LOG_CRIT)
end if

Expand Down
2 changes: 1 addition & 1 deletion components/mpas-ocean/src/shared/mpas_ocn_test.F
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ subroutine ocn_init_gm_test_functions(meshPool, scratchPool)!{{{
! zBot is location we apply boundary conditions on the ODE for stream function.
zBot = zMax

L = config_GM_constant_gravWaveSpeed * sqrt(rho_sw * zMax / gravity / config_eos_linear_alpha / config_gm_analytic_temperature3)
L = config_GM_constant_bclModeSpeed * sqrt(rho_sw * zMax / gravity / config_eos_linear_alpha / config_gm_analytic_temperature3)
R = - config_GM_constant_kappa * config_gm_analytic_temperature2 * zMax / config_gm_analytic_temperature3 &
/ config_gm_analytic_ymax
c1 = R*(1-exp(-zBot/L))/(exp(zBot/L) - exp(-zBot/L))
Expand Down

0 comments on commit 6ab06ba

Please sign in to comment.