chombo-discharge
CD_ItoKMCTagger.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_ItoKMCTagger_H
13 #define CD_ItoKMCTagger_H
14 
15 // Our includes
16 #include <CD_CellTagger.H>
17 #include <CD_ItoKMCStepper.H>
18 #include <CD_ItoKMCPhysics.H>
19 #include <CD_NamespaceHeader.H>
20 
21 namespace Physics {
22  namespace ItoKMC {
23 
28  template <typename S>
29  class ItoKMCTagger : public CellTagger
30  {
31  public:
35  ItoKMCTagger();
36 
43  ItoKMCTagger(const RefCountedPtr<ItoKMCPhysics>& a_physics,
44  const RefCountedPtr<S>& a_timeStepper,
45  const RefCountedPtr<AmrMesh>& a_amr) noexcept;
46 
50  virtual ~ItoKMCTagger() noexcept;
51 
58  virtual void
59  define(const RefCountedPtr<ItoKMCPhysics>& a_physics,
60  const RefCountedPtr<S>& a_timeStepper,
61  const RefCountedPtr<AmrMesh>& a_amr) noexcept;
62 
67  virtual int
68  getNumberOfPlotVariables() const noexcept override;
69 
73  virtual Vector<std::string>
74  getPlotVariableNames() const noexcept override;
75 
82  virtual void
83  writePlotData(LevelData<EBCellFAB>& a_output,
84  int& a_icomp,
85  const std::string a_outputRealm,
86  const int a_level) const noexcept override;
87 
91  virtual void
92  computeTagFields() const noexcept = 0;
93 
97  virtual void
98  parseOptions() override = 0;
99 
103  virtual void
104  parseRuntimeOptions() override = 0;
105 
109  virtual void
110  regrid() noexcept override;
111 
116  virtual bool
117  tagCells(EBAMRTags& a_tags) noexcept override;
118 
123  virtual void
124  setPhase(const phase::which_phase a_phase) noexcept;
125 
129  virtual Vector<EBAMRCellData>&
130  getTagFields() noexcept;
131 
132  protected:
137 
142 
146  std::string m_realm;
147 
151  phase::which_phase m_phase;
152 
156  RefCountedPtr<ItoKMCPhysics> m_physics;
157 
161  RefCountedPtr<S> m_timeStepper;
162 
166  RefCountedPtr<AmrMesh> m_amr;
167 
172 
176  mutable Vector<EBAMRCellData> m_tagFields;
177 
182 
197  virtual void
198  tagCellsBox(DenseIntVectSet& a_refinedCells,
199  DenseIntVectSet& a_coarsenedCells,
200  const Vector<EBCellFAB*>& a_tagFields,
201  const Vector<EBCellFAB*>& a_gradTagFields,
202  const int a_lvl,
203  const DataIndex a_dit,
204  const Box a_box,
205  const EBISBox& a_ebisbox,
206  const Real a_time,
207  const Real a_dx,
208  const RealVect a_probLo) const noexcept;
209 
219  virtual bool
220  coarsenCell(const RealVect a_pos,
221  const Real a_time,
222  const Real a_dx,
223  const int a_lvl,
224  const Vector<Real> a_tagFields,
225  const Vector<RealVect> a_gradTagFields) const noexcept = 0;
226 
236  virtual bool
237  refineCell(const RealVect a_pos,
238  const Real a_time,
239  const Real a_dx,
240  const int a_lvl,
241  const Vector<Real> a_tagFields,
242  const Vector<RealVect> a_gradTagFields) const noexcept = 0;
243  };
244  } // namespace ItoKMC
245 } // namespace Physics
246 
247 #include <CD_NamespaceFooter.H>
248 
249 #include <CD_ItoKMCTaggerImplem.H>
250 
251 #endif
Declaration of a base class for tagging cells across an AMR hierarchy.
Vector< RefCountedPtr< LayoutData< DenseIntVectSet > >> EBAMRTags
Declaration of cell tags.
Definition: CD_EBAMRTags.H:22
Main file for describing Ito-based plasma physics.
Declaration of an abstract class for integrating the Ito-KMC-Poisson equations.
Implementation of CD_ItoKMCTagger.H.
Class for handling spatial operations.
Definition: CD_AmrMesh.H:44
Base class for tagging cells across an AMR hierarchy.
Definition: CD_CellTagger.H:31
Base class for interaction between Kinetic Monte Carlo and Ito-based plasma solvers.
Definition: CD_ItoKMCPhysics.H:77
Class for tagging grid cells using the Ito-KMC-Poisson module. Note that S is the time integrator typ...
Definition: CD_ItoKMCTagger.H:30
ItoKMCTagger()
Weak constructor. User MUST subsequently call the define function.
Definition: CD_ItoKMCTaggerImplem.H:26
virtual void parseOptions() override=0
Parse class options.
RefCountedPtr< S > m_timeStepper
Time stepper.
Definition: CD_ItoKMCTagger.H:161
virtual void setPhase(const phase::which_phase a_phase) noexcept
Set the phase where we do the tagging.
Definition: CD_ItoKMCTaggerImplem.H:97
virtual void computeTagFields() const noexcept=0
Compute tagging fields.
virtual bool tagCells(EBAMRTags &a_tags) noexcept override
Tag cells for refinement and coarsening.
Definition: CD_ItoKMCTaggerImplem.H:187
virtual Vector< EBAMRCellData > & getTagFields() noexcept
Get tag fields. This is data that live on the primal realm and specified input phase.
Definition: CD_ItoKMCTaggerImplem.H:141
virtual ~ItoKMCTagger() noexcept
Destructor.
Definition: CD_ItoKMCTaggerImplem.H:51
virtual void tagCellsBox(DenseIntVectSet &a_refinedCells, DenseIntVectSet &a_coarsenedCells, const Vector< EBCellFAB * > &a_tagFields, const Vector< EBCellFAB * > &a_gradTagFields, const int a_lvl, const DataIndex a_dit, const Box a_box, const EBISBox &a_ebisbox, const Real a_time, const Real a_dx, const RealVect a_probLo) const noexcept
Per-box refinement tagging routine.
Definition: CD_ItoKMCTaggerImplem.H:271
bool m_plotData
Plot data or not.
Definition: CD_ItoKMCTagger.H:141
virtual bool refineCell(const RealVect a_pos, const Real a_time, const Real a_dx, const int a_lvl, const Vector< Real > a_tagFields, const Vector< RealVect > a_gradTagFields) const noexcept=0
Determine if a particular cell should be refined or not.
bool m_isDefined
Defined or not.
Definition: CD_ItoKMCTagger.H:136
Vector< EBAMRCellData > m_tagFields
Tagging fields.
Definition: CD_ItoKMCTagger.H:176
int m_numTagFields
Number of tagging fields.
Definition: CD_ItoKMCTagger.H:171
RefCountedPtr< ItoKMCPhysics > m_physics
Physics implementation.
Definition: CD_ItoKMCTagger.H:156
virtual int getNumberOfPlotVariables() const noexcept override
Get number of plot variables that will be written to file (by Driver).
Definition: CD_ItoKMCTaggerImplem.H:109
virtual void define(const RefCountedPtr< ItoKMCPhysics > &a_physics, const RefCountedPtr< S > &a_timeStepper, const RefCountedPtr< AmrMesh > &a_amr) noexcept
Define function.
Definition: CD_ItoKMCTaggerImplem.H:56
virtual Vector< std::string > getPlotVariableNames() const noexcept override
Get plot variable names.
Definition: CD_ItoKMCTaggerImplem.H:121
virtual bool coarsenCell(const RealVect a_pos, const Real a_time, const Real a_dx, const int a_lvl, const Vector< Real > a_tagFields, const Vector< RealVect > a_gradTagFields) const noexcept=0
Determine if a particular cell should be coarsened or not.
RefCountedPtr< AmrMesh > m_amr
AmrMesh. Needed for allocating memory and things like that.
Definition: CD_ItoKMCTagger.H:166
virtual void parseRuntimeOptions() override=0
Parse run-time configurable class options.
virtual void regrid() noexcept override
Regrid this class. Note that there is no preRegrid method.
Definition: CD_ItoKMCTaggerImplem.H:74
phase::which_phase m_phase
Phase where data is allocated.
Definition: CD_ItoKMCTagger.H:151
std::string m_realm
Realm where data is allocated.
Definition: CD_ItoKMCTagger.H:146
Vector< EBAMRCellData > m_gradTagFields
Gradient of tagging fields.
Definition: CD_ItoKMCTagger.H:181
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const noexcept override
Write plot data.
Definition: CD_ItoKMCTaggerImplem.H:155
Name containing various physics models for running chombo-discharge code.
Definition: CD_AdvectionDiffusion.H:15
phase names
Definition: CD_MultiFluidIndexSpace.H:27