13#ifndef CD_SURFACEODESOLVERIMPLEM_H
14#define CD_SURFACEODESOLVERIMPLEM_H
23#include <CD_NamespaceHeader.H>
28 CH_TIME(
"SurfaceODESolver::SurfaceODESolver");
34 this->setVerbosity(-1);
44 CH_TIME(
"SurfaceODESolver::SurfaceODESolver");
55 CH_TIME(
"SurfaceODESolver::~SurfaceODESolver");
65 CH_TIME(
"SurfaceODESolver::parseOptions");
79 CH_TIME(
"SurfaceODESolver::parseRuntimeOptions");
93 CH_TIME(
"SurfaceODESolver::parseVerbosity");
107 CH_TIME(
"SurfaceODESolver::parseRegrid");
115 pp.get(
"regrid",
str);
117 if (
str ==
"conservative") {
118 m_conservativeRegrid =
true;
120 else if (
str ==
"arithmetic") {
121 m_conservativeRegrid =
false;
124 const std::string err =
"SurfaceODESolver<N>::parseRegrid() - argument '" +
str +
"' not recognized";
125 MayDay::Error(
err.c_str());
133 CH_TIME(
"SurfaceODESolver::parsePlotVariables");
143 const int num =
pp.countval(
"plt_vars");
149 for (
int i = 0;
i <
num;
i++) {
150 if (
str[
i] ==
"phi") {
153 else if (
str[
i] ==
"rhs") {
164 CH_TIME(
"SurfaceODESolver::setAmr");
165 if (m_verbosity > 5) {
166 pout() << m_name +
"::setAmr" <<
endl;
178 CH_TIME(
"SurfaceODESolver::setRealm");
179 if (m_verbosity > 5) {
180 pout() << m_name +
"::setRealm" <<
endl;
190 CH_TIME(
"SurfaceODESolver::setName");
191 if (m_verbosity > 5) {
192 pout() <<
"SurfaceODESolver::setName" <<
endl;
202 CH_TIME(
"SurfaceODESolver::getRealm");
204 pout() <<
"SurfaceODESolver::getRealm" <<
endl;
214 CH_TIME(
"SurfaceODESolver::setPhase");
215 if (m_verbosity > 5) {
216 pout() << m_name +
"::setPhase" <<
endl;
226 CH_TIME(
"SurfaceODESolver::getPhase");
238 CH_TIME(
"SurfaceODESolver::setVerbosity");
239 if (m_verbosity > 5) {
240 pout() << m_name +
"::setVerbosity" <<
endl;
250 CH_TIME(
"SurfaceODESolver::getVerbosity");
262 CH_TIME(
"SurfaceODESolver::setTime");
263 if (m_verbosity > 5) {
264 pout() << m_name +
"::setTime" <<
endl;
276 CH_TIME(
"SurfaceODESolver::computeMass(int)");
277 if (m_verbosity > 5) {
278 pout() << m_name +
"::computeMass(int)" <<
endl;
281 return this->computeMass(m_phi,
a_comp);
288 CH_TIME(
"SurfaceODESolver::computeMass(EBAMRIVData, int)");
289 if (m_verbosity > 5) {
290 pout() << m_name +
"::computeMass(EBAMRIVData, int)" <<
endl;
295 for (
int lvl = 0;
lvl <= m_amr->getFinestLevel();
lvl++) {
306#pragma omp parallel for schedule(runtime) reduction(+ : dataSum)
335 CH_TIME(
"SurfaceODESolver::getStep");
347 CH_TIME(
"SurfaceODESolver::getTime");
359 CH_TIME(
"SurfaceODESolver::getDt");
371 CH_TIME(
"SurfaceODESolver::setPhi(Real)");
383 CH_TIME(
"SurfaceODESolver::setPhi(std::array<Real, N>)");
388 for (
int i = 0;
i <
N;
i++) {
397 CH_TIME(
"SurfaceODESolver::setPhi(EBAMRIVData)");
409 CH_TIME(
"SurfaceODESolver::getPhi");
421 CH_TIME(
"SurfaceODESolver::getPhi");
433 CH_TIME(
"SurfaceODESolver::setRHS(Real)");
445 CH_TIME(
"SurfaceODESolver::setRHS(std::array<Real, N>)");
450 for (
int i = 0;
i <
N;
i++) {
459 CH_TIME(
"SurfaceODESolver::setRHS(EBAMRIVData)");
471 CH_TIME(
"SurfaceODESolver::getRHS");
483 CH_TIME(
"SurfaceODESolver::getRHS");
495 CH_TIME(
"SurfaceODESolver::allocate");
505 this->defineVoFIterators();
512 CH_TIME(
"SurfaceODESolver::deallocate");
525 CH_TIME(
"SurfaceODESolver::defineVoFIterators");
550#pragma omp parallel for schedule(runtime)
574 CH_TIME(
"SurfaceODESolver::registerOperators");
588 CH_TIME(
"SurfaceODESolver::registerOperators");
589 if (m_verbosity > 5) {
590 pout() << m_name +
"::registerOperators" <<
endl;
595 m_amr->allocate(m_cache, m_realm, m_phase,
N);
606 CH_TIME(
"SurfaceODESolver::regrid");
607 if (m_verbosity > 5) {
608 pout() << m_name +
"::registerOperators" <<
endl;
614 : EBCoarseToFineInterp::Type::PWC;
625 CH_TIME(
"SurfaceODESolver::resetElectrodes");
626 if (m_verbosity > 5) {
627 pout() << m_name +
"::resetElectrodes" <<
endl;
630 this->resetElectrodes(m_phi,
a_value);
637 CH_TIME(
"SurfaceODESolver::resetElectrodes(EBAMRIVData)");
638 if (m_verbosity > 5) {
639 pout() << m_name +
"::resetElectrodes(EBAMRIVData)" <<
endl;
642 for (
int lvl = 0;
lvl <= m_amr->getFinestLevel();
lvl++) {
648#pragma omp parallel for schedule(runtime)
670 CH_TIME(
"SurfaceODESolver::resetDielectrics");
671 if (m_verbosity > 5) {
672 pout() << m_name +
"::resetDielectrics" <<
endl;
675 this->resetDielectrics(m_phi,
a_value);
682 CH_TIME(
"SurfaceODESolver::resetDielectrics(EBAMRIVData)");
683 if (m_verbosity > 5) {
684 pout() << m_name +
"::resetDielectrics(EBAMRIVData)" <<
endl;
687 for (
int lvl = 0;
lvl <= m_amr->getFinestLevel();
lvl++) {
693#pragma omp parallel for schedule(runtime)
716 CH_TIME(
"SurfaceODESolver::writeCheckpointLevel");
717 if (m_verbosity > 5) {
718 pout() << m_name +
"::writeCheckpointLevel" <<
endl;
721 const std::string id =
"SurfaceODESolver::" + m_name +
"::phi";
743 CH_TIME(
"SurfaceODESolver::readCheckpointLevel");
744 if (m_verbosity > 5) {
745 pout() << m_name +
"::readCheckpointLevel" <<
endl;
748 const std::string id =
"SurfaceODESolver::" + m_name +
"::phi";
769 CH_TIME(
"SurfaceODESolver::writePlotFile");
776 if (numPlotVars > 0) {
802 DischargeIO::writeEBHDF5(
fname,
808 m_amr->getRefinementRatios(),
812 m_amr->getFinestLevel() + 1,
823 const int a_level)
const noexcept
825 CH_TIME(
"SurfaceODESolver::writePlotData");
826 if (m_verbosity > 5) {
827 pout() << m_name +
"::writePlotData" <<
endl;
873 CH_TIME(
"SurfaceODESolver::getNumberOfPlotVariables");
895 CH_TIME(
"SurfaceODESolver::getPlotVariableNames");
903 for (
int i = 0;
i <
N;
i++) {
914 for (
int i = 0;
i <
N;
i++) {
927#include <CD_NamespaceFooter.H>
Silly, but useful functions that override standard Chombo HDF5 IO.
Declaration of a cut-cell ODE solver.
static void incr(MFAMRCellData &a_lhs, const MFAMRCellData &a_rhs, const Real a_scale) noexcept
Function which increments data in the form a_lhs = a_lhs + a_rhs*a_scale for all components.
Definition CD_DataOps.cpp:820
static void setValue(LevelData< MFInterfaceFAB< T > > &a_lhs, const T &a_value)
Set value in an MFInterfaceFAB data holder.
Definition CD_DataOpsImplem.H:24
static void copy(MFAMRCellData &a_dst, const MFAMRCellData &a_src)
Copy data from one data holder to another.
Definition CD_DataOps.cpp:1201
Type
Type of interpolation methods supported. PWC = Piecewise constant, ignoring the embedded boundary....
Definition CD_EBCoarseToFineInterp.H:43
Wrapper class for holding multifluid EBLevelGrids.
Definition CD_MFLevelGrid.H:30
static const std::string Primal
Identifier for perimal realm.
Definition CD_Realm.H:39
Surface ODE solver.
Definition CD_SurfaceODESolver.H:29
virtual int getVerbosity() const noexcept
Get verbosity.
Definition CD_SurfaceODESolverImplem.H:248
virtual EBAMRIVData & getRHS()
Get internal state.
Definition CD_SurfaceODESolverImplem.H:469
void parseVerbosity() noexcept
Parse verbosity.
Definition CD_SurfaceODESolverImplem.H:91
virtual EBAMRIVData & getPhi() noexcept
Get internal state.
Definition CD_SurfaceODESolverImplem.H:407
virtual void setRHS(const Real a_rhs)
Convenience function for setting m_rhs.
Definition CD_SurfaceODESolverImplem.H:431
virtual phase::which_phase getPhase() const noexcept
Get phase.
Definition CD_SurfaceODESolverImplem.H:224
std::string m_name
Solver name.
Definition CD_SurfaceODESolver.H:409
virtual void resetElectrodes(const Real a_value) noexcept
Reset m_phi on electrode cells.
Definition CD_SurfaceODESolverImplem.H:623
virtual int getStep() const noexcept
Get current time step.
Definition CD_SurfaceODESolverImplem.H:333
virtual void parseOptions() noexcept
Parse solver options.
Definition CD_SurfaceODESolverImplem.H:63
void parsePlotVariables() noexcept
Parse plot variables.
Definition CD_SurfaceODESolverImplem.H:131
virtual void setPhase(const phase::which_phase a_phase) noexcept
Set phase.
Definition CD_SurfaceODESolverImplem.H:212
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amrMesh) noexcept
Set the amr object.
Definition CD_SurfaceODESolverImplem.H:162
SurfaceODESolver()
Default constructor. Must subsequently set AmrMesh.
Definition CD_SurfaceODESolverImplem.H:26
void parseRegrid() noexcept
Parse regrid method.
Definition CD_SurfaceODESolverImplem.H:105
virtual void allocate() noexcept
Allocate internal storage for this class.
Definition CD_SurfaceODESolverImplem.H:493
virtual Real getDt() const noexcept
Get last time step.
Definition CD_SurfaceODESolverImplem.H:357
std::string getRealm() const noexcept
Get the realm where the solver is registered.
Definition CD_SurfaceODESolverImplem.H:200
RefCountedPtr< AmrMesh > m_amr
AMR; needed for grid stuff.
Definition CD_SurfaceODESolver.H:439
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel) noexcept
Pre-regrid function.
Definition CD_SurfaceODESolverImplem.H:586
virtual ~SurfaceODESolver()
Destructor (does nothing).
Definition CD_SurfaceODESolverImplem.H:53
virtual void setRealm(const std::string &a_realm) noexcept
Set the realm.
Definition CD_SurfaceODESolverImplem.H:176
virtual Real getTime() const noexcept
Get current time.
Definition CD_SurfaceODESolverImplem.H:345
virtual void setVerbosity(const int a_verbosity) noexcept
Set verbosity.
Definition CD_SurfaceODESolverImplem.H:236
virtual void setPhi(const Real a_phi)
Convenience function for setting m_phi.
Definition CD_SurfaceODESolverImplem.H:369
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_comp, const std::string &a_outputRealm, const int a_level) const noexcept
Write output data to a_output.
Definition CD_SurfaceODESolverImplem.H:820
virtual void setName(const std::string &a_name) noexcept
Set the solver name.
Definition CD_SurfaceODESolverImplem.H:188
virtual Real computeMass(const int a_comp=0) const noexcept
Compute the total mass for component a_comp in m_phi.
Definition CD_SurfaceODESolverImplem.H:274
virtual Vector< std::string > getPlotVariableNames() const noexcept
Get output plot names.
Definition CD_SurfaceODESolverImplem.H:893
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) noexcept
Regrid function.
Definition CD_SurfaceODESolverImplem.H:604
virtual void registerOperators() noexcept
Register operators.
Definition CD_SurfaceODESolverImplem.H:572
int m_verbosity
Solver verbosity.
Definition CD_SurfaceODESolver.H:470
virtual void deallocate() noexcept
Deallocate internal storage.
Definition CD_SurfaceODESolverImplem.H:510
virtual void parseRuntimeOptions() noexcept
Parse runtime solver options.
Definition CD_SurfaceODESolverImplem.H:77
virtual void writePlotFile() const noexcept
Write a plot file.
Definition CD_SurfaceODESolverImplem.H:767
virtual void setTime(const int a_step, const Real a_time, const Real a_dt) noexcept
Set the time.
Definition CD_SurfaceODESolverImplem.H:260
void defineVoFIterators() noexcept
Define iterators for iterating over cell subsets.
Definition CD_SurfaceODESolverImplem.H:523
virtual int getNumberOfPlotVariables() const noexcept
Get number of variables to be plotted.
Definition CD_SurfaceODESolverImplem.H:871
virtual void resetDielectrics(const Real a_value) noexcept
Reset m_phi on dielectric cells.
Definition CD_SurfaceODESolverImplem.H:668
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
virtual void setRealm(const std::string &a_realm)
Set the solver realm.
Definition CD_TracerParticleSolverImplem.H:233
void parsePlotVariables()
Parse plot variables.
Definition CD_TracerParticleSolverImplem.H:148
phase::which_phase m_phase
Phase where this solver lives.
Definition CD_TracerParticleSolver.H:367
virtual void setName(const std::string &a_name) noexcept
Set the solver name.
Definition CD_TracerParticleSolverImplem.H:209
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26
virtual void setTime(const int a_step, const Real a_time, const Real a_dt)
Set the time for this solver.
Definition CD_TracerParticleSolverImplem.H:257
std::string m_realm
Realm where this solver lives.
Definition CD_TracerParticleSolver.H:352
void parseVerbosity()
Parse solver verbosity.
Definition CD_TracerParticleSolverImplem.H:163
int m_verbosity
Verbosity level.
Definition CD_TracerParticleSolver.H:387
RefCountedPtr< AmrMesh > m_amr
Handle to AMR mesh.
Definition CD_TracerParticleSolver.H:327
virtual Vector< std::string > getPlotVariableNames() const
Get plot variable names.
Definition CD_TracerParticleSolverImplem.H:482
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_comp, const std::string &a_outputRealm, const int a_level) const noexcept
Write plot data.
Definition CD_TracerParticleSolverImplem.H:511
virtual void setPhase(const phase::which_phase &a_phase)
Set the solver phase.
Definition CD_TracerParticleSolverImplem.H:245
Real m_dt
Time step.
Definition CD_TracerParticleSolver.H:372
virtual void allocate()
Allocate storage for this solver.
Definition CD_TracerParticleSolverImplem.H:195
std::string m_name
Solver name.
Definition CD_TracerParticleSolver.H:357
std::string m_className
Class name.
Definition CD_TracerParticleSolver.H:362
Real m_time
Time.
Definition CD_TracerParticleSolver.H:377
virtual int getNumberOfPlotVariables() const
Get the number of plot variables.
Definition CD_TracerParticleSolverImplem.H:461
ALWAYS_INLINE void loop(const Box &a_computeBox, Functor &&kernel)
Launch a C++ kernel over a regular grid with compile-time per-dimension strides.
Definition CD_BoxLoopsImplem.H:39
Real sum(const Real &a_value) noexcept
Compute the sum across all MPI ranks.
Definition CD_ParallelOpsImplem.H:354
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38
@ gas
Gas phase.
Definition CD_MultiFluidIndexSpace.H:39