chombo-discharge
Loading...
Searching...
No Matches
CD_FieldStepper.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_FIELDSTEPPER_H
14#define CD_FIELDSTEPPER_H
15
16// Our includes
17#include <CD_TimeStepper.H>
18#include <CD_SurfaceODESolver.H>
19#include <CD_FieldSolver.H>
20#include <CD_NamespaceHeader.H>
21
22namespace Physics {
23 namespace Electrostatics {
24
37 template <class T>
39 {
40 public:
45
49 virtual ~FieldStepper();
50
54 void
55 setupSolvers() override;
56
60 void
61 initialData() override;
62
66 void
67 postInitialize() override;
68
72 void
73 allocate() override;
74
81
82#ifdef CH_USE_HDF5
89 void
90 writeCheckpointData(HDF5Handle& a_handle, const int a_lvl) const override;
91#endif
92
93#ifdef CH_USE_HDF5
99 void
100 readCheckpointData(HDF5Handle& a_handle, const int a_lvl) override;
101#endif
102
106 void
108 {}
109
114 int
115 getNumberOfPlotVariables() const override;
116
122 getPlotVariableNames() const override;
123
131 void
133 int& a_icomp,
135 const int a_level) const override;
136
142 Real
143 computeDt() override
144 {
145 return 0.0;
146 }
147
153 Real
154 advance(const Real a_dt) override;
155
162 void
163 synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override;
164
168 void
169 printStepReport() override {};
170
174 void
175 registerRealms() override;
176
180 void
181 registerOperators() override;
182
188 void
189 preRegrid(const int a_lbase, const int a_finestLevel) override;
190
196 bool
197 loadBalanceThisRealm(const std::string& a_realm) const override;
198
212 void
215 const std::string& a_realm,
217 const int a_lmin,
218 const int a_finestLevel) override;
219
226 void
227 regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override;
228
233 void
234 postRegrid() override;
235
241 void
242 setRho(const std::function<Real(const RealVect& a_pos)>& a_rho, const phase::which_phase a_phase) noexcept;
243
248 void
249 setSigma(const std::function<Real(const RealVect& a_pos)>& a_sigma) noexcept;
250
251 protected:
256
261
266
271
276
281
286
291
296 void
297 solvePoisson();
298 };
299 } // namespace Electrostatics
300} // namespace Physics
301
302#include <CD_NamespaceFooter.H>
303
305
306#endif
BoxSorting
Enum for sorting boxes.
Definition CD_BoxSorting.H:22
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.
TimeStepper for solving the electrostatic Poisson equation, optionally with surface charge.
Definition CD_FieldStepper.H:39
std::string m_realm
Realm where the solver lives.
Definition CD_FieldStepper.H:275
void setRho(const std::function< Real(const RealVect &a_pos)> &a_rho, const phase::which_phase a_phase) noexcept
Set the space charge distribution.
Definition CD_FieldStepperImplem.H:450
Real computeDt() override
Compute time step.
Definition CD_FieldStepper.H:143
void preRegrid(const int a_lbase, const int a_finestLevel) override
Perform pre-regrid operations.
Definition CD_FieldStepperImplem.H:355
Vector< std::string > getPlotVariableNames() const override
Get plot variable names.
Definition CD_FieldStepperImplem.H:302
void initialData() override
Set initial data – this sets the space and surface charges.
Definition CD_FieldStepperImplem.H:182
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:368
std::function< Real(const RealVect &a_pos)> m_rhoDielectric
Space charge inside dielectric.
Definition CD_FieldStepper.H:285
void setSigma(const std::function< Real(const RealVect &a_pos)> &a_sigma) noexcept
Set the surface charge distribution.
Definition CD_FieldStepperImplem.H:468
void solvePoisson()
Solve the Poisson equation and compute the electric field.
Definition CD_FieldStepperImplem.H:192
void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string &a_outputRealm, const int a_level) const override
Write plot data to output holder.
Definition CD_FieldStepperImplem.H:319
void postCheckpointSetup() override
Post-initialize operations to be performed – does nothing.
Definition CD_FieldStepper.H:107
void postInitialize() override
Post-initialization routine. This solves the Poisson equation.
Definition CD_FieldStepperImplem.H:217
int getNumberOfPlotVariables() const override
Get number of plot variables contributed by this TimeStepper.
Definition CD_FieldStepperImplem.H:285
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:408
void registerRealms() override
Register simulation realms to be used for this simulation module.
Definition CD_FieldStepperImplem.H:145
std::function< Real(const RealVect &a_pos)> m_rhoGas
Space charge inside gas phase.
Definition CD_FieldStepper.H:280
void allocate() override
Allocation method – allocates memory and internal data for solvers.
Definition CD_FieldStepperImplem.H:157
bool m_loadBalance
If true, the simulation will be introspectively load balanced.
Definition CD_FieldStepper.H:255
void registerOperators() override
Register operators for this simulation module.
Definition CD_FieldStepperImplem.H:132
std::function< Real(const RealVect &a_pos)> m_surfaceChargeDensity
Surface charge distribution.
Definition CD_FieldStepper.H:290
void synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override
Synchronize solver times and time steps.
Definition CD_FieldStepperImplem.H:339
virtual ~FieldStepper()
Destructor (does nothing)
Definition CD_FieldStepperImplem.H:91
void postRegrid() override
Perform post-regrid operations – this will resolve the Poisson equation.
Definition CD_FieldStepperImplem.H:384
void printStepReport() override
Print step report – this does nothing.
Definition CD_FieldStepper.H:169
MFAMRCellData & getPotential()
Get the electrostatic potential.
Definition CD_FieldStepperImplem.H:170
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:396
FieldStepper()
Constructor – parses some input options.
Definition CD_FieldStepperImplem.H:32
RefCountedPtr< SurfaceODESolver< 1 > > m_sigma
Reference to the surface charge solver.
Definition CD_FieldStepper.H:270
BoxSorting m_boxSort
If using load balancing, this specifies how boxes will be sorted (in space) before load balancing.
Definition CD_FieldStepper.H:260
RefCountedPtr< FieldSolver > m_fieldSolver
Reference to the FieldSolver.
Definition CD_FieldStepper.H:265
Real advance(const Real a_dt) override
Perform a single time step with step a_dt.
Definition CD_FieldStepperImplem.H:245
void setupSolvers() override
Solver setup routine. This instantiates the FieldSolver and parses input options.
Definition CD_FieldStepperImplem.H:98
Base class for advancing equations.
Definition CD_TimeStepper.H:31
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26
Namespace containing physics models for use with chombo-discharge.
Definition CD_AdvectionDiffusion.H:16
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38