chombo-discharge
CD_CdrPlasmaTagger.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_CdrPlasmaTagger_H
13 #define CD_CdrPlasmaTagger_H
14 
15 // Our includes
16 #include <CD_CellTagger.H>
17 #include <CD_CdrPlasmaStepper.H>
18 #include <CD_NamespaceHeader.H>
19 
20 namespace Physics {
21  namespace CdrPlasma {
22 
34  class CdrPlasmaTagger : public CellTagger
35  {
36  public:
41 
49  CdrPlasmaTagger(const RefCountedPtr<CdrPlasmaPhysics>& a_physics,
50  const RefCountedPtr<CdrPlasmaStepper>& a_timeStepper,
51  const RefCountedPtr<AmrMesh>& a_amr,
52  const RefCountedPtr<ComputationalGeometry>& a_computationalGeometry);
53 
57  virtual ~CdrPlasmaTagger();
58 
66  void
67  define(const RefCountedPtr<CdrPlasmaPhysics>& a_physics,
68  const RefCountedPtr<CdrPlasmaStepper>& a_timeStepper,
69  const RefCountedPtr<AmrMesh>& a_amr,
70  const RefCountedPtr<ComputationalGeometry>& a_computationalGeometry);
71 
76  virtual void
77  computeTracers() const = 0;
78 
82  virtual void
83  parseOptions() override = 0;
84 
88  virtual void
89  prePlot() const noexcept override;
90 
94  virtual void
95  preRegrid() noexcept override;
96 
100  virtual void
101  regrid() override final;
102 
110  virtual bool
111  tagCells(EBAMRTags& a_tags) override final;
112 
116  virtual int
117  getNumberOfPlotVariables() const override final;
118 
122  virtual Vector<std::string>
123  getPlotVariableNames() const override final;
124 
132  virtual void
133  writePlotData(LevelData<EBCellFAB>& a_output,
134  int& a_icomp,
135  const std::string a_outputRealm,
136  const int a_level) const override final;
137 
138  protected:
142  std::string m_realm;
143 
147  phase::which_phase m_phase;
148 
152  RefCountedPtr<CdrPlasmaPhysics> m_physics;
153 
158 
162  RefCountedPtr<AmrMesh> m_amr;
163 
168 
173 
177  mutable Vector<EBAMRCellData> m_tracers;
178 
182  mutable Vector<EBAMRCellData> m_gradTracers;
183 
198  virtual void
199  refineCellsBox(DenseIntVectSet& a_refinedCells,
200  const Vector<EBCellFAB*>& a_tracers,
201  const Vector<EBCellFAB*>& a_gradTracers,
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);
209 
224  virtual void
225  coarsenCellsBox(DenseIntVectSet& a_coarsenedCells,
226  const Vector<EBCellFAB*>& a_tracers,
227  const Vector<EBCellFAB*>& a_gradTracers,
228  const int a_lvl,
229  const DataIndex a_dit,
230  const Box a_box,
231  const EBISBox& a_ebisbox,
232  const Real a_time,
233  const Real a_dx,
234  const RealVect a_probLo);
235 
246  virtual bool
247  coarsenCell(const RealVect a_pos,
248  const Real a_time,
249  const Real a_dx,
250  const int a_lvl,
251  const Vector<Real> a_tracers,
252  const Vector<RealVect> a_gradTracers) const = 0;
253 
264  virtual bool
265  refineCell(const RealVect a_pos,
266  const Real a_time,
267  const Real a_dx,
268  const int a_lvl,
269  const Vector<Real> a_tracers,
270  const Vector<RealVect> a_gradTracers) const = 0;
271  };
272  } // namespace CdrPlasma
273 } // namespace Physics
274 
275 #include <CD_NamespaceFooter.H>
276 
277 #endif
Declaration of a CdrPlasmaStepper, an abstract class for evolving cdr plasma equations in time.
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
Class for handling spatial operations.
Definition: CD_AmrMesh.H:44
Base class for tagging cells across an AMR hierarchy.
Definition: CD_CellTagger.H:31
Abstract base class for geometries.
Definition: CD_ComputationalGeometry.H:36
Abstract base class for specifying plasma kinetics. This is the base class used by CdrPlasmaStepper w...
Definition: CD_CdrPlasmaPhysics.H:32
Abstract class for evolving the minimal plasma model in time.
Definition: CD_CdrPlasmaStepper.H:39
Abstract Class which implements CellTagger for the CDR plasma physics module.
Definition: CD_CdrPlasmaTagger.H:35
virtual void regrid() override final
Regrid method – used for reallocating storage for the tracer fields.
Definition: CD_CdrPlasmaTagger.cpp:105
RefCountedPtr< CdrPlasmaPhysics > m_physics
Plasma physics.
Definition: CD_CdrPlasmaTagger.H:152
RefCountedPtr< CdrPlasmaStepper > m_timeStepper
Time stepper.
Definition: CD_CdrPlasmaTagger.H:157
virtual bool coarsenCell(const RealVect a_pos, const Real a_time, const Real a_dx, const int a_lvl, const Vector< Real > a_tracers, const Vector< RealVect > a_gradTracers) const =0
Coarsen a cell based on a tracer field.
virtual void computeTracers() const =0
Compute tracer fields.
virtual Vector< std::string > getPlotVariableNames() const override final
Get plot variable names.
Definition: CD_CdrPlasmaTagger.cpp:138
Vector< EBAMRCellData > m_gradTracers
Gradient of tracer fields.
Definition: CD_CdrPlasmaTagger.H:182
virtual bool refineCell(const RealVect a_pos, const Real a_time, const Real a_dx, const int a_lvl, const Vector< Real > a_tracers, const Vector< RealVect > a_gradTracers) const =0
Refine a cell based on a tracer field.
virtual bool tagCells(EBAMRTags &a_tags) override final
Tag cells for refinement.
Definition: CD_CdrPlasmaTagger.cpp:185
Vector< EBAMRCellData > m_tracers
Tracer fields.
Definition: CD_CdrPlasmaTagger.H:177
std::string m_realm
Realm where this cell tagger allocates its data.
Definition: CD_CdrPlasmaTagger.H:142
virtual void coarsenCellsBox(DenseIntVectSet &a_coarsenedCells, const Vector< EBCellFAB * > &a_tracers, const Vector< EBCellFAB * > &a_gradTracers, 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)
Per-box coarsening method.
Definition: CD_CdrPlasmaTagger.cpp:351
virtual void writePlotData(LevelData< EBCellFAB > &a_output, int &a_icomp, const std::string a_outputRealm, const int a_level) const override final
Write plot data.
Definition: CD_CdrPlasmaTagger.cpp:155
RefCountedPtr< AmrMesh > m_amr
AmrMesh. Needed for computing tracer stuff.
Definition: CD_CdrPlasmaTagger.H:162
CdrPlasmaTagger()
Weak constructor. Must subsequently call define.
Definition: CD_CdrPlasmaTagger.cpp:25
int m_numTracers
Number of tracer fields.
Definition: CD_CdrPlasmaTagger.H:172
void define(const RefCountedPtr< CdrPlasmaPhysics > &a_physics, const RefCountedPtr< CdrPlasmaStepper > &a_timeStepper, const RefCountedPtr< AmrMesh > &a_amr, const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry)
Define function constructor. Leaves object in usable state.
Definition: CD_CdrPlasmaTagger.cpp:61
virtual int getNumberOfPlotVariables() const override final
Get number of plot variables. This is fetched by Driver and can be used.
Definition: CD_CdrPlasmaTagger.cpp:127
virtual ~CdrPlasmaTagger()
Destructor.
Definition: CD_CdrPlasmaTagger.cpp:52
RefCountedPtr< ComputationalGeometry > m_computationalGeometry
Computational geometry. Not needed but useful to have.
Definition: CD_CdrPlasmaTagger.H:167
virtual void parseOptions() override=0
Parse class options – must be implemented by user.
virtual void refineCellsBox(DenseIntVectSet &a_refinedCells, const Vector< EBCellFAB * > &a_tracers, const Vector< EBCellFAB * > &a_gradTracers, 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)
Per-box refinement method.
Definition: CD_CdrPlasmaTagger.cpp:268
virtual void prePlot() const noexcept override
Pre-plot magic for Driver.
Definition: CD_CdrPlasmaTagger.cpp:80
phase::which_phase m_phase
Phase where this cell tagger allocates its data.
Definition: CD_CdrPlasmaTagger.H:147
virtual void preRegrid() noexcept override
Perform pre-regrid operations.
Definition: CD_CdrPlasmaTagger.cpp:91
Name containing various physics models for running chombo-discharge code.
Definition: CD_AdvectionDiffusion.H:15
phase names
Definition: CD_MultiFluidIndexSpace.H:27