ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
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 
12 /*! \brief Base class for microphysics interface */
13 class Microphysics {
14 
15 public:
16 
17  /*! \brief Null constructor */
18  Microphysics () { }
19 
20  /*! \brief default destructor */
21  virtual ~Microphysics () = default;
22 
23  /*! \brief define the microphysics object */
24  virtual void Define (const int&, SolverChoice&) = 0;
25 
26  /*! \brief initialize the microphysics object */
27  virtual void Init (const int&,
28  const amrex::MultiFab&,
29  const amrex::BoxArray&,
30  const amrex::Geometry&,
31  const amrex::Real&,
32  std::unique_ptr<amrex::MultiFab>&,
33  std::unique_ptr<amrex::MultiFab>&) = 0;
34 
35  /*! \brief advance microphysics for one time step */
36  virtual void Advance (const int&,
37  const amrex::Real&,
38  const int&,
39  const amrex::Real&,
40  const SolverChoice&,
41  amrex::Vector<amrex::Vector<amrex::MultiFab>>&,
42  const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& ) = 0;
43 
44  /*! \brief update microphysics variables from ERF state variables */
45  virtual void Update_Micro_Vars_Lev (const int&, amrex::MultiFab&) = 0;
46 
47  /*! \brief update ERF state variables from microphysics variables */
48  virtual void Update_State_Vars_Lev (const int&, amrex::MultiFab&) = 0;
49 
50  /*! \brief get pointer to a moisture variable */
51  virtual amrex::MultiFab* Get_Qmoist_Ptr (const int&, const int&) = 0;
52 
53  /*! \brief get the number of moisture model variables */
54  virtual int Get_Qmoist_Size (const int&) = 0;
55 
56  /*! \brief get the number of moisture-model-related conserved state variables */
57  virtual int Get_Qstate_Size () = 0;
58 
59  /*! \brief get the indices and names of moisture model variables for restart
60  at a given level */
61  virtual void Get_Qmoist_Restart_Vars ( int, const SolverChoice&, std::vector<int>&, std::vector<std::string>& ) const = 0;
62 
63  /*! \brief query if a specified moisture model is Eulerian or Lagrangian */
64  static MoistureModelType modelType (const MoistureType a_moisture_type)
65  {
66  if ( (a_moisture_type == MoistureType::SAM)
67  || (a_moisture_type == MoistureType::SAM_NoIce)
68  || (a_moisture_type == MoistureType::SAM_NoPrecip_NoIce)
69  || (a_moisture_type == MoistureType::Kessler)
70  || (a_moisture_type == MoistureType::Kessler_NoRain)
71  || (a_moisture_type == MoistureType::None) ) {
72  return MoistureModelType::Eulerian;
73  } else {
74  amrex::Abort("Dont know this moisture_type!") ;
75  return MoistureModelType::Undefined;
76  }
77  }
78 
79 private:
80 
81 };
82 #endif
Base class for microphysics interface.
Definition: ERF_Microphysics.H:13
virtual int Get_Qmoist_Size(const int &)=0
get the number of moisture model variables
virtual ~Microphysics()=default
default destructor
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 void Update_Micro_Vars_Lev(const int &, amrex::MultiFab &)=0
update microphysics variables from ERF state variables
virtual int Get_Qstate_Size()=0
get the number of moisture-model-related conserved state variables
Microphysics()
Null constructor.
Definition: ERF_Microphysics.H:18
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 >> &)=0
advance microphysics for one time step
virtual amrex::MultiFab * Get_Qmoist_Ptr(const int &, const int &)=0
get pointer to a moisture variable
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
static MoistureModelType modelType(const MoistureType a_moisture_type)
query if a specified moisture model is Eulerian or Lagrangian
Definition: ERF_Microphysics.H:64
Definition: ERF_DataStruct.H:78