chombo-discharge
CD_TimeStepper.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_TimeStepper_H
13 #define CD_TimeStepper_H
14 
15 // Chombo includes
16 #include <CH_HDF5.H>
17 
18 // Our includes
21 #include <CD_AmrMesh.H>
22 #include <CD_NamespaceHeader.H>
23 
30 {
31 public:
35  TimeStepper();
36 
40  virtual ~TimeStepper();
41 
46  void
47  setAmr(const RefCountedPtr<AmrMesh>& a_amr);
48 
53  void
54  setComputationalGeometry(const RefCountedPtr<ComputationalGeometry>& a_computationalGeometry);
55 
59  virtual void
60  setupSolvers() = 0;
61 
65  virtual void
66  allocate() = 0;
67 
71  virtual void
72  initialData() = 0;
73 
77  virtual void
79 
83  virtual void
85 
89  virtual void
91 
95  virtual void
97 
103  virtual void
105 
106 #ifdef CH_USE_HDF5
111  virtual void
112  readCheckpointHeader(HDF5HeaderData& a_header);
113 #endif
114 
115 #ifdef CH_USE_HDF5
120  virtual void
121  writeCheckpointHeader(HDF5HeaderData& a_header) const;
122 #endif
123 
124 #ifdef CH_USE_HDF5
131  virtual void
132  writeCheckpointData(HDF5Handle& a_handle, const int a_lvl) const = 0;
133 #endif
134 
135 #ifdef CH_USE_HDF5
142  virtual void
143  readCheckpointData(HDF5Handle& a_handle, const int a_lvl) = 0;
144 #endif
145 
151  virtual int
153 
157  virtual Vector<std::string>
158  getPlotVariableNames() const = 0;
159 
167  virtual void
168  writePlotData(LevelData<EBCellFAB>& a_output,
169  int& a_icomp,
170  const std::string a_outputRealm,
171  const int a_level) const = 0;
172 
177  virtual void
178  prePlot();
179 
184  virtual void
185  postPlot();
186 
201  virtual Vector<long int>
202  getCheckpointLoads(const std::string a_realm, const int a_level) const;
203 
207  virtual Real
208  computeDt() = 0;
209 
216  virtual Real
217  advance(const Real a_dt) = 0;
218 
225  virtual void
226  synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) = 0;
227 
232  virtual void
234 
242  virtual void
243  preRegrid(const int a_lmin, const int a_oldFinestLevel) = 0;
244 
251  virtual void
252  regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) = 0;
253 
258  virtual void
259  postRegrid() = 0;
260 
266  virtual bool
267  needToRegrid();
268 
273  virtual bool
274  loadBalanceThisRealm(const std::string a_realm) const;
275 
289  virtual void
290  loadBalanceBoxes(Vector<Vector<int>>& a_procs,
291  Vector<Vector<Box>>& a_boxes,
292  const std::string a_realm,
293  const Vector<DisjointBoxLayout>& a_grids,
294  const int a_lmin,
295  const int a_finestLevel);
296 
297 protected:
302 
307 
311  Real m_time;
312 
316  Real m_dt;
317 
321  RefCountedPtr<AmrMesh> m_amr;
322 
326  RefCountedPtr<ComputationalGeometry> m_computationalGeometry;
327 };
328 
329 #include <CD_NamespaceFooter.H>
330 
331 #endif
Declaration of core class for handling AMR-related operations (with embedded boundaries)
Declaration of base class for defining geometries.
Multi-fluid index space.
Base class for advancing equations.
Definition: CD_TimeStepper.H:30
virtual Vector< long int > getCheckpointLoads(const std::string a_realm, const int a_level) const
Get computational loads to be checkpointed.
Definition: CD_TimeStepper.cpp:70
virtual void synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt)=0
Synchronzie solver times and time steps.
virtual void setupSolvers()=0
Set up solvers.
virtual void prePlot()
An option for calling special functions prior to plotting data. Called by Driver in the IMMEDIATELY b...
Definition: CD_TimeStepper.cpp:144
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.
virtual ~TimeStepper()
Default destructor (does nothing)
Definition: CD_TimeStepper.cpp:20
void setComputationalGeometry(const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Set the computational geometry.
Definition: CD_TimeStepper.cpp:37
Real m_time
TIme.
Definition: CD_TimeStepper.H:311
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.
Definition: CD_TimeStepper.cpp:100
int m_verbosity
Class verbosity.
Definition: CD_TimeStepper.H:301
virtual Real computeDt()=0
Compute a time step to be used by Driver.
virtual void preRegrid(const int a_lmin, const int a_oldFinestLevel)=0
Perform pre-regrid operations.
virtual void printStepReport()=0
Print a step report.
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel)=0
Time stepper regrid method.
virtual void registerOperators()=0
Register operators to be used for the simulation.
virtual void registerRealms()=0
Register realms to be used for the simulation.
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Computational geometry.
Definition: CD_TimeStepper.H:326
TimeStepper()
Default constructor (does nothing)
Definition: CD_TimeStepper.cpp:17
virtual int getNumberOfPlotVariables() const =0
Get the number of plot variables for this time stepper.
virtual void postRegrid()=0
Perform post-regrid operations.
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...
Definition: CD_TimeStepper.cpp:89
int m_timeStep
Time step.
Definition: CD_TimeStepper.H:306
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 Vector< std::string > getPlotVariableNames() const =0
Get plot variable names.
Real m_dt
Previous time step size.
Definition: CD_TimeStepper.H:316
virtual void allocate()=0
Allocate data for the time stepper and solvers.
virtual Real advance(const Real a_dt)=0
Advancement method. The implementation of this method should advance all equations of motion.
virtual bool needToRegrid()
Fuction which can have Driver do regrids at arbitrary points in the simulation.
Definition: CD_TimeStepper.cpp:50
RefCountedPtr< AmrMesh > m_amr
AmrMesh.
Definition: CD_TimeStepper.H:321
virtual void postCheckpointSetup()=0
Post-initialize operations to be performed after filling solvers with data read from checkpoint files...
virtual void postPlot()
An option for calling special functions prior to plotting data. Called by Driver in the IMMEDIATELY a...
Definition: CD_TimeStepper.cpp:148
void setAmr(const RefCountedPtr< AmrMesh > &a_amr)
Set AmrMesh.
Definition: CD_TimeStepper.cpp:24
virtual void parseRuntimeOptions()
Parse runtime options.
Definition: CD_TimeStepper.cpp:61