chombo-discharge
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MeshODESolver< N > Class Template Reference

Class for solving dy/dt = f on an AMR hierarchy. More...

#include <CD_MeshODESolver.H>

Collaboration diagram for MeshODESolver< N >:
Collaboration graph
[legend]

Public Types

using RHSFunction = std::function< std::array< Real, N >(const std::array< Real, N > &, const Real)>
 Alias for right-hand side.
 

Public Member Functions

 MeshODESolver ()
 Default constructor. Must subsequently set everything through public member functions.
 
 MeshODESolver (const RefCountedPtr< AmrMesh > &a_amr) noexcept
 Full constructor. More...
 
 MeshODESolver (const MeshODESolver &)=delete
 Disallowed copy constructor.
 
 MeshODESolver (const MeshODESolver &&)=delete
 Disallowed move constructor.
 
virtual ~MeshODESolver ()
 Destructor.
 
MeshODESolveroperator= (const MeshODESolver &)=delete
 Disallowed assignment operator.
 
MeshODESolveroperator= (const MeshODESolver &&)=delete
 Disallowed move assignement operator.
 
virtual void setAmr (const RefCountedPtr< AmrMesh > &a_amrMesh) noexcept
 Set AmrMesh. More...
 
virtual void parseOptions () noexcept
 Parse class options.
 
virtual void parseRuntimeOptions () noexcept
 Parse run-time configurable class options.
 
virtual void allocate () noexcept
 Allocate internal storage.
 
virtual void setPhi (const std::function< Real(const RealVect &a_pos)> &a_phiFunc, const size_t a_comp) noexcept
 Set phi for a specific component. More...
 
virtual void setPhi (const std::function< std::array< Real, N >(const RealVect &a_pos)> &a_phiFunc) noexcept
 Set phi everywhere. More...
 
virtual void setRHS (const std::function< Real(const RealVect &a_pos)> &a_srcFunc, const size_t a_comp) noexcept
 Set right-hand side for specified component. More...
 
virtual void computeRHS (const RHSFunction &a_rhsFunction) noexcept
 Compute right-hand side from left-hand side. I.e. compute f = f(y,t). More...
 
virtual void computeRHS (EBAMRCellData &rhs, const RHSFunction &a_rhsFunction) const noexcept
 Compute right-hand side from left-hand side. I.e. compute f = f(y,t). More...
 
EBAMRCellDatagetPhi () noexcept
 Get the solution vector (left-hand side of equation).
 
const EBAMRCellDatagetPhi () const noexcept
 Get the solution vector (left-hand side of equation).
 
EBAMRCellDatagetRHS () noexcept
 Get the solution vector (left-hand side of equation).
 
const EBAMRCellDatagetRHS () const noexcept
 Get the solution vector (left-hand side of equation).
 
virtual void preRegrid (const int a_lbase, const int a_oldFinestLevel) noexcept
 Perform pre-regrid operations. More...
 
virtual void regrid (const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) noexcept
 Regrid this solver. More...
 
virtual std::string getRealm () const noexcept
 Get the realm where this solver is registered. More...
 
virtual std::string getName () const noexcept
 Get solver name. More...
 
virtual void setName (const std::string &a_name) noexcept
 Set solver name. More...
 
virtual void registerOperators () const noexcept
 Register operators for AMR operations. More...
 
virtual void setRealm (const std::string a_realm) noexcept
 Set the realm for this solver. More...
 
virtual void setPhase (phase::which_phase a_phase) noexcept
 Set phase. More...
 
virtual void setVerbosity (const int a_verbosity) noexcept
 Set verbosity. More...
 
virtual void setTime (const int a_step, const Real a_time, const Real a_dt) noexcept
 Set the time for this solver. More...
 
virtual void writePlotFile () const noexcept
 Write plot file. More...
 
virtual int getNumberOfPlotVariables () const noexcept
 Get number of output fields. More...
 
virtual Vector< std::string > getPlotVariableNames () const noexcept
 Get output plot names. More...
 
virtual void writePlotData (LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const noexcept
 Write plot data to output holder. More...
 

Protected Member Functions

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. More...
 
virtual void parsePlotVariables () noexcept
 Parse plot variables.
 

Protected Attributes

RefCountedPtr< AmrMeshm_amr
 Write checkpoint data into HDF5 file. @paramo[out] a_handle HDF5 file. More...
 
int m_verbosity
 Chattiness.
 
int m_timeStep
 Time step.
 
Real m_time
 Current time.
 
Real m_dt
 Last time step increment.
 
bool m_plotPhi
 Plot solution vector or not.
 
bool m_plotRHS
 Plot source term or not.
 
bool m_regridSlopes
 Use slopes when regridding.
 
std::string m_name
 Solver name.
 
std::string m_className
 Class name. More...
 
std::string m_realm
 Realm where solver is registered.
 
phase::which_phase m_phase
 Phase where solver data lives.
 
EBAMRCellData m_phi
 Solution vector (left hand side of equation).
 
EBAMRCellData m_rhs
 Source term (right-hand side of equation).
 
EBAMRCellData m_cache
 Cache storage when doing regrids.
 

Detailed Description

template<size_t N = 1>
class MeshODESolver< N >

Class for solving dy/dt = f on an AMR hierarchy.

The template parameter is the number of variables in y and f.

Constructor & Destructor Documentation

◆ MeshODESolver()

template<size_t N>
MeshODESolver< N >::MeshODESolver ( const RefCountedPtr< AmrMesh > &  a_amr)
noexcept

Full constructor.

Parameters
[in]a_amrAMR core.

Member Function Documentation

◆ computeRHS() [1/2]

template<size_t N>
void MeshODESolver< N >::computeRHS ( const RHSFunction a_rhsFunction)
virtualnoexcept

Compute right-hand side from left-hand side. I.e. compute f = f(y,t).

Parameters
[in]a_rhsFunctionFunction for computing the right-hand side.

◆ computeRHS() [2/2]

template<size_t N>
void MeshODESolver< N >::computeRHS ( EBAMRCellData rhs,
const RHSFunction a_rhsFunction 
) const
virtualnoexcept

Compute right-hand side from left-hand side. I.e. compute f = f(y,t).

Parameters
[out]a_rhsRight-hand side on the mesh.
[in]a_rhsFunctionFunction for computing the right-hand side.

◆ getName()

template<size_t N>
std::string MeshODESolver< N >::getName
virtualnoexcept

Get solver name.

Note
Not necessarily equal to class name (we can have many CdrSolvers instantiated).

◆ getNumberOfPlotVariables()

template<size_t N>
int MeshODESolver< N >::getNumberOfPlotVariables
virtualnoexcept

Get number of output fields.

Returns
Returns number of plot variables include in writePlotFile() and writePlotData()

◆ getPlotVariableNames()

template<size_t N>
Vector< std::string > MeshODESolver< N >::getPlotVariableNames
virtualnoexcept

Get output plot names.

Returns
Return a list of plot variable names.

◆ getRealm()

template<size_t N>
std::string MeshODESolver< N >::getRealm
virtualnoexcept

Get the realm where this solver is registered.

Returns
Returns realm name.

◆ preRegrid()

template<size_t N>
void MeshODESolver< N >::preRegrid ( const int  a_lbase,
const int  a_oldFinestLevel 
)
virtualnoexcept

Perform pre-regrid operations.

Parameters
[in]a_lbaseCoarsest level that changed during regrid.
[in]a_oldFinestLevelFinest grid level before the regrid operation.
Note
This copies m_phi onto m_cache

◆ registerOperators()

template<size_t N>
void MeshODESolver< N >::registerOperators
virtualnoexcept

Register operators for AMR operations.

Note
This includes operators for redistribution, flux registers, regridding, ghost cell interpolation, and conservative coarsening.

◆ regrid()

template<size_t N>
void MeshODESolver< N >::regrid ( const int  a_lmin,
const int  a_oldFinestLevel,
const int  a_newFinestLevel 
)
virtualnoexcept

Regrid this solver.

Parameters
[in]a_lminCoarsest level where grids did not change.
[in]a_oldFinestLevelFinest AMR level before the regrid.
[in]a_newFinestLevelFinest AMR level after the regrid.

This linearly interpolates (potentially with limiters) m_phi to the new grids.

◆ setAmr()

template<size_t N>
void MeshODESolver< N >::setAmr ( const RefCountedPtr< AmrMesh > &  a_amrMesh)
virtualnoexcept

Set AmrMesh.

Parameters
[in]a_amrMeshAmrMesh

◆ setName()

template<size_t N>
void MeshODESolver< N >::setName ( const std::string &  a_name)
virtualnoexcept

Set solver name.

Parameters
[in]a_nameSolver name

◆ setPhase()

template<size_t N>
void MeshODESolver< N >::setPhase ( phase::which_phase  a_phase)
virtualnoexcept

Set phase.

Parameters
[in]a_phasePhase.

◆ setPhi() [1/2]

template<size_t N>
void MeshODESolver< N >::setPhi ( const std::function< Real(const RealVect &a_pos)> &  a_phiFunc,
const size_t  a_comp 
)
virtualnoexcept

Set phi for a specific component.

Parameters
[in]a_phiFuncPhi function
[in]a_compComponent

◆ setPhi() [2/2]

template<size_t N>
void MeshODESolver< N >::setPhi ( const std::function< std::array< Real, N >(const RealVect &a_pos)> &  a_phiFunc)
virtualnoexcept

Set phi everywhere.

Parameters
[in]a_phiFuncPhi function.

◆ setRealm()

template<size_t N>
void MeshODESolver< N >::setRealm ( const std::string  a_realm)
virtualnoexcept

Set the realm for this solver.

Parameters
[in]a_realmRealm identifier

◆ setRHS()

template<size_t N>
void MeshODESolver< N >::setRHS ( const std::function< Real(const RealVect &a_pos)> &  a_srcFunc,
const size_t  a_comp 
)
virtualnoexcept

Set right-hand side for specified component.

Parameters
[in]a_srcFuncSource term function.
[in]a_compComponent

◆ setTime()

template<size_t N>
void MeshODESolver< N >::setTime ( const int  a_step,
const Real  a_time,
const Real  a_dt 
)
virtualnoexcept

Set the time for this solver.

Parameters
[in]a_stepTime step number
[in]a_timeTime (in seconds)
[in]a_dtTime step increment
Note
This sets m_step=a_step, m_time=a_time, m_dt=a_dt

◆ setVerbosity()

template<size_t N>
void MeshODESolver< N >::setVerbosity ( const int  a_verbosity)
virtualnoexcept

Set verbosity.

Parameters
[in]a_verbosityVerbosity level.

◆ writeData()

template<size_t N>
void MeshODESolver< N >::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
protectedvirtualnoexcept

Write data to output. Convenience function.

Parameters
[in,out]a_outputOutput data holder.
[in,out]a_icompStarting component where this solver begins writing the output.
[in]a_dataData to write.
[in]a_outputRealmRealm where a_output belongs
[in]a_levelGrid level
[in]a_interpToCentroidsIf true, a_data will be interpolated to cell centroids before writing to a_output.
[in]a_interpGhostIf true, interpolate ghost cells

◆ writePlotData()

template<size_t N>
void MeshODESolver< N >::writePlotData ( LevelData< EBCellFAB > &  a_output,
int &  a_icomp,
const std::string  a_outputRealm,
const int  a_level 
) const
virtualnoexcept

Write plot data to output holder.

Parameters
[in,out]a_outputOutput data holder.
[in,out]a_icompStarting component in a_output to begin at.
[in]a_outputRealmRealm where a_output belongs
[in]a_levelGrid level

◆ writePlotFile()

template<size_t N>
void MeshODESolver< N >::writePlotFile
virtualnoexcept

Write plot file.

The name of the plot file is m_name.stepXXXXX.DIM.hdf5

Note
This calls writePlotData(...)

Member Data Documentation

◆ m_amr

template<size_t N = 1>
RefCountedPtr<AmrMesh> MeshODESolver< N >::m_amr
protected

Write checkpoint data into HDF5 file. @paramo[out] a_handle HDF5 file.

Parameters
[in]a_levelGrid level

Read checkpoint data from HDF5 file.

Parameters
[in]a_handleHDF5 handle.
[in]constint a_level Grid level

AMR mesh reference

◆ m_className

template<size_t N = 1>
std::string MeshODESolver< N >::m_className
protected

Class name.

This will be different for different implementations of CdrSolver


The documentation for this class was generated from the following files: