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 #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 moisture-model-related conserved state variables */
59  virtual int Get_Qstate_Size () = 0;
60 
61  /*! \brief get the indices and names of moisture model variables for restart
62  at a given level */
63  virtual void Get_Qmoist_Restart_Vars (int,
64  const SolverChoice&,
65  std::vector<int>&,
66  std::vector<std::string>& ) const = 0;
67 
68  /*! \brief query if a specified moisture model is Eulerian or Lagrangian */
69  static MoistureModelType modelType (const MoistureType a_moisture_type)
70  {
71  if ( (a_moisture_type == MoistureType::SAM)
72  || (a_moisture_type == MoistureType::SAM_NoIce)
73  || (a_moisture_type == MoistureType::SAM_NoPrecip_NoIce)
74  || (a_moisture_type == MoistureType::Kessler)
75  || (a_moisture_type == MoistureType::Kessler_NoRain)
76  || (a_moisture_type == MoistureType::SatAdj)
77  || (a_moisture_type == MoistureType::None) ) {
78  return MoistureModelType::Eulerian;
79  } else {
80  amrex::Abort("Dont know this moisture_type!") ;
81  return MoistureModelType::Undefined;
82  }
83  }
84 
85 private:
86 
87 };
88 #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 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:19
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:69
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:82