12 #ifndef CD_CdrSolver_H
13 #define CD_CdrSolver_H
26 #include <CD_NamespaceHeader.H>
134 const Real a_dt) = 0;
157 const Real a_dt) = 0;
172 const Real a_extrapDt,
173 const bool a_conservativeOnly,
175 const bool a_domainFlux) = 0;
191 const Real a_extrapDt,
192 const bool a_conservativeOnly,
194 const bool a_domainFlux) = 0;
209 const bool a_conservativeOnly,
211 const bool a_domainFlux) = 0;
247 preRegrid(
const int a_lbase,
const int a_oldFinestLevel);
268 setRealm(
const std::string a_realm);
273 virtual RefCountedPtr<CdrSpecies>&
325 setTime(const
int a_step, const Real a_time, const Real a_dt);
348 setVelocity(const std::function<RealVect(const RealVect a_pos)>& a_velocity);
397 setSource(const std::function<Real(const RealVect a_position)> a_source);
449 const std::
string a_outputRealm,
450 const
int a_level) const noexcept;
459 writeCheckpointLevel(HDF5Handle& a_handle,
const int a_level)
const;
469 readCheckpointLevel(HDF5Handle& a_handle,
const int a_level);
480 regrid(
const int a_lmin,
const int a_oldFinestLevel,
const int a_newFinestLevel);
500 virtual Vector<std::string>
955 const bool a_addDomainFlux =
true);
969 const LevelData<EBFluxFAB>& a_facePhi,
970 const LevelData<EBFluxFAB>& a_faceVelocity,
992 computeDiffusionFlux(LevelData<EBFluxFAB>& a_flux,
const LevelData<EBCellFAB>& a_phi,
const int a_lvl);
1009 const bool a_addDomainFlux);
1074 LevelData<BaseIVFAB<Real>>& a_massDifference,
1075 const LevelData<BaseIVFAB<Real>>& a_nonConservativeDivergence,
1115 const LevelData<EBFluxFAB>& a_centroidFluxes,
1116 const LevelData<BaseIVFAB<Real>>& a_ebFlux,
1177 makeBcString(
const int a_dir,
const Side::LoHiSide a_side)
const;
1207 writeData(LevelData<EBCellFAB>& a_output,
1210 const std::string a_outputRealm,
1212 const bool a_interpToCentroids,
1213 const bool a_interpGhost)
const noexcept;
1216 #include <CD_NamespaceFooter.H>
Declaration of core class for handling AMR-related operations (with embedded boundaries)
Declaration of domain boundary condition types for CdrSolver.
Declaration of a class that passes information into CdrSolver (e.g., initial conditions).
Declaration of base class for defining geometries.
Class for handling spatial operations.
Definition: CD_AmrMesh.H:44
Class for encapsulating possible domain boundary conditions for CdrSolver.
Definition: CD_CdrDomainBC.H:31
std::function< Real(const RealVect a_position, const Real a_time)> FluxFunction
Function which maps f(R^3,t) : R. Used for setting the associated value and boundary condition type.
Definition: CD_CdrDomainBC.H:51
std::pair< int, Side::LoHiSide > DomainSide
Alias for mapping a direction and side. The first element in pair is the coordinate direction and the...
Definition: CD_CdrDomainBC.H:56
BcType
Boundary condition types for the CDR solvers.
Definition: CD_CdrDomainBC.H:37
Base class for solving convection-diffusion-reaction equations.
Definition: CD_CdrSolver.H:34
virtual void gwnDiffusionSource(EBAMRCellData &a_noiseSource, const EBAMRCellData &a_cellPhi)
Compute a random gaussian white noise source term.
Definition: CD_CdrSolver.cpp:2936
virtual void parseOptions()=0
Parse class options.
virtual void computeDivF(EBAMRCellData &a_divF, EBAMRCellData &a_phi, const Real a_extrapDt, const bool a_conservativeOnly, const bool a_ebFlux, const bool a_domainFlux)=0
Compute div(v*phi) explicitly.
bool m_isDiffusive
Is the solver diffusive or not.
Definition: CD_CdrSolver.H:876
virtual void computeAdvectionDiffusionFlux(EBAMRFluxData &a_flux, const EBAMRCellData &a_cellStates, const EBAMRFluxData &a_faceStates, const EBAMRFluxData &a_faceVelocities, const EBAMRFluxData &a_faceDiffCo, const bool a_addDomainFlux)
Compute the full advection-diffusion flux. This assumes that the solver is mobile and diffusive.
Definition: CD_CdrSolver.cpp:684
virtual void nonConservativeDivergence(EBAMRIVData &a_nonConservativeDivergence, const EBAMRCellData &a_divG)
Compute the non-conservative divergence.
Definition: CD_CdrSolver.cpp:1458
virtual RefCountedPtr< CdrSpecies > & getSpecies() noexcept
Get the CDR species.
Definition: CD_CdrSolver.cpp:46
bool m_plotPhi
If true, m_phi is added to plot files.
Definition: CD_CdrSolver.H:886
virtual EBAMRIVData & getEbCenteredDiffusionCoefficient()
Get the EB-centered diffusion coefficient.
Definition: CD_CdrSolver.cpp:2678
virtual void parseRuntimeOptions()=0
Parse runtime options.
virtual EBAMRIVData & getEbCenteredVelocity()
Get the eb-centered velocities.
Definition: CD_CdrSolver.cpp:2645
int m_timeStep
Time step.
Definition: CD_CdrSolver.H:851
EBAMRCellData m_source
Source term.
Definition: CD_CdrSolver.H:758
virtual EBAMRCellData & getSource()
Get the source term.
Definition: CD_CdrSolver.cpp:2612
CdrSolver(const CdrSolver &&a_other)=delete
Disallowed move constructor.
virtual void parsePlotVariables()
Parses plot variables.
Definition: CD_CdrSolver.cpp:2893
CdrSolver()
Default constructor.
Definition: CD_CdrSolver.cpp:29
virtual void parsePlotMode()
Parse plot mode.
Definition: CD_CdrSolver.cpp:3191
EBAMRFluxData m_faceCenteredDiffusionCoefficient
Diffusion coefficients on face centers.
Definition: CD_CdrSolver.H:828
virtual int getNumberOfPlotVariables() const
Get number of output fields.
Definition: CD_CdrSolver.cpp:187
virtual bool isMobile()
Return true if the solver is mobile and false otherwise.
Definition: CD_CdrSolver.cpp:2590
virtual EBAMRFluxData & getFaceCenteredVelocity()
Get the face-centered velocities.
Definition: CD_CdrSolver.cpp:2634
bool m_plotDiffusionCoefficient
Output diffusion coefficients.
Definition: CD_CdrSolver.H:896
virtual void setRealm(const std::string a_realm)
Set the realm for this solver.
Definition: CD_CdrSolver.cpp:138
EBAMRIVData m_massDifference
Scratch storage for the mass difference.
Definition: CD_CdrSolver.H:786
CdrSolver(const CdrSolver &a_other)=delete
Disallowed copy constructor.
static constexpr int m_nComp
Number of components that this solver solves for.
Definition: CD_CdrSolver.H:702
virtual void allocate()
Allocate internal storage.
Definition: CD_CdrSolver.cpp:269
virtual void setPhase(phase::which_phase a_phase)
Set phase.
Definition: CD_CdrSolver.cpp:1753
Real m_dt
Last time step increment.
Definition: CD_CdrSolver.H:861
virtual void hybridDivergence(EBAMRCellData &a_hybridDivergence, EBAMRIVData &a_massDifference, const EBAMRIVData &a_nonConservativeDivergence)
Use the non-conservative divergence to make the conservative divergence hold the hybrid divergence.
Definition: CD_CdrSolver.cpp:1303
Redistribution m_whichRedistribution
Which type of redistribution to use.
Definition: CD_CdrSolver.H:866
virtual Real computeAdvectionDt()
Compute the largest possible diffusive time step (for explicit methods)
Definition: CD_CdrSolver.cpp:1990
bool m_plotVelocity
Output velocities.
Definition: CD_CdrSolver.H:891
virtual EBAMRFluxData & getFaceCenteredDiffusionCoefficient()
Get the face-centered diffusion coefficient.
Definition: CD_CdrSolver.cpp:2667
RefCountedPtr< AmrMesh > m_amr
AMR; needed for grid stuff.
Definition: CD_CdrSolver.H:717
RefCountedPtr< CdrSpecies > m_species
Species through which e.g. mobility/diffusion and initial conditions is passed.
Definition: CD_CdrSolver.H:707
virtual void registerOperators()
Register operators for AMR operations.
Definition: CD_CdrSolver.cpp:1528
virtual void fillGwn(EBAMRFluxData &a_noise, const Real a_sigma)
Gaussian noise field.
Definition: CD_CdrSolver.cpp:3126
virtual void setEbFlux(const EBAMRIVData &a_ebFlux)
Data-based version of setting the EB flux.
Definition: CD_CdrSolver.cpp:1611
virtual void redistribute(EBAMRCellData &a_phi, const EBAMRIVData &a_delta) const noexcept
Add data through redistribution into cell-centered holders.
Definition: CD_CdrSolver.cpp:477
Vector< RefCountedPtr< LayoutData< BaseIFFAB< FaceStencil > > > > m_interpStencils[SpaceDim]
Stencils for interpolating face-centered fluxes to face centroids.
Definition: CD_CdrSolver.H:722
virtual void setComputationalGeometry(const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Set computational geometry.
Definition: CD_CdrSolver.cpp:1546
std::string m_realm
Realm where this solver is registered.
Definition: CD_CdrSolver.H:743
virtual void computeDivJ(EBAMRCellData &a_divJ, EBAMRCellData &a_phi, const Real a_extrapDt, const bool a_conservativeOnly, const bool a_ebFlux, const bool a_domainFlux)=0
Compute div(J) explicitly, where J = nV - D*grad(n)
EBAMRIVData m_nonConservativeDivG
Scratch storage for the non-conservative divergence.
Definition: CD_CdrSolver.H:781
CdrSolver & operator=(const CdrSolver &a_other)=delete
Disallowed assignment operator.
virtual EBAMRCellData & getPhi()
Get the cell-centered phi.
Definition: CD_CdrSolver.cpp:2601
virtual void initialDataDistribution()
Fill initial data from a distribution function.
Definition: CD_CdrSolver.cpp:1218
EBAMRCellData m_phi
Cell-centered data (i.e. the advected-diffused quantity)
Definition: CD_CdrSolver.H:753
CdrSolver & operator=(const CdrSolver &&a_other)=delete
Disallowed move assignement operator.
virtual Real computeAdvectionDiffusionDt()
Compute the largest possible diffusive time step (for explicit methods)
Definition: CD_CdrSolver.cpp:2143
virtual void advanceEuler(EBAMRCellData &a_newPhi, const EBAMRCellData &a_oldPhi, const Real a_dt)
Implicit diffusion Euler advance without source term.
Definition: CD_CdrSolver.cpp:219
virtual bool isDiffusive()
Return true if the solver is diffusive and false otherwise.
Definition: CD_CdrSolver.cpp:2579
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Computational geometry.
Definition: CD_CdrSolver.H:712
virtual void resetDomainFlux(EBAMRFluxData &a_flux)
Set flux to zero on domain boundaries.
Definition: CD_CdrSolver.cpp:784
virtual void computeDivG(EBAMRCellData &a_divG, EBAMRFluxData &a_G, const EBAMRIVData &a_ebFlux, const bool a_conservativeOnly)
Compute div(G) where G is a general face-centered flux on face centers and EB centers....
Definition: CD_CdrSolver.cpp:417
virtual EBAMRIFData & getDomainFlux()
Get the domain flux data holder.
Definition: CD_CdrSolver.cpp:2700
EBAMRIVData m_ebCenteredDiffusionCoefficient
Diffusion coefficients on EB faces.
Definition: CD_CdrSolver.H:834
bool m_plotEbFlux
Output EB fluxes.
Definition: CD_CdrSolver.H:901
EBAMRFluxData m_faceStates
Holder for face centered states.
Definition: CD_CdrSolver.H:770
Redistribution
Redistribution method.
Definition: CD_CdrSolver.H:689
EBAMRCellData m_cellVelocity
Cell-centered velocities.
Definition: CD_CdrSolver.H:764
virtual void initialData()
Fill m_phi state with initial data from m_species.
Definition: CD_CdrSolver.cpp:1193
virtual void smoothHeavisideFaces(EBAMRFluxData &a_facePhi, const EBAMRCellData &a_cellPhi)
Use Heaviside smoothing for computing face-centered states.
Definition: CD_CdrSolver.cpp:2995
std::map< CdrDomainBC::DomainSide, CdrDomainBC::FluxFunction > m_domainFluxFunctions
Domain flux functions.
Definition: CD_CdrSolver.H:840
bool m_regridSlopes
Use slopes when regridding.
Definition: CD_CdrSolver.H:916
virtual void parseDomainBc()
Parses domain BC options.
Definition: CD_CdrSolver.cpp:2821
virtual std::string getName() const
Get solver name.
Definition: CD_CdrSolver.cpp:116
virtual void conservativeDivergenceNoKappaDivision(EBAMRCellData &a_conservativeDivergence, EBAMRFluxData &a_flux, const EBAMRIVData &a_ebFlux)
Compute conservative divergence from fluxes.
Definition: CD_CdrSolver.cpp:980
void setDefaultDomainBC()
This sets default boundary conditions (wall type).
Definition: CD_CdrSolver.cpp:68
virtual void setVerbosity(const int a_verbosity)
Set verbosity.
Definition: CD_CdrSolver.cpp:1764
virtual Real computeCharge()
Compute the total charge in m_phi.
Definition: CD_CdrSolver.cpp:2564
virtual void parseRegridSlopes()
Parse slope regrid.
Definition: CD_CdrSolver.cpp:3215
std::string m_className
Class name.
Definition: CD_CdrSolver.H:738
virtual ~CdrSolver()
Constructor.
Definition: CD_CdrSolver.cpp:42
virtual void averageVelocityToFaces()
Average velocities to faces.
Definition: CD_CdrSolver.cpp:363
EBAMRIVData m_ebFlux
Flux through the embedded boundary.
Definition: CD_CdrSolver.H:811
EBAMRCellData m_cellCenteredDiffusionCoefficient
Diffusion coefficients on cell centers.
Definition: CD_CdrSolver.H:822
virtual void deallocate()
Deallocate internal storage.
Definition: CD_CdrSolver.cpp:344
virtual void setTime(const int a_step, const Real a_time, const Real a_dt)
Set the time for this solver.
Definition: CD_CdrSolver.cpp:1695
virtual std::string getRealm() const
Get the realm where this solver is registered.
Definition: CD_CdrSolver.cpp:127
int m_seed
RNG seed.
Definition: CD_CdrSolver.H:921
virtual Real computeDiffusionDt()
Compute the largest possible diffusive time step (for explicit methods)
Definition: CD_CdrSolver.cpp:2057
virtual void weightedUpwind(EBAMRCellData &a_weightedUpwindPhi, const int a_pow)
Compute an upwind-weighted version of phi.
Definition: CD_CdrSolver.cpp:2324
virtual void computeAdvectionFlux(EBAMRFluxData &a_flux, const EBAMRFluxData &a_facePhi, const EBAMRFluxData &a_faceVelocity, const bool a_addDomainFlux=true)
Set up face-centered advection flux.
Definition: CD_CdrSolver.cpp:511
EBAMRCellData m_cachePhi
Cached state vector for regrid.
Definition: CD_CdrSolver.H:796
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const noexcept
Write output data to a_output.
Definition: CD_CdrSolver.cpp:1829
virtual void advanceEuler(EBAMRCellData &a_newPhi, const EBAMRCellData &a_oldPhi, const EBAMRCellData &a_source, const Real a_dt)=0
Implicit diffusion Euler advance with source term.
virtual void fillDomainFlux(EBAMRFluxData &a_flux)
Set domain in data holder. This sets the flux on the boundary to either zero or to m_domainFlux.
Definition: CD_CdrSolver.cpp:848
bool m_plotNumbers
Plot numbers or densities.
Definition: CD_CdrSolver.H:911
virtual Real computeMass()
Compute the "physical mass" in m_phi.
Definition: CD_CdrSolver.cpp:2493
virtual void parseDivergenceComputation()
Parse the conservation.
Definition: CD_CdrSolver.cpp:2865
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel)
Perform pre-regrid operations.
Definition: CD_CdrSolver.cpp:400
virtual void advanceCrankNicholson(EBAMRCellData &a_newPhi, const EBAMRCellData &a_oldPhi, const EBAMRCellData &a_source, const Real a_dt)=0
Implicit diffusion Crank-Nicholson advance with source term.
virtual void defineInterpolationStencils()
Define stencils for doing face-centered to face-centroid-centered states.
Definition: CD_CdrSolver.cpp:1143
Real m_time
Current time.
Definition: CD_CdrSolver.H:856
EBAMRIVData m_ebZero
Scratch storage for the EB flux.
Definition: CD_CdrSolver.H:791
bool m_blendConservation
Flag for blending the hybrid divergence.
Definition: CD_CdrSolver.H:871
bool m_isMobile
Solve for advection/convection or not.
Definition: CD_CdrSolver.H:881
virtual void interpolateFluxToFaceCentroids(EBAMRFluxData &a_flux)
Interpolate flux to centroids.
Definition: CD_CdrSolver.cpp:1377
EBAMRIVData m_ebVelocity
EB-centered velocities.
Definition: CD_CdrSolver.H:806
void setDomainBcFunction(const CdrDomainBC::DomainSide a_domainSide, const CdrDomainBC::FluxFunction a_fluxFunction)
Set domain bc function on particular domain side.
Definition: CD_CdrSolver.cpp:104
virtual void advectToFaces(EBAMRFluxData &a_facePhi, const EBAMRCellData &a_phi, const Real a_extrapDt)=0
Advection-only extrapolation to faces.
virtual void advanceCrankNicholson(EBAMRCellData &a_newPhi, const EBAMRCellData &a_oldPhi, const Real a_dt)
Implicit diffusion Crank-Nicholson advance without source term.
Definition: CD_CdrSolver.cpp:244
static constexpr int m_comp
Component number in data holder.
Definition: CD_CdrSolver.H:697
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)
Write checkpoint data into HDF5 file. @paramo[out] a_handle HDF5 file.
Definition: CD_CdrSolver.cpp:1484
EBAMRFluxData m_faceVelocity
Face-centered velocities (only normal components)
Definition: CD_CdrSolver.H:776
virtual void setDiffusionCoefficient(const EBAMRFluxData &a_diffusionCoefficient, const EBAMRIVData &a_ebDiffusionCoefficient)
Data-based version of setting diffusion coefficients (which are stored on faces)
Definition: CD_CdrSolver.cpp:1561
EBAMRCellData m_cacheSource
Cached source term for regrids.
Definition: CD_CdrSolver.H:801
EBAMRIFData m_domainFlux
Domain flux.
Definition: CD_CdrSolver.H:816
virtual void setAmr(const RefCountedPtr< AmrMesh > &a_amr)
Set the amr object.
Definition: CD_CdrSolver.cpp:1515
virtual void setSpecies(const RefCountedPtr< CdrSpecies > &a_species)
Set species.
Definition: CD_CdrSolver.cpp:1635
virtual EBAMRCellData & getCellCenteredVelocity()
Get the cell-centered velocity.
Definition: CD_CdrSolver.cpp:2623
virtual EBAMRIVData & getEbFlux()
Get the eb flux data holder.
Definition: CD_CdrSolver.cpp:2689
virtual Real computeSourceDt(const Real a_max, const Real a_tolerance)
Compute the largest possible source time step (for explicit methods.
Definition: CD_CdrSolver.cpp:2261
int m_verbosity
Solver verbosity.
Definition: CD_CdrSolver.H:846
virtual void setSource(const EBAMRCellData &a_source)
Data based version of setting source terms.
Definition: CD_CdrSolver.cpp:1651
virtual void setVelocity(const EBAMRCellData &a_velocity)
Set velocity from data holder.
Definition: CD_CdrSolver.cpp:1708
virtual void writePlotFile()
Write plot file.
Definition: CD_CdrSolver.cpp:1775
virtual void conservativeDivergenceRegular(LevelData< EBCellFAB > &a_divJ, const LevelData< EBFluxFAB > &a_flux, const int a_lvl)
Compute the conservative divergence over regular cells.
Definition: CD_CdrSolver.cpp:1084
virtual void initialDataParticles()
Fill initial data from particles.
Definition: CD_CdrSolver.cpp:1244
virtual void computeDiffusionFlux(EBAMRFluxData &a_flux, const EBAMRCellData &a_phi, const bool a_addDomainFlux)
Compute the face-centered diffusion flux.
Definition: CD_CdrSolver.cpp:576
virtual void extrapolateAdvectiveFluxToEB() noexcept
Extrapolate advective flux to EB.
Definition: CD_CdrSolver.cpp:2711
virtual Vector< std::string > getPlotVariableNames() const
Get output plot names.
Definition: CD_CdrSolver.cpp:149
bool m_plotSource
Output source term.
Definition: CD_CdrSolver.H:906
virtual EBAMRCellData & getCellCenteredDiffusionCoefficient()
Get the cell-centered diffusion coefficient.
Definition: CD_CdrSolver.cpp:2656
virtual void computeDivergenceIrregular(LevelData< EBCellFAB > &a_divG, const LevelData< EBFluxFAB > &a_centroidFluxes, const LevelData< BaseIVFAB< Real >> &a_ebFlux, const int a_lvl)
Compute conservative divergence on irregular cells (not kappa divided)
Definition: CD_CdrSolver.cpp:1016
std::string m_name
Solver name.
Definition: CD_CdrSolver.H:732
virtual std::string makeBcString(const int a_dir, const Side::LoHiSide a_side) const
Shortcut for making a boundary condition string.
Definition: CD_CdrSolver.cpp:2788
phase::which_phase m_phase
Phase.
Definition: CD_CdrSolver.H:727
virtual void computeDivD(EBAMRCellData &a_divD, EBAMRCellData &a_phi, const bool a_conservativeOnly, const bool a_ebFlux, const bool a_domainFlux)=0
Compute div(D*grad(phi)) explicitly.
CdrDomainBC m_domainBC
Domain BCs.
Definition: CD_CdrSolver.H:748
virtual void writeData(LevelData< EBCellFAB > &a_output, int &a_comp, const EBAMRCellData &a_data, const std::string a_outputRealm, const int a_level, const bool a_interpToCentroids, const bool a_interpGhost) const noexcept
Write data to output. Convenience function.
Definition: CD_CdrSolver.cpp:1901
void setDomainBcType(const CdrDomainBC::DomainSide a_domainSide, const CdrDomainBC::BcType a_bcType)
Set domain bc type on domain side.
Definition: CD_CdrSolver.cpp:93
Abstract class that describes the scalar quantity that is advected in CdrSolver.
Definition: CD_CdrSpecies.H:30
Abstract base class for geometries.
Definition: CD_ComputationalGeometry.H:36
phase names
Definition: CD_MultiFluidIndexSpace.H:27