chombo-discharge
Loading...
Searching...
No Matches
CD_TimeStepper.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_TIMESTEPPER_H
14#define CD_TIMESTEPPER_H
15
16// Chombo includes
17#include <CH_HDF5.H>
18
19// Our includes
22#include <CD_AmrMesh.H>
23#include <CD_NamespaceHeader.H>
24
32{
33public:
38
42 virtual ~TimeStepper();
43
47 TimeStepper(const TimeStepper&) = delete;
48
53 operator=(const TimeStepper&) = delete;
54
59
65 operator=(TimeStepper&&) = default;
66
71 void
72 setAmr(const RefCountedPtr<AmrMesh>& a_amr);
73
78 void
79 setComputationalGeometry(const RefCountedPtr<ComputationalGeometry>& a_computationalGeometry);
80
84 virtual void
86
90 virtual void
91 allocate() = 0;
92
96 virtual void
98
102 virtual void
104
108 virtual void
110
114 virtual void
116
120 virtual void
122
128 virtual void
130
131#ifdef CH_USE_HDF5
136 virtual void
137 readCheckpointHeader(HDF5HeaderData& a_header);
138#endif
139
140#ifdef CH_USE_HDF5
145 virtual void
146 writeCheckpointHeader(HDF5HeaderData& a_header) const;
147#endif
148
149#ifdef CH_USE_HDF5
157 virtual void
158 writeCheckpointData(HDF5Handle& a_handle, int a_lvl) const = 0;
159#endif
160
161#ifdef CH_USE_HDF5
169 virtual void
170 readCheckpointData(HDF5Handle& a_handle, int a_lvl) = 0;
171#endif
172
178 virtual int
180
185 virtual Vector<std::string>
187
195 virtual void
196 writePlotData(LevelData<EBCellFAB>& a_output, int& a_icomp, const std::string& a_outputRealm, int a_level) const = 0;
197
202 virtual void
203 prePlot();
204
209 virtual void
210 postPlot();
211
228 virtual Vector<long int>
229 getCheckpointLoads(const std::string& a_realm, int a_level) const;
230
235 virtual Real
237
244 virtual Real
245 advance(Real a_dt) = 0;
246
253 virtual void
254 synchronizeSolverTimes(int a_step, Real a_time, Real a_dt) = 0;
255
261 virtual void
263
271 virtual void
272 preRegrid(int a_lmin, int a_oldFinestLevel) = 0;
273
280 virtual void
281 regrid(int a_lmin, int a_oldFinestLevel, int a_newFinestLevel) = 0;
282
287 virtual void
289
296 virtual bool
297 needToRegrid();
298
305 bool
306 keepGoing() const;
307
314 virtual bool
315 loadBalanceThisRealm(const std::string& a_realm) const;
316
331 virtual void
332 loadBalanceBoxes(Vector<Vector<int>>& a_procs,
333 Vector<Vector<Box>>& a_boxes,
334 const std::string& a_realm,
335 const Vector<DisjointBoxLayout>& a_grids,
336 int a_lmin,
337 int a_finestLevel);
338
339protected:
344
349
353 Real m_time;
354
358 Real m_dt;
359
366
370 RefCountedPtr<AmrMesh> m_amr;
371
375 RefCountedPtr<ComputationalGeometry> m_computationalGeometry;
376};
377
378#include <CD_NamespaceFooter.H>
379
380#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:32
virtual void preRegrid(int a_lmin, int a_oldFinestLevel)=0
Perform pre-regrid operations.
virtual void regrid(int a_lmin, int a_oldFinestLevel, int a_newFinestLevel)=0
Time stepper regrid method.
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:152
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string &a_outputRealm, int a_level) const =0
Write plot data to output holder.
virtual ~TimeStepper()
Default destructor (does nothing)
void setComputationalGeometry(const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Set the computational geometry.
Definition CD_TimeStepper.cpp:37
Real m_time
TIme.
Definition CD_TimeStepper.H:353
int m_verbosity
Class verbosity.
Definition CD_TimeStepper.H:343
virtual Real computeDt()=0
Compute a time step to be used by Driver.
TimeStepper(TimeStepper &&)=default
Allow move construction.
TimeStepper(const TimeStepper &)=delete
Disallow copy construction.
TimeStepper & operator=(TimeStepper &&)=default
Allow move assignment.
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:97
TimeStepper & operator=(const TimeStepper &)=delete
Disallow copy assignment.
bool keepGoing() const
Query whether the time stepper wants to continue stepping.
Definition CD_TimeStepper.cpp:50
virtual void printStepReport()=0
Print a step report.
virtual Vector< std::string > getPlotVariableNames() const =0
Get plot variable names.
virtual Real advance(Real a_dt)=0
Advancement method. The implementation of this method should advance all equations of motion.
virtual void registerOperators()=0
Register operators to be used for the simulation.
virtual void loadBalanceBoxes(Vector< Vector< int > > &a_procs, Vector< Vector< Box > > &a_boxes, const std::string &a_realm, const Vector< DisjointBoxLayout > &a_grids, int a_lmin, int a_finestLevel)
Load balance grid boxes for a specified realm.
Definition CD_TimeStepper.cpp:108
virtual void registerRealms()=0
Register realms to be used for the simulation.
virtual Vector< long int > getCheckpointLoads(const std::string &a_realm, int a_level) const
Get computational loads to be checkpointed.
Definition CD_TimeStepper.cpp:78
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Computational geometry.
Definition CD_TimeStepper.H:375
TimeStepper()
Default constructor (does nothing)
Definition CD_TimeStepper.cpp:18
virtual int getNumberOfPlotVariables() const =0
Get the number of plot variables for this time stepper.
virtual void postRegrid()=0
Perform post-regrid operations.
virtual void synchronizeSolverTimes(int a_step, Real a_time, Real a_dt)=0
Synchronzie solver times and time steps.
int m_timeStep
Time step.
Definition CD_TimeStepper.H:348
virtual void initialData()=0
Fill solvers with initial data.
virtual void postInitialize()=0
Post-initialize operations to be performed at end of setup stage.
Real m_dt
Previous time step size.
Definition CD_TimeStepper.H:358
virtual void allocate()=0
Allocate data for the time stepper and solvers.
bool m_keepGoing
If false, Driver will stop the time loop after the current step.
Definition CD_TimeStepper.H:365
virtual bool needToRegrid()
Function which can have Driver do regrids at arbitrary points in the simulation.
Definition CD_TimeStepper.cpp:58
RefCountedPtr< AmrMesh > m_amr
AmrMesh.
Definition CD_TimeStepper.H:370
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:156
void setAmr(const RefCountedPtr< AmrMesh > &a_amr)
Set AmrMesh.
Definition CD_TimeStepper.cpp:24
virtual void parseRuntimeOptions()
Parse runtime options.
Definition CD_TimeStepper.cpp:69