ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
CanopyTurbulence Struct Reference

#include <ERF_CanopyTurbStruct.H>

Collaboration diagram for CanopyTurbulence:

Public Member Functions

void init_params (amrex::ParmParse &pp)
 
void check_config (bool do_forest_drag, bool keqn_on_every_level, bool implicit_diss_on_every_level) const
 

Public Attributes

bool enabled = false
 erf.forest_canopy_tke: add the canopy terms to the k-eqn RANS model More...
 
amrex::Real beta_p = amrex::Real(1.0)
 erf.forest_canopy_beta_p: fraction of the drag work that becomes TKE More...
 
amrex::Real beta_d = amrex::Real(4.0)
 erf.forest_canopy_beta_d: short-circuit dissipation coefficient More...
 
amrex::Real length_alpha = amrex::Real(0.04)
 

Detailed Description

Inputs of the canopy terms of the k-eqn RANS model (erf.forest_canopy_*). The terms themselves are in Source/SourceTerms/ERF_CanopyTurbulence.H.

Member Function Documentation

◆ check_config()

void CanopyTurbulence::check_config ( bool  do_forest_drag,
bool  keqn_on_every_level,
bool  implicit_diss_on_every_level 
) const
inline

The canopy terms act on the forest drag field and on the k-eqn RANS model only: abort when either is missing, rather than ignore the input, and when the length cap would meet the explicit TKE dissipation.

Parameters
do_forest_draga forest is configured (erf.forest_file or gridded)
keqn_on_every_levelerf.rans_type = kEqn on every level
implicit_diss_on_every_levelerf.implicit_tke_dissipation on every level
77  {
78  if (!enabled) { return; }
79  if (!do_forest_drag) {
80  amrex::Abort("erf.forest_canopy_tke = true needs a forest: set erf.forest_file, "
81  "or the gridded erf.forest_lai_file/forest_height_file inputs");
82  }
83  if (!keqn_on_every_level) {
84  amrex::Abort("erf.forest_canopy_tke = true needs erf.rans_type = kEqn on every "
85  "level");
86  }
87  // The cap makes the explicit dissipation rho Cmu0^3 k^1.5 / L stiff: with
88  // L = alpha / f its rate Cmu0^3 sqrt(k) f / alpha exceeds 1/dt, and k can go
89  // negative in one step, at time steps of a fraction of a second in a dense
90  // canopy (f = 0.6 1/m and k = 5 m^2/s^2 give 5.8 1/s). The implicit form has
91  // no such limit, so the cap requires it rather than warning about it.
92  if (length_alpha > amrex::Real(0.0) && !implicit_diss_on_every_level) {
93  amrex::Abort("erf.forest_canopy_tke = true with erf.forest_canopy_length_alpha > 0 "
94  "needs erf.implicit_tke_dissipation = true on every level: the canopy "
95  "length cap makes the explicit TKE dissipation stiff (see the Forest "
96  "model section of the docs)");
97  }
98  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
amrex::Real length_alpha
Definition: ERF_CanopyTurbStruct.H:25
bool enabled
erf.forest_canopy_tke: add the canopy terms to the k-eqn RANS model
Definition: ERF_CanopyTurbStruct.H:18

◆ init_params()

void CanopyTurbulence::init_params ( amrex::ParmParse &  pp)
inline

Read the erf.forest_canopy_* inputs and check their ranges. The checks that need the rest of the configuration (a forest and the k-eqn model) are in check_config.

33  {
34  pp.query("forest_canopy_tke", enabled);
35  const bool has_beta_p = pp.query("forest_canopy_beta_p", beta_p);
36  const bool has_beta_d = pp.query("forest_canopy_beta_d", beta_d);
37  const bool has_alpha = pp.query("forest_canopy_length_alpha", length_alpha);
38 
39  // Unused coefficients are left in place (with a warning) so that a deck
40  // can switch the canopy terms on and off with erf.forest_canopy_tke alone;
41  // their ranges are still checked below
42  if (!enabled && (has_beta_p || has_beta_d || has_alpha)) {
43  amrex::Warning("erf.forest_canopy_beta_p, erf.forest_canopy_beta_d and "
44  "erf.forest_canopy_length_alpha are not used without "
45  "erf.forest_canopy_tke = true");
46  }
47  if (!(beta_p >= amrex::Real(0.0) && beta_p <= amrex::Real(1.0))) {
48  amrex::Abort("erf.forest_canopy_beta_p must be in [0, 1], the fraction of the "
49  "drag work that becomes TKE; got " + std::to_string(beta_p));
50  }
51  if (!(beta_d >= amrex::Real(0.0) && std::isfinite(beta_d))) {
52  amrex::Abort("erf.forest_canopy_beta_d must be finite and not negative; got " +
53  std::to_string(beta_d));
54  }
55  if (!(length_alpha >= amrex::Real(0.0) && length_alpha <= amrex::Real(1.0))) {
56  amrex::Abort("erf.forest_canopy_length_alpha must be in [0, 1] (0 disables the "
57  "length scale cap); got " + std::to_string(length_alpha));
58  }
59  if (enabled && beta_p == amrex::Real(0.0) && beta_d == amrex::Real(0.0) &&
60  length_alpha == amrex::Real(0.0)) {
61  amrex::Abort("erf.forest_canopy_tke = true with erf.forest_canopy_beta_p, "
62  "erf.forest_canopy_beta_d and erf.forest_canopy_length_alpha all "
63  "zero would change nothing; set erf.forest_canopy_tke = false");
64  }
65  }
ParmParse pp("prob")
amrex::Real beta_d
erf.forest_canopy_beta_d: short-circuit dissipation coefficient
Definition: ERF_CanopyTurbStruct.H:22
amrex::Real beta_p
erf.forest_canopy_beta_p: fraction of the drag work that becomes TKE
Definition: ERF_CanopyTurbStruct.H:20

Referenced by SolverChoice::init_params().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ beta_d

amrex::Real CanopyTurbulence::beta_d = amrex::Real(4.0)

erf.forest_canopy_beta_d: short-circuit dissipation coefficient

Referenced by AddCanopyTKESources(), and init_params().

◆ beta_p

amrex::Real CanopyTurbulence::beta_p = amrex::Real(1.0)

erf.forest_canopy_beta_p: fraction of the drag work that becomes TKE

Referenced by AddCanopyTKESources(), and init_params().

◆ enabled

bool CanopyTurbulence::enabled = false

erf.forest_canopy_tke: add the canopy terms to the k-eqn RANS model

Referenced by check_config(), ComputeTurbulentViscosityRANS(), init_params(), and make_sources().

◆ length_alpha

amrex::Real CanopyTurbulence::length_alpha = amrex::Real(0.04)

erf.forest_canopy_length_alpha: length scale cap L <= alpha / f; zero disables the cap and keeps the TKE source

Referenced by check_config(), ComputeTurbulentViscosityRANS(), and init_params().


The documentation for this struct was generated from the following file: