chombo-discharge
CD_TracerParticleStepper.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2022 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_TracerParticleStepper_H
13 #define CD_TracerParticleStepper_H
14 
15 // Our includes
18 #include <CD_TimeStepper.H>
19 #include <CD_NamespaceHeader.H>
20 
21 namespace Physics {
22  namespace TracerParticle {
23 
28  {
29  Euler,
30  RK2,
31  RK4
32  };
33 
37  enum class VelocityField
38  {
39  Diagonal,
40  Rotational
41  };
42 
49  template <typename P>
51  {
52  public:
57 
63 
69 
73  virtual ~TracerParticleStepper();
74 
80  operator=(const TracerParticleStepper<P>& a_other) = delete;
81 
87  operator=(const TracerParticleStepper<P>&& a_other) = delete;
88 
92  void
93  setupSolvers() override;
94 
98  void
99  allocate() override;
100 
104  void
105  initialData() override;
106 
110  void
111  postInitialize() override
112  {}
113 
117  void
119  {}
120 
124  void
125  registerRealms() override;
126 
131  void
132  registerOperators() override;
133 
137  void
138  parseOptions();
139 
143  void
144  parseRuntimeOptions() override;
145 
146 #ifdef CH_USE_HDF5
152  virtual void
153  writeCheckpointData(HDF5Handle& a_handle, const int a_lvl) const override;
154 #endif
155 
156 #ifdef CH_USE_HDF5
162  virtual void
163  readCheckpointData(HDF5Handle& a_handle, const int a_lvl) override;
164 #endif
165 
169  int
170  getNumberOfPlotVariables() const override;
171 
175  Vector<std::string>
176  getPlotVariableNames() const override;
177 
185  void
186  writePlotData(LevelData<EBCellFAB>& a_output,
187  int& a_icomp,
188  const std::string a_realm,
189  const int a_level) const override;
190 
194  virtual Real
195  computeDt() override;
196 
202  virtual Real
203  advance(const Real a_dt) override;
204 
211  virtual void
212  synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override;
213 
218  virtual void
219  printStepReport() override
220  {}
221 
227  virtual void
228  preRegrid(const int a_lmin, const int a_oldFinestLevel) override;
229 
236  virtual void
237  regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override;
238 
243  virtual void
244  postRegrid() override;
245 
246  protected:
251 
256 
260  std::string m_realm;
261 
265  phase::which_phase m_phase;
266 
270  RefCountedPtr<TracerParticleSolver<P>> m_solver;
271 
276 
280  Real m_cfl;
281 
286 
290  virtual void
292 
296  virtual void
297  setVelocity();
298 
302  virtual void
303  parseIntegrator();
304 
308  virtual void
310 
314  virtual void
316 
321  virtual void
322  advanceParticlesEuler(const Real a_dt);
323 
328  virtual void
329  advanceParticlesRK2(const Real a_dt);
330 
335  virtual void
336  advanceParticlesRK4(const Real a_dt);
337  };
338  } // namespace TracerParticle
339 } // namespace Physics
340 
341 #include <CD_NamespaceFooter.H>
342 
344 
345 #endif
Declaration of main (abstract) time stepper class.
Documentation of Physics/TracerParticle namespace.
Declaration of a solver class that advances tracer particles.
Implementation of CD_TracerParticleStepper.H.
Implementation of TimeStepper for advancing tracer particles in a fixed velocity field.
Definition: CD_TracerParticleStepper.H:51
std::string m_realm
Realm where solver and m_velocity lives.
Definition: CD_TracerParticleStepper.H:260
void registerRealms() override
Register realms. Primal is the only realm we need.
Definition: CD_TracerParticleStepperImplem.H:93
virtual void parseInitialConditions()
Parse initial conditions.
Definition: CD_TracerParticleStepperImplem.H:200
TracerParticleStepper(const TracerParticleStepper< P > &a_other)=delete
Copy constructor. Disallowed.
RefCountedPtr< TracerParticleSolver< P > > m_solver
Tracer particle solvers.
Definition: CD_TracerParticleStepper.H:270
void parseRuntimeOptions() override
Parse runtime options.
Definition: CD_TracerParticleStepperImplem.H:131
void initialData() override
Fill problem with initial data.
Definition: CD_TracerParticleStepperImplem.H:77
void registerOperators() override
Register operators.
Definition: CD_TracerParticleStepperImplem.H:105
virtual Real computeDt() override
Compute a time step to be used by Driver.
Definition: CD_TracerParticleStepperImplem.H:287
void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_realm, const int a_level) const override
Write plot data to output holder.
Definition: CD_TracerParticleStepperImplem.H:269
phase::which_phase m_phase
Phase (gas/solid) where the solver lives.
Definition: CD_TracerParticleStepper.H:265
EBAMRCellData m_velocity
Tracer particle velocity field.
Definition: CD_TracerParticleStepper.H:275
int getNumberOfPlotVariables() const override
Get number of plot variables for this physics module.
Definition: CD_TracerParticleStepperImplem.H:245
virtual void advanceParticlesEuler(const Real a_dt)
Advance particles using explicit Euler rule.
Definition: CD_TracerParticleStepperImplem.H:478
virtual void preRegrid(const int a_lmin, const int a_oldFinestLevel) override
Perform pre-regrid operations.
Definition: CD_TracerParticleStepperImplem.H:348
void allocate() override
Allocate storage for solvers and time stepper.
Definition: CD_TracerParticleStepperImplem.H:64
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override
Time stepper regrid method.
Definition: CD_TracerParticleStepperImplem.H:360
virtual Real advance(const Real a_dt) override
Advancement method. Swaps between various kernels.
Definition: CD_TracerParticleStepperImplem.H:299
VelocityField m_velocityField
Velocity field type.
Definition: CD_TracerParticleStepper.H:255
TracerParticleStepper(const TracerParticleStepper< P > &&a_other)=delete
Move constructor. Disallowed.
size_t m_numInitialParticles
Number of particles.
Definition: CD_TracerParticleStepper.H:285
void postCheckpointSetup() override
Post checkpoint operations. Not needed for this time stepper.
Definition: CD_TracerParticleStepper.H:118
void parseOptions()
Parse options.
Definition: CD_TracerParticleStepperImplem.H:117
virtual void synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override
Synchronize solver times and time steps.
Definition: CD_TracerParticleStepperImplem.H:332
void postInitialize() override
Perform any post-initialization steps. Not needed for this time stepper.
Definition: CD_TracerParticleStepper.H:111
TracerParticleStepper & operator=(const TracerParticleStepper< P > &a_other)=delete
Copy assignment operator. Disallowed.
virtual void advanceParticlesRK2(const Real a_dt)
Advance particles using second order Runge-Kutta.
Definition: CD_TracerParticleStepperImplem.H:517
Real m_cfl
Particle "CFL" time step.
Definition: CD_TracerParticleStepper.H:280
void setupSolvers() override
Instantiate the tracer particle solver.
Definition: CD_TracerParticleStepperImplem.H:48
virtual void printStepReport() override
Print a step report.
Definition: CD_TracerParticleStepper.H:219
virtual ~TracerParticleStepper()
Destructor.
Definition: CD_TracerParticleStepperImplem.H:38
virtual void advanceParticlesRK4(const Real a_dt)
Advance particles using fourth order Runge-Kutta.
Definition: CD_TracerParticleStepperImplem.H:587
Vector< std::string > getPlotVariableNames() const override
Get plot variable names.
Definition: CD_TracerParticleStepperImplem.H:257
IntegrationAlgorithm m_algorithm
Integration algorithm.
Definition: CD_TracerParticleStepper.H:250
virtual void parseVelocityField()
Parse velocity field.
Definition: CD_TracerParticleStepperImplem.H:175
virtual void parseIntegrator()
Parse reactive integrator.
Definition: CD_TracerParticleStepperImplem.H:145
virtual void postRegrid() override
Perform post-regrid operations.
Definition: CD_TracerParticleStepperImplem.H:377
TracerParticleStepper & operator=(const TracerParticleStepper< P > &&a_other)=delete
Move assignment operator. Disallowed.
virtual void initialParticles()
Fill initial particles.
Definition: CD_TracerParticleStepperImplem.H:428
TracerParticleStepper()
Constructor. Does nothing.
Definition: CD_TracerParticleStepperImplem.H:27
virtual void setVelocity()
Set the velocity on the mesh.
Definition: CD_TracerParticleStepperImplem.H:391
Base class for advancing equations.
Definition: CD_TimeStepper.H:30
A tracer particle class. This is templated for holding extra storage (useful for kernels).
Definition: CD_TracerParticle.H:33
IntegrationAlgorithm
Various supported integration algorithms.
Definition: CD_TracerParticleStepper.H:28
VelocityField
Enum for handling various velocity fields.
Definition: CD_TracerParticleStepper.H:38
Name containing various physics models for running chombo-discharge code.
Definition: CD_AdvectionDiffusion.H:15