12 #ifndef CD_CdrLayoutImplem_H
13 #define CD_CdrLayoutImplem_H
20 #include <CD_NamespaceHeader.H>
25 CH_TIME(
"CdrLayout<T>::CdrLayout()");
29 m_species = a_species;
38 CH_TIME(
"CdrLayout<T>::~CdrLayout()");
45 CH_TIME(
"CdrLayout<T>::getPhase()");
46 if (m_verbosity > 6) {
47 pout() <<
"CdrLayout<T>::getPhase()" << endl;
57 CH_TIME(
"CdrLayout<T>::iterator()");
58 if (m_verbosity > 6) {
59 pout() <<
"CdrLayout<T>::iterator()" << endl;
69 CH_TIME(
"CdrLayout<T>::getRealm()");
70 if (m_verbosity > 6) {
71 pout() <<
"CdrLayout<T>::getRealm()" << endl;
81 CH_TIME(
"CdrLayout<T>::setRealm()");
82 if (m_verbosity > 6) {
83 pout() <<
"CdrLayout<T>::setRealm()" << endl;
88 for (
auto solver_it = this->iterator(); solver_it.ok(); ++solver_it) {
89 solver_it()->setRealm(a_realm);
97 CH_TIME(
"CdrLayout<T>::addSolver(RefCountedPtr<T>");
98 if (m_verbosity > 6) {
99 pout() <<
"CdrLayout<T>::addSolver()" << endl;
102 m_solvers.push_back(a_solver);
109 CH_TIME(
"CdrLayout<T>::parseOptions()");
110 if (m_verbosity > 6) {
111 pout() <<
"CdrLayout<T>::parseOptions()" << endl;
114 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
115 solver_it()->parseOptions();
123 CH_TIME(
"CdrLayout<T>::parseRuntimeOptions()");
124 if (m_verbosity > 6) {
125 pout() <<
"CdrLayout<T>::parseRuntimeOptions()" << endl;
128 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
129 solver_it()->parseRuntimeOptions();
137 CH_TIME(
"CdrLayout<T>::allocate()");
138 if (m_verbosity > 6) {
139 pout() <<
"CdrLayout<T>::allocate()" << endl;
142 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
143 solver_it()->allocate();
151 CH_TIME(
"CdrLayout<T>::deallocate()");
152 if (m_verbosity > 6) {
153 pout() <<
"CdrLayout<T>::deallocate()" << endl;
156 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
157 solver_it()->deallocate();
165 CH_TIME(
"CdrLayout<T>::preRegrid(int, int)");
166 if (m_verbosity > 6) {
167 pout() <<
"CdrLayout<T>::preRegrid(int, int)" << endl;
170 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
171 solver_it()->preRegrid(a_lbase, a_oldFinestLevel);
179 CH_TIME(
"CdrLayout<T>::initialData()");
180 if (m_verbosity > 6) {
181 pout() <<
"CdrLayout<T>::initialData()" << endl;
184 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
185 solver_it()->initialData();
193 CH_TIME(
"CdrLayout<T>::regrid(int, int, int)");
194 if (m_verbosity > 5) {
195 pout() <<
"CdrLayout<T>::regrid(int, int, int)" << endl;
198 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
199 solver_it()->regrid(a_lmin, a_oldFinestLevel, a_newFinestLevel);
207 CH_TIME(
"CdrLayout<T>::registerOperators()");
208 if (m_verbosity > 5) {
209 pout() <<
"CdrLayout<T>::registerOperators()" << endl;
212 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
213 solver_it()->registerOperators();
221 CH_TIME(
"CdrLayout<T>::setAmr(RefCountedPtr<AmrMesh>)");
222 if (m_verbosity > 5) {
223 pout() <<
"CdrLayout<T>::setAmr(RefCountedPtr<AmrMesh>)" << endl;
226 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
227 solver_it()->setAmr(a_amrMesh);
235 CH_TIME(
"CdrLayout<T>::setComputationalGeometry(RefCountedPtr<ComputationalGeometry>)");
236 if (m_verbosity > 5) {
237 pout() <<
"CdrLayout<T>::setComputationalGeometry(RefCountedPtr<ComputationalGeometry>)" << endl;
240 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
241 solver_it()->setComputationalGeometry(a_computationalGeometry);
249 CH_TIME(
"CdrLayout<T>::setPhase(phase::which_phase)");
250 if (m_verbosity > 5) {
251 pout() <<
"CdrLayout<T>::setPhase(phase::which_phase)" << endl;
256 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
257 solver_it()->setPhase(m_phase);
265 CH_TIME(
"CdrLayout<T>::setVerbosity(int)");
266 m_verbosity = a_verbosity;
267 if (m_verbosity > 5) {
268 pout() <<
"CdrLayout<T>::setVerbosity(int)" << endl;
271 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
272 solver_it()->setVerbosity(a_verbosity);
280 CH_TIME(
"CdrLayout<T>::setTime(int, int, int)");
281 if (m_verbosity > 5) {
282 pout() <<
"CdrLayout<T>::setTime(int, int, int)" << endl;
285 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
286 solver_it()->setTime(a_step, a_time, a_dt);
294 CH_TIME(
"CdrLayout<T>::writePlotFile()");
295 if (m_verbosity > 5) {
296 pout() <<
"CdrLayout<T>::writePlotFile()" << endl;
299 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
300 solver_it()->writePlotFile();
308 CH_TIME(
"CdrLayout<T>::computeAdvectionDt()");
309 if (m_verbosity > 5) {
310 pout() <<
"CdrLayout<T>::computeAdvectionDt()" << endl;
315 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
316 const Real curDt = solver_it()->computeAdvectionDt();
328 CH_TIME(
"CdrLayout<T>::computeDiffusionDt()");
329 if (m_verbosity > 5) {
330 pout() <<
"CdrLayout<T>::computeDiffusionDt()" << endl;
335 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
336 const Real curDt = solver_it()->computeDiffusionDt();
348 CH_TIME(
"CdrLayout<T>::computeAdvectionDiffusionDt()");
349 if (m_verbosity > 5) {
350 pout() <<
"CdrLayout<T>::computeAdvectionDiffusionDt()" << endl;
355 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
356 const Real curDt = solver_it()->computeAdvectionDiffusionDt();
365 Vector<RefCountedPtr<T>>&
368 CH_TIME(
"CdrLayout<T>::getSolvers()");
369 if (m_verbosity > 5) {
370 pout() <<
"CdrLayout<T>::getSolvers()" << endl;
377 Vector<RefCountedPtr<CdrSpecies>>&
380 CH_TIME(
"CdrLayout<T>::getSpecies()");
381 if (m_verbosity > 5) {
382 pout() <<
"CdrLayout<T>::getSpecies()" << endl;
389 Vector<EBAMRCellData*>
392 CH_TIME(
"CdrLayout<T>::getPhis()");
393 if (m_verbosity > 5) {
394 pout() <<
"CdrLayout<T>::getPhis()" << endl;
397 Vector<EBAMRCellData*> states;
399 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
400 states.push_back(&(solver_it()->getPhi()));
407 Vector<EBAMRCellData*>
410 CH_TIME(
"CdrLayout<T>::getSources()");
411 if (m_verbosity > 5) {
412 pout() <<
"CdrLayout<T>::getSources()" << endl;
415 Vector<EBAMRCellData*> sources;
417 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
418 sources.push_back(&(solver_it()->getSource()));
425 Vector<EBAMRCellData*>
428 CH_TIME(
"CdrLayout<T>::getVelocities()");
429 if (m_verbosity > 5) {
430 pout() <<
"CdrLayout<T>::getVelocities()" << endl;
433 Vector<EBAMRCellData*> velocities;
435 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
436 velocities.push_back(&(solver_it()->getCellCenteredVelocity()));
443 Vector<EBAMRCellData*>
446 CH_TIME(
"CdrLayout<T>::getCellCenteredDiffusionCoefficients()");
447 if (m_verbosity > 5) {
448 pout() <<
"CdrLayout<T>::getCellCenteredDiffusionCoefficients()" << endl;
451 Vector<EBAMRCellData*> diffCo;
453 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
454 diffCo.push_back(&(solver_it()->getCellCenteredDiffusionCoefficient()));
461 Vector<EBAMRFluxData*>
464 CH_TIME(
"CdrLayout<T>::getFaceCenteredDiffusionCoefficient()");
465 if (m_verbosity > 5) {
466 pout() <<
"CdrLayout<T>::getFaceCenteredDiffusionCoefficient()" << endl;
469 Vector<EBAMRFluxData*> diffCo;
471 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
472 diffCo.push_back(&(solver_it()->getFaceCenteredDiffusionCoefficient()));
482 CH_TIME(
"CdrLayout<T>::getEbCenteredDiffusionCoefficient");
483 if (m_verbosity > 5) {
484 pout() <<
"CdrLayout<T>::getEbCenteredDiffusionCoefficient" << endl;
487 Vector<EBAMRIVData*> diffCo;
489 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
490 diffCo.push_back(&(solver_it()->getEbCenteredDiffusionCoefficient()));
500 CH_TIME(
"CdrLayout<T>::getEbFlux()");
501 if (m_verbosity > 5) {
502 pout() <<
"CdrLayout<T>::getEbFlux()" << endl;
505 Vector<EBAMRIVData*> ebFlux;
507 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
508 ebFlux.push_back(&(solver_it()->getEbFlux()));
518 CH_TIME(
"CdrLayout<T>::getDomainFlux()");
519 if (m_verbosity > 5) {
520 pout() <<
"CdrLayout<T>::getDomainFlux()" << endl;
523 Vector<EBAMRIFData*> domainFlux;
525 for (
CdrIterator<T> solver_it = this->iterator(); solver_it.
ok(); ++solver_it) {
526 domainFlux.push_back(&(solver_it()->getDomainFlux()));
532 template <
class T,
class S>
535 CH_TIME(
"CdrFactory<T, S>::CdrFactory()");
538 template <
class T,
class S>
541 CH_TIME(
"CdrFactory<T, S>::~CdrFactory()");
544 template <
class T,
class S>
545 RefCountedPtr<CdrLayout<T>>
548 CH_TIME(
"CdrFactory<T, S>::newLayout(Vector<RefCountedPtr<CdrSpecies> >)");
551 auto cdr = RefCountedPtr<CdrLayout<T>>(
new CdrLayout<T>(a_species));
554 for (
int i = 0; i < a_species.size(); i++) {
556 auto solver = RefCountedPtr<T>(
static_cast<T*
>(
new S()));
558 solver->setSpecies(a_species[i]);
559 solver->setPhase(phase::gas);
560 solver->setVerbosity(-1);
562 cdr->addSolver(solver);
568 #include <CD_NamespaceFooter.H>
Declaration of an iterator class for CdrLayout (for iterating through subsets of solvers).
Declaration of a class that holds a set of CdrSolvers (to cut down on typing).
Agglomeration of useful data operations.
Declaration of various useful units.
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
virtual bool ok() const
Ok or not.
Definition: CD_CdrIteratorImplem.H:76
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
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
virtual Vector< RefCountedPtr< CdrSpecies > > & getSpecies()
Get species.
Definition: CD_CdrLayoutImplem.H:378
virtual CdrIterator< T > iterator()
Get an iterator which can iterate through the various Cdr solvers.
Definition: CD_CdrLayoutImplem.H:55
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
virtual void deallocate()
Deallocate solver internals.
Definition: CD_CdrLayoutImplem.H:149
static const std::string Primal
Identifier for perimal realm.
Definition: CD_Realm.H:47
Real max(const Real &a_input) noexcept
Get the maximum of the input, reduced over MPI ranks (in the Chombo communicator)
Definition: CD_ParallelOpsImplem.H:176
Real min(const Real &a_input) noexcept
Get the minimum of the input, reduced over MPI ranks (in the Chombo communicator)
Definition: CD_ParallelOpsImplem.H:58