ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_DiffStruct.H
Go to the documentation of this file.
1 #ifndef ERF_DIFF_STRUCT_H_
2 #define ERF_DIFF_STRUCT_H_
3 
4 #include <string>
5 #include <iostream>
6 
7 #include <AMReX_ParmParse.H>
8 #include <AMReX_Print.H>
9 #include <AMReX_Gpu.H>
10 
11 /**
12  * @brief Molecular diffusion model used for transport coefficients.
13  */
14 enum struct MolecDiffType {
16 };
17 
18 /**
19  * Container holding diffusion-related choices
20  */
21 
22 struct DiffChoice {
23  public:
24  /**
25  * @brief Read diffusion options from the input parameter database.
26  * @param pp_prefix ParmParse prefix for the ERF input namespace.
27  */
28  void init_params (std::string pp_prefix)
29  {
30  amrex::ParmParse pp(pp_prefix);
31 
32  static std::string molec_diff_type_string = "None";
33  pp.query("molec_diff_type",molec_diff_type_string);
34 
35  if (!molec_diff_type_string.compare("Constant")) {
37  } else if (!molec_diff_type_string.compare("ConstantAlpha")) {
39  } else if (!molec_diff_type_string.compare("None")) {
41  } else {
42  amrex::Error("Don't know this molec_diff_type");
43  }
44 
46  pp.query("alpha_T", alpha_T);
47  pp.query("alpha_C", alpha_C);
48  pp.query("dynamic_viscosity", dynamic_viscosity);
49  pp.query("rho0_trans", rho0_trans);
50  pp.query("eb_diff_constraint_x", eb_diff_constraint_x);
51  pp.query("eb_diff_constraint_y", eb_diff_constraint_y);
52  pp.query("eb_diff_constraint_z", eb_diff_constraint_z);
53  }
54 
55  // Compute relevant forms of diffusion parameters
58 
60  amrex::Print() << "Using constant kinematic diffusion coefficients" << std::endl;
61  amrex::Print() << " momentum : " << dynamic_viscosity/rho0_trans << " m^2/s" << std::endl;
62  amrex::Print() << " temperature : " << alpha_T << " m^2/s" << std::endl;
63  amrex::Print() << " scalar : " << alpha_C << " m^2/s" << std::endl;
64  }
66  amrex::Print() << "Using constant dynamic diffusion coefficients" << std::endl;
67  amrex::Print() << " momentum : " << dynamic_viscosity << " kg/(m-s)" << std::endl;
68  amrex::Print() << " temperature : " << rhoAlpha_T << " kg/(m-s)" << std::endl;
69  amrex::Print() << " scalar : " << rhoAlpha_C << " kg/(m-s)" << std::endl;
70  }
71 
72  }
73 
74  /**
75  * @brief Print the configured diffusion options.
76  */
77  void display ()
78  {
79  amrex::Print() << "Diffusion choices: " << std::endl;
80  amrex::Print() << " rho0_trans : " << rho0_trans << std::endl;
81  amrex::Print() << " alpha_T : " << alpha_T << std::endl;
82  amrex::Print() << " alpha_C : " << alpha_C << std::endl;
83  amrex::Print() << " dynamic_viscosity : " << dynamic_viscosity << std::endl;
84 
86  amrex::Print() << "Using constant molecular diffusivity (relevant for DNS)" << std::endl;
87  } else if (molec_diff_type == MolecDiffType::None) {
88  amrex::Print() << "Not using any molecular diffusivity, i.e. using the modeled turbulent diffusivity"
89  << std::endl;
90  }
91  }
92 
93  // Molecular transport model
95 
96  // Diffusive/viscous coefficients [m2/s]
99 
100  // Density for computation of rhoAlpha (which is assumed constant) [kg/m3]
102 
103  // Dynamic diffusion coefficients [kg/(m-s)]
107  bool eb_diff_constraint_x = false;
108  bool eb_diff_constraint_y = false;
109  bool eb_diff_constraint_z = false;
110 };
111 
112 /**
113  * @var DiffChoice::molec_diff_type
114  * @brief Selected molecular transport model.
115  * @var DiffChoice::alpha_T
116  * @brief Kinematic temperature diffusivity [m2/s].
117  * @var DiffChoice::alpha_C
118  * @brief Kinematic scalar diffusivity [m2/s].
119  * @var DiffChoice::rho0_trans
120  * @brief Reference density used to compute dynamic diffusion coefficients [kg/m3].
121  * @var DiffChoice::rhoAlpha_T
122  * @brief Dynamic temperature diffusion coefficient [kg/(m-s)].
123  * @var DiffChoice::rhoAlpha_C
124  * @brief Dynamic scalar diffusion coefficient [kg/(m-s)].
125  * @var DiffChoice::dynamic_viscosity
126  * @brief Dynamic viscosity for momentum diffusion [kg/(m-s)].
127  * @var DiffChoice::eb_diff_constraint_x
128  * @brief Whether to constrain EB diffusion in the x direction.
129  * @var DiffChoice::eb_diff_constraint_y
130  * @brief Whether to constrain EB diffusion in the y direction.
131  * @var DiffChoice::eb_diff_constraint_z
132  * @brief Whether to constrain EB diffusion in the z direction.
133  */
134 #endif
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
MolecDiffType
Molecular diffusion model used for transport coefficients.
Definition: ERF_DiffStruct.H:14
ParmParse pp("prob")
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_DiffStruct.H:22
bool eb_diff_constraint_z
Whether to constrain EB diffusion in the z direction.
Definition: ERF_DiffStruct.H:109
MolecDiffType molec_diff_type
Selected molecular transport model.
Definition: ERF_DiffStruct.H:94
amrex::Real rhoAlpha_T
Dynamic temperature diffusion coefficient [kg/(m-s)].
Definition: ERF_DiffStruct.H:104
bool eb_diff_constraint_y
Whether to constrain EB diffusion in the y direction.
Definition: ERF_DiffStruct.H:108
amrex::Real alpha_C
Kinematic scalar diffusivity [m2/s].
Definition: ERF_DiffStruct.H:98
bool eb_diff_constraint_x
Whether to constrain EB diffusion in the x direction.
Definition: ERF_DiffStruct.H:107
amrex::Real dynamic_viscosity
Dynamic viscosity for momentum diffusion [kg/(m-s)].
Definition: ERF_DiffStruct.H:106
void init_params(std::string pp_prefix)
Read diffusion options from the input parameter database.
Definition: ERF_DiffStruct.H:28
void display()
Print the configured diffusion options.
Definition: ERF_DiffStruct.H:77
amrex::Real rho0_trans
Reference density used to compute dynamic diffusion coefficients [kg/m3].
Definition: ERF_DiffStruct.H:101
amrex::Real alpha_T
Kinematic temperature diffusivity [m2/s].
Definition: ERF_DiffStruct.H:97
amrex::Real rhoAlpha_C
Dynamic scalar diffusion coefficient [kg/(m-s)].
Definition: ERF_DiffStruct.H:105