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

#include <ERF_DiffStruct.H>

Collaboration diagram for DiffChoice:

Public Member Functions

void init_params (std::string pp_prefix)
 Read diffusion options from the input parameter database. More...
 
void display ()
 Print the configured diffusion options. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool host_transports (int n) const noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool implicit_q (int n) const noexcept
 

Public Attributes

MolecDiffType molec_diff_type = MolecDiffType::Constant
 Selected molecular transport model. More...
 
amrex::Real alpha_T = zero
 Kinematic temperature diffusivity [m2/s]. More...
 
amrex::Real alpha_C = zero
 Kinematic scalar diffusivity [m2/s]. More...
 
amrex::Real rho0_trans = one
 Reference density used to compute dynamic diffusion coefficients [kg/m3]. More...
 
amrex::Real rhoAlpha_T = zero
 Dynamic temperature diffusion coefficient [kg/(m-s)]. More...
 
amrex::Real rhoAlpha_C = zero
 Dynamic scalar diffusion coefficient [kg/(m-s)]. More...
 
amrex::Real dynamic_viscosity = zero
 Dynamic viscosity for momentum diffusion [kg/(m-s)]. More...
 
bool eb_diff_constraint_x = false
 Whether to constrain EB diffusion in the x direction. More...
 
bool eb_diff_constraint_y = false
 Whether to constrain EB diffusion in the y direction. More...
 
bool eb_diff_constraint_z = false
 Whether to constrain EB diffusion in the z direction. More...
 
int n_qstate_moist = NMOIST_max
 Number of water-related conserved components starting at RhoQ1_comp, retaining their water-species molecular-diffusion coefficients. More...
 
int n_qstate_nonmoist = 0
 
amrex::GpuArray< bool, NVAR_max - RhoQ1_comp > qstate_is_diagnostic {}
 

Detailed Description

Container holding diffusion-related choices

Member Function Documentation

◆ display()

void DiffChoice::display ( )
inline

Print the configured diffusion options.

80  {
81  amrex::Print() << "Diffusion choices: " << std::endl;
82  amrex::Print() << " rho0_trans : " << rho0_trans << std::endl;
83  amrex::Print() << " alpha_T : " << alpha_T << std::endl;
84  amrex::Print() << " alpha_C : " << alpha_C << std::endl;
85  amrex::Print() << " dynamic_viscosity : " << dynamic_viscosity << std::endl;
86 
88  amrex::Print() << "Using constant molecular diffusivity (relevant for DNS)" << std::endl;
89  } else if (molec_diff_type == MolecDiffType::None) {
90  amrex::Print() << "Not using any molecular diffusivity, i.e. using the modeled turbulent diffusivity"
91  << std::endl;
92  }
93  }
MolecDiffType molec_diff_type
Selected molecular transport model.
Definition: ERF_DiffStruct.H:96
amrex::Real alpha_C
Kinematic scalar diffusivity [m2/s].
Definition: ERF_DiffStruct.H:100
amrex::Real dynamic_viscosity
Dynamic viscosity for momentum diffusion [kg/(m-s)].
Definition: ERF_DiffStruct.H:108
amrex::Real rho0_trans
Reference density used to compute dynamic diffusion coefficients [kg/m3].
Definition: ERF_DiffStruct.H:103
amrex::Real alpha_T
Kinematic temperature diffusivity [m2/s].
Definition: ERF_DiffStruct.H:99

Referenced by SolverChoice::display().

Here is the caller graph for this function:

◆ host_transports()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool DiffChoice::host_transports ( int  n) const
inlinenoexcept
122  {
123  AMREX_ASSERT(n >= 0 && n < NVAR_max);
124  return n < RhoQ1_comp || !qstate_is_diagnostic[n - RhoQ1_comp];
125  }
#define NVAR_max
Definition: ERF_IndexDefines.H:37
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:66
amrex::GpuArray< bool, NVAR_max - RhoQ1_comp > qstate_is_diagnostic
Definition: ERF_DiffStruct.H:118

Referenced by erf_slow_rhs_post(), if(), and implicit_q().

Here is the caller graph for this function:

◆ implicit_q()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool DiffChoice::implicit_q ( int  n) const
inlinenoexcept
129  {
130  return n >= RhoQ1_comp &&
132  host_transports(n);
133  }
int n_qstate_moist
Number of water-related conserved components starting at RhoQ1_comp, retaining their water-species mo...
Definition: ERF_DiffStruct.H:116
int n_qstate_nonmoist
Definition: ERF_DiffStruct.H:117
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool host_transports(int n) const noexcept
Definition: ERF_DiffStruct.H:121

Referenced by ResolveNativeScalarDiffusionPolicy().

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

◆ init_params()

void DiffChoice::init_params ( std::string  pp_prefix)
inline

Read diffusion options from the input parameter database.

Parameters
pp_prefixParmParse prefix for the ERF input namespace.
31  {
32  amrex::ParmParse pp(pp_prefix);
33 
34  static std::string molec_diff_type_string = "None";
35  pp.queryAdd("molec_diff_type",molec_diff_type_string);
36 
37  if (!molec_diff_type_string.compare("Constant")) {
39  } else if (!molec_diff_type_string.compare("ConstantAlpha")) {
41  } else if (!molec_diff_type_string.compare("None")) {
43  } else {
44  amrex::Error("Don't know this molec_diff_type");
45  }
46 
48  pp.queryAdd("alpha_T", alpha_T);
49  pp.queryAdd("alpha_C", alpha_C);
50  pp.queryAdd("dynamic_viscosity", dynamic_viscosity);
51  pp.queryAdd("rho0_trans", rho0_trans);
52  pp.queryAdd("eb_diff_constraint_x", eb_diff_constraint_x);
53  pp.queryAdd("eb_diff_constraint_y", eb_diff_constraint_y);
54  pp.queryAdd("eb_diff_constraint_z", eb_diff_constraint_z);
55  }
56 
57  // Compute relevant forms of diffusion parameters
60 
62  amrex::Print() << "Using constant kinematic diffusion coefficients" << std::endl;
63  amrex::Print() << " momentum : " << dynamic_viscosity/rho0_trans << " m^2/s" << std::endl;
64  amrex::Print() << " temperature : " << alpha_T << " m^2/s" << std::endl;
65  amrex::Print() << " scalar : " << alpha_C << " m^2/s" << std::endl;
66  }
68  amrex::Print() << "Using constant dynamic diffusion coefficients" << std::endl;
69  amrex::Print() << " momentum : " << dynamic_viscosity << " kg/(m-s)" << std::endl;
70  amrex::Print() << " temperature : " << rhoAlpha_T << " kg/(m-s)" << std::endl;
71  amrex::Print() << " scalar : " << rhoAlpha_C << " kg/(m-s)" << std::endl;
72  }
73 
74  }
ParmParse pp("prob")
bool eb_diff_constraint_z
Whether to constrain EB diffusion in the z direction.
Definition: ERF_DiffStruct.H:111
amrex::Real rhoAlpha_T
Dynamic temperature diffusion coefficient [kg/(m-s)].
Definition: ERF_DiffStruct.H:106
bool eb_diff_constraint_y
Whether to constrain EB diffusion in the y direction.
Definition: ERF_DiffStruct.H:110
bool eb_diff_constraint_x
Whether to constrain EB diffusion in the x direction.
Definition: ERF_DiffStruct.H:109
amrex::Real rhoAlpha_C
Dynamic scalar diffusion coefficient [kg/(m-s)].
Definition: ERF_DiffStruct.H:107

Referenced by SolverChoice::init_params().

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

Member Data Documentation

◆ alpha_C

◆ alpha_T

◆ dynamic_viscosity

◆ eb_diff_constraint_x

DiffChoice::eb_diff_constraint_x = false

Whether to constrain EB diffusion in the x direction.

Referenced by DiffusionSrcForMom_EB(), and init_params().

◆ eb_diff_constraint_y

DiffChoice::eb_diff_constraint_y = false

Whether to constrain EB diffusion in the y direction.

Referenced by DiffusionSrcForMom_EB(), and init_params().

◆ eb_diff_constraint_z

DiffChoice::eb_diff_constraint_z = false

Whether to constrain EB diffusion in the z direction.

Referenced by DiffusionSrcForMom_EB(), and init_params().

◆ molec_diff_type

◆ n_qstate_moist

DiffChoice::n_qstate_moist = NMOIST_max

Number of water-related conserved components starting at RhoQ1_comp, retaining their water-species molecular-diffusion coefficients.

Referenced by implicit_q(), ResolveNativeScalarDiffusionPolicy(), and VerticalMolecularAlphaByPrim().

◆ n_qstate_nonmoist

int DiffChoice::n_qstate_nonmoist = 0

Referenced by implicit_q().

◆ qstate_is_diagnostic

amrex::GpuArray<bool, NVAR_max - RhoQ1_comp> DiffChoice::qstate_is_diagnostic {}

Referenced by host_transports().

◆ rho0_trans

DiffChoice::rho0_trans = one

◆ rhoAlpha_C

DiffChoice::rhoAlpha_C = zero

Dynamic scalar diffusion coefficient [kg/(m-s)].

Referenced by ERF::ComputeDiffusiveRates(), init_params(), ResolveNativeScalarDiffusionPolicy(), and VerticalMolecularAlphaByPrim().

◆ rhoAlpha_T

DiffChoice::rhoAlpha_T = zero

Dynamic temperature diffusion coefficient [kg/(m-s)].

Referenced by ERF::ComputeDiffusiveRates(), init_params(), ResolveNativeScalarDiffusionPolicy(), and VerticalMolecularAlphaByPrim().


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