ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ERF_Microphysics.H
Go to the documentation of this file.
1 /*! @file ERF_Microphysics.H
2  * \brief Contains the base class for microphysics
3  */
4 
5 #ifndef ERF_MICROPHYSICS_H
6 #define ERF_MICROPHYSICS_H
7 
8 #include <vector>
9 #include <string>
10 #include "ERF_DataStruct.H"
11 #include "ERF_IndexDefines.H"
12 
13 /*! \brief Base class for microphysics interface */
14 class Microphysics {
15 
16 public:
17 
18  /*! \brief Null constructor */
19  Microphysics () { }
20 
21  /*! \brief default destructor */
22  virtual ~Microphysics () = default;
23 
24  /*! \brief define the microphysics object */
25  virtual void Define (const int&, SolverChoice&) = 0;
26 
27  /*! \brief initialize the microphysics object */
28  virtual void Init (const int&,
29  const amrex::MultiFab&,
30  const amrex::BoxArray&,
31  const amrex::Geometry&,
32  const amrex::Real&,
33  std::unique_ptr<amrex::MultiFab>&,
34  std::unique_ptr<amrex::MultiFab>&) = 0;
35 
36  /*! \brief advance microphysics for one time step */
37  virtual void Advance (const int&,
38  const amrex::Real&,
39  const int&,
40  const amrex::Real&,
41  const SolverChoice&,
42  amrex::Vector<amrex::Vector<amrex::MultiFab>>&,
43  const amrex::Vector<std::unique_ptr<amrex::MultiFab>>&,
44  const amrex::GpuArray<ERF_BC, AMREX_SPACEDIM*2>& ) = 0;
45 
46  /*! \brief update microphysics variables from ERF state variables */
47  virtual void Update_Micro_Vars_Lev (const int&, amrex::MultiFab&) = 0;
48 
49  /*! \brief update ERF state variables from microphysics variables */
50  virtual void Update_State_Vars_Lev (const int&, amrex::MultiFab&) = 0;
51 
52  /*! \brief get pointer to a moisture variable */
53  virtual amrex::MultiFab* Get_Qmoist_Ptr (const int&, const int&) = 0;
54 
55  /*! \brief get the number of moisture model variables */
56  virtual int Get_Qmoist_Size (const int&) = 0;
57 
58  /*! \brief get the number of microphysics conserved moist (water-related) state variables */
59  virtual int Get_Qstate_Moist_Size () = 0;
60 
61  /*! \brief get the number of microphysics conserved non-moist (non-water, i.e., other vapor/condensed species) state variables */
62  virtual int Get_Qstate_NonMoist_Size () = 0;
63 
64  /*! \brief get total number of conserved state variables */
65  inline int Get_Qstate_Size()
66  {
68  }
69 
70  /*! \brief get the indices and names of moisture model variables for restart
71  at a given level */
72  virtual void Get_Qmoist_Restart_Vars (int,
73  const SolverChoice&,
74  std::vector<int>&,
75  std::vector<std::string>& ) const = 0;
76 
77  /*! \brief Returns a list of additional plot variable names */
78  virtual void GetPlotVarNames (amrex::Vector<std::string>& a_vec) const = 0;
79 
80  /*! \brief Fills in a MultiFab for plotting */
81  virtual void GetPlotVar (const std::string& a_name,
82  amrex::MultiFab& a_mf,
83  const int a_lev) const = 0;
84 
85  /*! \brief query if a specified moisture model is Eulerian or Lagrangian */
86  static MoistureModelType modelType (const MoistureType a_moisture_type)
87  {
88  if ( (a_moisture_type == MoistureType::SAM)
89  || (a_moisture_type == MoistureType::SAM_NoIce)
90  || (a_moisture_type == MoistureType::SAM_NoPrecip_NoIce)
91  || (a_moisture_type == MoistureType::Morrison)
92  || (a_moisture_type == MoistureType::Morrison_NoIce)
93  || (a_moisture_type == MoistureType::Kessler)
94  || (a_moisture_type == MoistureType::Kessler_NoRain)
95  || (a_moisture_type == MoistureType::SatAdj)
96  || (a_moisture_type == MoistureType::None) ) {
97  return MoistureModelType::Eulerian;
98  } else {
99  amrex::Abort("Dont know this moisture_type!") ;
100  return MoistureModelType::Undefined;
101  }
102  }
103 private:
104 
105 };
106 #endif
Base class for microphysics interface.
Definition: ERF_Microphysics.H:14
virtual int Get_Qmoist_Size(const int &)=0
get the number of moisture model variables
virtual ~Microphysics()=default
default destructor
virtual int Get_Qstate_NonMoist_Size()=0
get the number of microphysics conserved non-moist (non-water, i.e., other vapor/condensed species) s...
virtual void Define(const int &, SolverChoice &)=0
define the microphysics object
virtual void Init(const int &, const amrex::MultiFab &, const amrex::BoxArray &, const amrex::Geometry &, const amrex::Real &, std::unique_ptr< amrex::MultiFab > &, std::unique_ptr< amrex::MultiFab > &)=0
initialize the microphysics object
virtual void Update_State_Vars_Lev(const int &, amrex::MultiFab &)=0
update ERF state variables from microphysics variables
virtual int Get_Qstate_Moist_Size()=0
get the number of microphysics conserved moist (water-related) state variables
virtual void Update_Micro_Vars_Lev(const int &, amrex::MultiFab &)=0
update microphysics variables from ERF state variables
Microphysics()
Null constructor.
Definition: ERF_Microphysics.H:19
virtual amrex::MultiFab * Get_Qmoist_Ptr(const int &, const int &)=0
get pointer to a moisture variable
virtual void GetPlotVarNames(amrex::Vector< std::string > &a_vec) const =0
Returns a list of additional plot variable names.
virtual void Get_Qmoist_Restart_Vars(int, const SolverChoice &, std::vector< int > &, std::vector< std::string > &) const =0
get the indices and names of moisture model variables for restart at a given level
int Get_Qstate_Size()
get total number of conserved state variables
Definition: ERF_Microphysics.H:65
static MoistureModelType modelType(const MoistureType a_moisture_type)
query if a specified moisture model is Eulerian or Lagrangian
Definition: ERF_Microphysics.H:86
virtual void GetPlotVar(const std::string &a_name, amrex::MultiFab &a_mf, const int a_lev) const =0
Fills in a MultiFab for plotting.
virtual void Advance(const int &, const amrex::Real &, const int &, const amrex::Real &, const SolverChoice &, amrex::Vector< amrex::Vector< amrex::MultiFab >> &, const amrex::Vector< std::unique_ptr< amrex::MultiFab >> &, const amrex::GpuArray< ERF_BC, AMREX_SPACEDIM *2 > &)=0
advance microphysics for one time step
Definition: ERF_DataStruct.H:99