chombo-discharge
Public Member Functions | Protected Attributes | List of all members
TimeStepper Class Referenceabstract

Base class for advancing equations. More...

#include <CD_TimeStepper.H>

Inheritance diagram for TimeStepper:
Inheritance graph
[legend]

Public Member Functions

 TimeStepper ()
 Default constructor (does nothing)
 
virtual ~TimeStepper ()
 Default destructor (does nothing)
 
void setAmr (const RefCountedPtr< AmrMesh > &a_amr)
 Set AmrMesh. More...
 
void setComputationalGeometry (const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
 Set the computational geometry. More...
 
virtual void setupSolvers ()=0
 Set up solvers.
 
virtual void allocate ()=0
 Allocate data for the time stepper and solvers.
 
virtual void initialData ()=0
 Fill solvers with initial data.
 
virtual void postInitialize ()=0
 Post-initialize operations to be performed at end of setup stage.
 
virtual void postCheckpointSetup ()=0
 Post-initialize operations to be performed after filling solvers with data read from checkpoint files.
 
virtual void registerRealms ()=0
 Register realms to be used for the simulation.
 
virtual void registerOperators ()=0
 Register operators to be used for the simulation.
 
virtual void parseRuntimeOptions ()
 Parse runtime options. More...
 
virtual int getNumberOfPlotVariables () const =0
 Get the number of plot variables for this time stepper. More...
 
virtual Vector< std::string > getPlotVariableNames () const =0
 Get plot variable names.
 
virtual void writePlotData (LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const =0
 Write plot data to output holder. More...
 
virtual void prePlot ()
 An option for calling special functions prior to plotting data. Called by Driver in the IMMEDIATELY before writing the plot file.
 
virtual void postPlot ()
 An option for calling special functions prior to plotting data. Called by Driver in the IMMEDIATELY after writing the plot file.
 
virtual Vector< long int > getCheckpointLoads (const std::string a_realm, const int a_level) const
 Get computational loads to be checkpointed. More...
 
virtual Real computeDt ()=0
 Compute a time step to be used by Driver.
 
virtual Real advance (const Real a_dt)=0
 Advancement method. The implementation of this method should advance all equations of motion. More...
 
virtual void synchronizeSolverTimes (const int a_step, const Real a_time, const Real a_dt)=0
 Synchronzie solver times and time steps. More...
 
virtual void printStepReport ()=0
 Print a step report. More...
 
virtual void preRegrid (const int a_lmin, const int a_oldFinestLevel)=0
 Perform pre-regrid operations. More...
 
virtual void regrid (const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)=0
 Time stepper regrid method. More...
 
virtual void postRegrid ()=0
 Perform post-regrid operations. More...
 
virtual bool needToRegrid ()
 Fuction which can have Driver do regrids at arbitrary points in the simulation. More...
 
virtual bool loadBalanceThisRealm (const std::string a_realm) const
 Load balancing query for a specified realm. If this returns true for a_realm, load balancing routines will be called during regrids. More...
 
virtual void loadBalanceBoxes (Vector< Vector< int >> &a_procs, Vector< Vector< Box >> &a_boxes, const std::string a_realm, const Vector< DisjointBoxLayout > &a_grids, const int a_lmin, const int a_finestLevel)
 Load balance grid boxes for a specified realm. More...
 

Protected Attributes

int m_verbosity
 Class verbosity.
 
int m_timeStep
 Time step.
 
Real m_time
 TIme.
 
Real m_dt
 Previous time step size.
 
RefCountedPtr< AmrMeshm_amr
 AmrMesh.
 
RefCountedPtr< ComputationalGeometrym_computationalGeometry
 Computational geometry.
 

Detailed Description

Base class for advancing equations.

This class is used by Driver for advancing sets of equations. In short, this class should implement a time-stepping routine for a set of solvers. One should also implement routines for setting up the solvers, allocating necessary memory, regridding etc.

Member Function Documentation

◆ advance()

virtual Real TimeStepper::advance ( const Real  a_dt)
pure virtual

◆ getCheckpointLoads()

Vector< long int > TimeStepper::getCheckpointLoads ( const std::string  a_realm,
const int  a_level 
) const
virtual

Get computational loads to be checkpointed.

This is used by Driver both for setting up load-balanced restarts AND for plotting the computational loads to a file. This routine is disjoint from loadBalanceBoxes because this routine is not part of a regrid. This means that we are not operating with temporarily load balanced grids where the but the final ones.

Note
The default implementation uses the box volume as a proxy for the load. You should overwrite this if you load balance your application, and also make sure that the loads returned from this routine are consistent with what you put in loadBalanceBoxes.

Also note that the return vector has the same ordering as the DisjointBoxLayout's boxes on the input grid level. See the implementation for further details.

Parameters
[in]a_realmRealm
[in]a_levelGrid level
Returns
Returns computational loads for each box on grid level a_level.

Reimplemented in Physics::ItoKMC::ItoKMCStepper< I, C, R, F >, Physics::ItoKMC::ItoKMCStepper< ItoSolver, CdrCTU, McPhoto, FieldSolverMultigrid >, and Physics::BrownianWalker::BrownianWalkerStepper.

◆ getNumberOfPlotVariables()

virtual int TimeStepper::getNumberOfPlotVariables ( ) const
pure virtual

◆ loadBalanceBoxes()

void TimeStepper::loadBalanceBoxes ( Vector< Vector< int >> &  a_procs,
Vector< Vector< Box >> &  a_boxes,
const std::string  a_realm,
const Vector< DisjointBoxLayout > &  a_grids,
const int  a_lmin,
const int  a_finestLevel 
)
virtual

Load balance grid boxes for a specified realm.

Parameters
[out]a_procsMPI ranks owning the various grid boxes.
[out]a_boxesGrid boxes on every level (obtain them with a_grids[lvl].boxArray())
[in]a_realmRealm identifier
[in]a_gridsOriginal grids
[in]a_lminCoarsest grid level that changed
[in]a_finestLevelNew finest grid level

This is only called by Driver if TimeStepper::loadBalanceThisRealm(a_realm) returned true. The default implementation uses volume-based loads for the grid patches. If the user wants to load balance boxes on a realm, this routine must be overwritten and he should compute loads for the various patches in a_grids and call LoadBalancing::makeBalance on each level. It is up to the user/programmer to decide if load balancing should be done independently on each level, or if loads per MPI rank are accumulated across levels.

Reimplemented in Physics::ItoKMC::ItoKMCStepper< I, C, R, F >, Physics::ItoKMC::ItoKMCStepper< ItoSolver, CdrCTU, McPhoto, FieldSolverMultigrid >, Physics::Electrostatics::FieldStepper< T >, and Physics::BrownianWalker::BrownianWalkerStepper.

◆ loadBalanceThisRealm()

bool TimeStepper::loadBalanceThisRealm ( const std::string  a_realm) const
virtual

Load balancing query for a specified realm. If this returns true for a_realm, load balancing routines will be called during regrids.

Parameters
[in]a_realmRealm name

Reimplemented in Physics::ItoKMC::ItoKMCStepper< I, C, R, F >, Physics::ItoKMC::ItoKMCStepper< ItoSolver, CdrCTU, McPhoto, FieldSolverMultigrid >, Physics::Electrostatics::FieldStepper< T >, and Physics::BrownianWalker::BrownianWalkerStepper.

◆ needToRegrid()

bool TimeStepper::needToRegrid ( )
virtual

Fuction which can have Driver do regrids at arbitrary points in the simulation.

This is called by Driver at every time step and if it returns true, Driver will regrid, regardless of whether or not it is on the regular "regrid intervals".

Reimplemented in Physics::BrownianWalker::BrownianWalkerStepper.

◆ parseRuntimeOptions()

void TimeStepper::parseRuntimeOptions ( )
virtual

◆ postRegrid()

virtual void TimeStepper::postRegrid ( )
pure virtual

◆ preRegrid()

virtual void TimeStepper::preRegrid ( const int  a_lmin,
const int  a_oldFinestLevel 
)
pure virtual

◆ printStepReport()

virtual void TimeStepper::printStepReport ( )
pure virtual

◆ regrid()

virtual void TimeStepper::regrid ( const int  a_lmin,
const int  a_oldFinestLevel,
const int  a_newFinestLevel 
)
pure virtual

◆ setAmr()

void TimeStepper::setAmr ( const RefCountedPtr< AmrMesh > &  a_amr)

Set AmrMesh.

Parameters
[in]a_amrAmrMesh

◆ setComputationalGeometry()

void TimeStepper::setComputationalGeometry ( const RefCountedPtr< ComputationalGeometry > &  a_computationalGeometry)

Set the computational geometry.

Parameters
[in]a_computationalGeometryThe computational geometry.

◆ synchronizeSolverTimes()

virtual void TimeStepper::synchronizeSolverTimes ( const int  a_step,
const Real  a_time,
const Real  a_dt 
)
pure virtual

◆ writePlotData()

virtual void TimeStepper::writePlotData ( LevelData< EBCellFAB > &  a_output,
int &  a_icomp,
const std::string  a_outputRealm,
const int  a_level 
) const
pure virtual

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