chombo-discharge
Loading...
Searching...
No Matches
CD_BrownianWalkerStepper.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_BrownianWalkerStepper_H
13#define CD_BrownianWalkerStepper_H
14
15// Our includes
16#include <CD_TimeStepper.H>
17#include <CD_ItoSolver.H>
18#include <CD_ItoLayout.H>
19#include <CD_NamespaceHeader.H>
20
21namespace Physics {
22 namespace BrownianWalker {
23
36 {
37 public:
42
46 BrownianWalkerStepper(RefCountedPtr<ItoSolver>& a_solver);
47
51 virtual ~BrownianWalkerStepper();
52
56 void
57 initialData() override;
58
62 void
63 allocate() override;
64
68 void
69 postInitialize() override;
70
76 bool
77 loadBalanceThisRealm(const std::string a_realm) const override;
78
86 Vector<long int>
87 getCheckpointLoads(const std::string a_realm, const int a_level) const override;
88
100 void
101 loadBalanceBoxes(Vector<Vector<int>>& a_procs,
102 Vector<Vector<Box>>& a_boxes,
103 const std::string a_realm,
104 const Vector<DisjointBoxLayout>& a_grids,
105 const int a_lmin,
106 const int a_finestLevel) override;
107
108#ifdef CH_USE_HDF5
114 void
115 writeCheckpointData(HDF5Handle& a_handle, const int a_lvl) const override;
116#endif
117
118#ifdef CH_USE_HDF5
124 void
125 readCheckpointData(HDF5Handle& a_handle, const int a_lvl) override;
126#endif
127
132 void
133 postCheckpointSetup() override;
134
139 int
140 getNumberOfPlotVariables() const override;
141
145 Vector<std::string>
146 getPlotVariableNames() const override;
147
155 void
156 writePlotData(LevelData<EBCellFAB>& a_output,
157 int& a_icomp,
158 const std::string a_outputRealm,
159 const int a_level) const override;
160
165 Real
166 computeDt() override;
167
174 void
175 synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override;
180 void
181 printStepReport() override;
182
186 void
187 registerOperators() override;
188
193 void
194 registerRealms() override;
195
199 void
200 parseRuntimeOptions() override;
201
205 bool
206 needToRegrid() override;
207
213 void
214 preRegrid(const int a_lbase, const int a_oldFinestLevel) override;
215
219 void
220 setupSolvers() override;
221
226 Real
227 advance(const Real a_dt) override;
228
235 void
236 regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override;
237
241 void
242 postRegrid() override;
243
244 protected:
249 {
250 Mesh,
251 Particle
252 };
253
258
262 std::string m_realm;
263
267 phase::which_phase m_phase;
268
273
277 RefCountedPtr<ItoSolver> m_solver;
278
282 RefCountedPtr<ItoSpecies> m_species;
283
288
293
298
303
307 int m_ppc;
308
312 Real m_cfl;
313
317 void
319
323 void
324 setVelocity();
325
329 void
330 setDiffusion();
331
335 void
337
354 void
355 loadBalanceBoxesMesh(Vector<Vector<int>>& a_procs,
356 Vector<Vector<Box>>& a_boxes,
357 const std::string a_realm,
358 const Vector<DisjointBoxLayout>& a_grids,
359 const int a_lmin,
360 const int a_finestLevel);
361
376 void
377 loadBalanceBoxesParticles(Vector<Vector<int>>& a_procs,
378 Vector<Vector<Box>>& a_boxes,
379 const std::string a_realm,
380 const Vector<DisjointBoxLayout>& a_grids,
381 const int a_lmin,
382 const int a_finestLevel);
383 };
384 } // namespace BrownianWalker
385} // namespace Physics
386
387#include <CD_NamespaceFooter.H>
388
389#endif
Declaration of a class that holds a set of ItoSolvers.
Declaration of solver class for Ito diffusion.
Declaration of main (abstract) time stepper class.
Implementation of TimeStepper which advances an ItoSolver.
Definition CD_BrownianWalkerStepper.H:36
phase::which_phase m_phase
Phase where the particles live.
Definition CD_BrownianWalkerStepper.H:267
void preRegrid(const int a_lbase, const int a_oldFinestLevel) override
Perform pre-regrid operations.
Definition CD_BrownianWalkerStepper.cpp:371
bool needToRegrid() override
Always returns false.
Definition CD_BrownianWalkerStepper.cpp:360
Real m_diffCo
Fluid diffusion coefficient.
Definition CD_BrownianWalkerStepper.H:292
void loadBalanceBoxesMesh(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)
Method that shows how to load balance the application using the number of particles per cell stored o...
Definition CD_BrownianWalkerStepper.cpp:582
void setupSolvers() override
Set up the Ito solver. This instantiates the solver and parses solver options.
Definition CD_BrownianWalkerStepper.cpp:401
LoadBalancingMethod m_whichLoadBalance
Load balancing method.
Definition CD_BrownianWalkerStepper.H:257
EBAMRCellData m_regridPPC
Number of particles per cell. Used only during regrids.
Definition CD_BrownianWalkerStepper.H:287
int getNumberOfPlotVariables() const override
Get the number of plot variables for this time stepper.
Definition CD_BrownianWalkerStepper.cpp:276
BrownianWalkerStepper()
Default constructor – parses basic options.
Definition CD_BrownianWalkerStepper.cpp:26
RefCountedPtr< ItoSolver > m_solver
Reference to underlying solver.
Definition CD_BrownianWalkerStepper.H:277
Real m_cfl
Effective CFL number for particle hops.
Definition CD_BrownianWalkerStepper.H:312
Real advance(const Real a_dt) override
Advancement method.
Definition CD_BrownianWalkerStepper.cpp:451
std::string m_realm
Realm where the particles live.
Definition CD_BrownianWalkerStepper.H:262
void loadBalanceBoxesParticles(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)
Method that shows how to load balance the application using the number of particles per cell stored o...
Definition CD_BrownianWalkerStepper.cpp:719
bool loadBalanceThisRealm(const std::string a_realm) const override
Check if the input realm should be load balanced.
Definition CD_BrownianWalkerStepper.cpp:182
bool m_loadBalance
If true, application will be load balanced.
Definition CD_BrownianWalkerStepper.H:272
LoadBalancingMethod
For classifying load balancing methods.
Definition CD_BrownianWalkerStepper.H:249
void makeSuperParticles()
Make super particles.
Definition CD_BrownianWalkerStepper.cpp:564
void printStepReport() override
Print a step report – this prints the local and global number of particles in the simulation.
Definition CD_BrownianWalkerStepper.cpp:345
void parseRuntimeOptions() override
Parse runtime options.
Definition CD_BrownianWalkerStepper.cpp:72
void setDiffusion()
Set the ItoSolver "diffusion field".
Definition CD_BrownianWalkerStepper.cpp:135
void synchronizeSolverTimes(const int a_step, const Real a_time, const Real a_dt) override
Synchronize solver times.
Definition CD_BrownianWalkerStepper.cpp:328
int m_ppc
Number of particles per cell.
Definition CD_BrownianWalkerStepper.H:307
void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override
Regrid method. This just regrids the solver.
Definition CD_BrownianWalkerStepper.cpp:528
void postCheckpointSetup() override
Perform post-initialization routines.
Definition CD_BrownianWalkerStepper.cpp:253
void registerRealms() override
Register realms to be used in the simulation.
Definition CD_BrownianWalkerStepper.cpp:420
void postRegrid() override
Post-regrid operations.
Definition CD_BrownianWalkerStepper.cpp:543
Real m_omega
Angular velocity for advection field.
Definition CD_BrownianWalkerStepper.H:302
void allocate() override
Allocate storage for solvers and TimeStepper.
Definition CD_BrownianWalkerStepper.cpp:442
Vector< std::string > getPlotVariableNames() const override
Get plot variable names.
Definition CD_BrownianWalkerStepper.cpp:289
RefCountedPtr< ItoSpecies > m_species
Reference to underlying species.
Definition CD_BrownianWalkerStepper.H:282
virtual ~BrownianWalkerStepper()
Destructor (does nothing)
Definition CD_BrownianWalkerStepper.cpp:66
void postInitialize() override
Perform post-initialization routines. This does nothing.
Definition CD_BrownianWalkerStepper.cpp:109
Vector< long int > getCheckpointLoads(const std::string a_realm, const int a_level) const override
Get computational loads to be checkpointed. This is used by Driver both for plotting computational lo...
Definition CD_BrownianWalkerStepper.cpp:806
void initialData() override
Fill solver with initial data.
Definition CD_BrownianWalkerStepper.cpp:87
Real m_mobility
Particle mobility coefficients.
Definition CD_BrownianWalkerStepper.H:297
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 specific realm.
Definition CD_BrownianWalkerStepper.cpp:193
void setVelocity()
Set the Brownian walker advection field.
Definition CD_BrownianWalkerStepper.cpp:149
Real computeDt() override
Compute a time step to be used by Driver.
Definition CD_BrownianWalkerStepper.cpp:317
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_BrownianWalkerStepper.cpp:300
void setAdvectionDiffusion()
Set advection and diffusion fields.
Definition CD_BrownianWalkerStepper.cpp:118
void registerOperators() override
Register operators – we only need the ones the solver needs to have the solver do this.
Definition CD_BrownianWalkerStepper.cpp:431
Base class for advancing equations.
Definition CD_TimeStepper.H:30
Name containing various physics models for running chombo-discharge code.
Definition CD_AdvectionDiffusion.H:15