Skip to content

Commit

Permalink
Add option to specify eddy diffusivities for moist vars from MYNN
Browse files Browse the repository at this point in the history
  • Loading branch information
ewquon committed Aug 15, 2024
1 parent 359c1dd commit 6543199
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 50 deletions.
99 changes: 52 additions & 47 deletions Docs/sphinx_doc/Inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -846,53 +846,58 @@ PBL Scheme
List of Parameters
------------------

+----------------------------------+--------------------+---------------------+-------------+
| Parameter | Definition | Acceptable | Default |
| | | Values | |
+==================================+====================+=====================+=============+
| **erf.pbl_type** | Name of PBL Scheme | "None", "MYNN2.5", | "None" |
| | to be used | "YSU" | |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_A1** | MYNN Constant A1 | Real | 1.18 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_A2** | MYNN Constant A2 | Real | 0.665 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_B1** | MYNN Constant B1 | Real | 24.0 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_B2** | MYNN Constant B2 | Real | 15.0 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C1** | MYNN Constant C1 | Real | 0.137 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C2** | MYNN Constant C1 | Real | 0.75 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C3** | MYNN Constant C3 | Real | 0.352 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C4** | MYNN Constant C4 | Real | 0.0 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C5** | MYNN Constant C5 | Real | 0.2 |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.advect_QKE** | Include advection | bool | 1 |
| | terms in QKE eqn | | |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.diffuse_QKE_3D** | Include horizontal | bool | 0 |
| | turb. diffusion | | |
| | terms in QKE eqn. | | |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_ysu_over_land** | Treat whole domain | bool | 1 |
| | as being over land | | |
| | for YSU PBL scheme | | |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_ysu_land_Ribcr** | Over land critical | Real | 0.25 |
| | Richardson number | | |
| | for YSU PBL Scheme | | |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_ysu_unst_Ribcr** | Unstable critical | Real | 0.0 |
| | Richardson number | | |
| | for YSU PBL Scheme | | |
+----------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_ysu_coriolis_freq** | Coriolis frq. used | Real | 1.0e-4 |
| | for YSU PBL Scheme | | |
+----------------------------------+--------------------+---------------------+-------------+
+------------------------------------+--------------------+---------------------+-------------+
| Parameter | Definition | Acceptable | Default |
| | | Values | |
+====================================+====================+=====================+=============+
| **erf.pbl_type** | Name of PBL Scheme | "None", "MYNN2.5", | "None" |
| | to be used | "YSU" | |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_A1** | MYNN Constant A1 | Real | 1.18 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_A2** | MYNN Constant A2 | Real | 0.665 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_B1** | MYNN Constant B1 | Real | 24.0 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_B2** | MYNN Constant B2 | Real | 15.0 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C1** | MYNN Constant C1 | Real | 0.137 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C2** | MYNN Constant C1 | Real | 0.75 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C3** | MYNN Constant C3 | Real | 0.352 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C4** | MYNN Constant C4 | Real | 0.0 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_C5** | MYNN Constant C5 | Real | 0.2 |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_mynn_diffuse_moistvars** | Diffuse moisture | bool | 0 |
| | variables using | | |
| | modeled eddy | | |
| | diffusivity | | |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.advect_QKE** | Include advection | bool | 1 |
| | terms in QKE eqn | | |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.diffuse_QKE_3D** | Include horizontal | bool | 0 |
| | turb. diffusion | | |
| | terms in QKE eqn. | | |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_ysu_over_land** | Treat whole domain | bool | 1 |
| | as being over land | | |
| | for YSU PBL scheme | | |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_ysu_land_Ribcr** | Over land critical | Real | 0.25 |
| | Richardson number | | |
| | for YSU PBL Scheme | | |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_ysu_unst_Ribcr** | Unstable critical | Real | 0.0 |
| | Richardson number | | |
| | for YSU PBL Scheme | | |
+------------------------------------+--------------------+---------------------+-------------+
| **erf.pbl_ysu_coriolis_freq** | Coriolis frq. used | Real | 1.0e-4 |
| | for YSU PBL Scheme | | |
+------------------------------------+--------------------+---------------------+-------------+

Note that both PBL schemes must be used in conjunction with a MOST boundary condition
at the surface (Zlo) boundary. The YSU scheme is work in progress currently.
Expand Down
4 changes: 4 additions & 0 deletions Source/DataStructs/TurbStruct.H
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct TurbChoice {
pp.query("pbl_mynn_C5", pbl_mynn_C5);
pbl_mynn_level2.init_coeffs(pbl_mynn_A1, pbl_mynn_A2, pbl_mynn_B1, pbl_mynn_B2,
pbl_mynn_C1, pbl_mynn_C2, pbl_mynn_C3, pbl_mynn_C4, pbl_mynn_C5);
pp.query("pbl_mynn_diffuse_moistvars", pbl_mynn_diffuse_moistvars);
} else if (pbl_type == PBLType::YSU) {
pp.query("pbl_ysu_coriolis_freq", pbl_ysu_coriolis_freq);
pp.query("pbl_ysu_over_land", pbl_ysu_over_land);
Expand Down Expand Up @@ -187,6 +188,7 @@ struct TurbChoice {
pp.query("pbl_mynn_C5", pbl_mynn_C5, lev);
pbl_mynn_level2.init_coeffs(pbl_mynn_A1, pbl_mynn_A2, pbl_mynn_B1, pbl_mynn_B2,
pbl_mynn_C1, pbl_mynn_C2, pbl_mynn_C3, pbl_mynn_C4, pbl_mynn_C5);
pp.query("pbl_mynn_diffuse_moistvars", pbl_mynn_diffuse_moistvars, lev);
} else if (pbl_type == PBLType::YSU) {
pp.query("pbl_ysu_coriolis_freq", pbl_ysu_coriolis_freq);
pp.query("pbl_ysu_over_land", pbl_ysu_over_land);
Expand Down Expand Up @@ -303,6 +305,8 @@ struct TurbChoice {
// PBL model
PBLType pbl_type;

bool pbl_mynn_diffuse_moistvars = false;

// Model coefficients - MYNN2.5 (from Nakanishi & Niino 2009 [NN09])
// TODO: Move to MYNNStruct.H
amrex::Real pbl_mynn_A1 = 1.18;
Expand Down
2 changes: 0 additions & 2 deletions Source/Diffusion/ComputeTurbulentViscosity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ void ComputeTurbulentViscosityLES (const MultiFab& Tau11, const MultiFab& Tau22,
}
}

// refactor the code to eliminate the need for ifdef's
for (auto n = 1; n < (EddyDiff::NumDiffs-1)/2; ++n) {
int offset = (EddyDiff::NumDiffs-1)/2;
switch (n)
Expand Down Expand Up @@ -399,7 +398,6 @@ void ComputeTurbulentViscosityLES (const MultiFab& Tau11, const MultiFab& Tau22,

const Array4<Real>& mu_turb = eddyViscosity.array(mfi);

// refactor the code to eliminate the need for ifdef's
for (auto n = 0; n < (EddyDiff::NumDiffs-1)/2; ++n) {
int offset = (EddyDiff::NumDiffs-1)/2;
switch (n)
Expand Down
9 changes: 8 additions & 1 deletion Source/Diffusion/PBLModels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ ComputeTurbulentViscosityPBL (const MultiFab& xvel,
const Real C5 = turbChoice.pbl_mynn_C5;
auto level2 = turbChoice.pbl_mynn_level2;

const bool update_moist_eddydiff = turbChoice.pbl_mynn_diffuse_moistvars;

// Dirichlet flags to switch derivative stencil
bool c_ext_dir_on_zlo = ( (bc_ptr[BCVars::cons_bc].lo(2) == ERFBCType::ext_dir) );
bool c_ext_dir_on_zhi = ( (bc_ptr[BCVars::cons_bc].lo(5) == ERFBCType::ext_dir) );
Expand Down Expand Up @@ -265,8 +267,13 @@ ComputeTurbulentViscosityPBL (const MultiFab& xvel,
K_turb(i,j,k,EddyDiff::Theta_v) = rho * Lturb * qvel(i,j,k) * SH;
K_turb(i,j,k,EddyDiff::QKE_v) = rho * Lturb * qvel(i,j,k) * SQ;

// NN09 gives the total water content flux; this assumes that
// all the species have the same eddy diffusivity
if (update_moist_eddydiff) {
K_turb(i,j,k,EddyDiff::Q_v) = rho * Lturb * qvel(i,j,k) * SH;
}

K_turb(i,j,k,EddyDiff::PBL_lengthscale) = Lturb;
// TODO: How should this be done for other components (scalars, moisture)
});
}
} else if (turbChoice.pbl_type == PBLType::YSU) {
Expand Down

0 comments on commit 6543199

Please sign in to comment.