chombo-discharge
CD_CdrLayout.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_CdrLayout_H
13 #define CD_CdrLayout_H
14 
15 // Our includes
16 #include <CD_CdrSolver.H>
17 #include <CD_NamespaceHeader.H>
18 
23 template <class T>
24 class CdrIterator;
25 
35 template <class T>
36 class CdrLayout
37 {
38 public:
42  CdrLayout() = delete;
43 
48  CdrLayout(const Vector<RefCountedPtr<CdrSpecies>>& a_species);
49 
53  virtual ~CdrLayout();
54 
59  virtual phase::which_phase
60  getPhase() const;
61 
65  virtual CdrIterator<T>
66  iterator();
67 
72  virtual std::string
73  getRealm() const;
74 
79  virtual void
80  setRealm(const std::string a_realm);
81 
85  virtual void
86  parseOptions();
87 
91  virtual void
93 
98  virtual void
99  addSolver(RefCountedPtr<T>& a_solver);
100 
104  virtual void
105  allocate();
106 
110  virtual void
111  deallocate();
112 
118  virtual void
119  preRegrid(const int a_lbase, const int a_oldFinestLevel);
120 
124  virtual void
125  initialData();
126 
133  virtual void
134  regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel);
135 
139  virtual void
141 
146  virtual void
147  setAmr(const RefCountedPtr<AmrMesh>& a_amrMesh);
148 
153  virtual void
154  setComputationalGeometry(const RefCountedPtr<ComputationalGeometry>& a_computationalGeometry);
155 
160  virtual void
161  setPhase(const phase::which_phase a_phase = phase::gas);
162 
167  virtual void
168  setVerbosity(const int a_verbosity);
169 
176  virtual void
177  setTime(const int a_step, const Real a_time, const Real a_dt);
178 
182  virtual void
183  writePlotFile();
184 
189  virtual Real
191 
196  virtual Real
198 
203  virtual Real
205 
210  virtual Vector<RefCountedPtr<T>>&
211  getSolvers();
212 
216  virtual Vector<RefCountedPtr<CdrSpecies>>&
217  getSpecies();
218 
222  virtual Vector<EBAMRCellData*>
223  getSources();
224 
228  virtual Vector<EBAMRCellData*>
229  getPhis();
230 
234  virtual Vector<EBAMRCellData*>
235  getVelocities();
236 
240  virtual Vector<EBAMRCellData*>
242 
246  virtual Vector<EBAMRFluxData*>
248 
252  virtual Vector<EBAMRIVData*>
254 
258  virtual Vector<EBAMRIVData*>
259  getEbFlux();
260 
264  virtual Vector<EBAMRIFData*>
265  getDomainFlux();
266 
267 protected:
271  std::string m_realm;
272 
276  phase::which_phase m_phase;
277 
282 
286  Vector<RefCountedPtr<CdrSolver>> m_solvers;
287 
291  Vector<RefCountedPtr<CdrSpecies>> m_species;
292 };
293 
300 template <class T, class S>
302 {
303 public:
307  CdrFactory();
308 
312  ~CdrFactory();
313 
318  RefCountedPtr<CdrLayout<T>>
319  newLayout(const Vector<RefCountedPtr<CdrSpecies>>& a_species) const;
320 };
321 
322 #include <CD_NamespaceFooter.H>
323 
324 #include <CD_CdrLayoutImplem.H>
325 
326 #endif
Implementation of CD_CdrLayout.H.
Declaration of an abstract class for solving scalar convection-diffusion-reaction problems.
Factory class for CdrLayout. T is (usually) CdrSolver and S is the implementation class (e....
Definition: CD_CdrLayout.H:302
CdrFactory()
Default constructor (does nothing)
Definition: CD_CdrLayoutImplem.H:533
RefCountedPtr< CdrLayout< T > > newLayout(const Vector< RefCountedPtr< CdrSpecies >> &a_species) const
Factory method, create a new CdrLayout.
Definition: CD_CdrLayoutImplem.H:546
~CdrFactory()
Default constructor (does nothing)
Definition: CD_CdrLayoutImplem.H:539
Iterator class for CdrLayout. This allows iteration through solvers (or subsets of solvers).
Definition: CD_CdrIterator.H:27
Class for holding a set of CdrSolvers.
Definition: CD_CdrLayout.H:37
virtual void setPhase(const phase::which_phase a_phase=phase::gas)
Set phase.
Definition: CD_CdrLayoutImplem.H:247
virtual std::string getRealm() const
Get the realm where the Cdr solvers live.
Definition: CD_CdrLayoutImplem.H:67
virtual void parseOptions()
Parse class options.
Definition: CD_CdrLayoutImplem.H:107
virtual void parseRuntimeOptions()
Parse runtime options.
Definition: CD_CdrLayoutImplem.H:121
virtual Vector< EBAMRCellData * > getPhis()
Get all cell-centered states.
Definition: CD_CdrLayoutImplem.H:390
virtual Vector< EBAMRIVData * > getEbFlux()
Get all EB flux data holders.
Definition: CD_CdrLayoutImplem.H:498
virtual Vector< EBAMRCellData * > getSources()
Get all source terms.
Definition: CD_CdrLayoutImplem.H:408
virtual phase::which_phase getPhase() const
Get phase.
Definition: CD_CdrLayoutImplem.H:43
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel)
Call preRegrid(...) method for all the CdrSolvers.
Definition: CD_CdrLayoutImplem.H:163
virtual Vector< EBAMRIFData * > getDomainFlux()
Get domain flux data holders.
Definition: CD_CdrLayoutImplem.H:516
virtual Vector< EBAMRCellData * > getVelocities()
Get all cell-centered velocities.
Definition: CD_CdrLayoutImplem.H:426
virtual void writePlotFile()
Convenience function. All solvers write plot files (for debugging purposes)
Definition: CD_CdrLayoutImplem.H:292
virtual void setComputationalGeometry(const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Set the computational geometry for all CdrSolvers.
Definition: CD_CdrLayoutImplem.H:233
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amrMesh)
Set AmrMesh for all CdrSolvers.
Definition: CD_CdrLayoutImplem.H:219
virtual Real computeDiffusionDt()
Get time step for explicit diffusion.
Definition: CD_CdrLayoutImplem.H:326
virtual ~CdrLayout()
Destructor.
Definition: CD_CdrLayoutImplem.H:36
virtual void addSolver(RefCountedPtr< T > &a_solver)
Add solver. This appends a_solver to m_solvers.
Definition: CD_CdrLayoutImplem.H:95
virtual Vector< EBAMRIVData * > getEbCenteredDiffusionCoefficient()
Get all EB-centered diffusion coefficients.
Definition: CD_CdrLayoutImplem.H:480
phase::which_phase m_phase
Phase where solvers live.
Definition: CD_CdrLayout.H:276
virtual void setTime(const int a_step, const Real a_time, const Real a_dt)
Set time.
Definition: CD_CdrLayoutImplem.H:278
virtual Real computeAdvectionDiffusionDt()
Get the time step for explicit advection-diffusion.
Definition: CD_CdrLayoutImplem.H:346
virtual Vector< EBAMRFluxData * > getFaceCenteredDiffusionCoefficient()
Get all face-centered diffusion coefficients.
Definition: CD_CdrLayoutImplem.H:462
virtual void setVerbosity(const int a_verbosity)
Set verbosity for all CdrSolvers.
Definition: CD_CdrLayoutImplem.H:263
virtual void registerOperators()
Register operators.
Definition: CD_CdrLayoutImplem.H:205
CdrLayout()=delete
Disallowed weak constructor. Use the full constructor.
virtual Vector< RefCountedPtr< T > > & getSolvers()
Get solvers.
Definition: CD_CdrLayoutImplem.H:366
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)
Regrid method. Calls regrid(...) for every CdrSolver.
Definition: CD_CdrLayoutImplem.H:191
virtual Vector< EBAMRCellData * > getCellCenteredDiffusionCoefficients()
Get all cell-centered diffusion coefficients.
Definition: CD_CdrLayoutImplem.H:444
virtual void allocate()
Allocate internal storage for solvers.
Definition: CD_CdrLayoutImplem.H:135
virtual void initialData()
Initial data. Fill all solvers with initial data.
Definition: CD_CdrLayoutImplem.H:177
int m_verbosity
Verbosity.
Definition: CD_CdrLayout.H:281
virtual Vector< RefCountedPtr< CdrSpecies > > & getSpecies()
Get species.
Definition: CD_CdrLayoutImplem.H:378
std::string m_realm
Realm where solvers live.
Definition: CD_CdrLayout.H:271
virtual CdrIterator< T > iterator()
Get an iterator which can iterate through the various Cdr solvers.
Definition: CD_CdrLayoutImplem.H:55
Vector< RefCountedPtr< CdrSolver > > m_solvers
Solver instantiations.
Definition: CD_CdrLayout.H:286
virtual Real computeAdvectionDt()
Get CFL time for advection.
Definition: CD_CdrLayoutImplem.H:306
virtual void setRealm(const std::string a_realm)
Set realm for all CdrSolvers.
Definition: CD_CdrLayoutImplem.H:79
Vector< RefCountedPtr< CdrSpecies > > m_species
Cdr species.
Definition: CD_CdrLayout.H:291
virtual void deallocate()
Deallocate solver internals.
Definition: CD_CdrLayoutImplem.H:149