chombo-discharge
Loading...
Searching...
No Matches
CD_FieldStepper.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_FieldStepper_H
13#define CD_FieldStepper_H
14
15// Our includes
16#include <CD_TimeStepper.H>
17#include <CD_SurfaceODESolver.H>
18#include <CD_FieldSolver.H>
19#include <CD_NamespaceHeader.H>
20
21namespace Physics {
22 namespace Electrostatics {
23
34 template <class T>
36 {
37 public:
42
46 virtual ~FieldStepper();
47
51 void
52 setupSolvers() override;
53
57 void
58 initialData() override;
59
63 void
64 postInitialize() override;
65
69 void
70 allocate() override;
71
77
78#ifdef CH_USE_HDF5
84 void
85 writeCheckpointData(HDF5Handle& a_handle, const int a_lvl) const override;
86#endif
87
88#ifdef CH_USE_HDF5
94 void
95 readCheckpointData(HDF5Handle& a_handle, const int a_lvl) override;
96#endif
97
101 void
103 {}
104
109 int
110 getNumberOfPlotVariables() const override;
111
116 getPlotVariableNames() const override;
117
125 void
127 int& a_icomp,
129 const int a_level) const override;
130
135 Real
136 computeDt() override
137 {
138 return 0.0;
139 }
140
146 Real
147 advance(const Real a_dt) override;
148
155 void
156 synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override;
157
161 void
162 printStepReport() override {};
163
167 void
168 registerRealms() override;
169
173 void
174 registerOperators() override;
175
181 void
182 preRegrid(const int a_lbase, const int a_finestLevel) override;
183
188 bool
189 loadBalanceThisRealm(const std::string a_realm) const override;
190
204 void
207 const std::string a_realm,
209 const int a_lmin,
210 const int a_finestLevel) override;
211
218 void
219 regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override;
220
225 void
226 postRegrid() override;
227
232 void
233 setRho(const std::function<Real(const RealVect& a_pos)>& a_rho, const phase::which_phase a_phase) noexcept;
234
239 void
240 setSigma(const std::function<Real(const RealVect& a_pos)>& a_sigma) noexcept;
241
242 protected:
247
252
257
262
267
272
277
282
286 void
287 solvePoisson();
288 };
289 } // namespace Electrostatics
290} // namespace Physics
291
292#include <CD_NamespaceFooter.H>
293
295
296#endif
BoxSorting
Enum for sorting boxes.
Definition CD_BoxSorting.H:21
Contains declaration of a base electrostatics solver class.
Implementation of CD_FieldStepper.H.
Declaration of a cut-cell ODE solver.
Declaration of main (abstract) time stepper class.
Implementation of TimeStepper for solving electrostatic problems. The template parameter is the Field...
Definition CD_FieldStepper.H:36
std::string m_realm
Realm where the solver lives.
Definition CD_FieldStepper.H:266
void setRho(const std::function< Real(const RealVect &a_pos)> &a_rho, const phase::which_phase a_phase) noexcept
Set space charge.
Definition CD_FieldStepperImplem.H:444
void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const override
Write plot data to file.
Definition CD_FieldStepperImplem.H:313
Real computeDt() override
Compute time step.
Definition CD_FieldStepper.H:136
void preRegrid(const int a_lbase, const int a_finestLevel) override
Perform pre-regrid operations.
Definition CD_FieldStepperImplem.H:349
Vector< std::string > getPlotVariableNames() const override
Get plot variable names.
Definition CD_FieldStepperImplem.H:296
void initialData() override
Set initial data – this sets the space and surface charges.
Definition CD_FieldStepperImplem.H:181
void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override
Regrid method – regrids the potential distribution in FieldSolver (but does not solve the Poisson equ...
Definition CD_FieldStepperImplem.H:362
std::function< Real(const RealVect &a_pos)> m_rhoDielectric
Space charge inside dielectric.
Definition CD_FieldStepper.H:276
void setSigma(const std::function< Real(const RealVect &a_pos)> &a_sigma) noexcept
Set surface charge.
Definition CD_FieldStepperImplem.H:462
void solvePoisson()
Internal routine for solving the Poisson equation.
Definition CD_FieldStepperImplem.H:191
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) override
Load balance grid boxes for a specified realm.
Definition CD_FieldStepperImplem.H:402
void postCheckpointSetup() override
Post-initialize operations to be performed – does nothing.
Definition CD_FieldStepper.H:102
void postInitialize() override
Post-initialization routine. This solves the Poisson equation.
Definition CD_FieldStepperImplem.H:216
int getNumberOfPlotVariables() const override
Get number of plot variables.
Definition CD_FieldStepperImplem.H:279
void registerRealms() override
Register simulation realms to be used for this simulation module.
Definition CD_FieldStepperImplem.H:144
std::function< Real(const RealVect &a_pos)> m_rhoGas
Space charge inside gas phase.
Definition CD_FieldStepper.H:271
void allocate() override
Allocation method – allocates memory and internal data for solvers.
Definition CD_FieldStepperImplem.H:156
bool m_loadBalance
If true, the simulation will be introspectively load balanced.
Definition CD_FieldStepper.H:246
void registerOperators() override
Register operators for this simulation module.
Definition CD_FieldStepperImplem.H:131
std::function< Real(const RealVect &a_pos)> m_surfaceChargeDensity
Surface charge distribution.
Definition CD_FieldStepper.H:281
void synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override
Synchronzie solver times and time steps.
Definition CD_FieldStepperImplem.H:333
virtual ~FieldStepper()
Destructor (does nothing)
Definition CD_FieldStepperImplem.H:90
void postRegrid() override
Perform post-regrid operations – this will resolve the Poisson equation.
Definition CD_FieldStepperImplem.H:378
void printStepReport() override
Print step report – this does nothing.
Definition CD_FieldStepper.H:162
MFAMRCellData & getPotential()
Get the potential.
Definition CD_FieldStepperImplem.H:169
FieldStepper()
Constructor – parses some input options.
Definition CD_FieldStepperImplem.H:31
RefCountedPtr< SurfaceODESolver< 1 > > m_sigma
Reference to the surface charge solver.
Definition CD_FieldStepper.H:261
BoxSorting m_boxSort
If using load balancing, this specifies how boxes will be sorted (in space) before load balancing.
Definition CD_FieldStepper.H:251
RefCountedPtr< FieldSolver > m_fieldSolver
Reference to the FieldSolver.
Definition CD_FieldStepper.H:256
bool loadBalanceThisRealm(const std::string a_realm) const override
Load balancing query for a specified realm. If this returns true for a_realm, load balancing routines...
Definition CD_FieldStepperImplem.H:390
Real advance(const Real a_dt) override
Perform a single time step with step a_dt.
Definition CD_FieldStepperImplem.H:239
void setupSolvers() override
Solver setup routine. This instantiates the FieldSolver and parses input options.
Definition CD_FieldStepperImplem.H:97
Base class for advancing equations.
Definition CD_TimeStepper.H:30
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25
Name containing various physics models for running chombo-discharge code.
Definition CD_AdvectionDiffusion.H:15