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 enum struct MolecDiffType {
13 };
14 
15 /**
16  * Container holding diffusion-related choices
17  */
18 
19 struct DiffChoice {
20  public:
21  void init_params()
22  {
23  amrex::ParmParse pp(pp_prefix);
24 
25  static std::string molec_diff_type_string = "None";
26  pp.query("molec_diff_type",molec_diff_type_string);
27 
28  if (!molec_diff_type_string.compare("Constant")) {
30  } else if (!molec_diff_type_string.compare("ConstantAlpha")) {
32  } else if (!molec_diff_type_string.compare("None")) {
34  } else {
35  amrex::Error("Don't know this molec_diff_type");
36  }
37 
39  pp.query("alpha_T", alpha_T);
40  pp.query("alpha_C", alpha_C);
41  pp.query("dynamic_viscosity", dynamic_viscosity);
42  pp.query("rho0_trans", rho0_trans);
43  }
44 
45  // Compute relevant forms of diffusion parameters
48 
50  amrex::Print() << "Using constant kinematic diffusion coefficients" << std::endl;
51  amrex::Print() << " momentum : " << dynamic_viscosity/rho0_trans << " m^2/s" << std::endl;
52  amrex::Print() << " temperature : " << alpha_T << " m^2/s" << std::endl;
53  amrex::Print() << " scalar : " << alpha_C << " m^2/s" << std::endl;
54  }
56  amrex::Print() << "Using constant dynamic diffusion coefficients" << std::endl;
57  amrex::Print() << " momentum : " << dynamic_viscosity << " kg/(m-s)" << std::endl;
58  amrex::Print() << " temperature : " << rhoAlpha_T << " kg/(m-s)" << std::endl;
59  amrex::Print() << " scalar : " << rhoAlpha_C << " kg/(m-s)" << std::endl;
60  }
61 
62  }
63 
64  void display()
65  {
66  amrex::Print() << "Diffusion choices: " << std::endl;
67  amrex::Print() << " rho0_trans : " << rho0_trans << std::endl;
68  amrex::Print() << " alpha_T : " << alpha_T << std::endl;
69  amrex::Print() << " alpha_C : " << alpha_C << std::endl;
70  amrex::Print() << " dynamic_viscosity : " << dynamic_viscosity << std::endl;
71 
73  amrex::Print() << "Using constant molecular diffusivity (relevant for DNS)" << std::endl;
74  } else if (molec_diff_type == MolecDiffType::None) {
75  amrex::Print() << "Not using any molecular diffusivity, i.e. using the modeled turbulent diffusivity"
76  << std::endl;
77  }
78  }
79 
80  // Default prefix
81  std::string pp_prefix {"erf"};
82 
83  // Molecular transport model
85 
86  // Diffusive/viscous coefficients [m2/s]
87  amrex::Real alpha_T = 0.0;
88  amrex::Real alpha_C = 0.0;
89 
90  // Density for computation of rhoAlpha (which is assumed constant) [kg/m3]
91  amrex::Real rho0_trans = 1.0;
92 
93  // Dynamic diffusion coefficients [kg/(m-s)]
94  amrex::Real rhoAlpha_T = 0.0;
95  amrex::Real rhoAlpha_C = 0.0;
96  amrex::Real dynamic_viscosity = 0.0;
97 };
98 #endif
MolecDiffType
Definition: ERF_DiffStruct.H:11
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pp(amrex::Real y)
Definition: ERF_MicrophysicsUtils.H:219
Definition: ERF_DiffStruct.H:19
amrex::Real rho0_trans
Definition: ERF_DiffStruct.H:91
amrex::Real rhoAlpha_C
Definition: ERF_DiffStruct.H:95
amrex::Real rhoAlpha_T
Definition: ERF_DiffStruct.H:94
amrex::Real alpha_T
Definition: ERF_DiffStruct.H:87
amrex::Real alpha_C
Definition: ERF_DiffStruct.H:88
std::string pp_prefix
Definition: ERF_DiffStruct.H:81
void init_params()
Definition: ERF_DiffStruct.H:21
void display()
Definition: ERF_DiffStruct.H:64
MolecDiffType molec_diff_type
Definition: ERF_DiffStruct.H:84
amrex::Real dynamic_viscosity
Definition: ERF_DiffStruct.H:96