12#ifndef CD_SurfaceODESolverImplem_H
13#define CD_SurfaceODESolverImplem_H
22#include <CD_NamespaceHeader.H>
27 CH_TIME(
"SurfaceODESolver::SurfaceODESolver");
33 this->setVerbosity(-1);
43 CH_TIME(
"SurfaceODESolver::SurfaceODESolver");
54 CH_TIME(
"SurfaceODESolver::~SurfaceODESolver");
64 CH_TIME(
"SurfaceODESolver::parseOptions");
78 CH_TIME(
"SurfaceODESolver::parseRuntimeOptions");
92 CH_TIME(
"SurfaceODESolver::parseVerbosity");
106 CH_TIME(
"SurfaceODESolver::parseRegrid");
114 pp.get(
"regrid",
str);
116 if (
str ==
"conservative") {
117 m_conservativeRegrid =
true;
119 else if (
str ==
"arithmetic") {
120 m_conservativeRegrid =
false;
123 const std::string err =
"SurfaceODESolver<N>::parseRegrid() - argument '" +
str +
"' not recognized";
124 MayDay::Error(
err.c_str());
132 CH_TIME(
"SurfaceODESolver::parsePlotVariables");
142 const int num =
pp.countval(
"plt_vars");
148 for (
int i = 0;
i <
num;
i++) {
149 if (
str[
i] ==
"phi") {
152 else if (
str[
i] ==
"rhs") {
163 CH_TIME(
"SurfaceODESolver::setAmr");
164 if (m_verbosity > 5) {
165 pout() << m_name +
"::setAmr" <<
endl;
177 CH_TIME(
"SurfaceODESolver::setRealm");
178 if (m_verbosity > 5) {
179 pout() << m_name +
"::setRealm" <<
endl;
189 CH_TIME(
"SurfaceODESolver::setName");
190 if (m_verbosity > 5) {
191 pout() <<
"SurfaceODESolver::setName" <<
endl;
201 CH_TIME(
"SurfaceODESolver::getRealm");
203 pout() <<
"SurfaceODESolver::getRealm" <<
endl;
213 CH_TIME(
"SurfaceODESolver::setPhase");
214 if (m_verbosity > 5) {
215 pout() << m_name +
"::setPhase" <<
endl;
225 CH_TIME(
"SurfaceODESolver::getPhase");
237 CH_TIME(
"SurfaceODESolver::setVerbosity");
238 if (m_verbosity > 5) {
239 pout() << m_name +
"::setVerbosity" <<
endl;
249 CH_TIME(
"SurfaceODESolver::getVerbosity");
261 CH_TIME(
"SurfaceODESolver::setTime");
262 if (m_verbosity > 5) {
263 pout() << m_name +
"::setTime" <<
endl;
275 CH_TIME(
"SurfaceODESolver::computeMass(int)");
276 if (m_verbosity > 5) {
277 pout() << m_name +
"::computeMass(int)" <<
endl;
280 return this->computeMass(m_phi,
a_comp);
287 CH_TIME(
"SurfaceODESolver::computeMass(EBAMRIVData, int)");
288 if (m_verbosity > 5) {
289 pout() << m_name +
"::computeMass(EBAMRIVData, int)" <<
endl;
294 for (
int lvl = 0;
lvl <= m_amr->getFinestLevel();
lvl++) {
305#pragma omp parallel for schedule(runtime) reduction(+ : dataSum)
334 CH_TIME(
"SurfaceODESolver::getStep");
346 CH_TIME(
"SurfaceODESolver::getTime");
358 CH_TIME(
"SurfaceODESolver::getDt");
370 CH_TIME(
"SurfaceODESolver::setPhi(Real)");
382 CH_TIME(
"SurfaceODESolver::setPhi(std::array<Real, N>)");
387 for (
int i = 0;
i <
N;
i++) {
396 CH_TIME(
"SurfaceODESolver::setPhi(EBAMRIVData)");
408 CH_TIME(
"SurfaceODESolver::getPhi");
420 CH_TIME(
"SurfaceODESolver::getPhi");
432 CH_TIME(
"SurfaceODESolver::setRHS(Real)");
444 CH_TIME(
"SurfaceODESolver::setRHS(std::array<Real, N>)");
449 for (
int i = 0;
i <
N;
i++) {
458 CH_TIME(
"SurfaceODESolver::setRHS(EBAMRIVData)");
470 CH_TIME(
"SurfaceODESolver::getRHS");
482 CH_TIME(
"SurfaceODESolver::getRHS");
494 CH_TIME(
"SurfaceODESolver::allocate");
504 this->defineVoFIterators();
511 CH_TIME(
"SurfaceODESolver::deallocate");
524 CH_TIME(
"SurfaceODESolver::defineVoFIterators");
549#pragma omp parallel for schedule(runtime)
573 CH_TIME(
"SurfaceODESolver::registerOperators");
587 CH_TIME(
"SurfaceODESolver::registerOperators");
588 if (m_verbosity > 5) {
589 pout() << m_name +
"::registerOperators" <<
endl;
594 m_amr->allocate(m_cache, m_realm, m_phase,
N);
605 CH_TIME(
"SurfaceODESolver::regrid");
606 if (m_verbosity > 5) {
607 pout() << m_name +
"::registerOperators" <<
endl;
613 : EBCoarseToFineInterp::Type::PWC;
624 CH_TIME(
"SurfaceODESolver::resetElectrodes");
625 if (m_verbosity > 5) {
626 pout() << m_name +
"::resetElectrodes" <<
endl;
629 this->resetElectrodes(m_phi,
a_value);
636 CH_TIME(
"SurfaceODESolver::resetElectrodes(EBAMRIVData)");
637 if (m_verbosity > 5) {
638 pout() << m_name +
"::resetElectrodes(EBAMRIVData)" <<
endl;
641 for (
int lvl = 0;
lvl <= m_amr->getFinestLevel();
lvl++) {
647#pragma omp parallel for schedule(runtime)
669 CH_TIME(
"SurfaceODESolver::resetDielectrics");
670 if (m_verbosity > 5) {
671 pout() << m_name +
"::resetDielectrics" <<
endl;
674 this->resetDielectrics(m_phi,
a_value);
681 CH_TIME(
"SurfaceODESolver::resetDielectrics(EBAMRIVData)");
682 if (m_verbosity > 5) {
683 pout() << m_name +
"::resetDielectrics(EBAMRIVData)" <<
endl;
686 for (
int lvl = 0;
lvl <= m_amr->getFinestLevel();
lvl++) {
692#pragma omp parallel for schedule(runtime)
715 CH_TIME(
"SurfaceODESolver::writeCheckpointLevel");
716 if (m_verbosity > 5) {
717 pout() << m_name +
"::writeCheckpointLevel" <<
endl;
720 const std::string id =
"SurfaceODESolver::" + m_name +
"::phi";
742 CH_TIME(
"SurfaceODESolver::readCheckpointLevel");
743 if (m_verbosity > 5) {
744 pout() << m_name +
"::readCheckpointLevel" <<
endl;
747 const std::string id =
"SurfaceODESolver::" + m_name +
"::phi";
768 CH_TIME(
"SurfaceODESolver::writePlotFile");
775 if (numPlotVars > 0) {
801 DischargeIO::writeEBHDF5(
fname,
807 m_amr->getRefinementRatios(),
811 m_amr->getFinestLevel() + 1,
822 const int a_level)
const noexcept
824 CH_TIME(
"SurfaceODESolver::writePlotData");
825 if (m_verbosity > 5) {
826 pout() << m_name +
"::writePlotData" <<
endl;
872 CH_TIME(
"SurfaceODESolver::getNumberOfPlotVariables");
894 CH_TIME(
"SurfaceODESolver::getPlotVariableNames");
902 for (
int i = 0;
i <
N;
i++) {
913 for (
int i = 0;
i <
N;
i++) {
926#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:801
static void setValue(LevelData< MFInterfaceFAB< T > > &a_lhs, const T &a_value)
Set value in an MFInterfaceFAB data holder.
Definition CD_DataOpsImplem.H:23
static void copy(MFAMRCellData &a_dst, const MFAMRCellData &a_src)
Copy data from one data holder to another.
Definition CD_DataOps.cpp:1132
Type
Type of interpolation methods supported. PWC = Piecewise constant, ignoring the embedded boundary....
Definition CD_EBCoarseToFineInterp.H:42
Wrapper class for holding multifluid EBLevelGrids.
Definition CD_MFLevelGrid.H:29
static const std::string Primal
Identifier for perimal realm.
Definition CD_Realm.H:47
Surface ODE solver.
Definition CD_SurfaceODESolver.H:28
virtual void setName(const std::string a_name) noexcept
Set the solver name.
Definition CD_SurfaceODESolverImplem.H:187
virtual int getVerbosity() const noexcept
Get verbosity.
Definition CD_SurfaceODESolverImplem.H:247
virtual EBAMRIVData & getRHS()
Get internal state.
Definition CD_SurfaceODESolverImplem.H:468
void parseVerbosity() noexcept
Parse verbosity.
Definition CD_SurfaceODESolverImplem.H:90
virtual EBAMRIVData & getPhi() noexcept
Get internal state.
Definition CD_SurfaceODESolverImplem.H:406
virtual void setRHS(const Real a_rhs)
Convenience function for setting m_rhs.
Definition CD_SurfaceODESolverImplem.H:430
virtual phase::which_phase getPhase() const noexcept
Get phase.
Definition CD_SurfaceODESolverImplem.H:223
virtual void setRealm(const std::string a_realm) noexcept
Set the realm.
Definition CD_SurfaceODESolverImplem.H:175
std::string m_name
Solver name.
Definition CD_SurfaceODESolver.H:405
virtual void resetElectrodes(const Real a_value) noexcept
Reset m_phi on electrode cells.
Definition CD_SurfaceODESolverImplem.H:622
virtual int getStep() const noexcept
Get current time step.
Definition CD_SurfaceODESolverImplem.H:332
virtual void parseOptions() noexcept
Parse solver options.
Definition CD_SurfaceODESolverImplem.H:62
void parsePlotVariables() noexcept
Parse plot variables.
Definition CD_SurfaceODESolverImplem.H:130
virtual void setPhase(const phase::which_phase a_phase) noexcept
Set phase.
Definition CD_SurfaceODESolverImplem.H:211
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amrMesh) noexcept
Set the amr object.
Definition CD_SurfaceODESolverImplem.H:161
SurfaceODESolver()
Default constructor. Must subsequently set AmrMesh.
Definition CD_SurfaceODESolverImplem.H:25
void parseRegrid() noexcept
Parse regrid method.
Definition CD_SurfaceODESolverImplem.H:104
virtual void allocate() noexcept
Allocate internal storage for this class.
Definition CD_SurfaceODESolverImplem.H:492
virtual Real getDt() const noexcept
Get last time step.
Definition CD_SurfaceODESolverImplem.H:356
std::string getRealm() const noexcept
Get the realm where the solver is registered.
Definition CD_SurfaceODESolverImplem.H:199
RefCountedPtr< AmrMesh > m_amr
AMR; needed for grid stuff.
Definition CD_SurfaceODESolver.H:435
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel) noexcept
Pre-regrid function.
Definition CD_SurfaceODESolverImplem.H:585
virtual ~SurfaceODESolver()
Destructor (does nothing).
Definition CD_SurfaceODESolverImplem.H:52
virtual Real getTime() const noexcept
Get current time.
Definition CD_SurfaceODESolverImplem.H:344
virtual void setVerbosity(const int a_verbosity) noexcept
Set verbosity.
Definition CD_SurfaceODESolverImplem.H:235
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:819
virtual void setPhi(const Real a_phi)
Convenience function for setting m_phi.
Definition CD_SurfaceODESolverImplem.H:368
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:273
virtual Vector< std::string > getPlotVariableNames() const noexcept
Get output plot names.
Definition CD_SurfaceODESolverImplem.H:892
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) noexcept
Regrid function.
Definition CD_SurfaceODESolverImplem.H:603
virtual void registerOperators() noexcept
Register operators.
Definition CD_SurfaceODESolverImplem.H:571
int m_verbosity
Solver verbosity.
Definition CD_SurfaceODESolver.H:466
virtual void deallocate() noexcept
Deallocate internal storage.
Definition CD_SurfaceODESolverImplem.H:509
virtual void parseRuntimeOptions() noexcept
Parse runtime solver options.
Definition CD_SurfaceODESolverImplem.H:76
virtual void writePlotFile() const noexcept
Write a plot file.
Definition CD_SurfaceODESolverImplem.H:766
virtual void setTime(const int a_step, const Real a_time, const Real a_dt) noexcept
Set the time.
Definition CD_SurfaceODESolverImplem.H:259
void defineVoFIterators() noexcept
Define iterators for iterating over cell subsets.
Definition CD_SurfaceODESolverImplem.H:522
virtual int getNumberOfPlotVariables() const noexcept
Get number of variables to be plotted.
Definition CD_SurfaceODESolverImplem.H:870
virtual void resetDielectrics(const Real a_value) noexcept
Reset m_phi on dielectric cells.
Definition CD_SurfaceODESolverImplem.H:667
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
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:145
phase::which_phase m_phase
Phase where this solver lives.
Definition CD_TracerParticleSolver.H:343
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:25
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:328
void parseVerbosity()
Parse solver verbosity.
Definition CD_TracerParticleSolverImplem.H:160
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:505
int m_verbosity
Verbosity level.
Definition CD_TracerParticleSolver.H:363
RefCountedPtr< AmrMesh > m_amr
Handle to AMR mesh.
Definition CD_TracerParticleSolver.H:303
virtual Vector< std::string > getPlotVariableNames() const
Get plot variable names.
Definition CD_TracerParticleSolverImplem.H:476
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:348
virtual void allocate()
Allocate storage for this solver.
Definition CD_TracerParticleSolverImplem.H:195
std::string m_name
Solver name.
Definition CD_TracerParticleSolver.H:333
std::string m_className
Class name.
Definition CD_TracerParticleSolver.H:338
Real m_time
Time.
Definition CD_TracerParticleSolver.H:353
virtual int getNumberOfPlotVariables() const
Get the number of plot variables.
Definition CD_TracerParticleSolverImplem.H:455
ALWAYS_INLINE void loop(const Box &a_computeBox, Functor &&kernel, const IntVect &a_stride=IntVect::Unit)
Launch a C++ kernel over a regular grid.
Definition CD_BoxLoopsImplem.H:20
Real sum(const Real &a_value) noexcept
Compute the sum across all MPI ranks.
Definition CD_ParallelOpsImplem.H:353