chombo-discharge
CD_EBAMRParticleMesh.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_EBAMRParticleMesh_H
13 #define CD_EBAMRParticleMesh_H
14 
15 // Chombo includes
16 #include <RefCountedPtr.H>
17 #include <Copier.H>
18 #include <EBLevelGrid.H>
19 
20 // Our includes
21 #include <CD_DepositionType.H>
22 #include <CD_EBAMRData.H>
25 #include <CD_EBParticleMesh.H>
26 #include <CD_ParticleContainer.H>
27 #include <CD_NamespaceHeader.H>
28 
47 {
48 public:
53 
64  EBAMRParticleMesh(const Vector<RefCountedPtr<EBLevelGrid>>& a_eblgs,
65  const Vector<int>& a_refRat,
66  const Vector<Real>& a_dx,
67  const RealVect& a_probLo,
68  const IntVect& a_ghost,
69  const int a_maxParticleWidth,
70  const int a_finestLevel);
71 
75  virtual ~EBAMRParticleMesh();
76 
87  void
88  define(const Vector<RefCountedPtr<EBLevelGrid>>& a_eblgs,
89  const Vector<int>& a_refRat,
90  const Vector<Real>& a_dx,
91  const RealVect& a_probLo,
92  const IntVect& a_ghost,
93  const int a_maxParticleWidth,
94  const int a_finestLevel);
95 
115  template <class P, const Real& (P::*particleScalarField)() const>
116  void
117  deposit(EBAMRCellData& a_meshData,
118  const ParticleContainer<P>& a_particles,
119  const DepositionType a_depositionType,
120  const CoarseFineDeposition a_coarseFineDeposition,
121  const bool a_forceIrregNGP = false);
122 
133  template <class P, Real (P::*particleScalarField)() const>
134  void
135  deposit(EBAMRCellData& a_meshData,
136  const ParticleContainer<P>& a_particles,
137  const DepositionType a_depositionType,
138  const CoarseFineDeposition a_coarseFineDeposition,
139  const bool a_forceIrregNGP = false);
140 
159  template <class P, const RealVect& (P::*particleVectorField)() const>
160  void
161  deposit(EBAMRCellData& a_meshData,
162  const ParticleContainer<P>& a_particles,
163  const DepositionType a_depositionType,
164  const CoarseFineDeposition a_coarseFineDeposition,
165  const bool a_forceIrregNGP = false);
166 
176  template <class P, RealVect (P::*particleVectorField)() const>
177  void
178  deposit(EBAMRCellData& a_meshData,
179  const ParticleContainer<P>& a_particles,
180  const DepositionType a_depositionType,
181  const CoarseFineDeposition a_coarseFineDeposition,
182  const bool a_forceIrregNGP = false);
183 
200  template <class P, Real& (P::*particleScalarField)()>
201  void
202  interpolate(ParticleContainer<P>& a_particles,
203  const EBAMRCellData& a_meshVectorField,
204  const DepositionType a_interpType,
205  const bool a_forceIrregNGP = false) const;
206 
224  template <class P, RealVect& (P::*particleVectorField)()>
225  void
227  const EBAMRCellData& a_meshVectorField,
228  const DepositionType a_interpType,
229  const bool a_forceIrregNGP = false) const;
230 
235  Vector<RefCountedPtr<EBCoarseFineParticleMesh>>&
237 
245  const EBParticleMesh&
246  getEBParticleMesh(const int a_lvl, const DataIndex& a_dit) const;
247 
248 protected:
253 
257  RealVect m_probLo;
258 
262  IntVect m_ghost;
263 
268 
273 
277  Vector<RefCountedPtr<EBLevelGrid>> m_eblgs;
278 
282  Vector<int> m_refRat;
283 
287  Vector<Real> m_dx;
288 
292  Vector<RefCountedPtr<LayoutData<EBParticleMesh>>> m_ebParticleMesh;
293 
299  Vector<RefCountedPtr<LayoutData<EBParticleMesh>>> m_ebParticleMeshFiCo;
300 
305  mutable Vector<RefCountedPtr<EBCoarseFineParticleMesh>> m_coarseFinePM;
306 
311  mutable Vector<Copier> m_levelCopiers;
312 
317  void
319 
324  void
326 
330  void
332 
342  template <class P, const Real& (P::*particleScalarField)() const>
343  void
344  depositInterp(EBAMRCellData& a_meshData,
345  const ParticleContainer<P>& a_particles,
346  const DepositionType a_depositionType,
347  const bool a_forceIrregNGP = false);
348 
357  template <class P, Real (P::*particleScalarField)() const>
358  void
360  const ParticleContainer<P>& a_particles,
361  const DepositionType a_depositionType,
362  const bool a_forceIrregNGP = false);
363 
374  template <class P, const Real& (P::*particleScalarField)() const>
375  void
376  depositHalo(EBAMRCellData& a_meshData,
377  const ParticleContainer<P>& a_particles,
378  const DepositionType a_depositionType,
379  const bool a_forceIrregNGP = false);
380 
390  template <class P, Real (P::*particleScalarField)() const>
391  void
393  const ParticleContainer<P>& a_particles,
394  const DepositionType a_depositionType,
395  const bool a_forceIrregNGP = false);
396 
407  template <class P, const Real& (P::*particleScalarField)() const>
408  void
409  depositHaloNGP(EBAMRCellData& a_meshData,
410  const ParticleContainer<P>& a_particles,
411  const DepositionType a_depositionType,
412  const bool a_forceIrregNGP = false);
413 
422  template <class P, Real (P::*particleScalarField)() const>
423  void
425  const ParticleContainer<P>& a_particles,
426  const DepositionType a_depositionType,
427  const bool a_forceIrregNGP = false);
428 
438  template <class P, const RealVect& (P::*particleScalarField)() const>
439  void
441  const ParticleContainer<P>& a_particles,
442  const DepositionType a_depositionType,
443  const bool a_forceIrregNGP = false);
444 
454  template <class P, RealVect (P::*particleScalarField)() const>
455  void
457  const ParticleContainer<P>& a_particles,
458  const DepositionType a_depositionType,
459  const bool a_forceIrregNGP = false);
460 
471  template <class P, const RealVect& (P::*particleScalarField)() const>
472  void
474  const ParticleContainer<P>& a_particles,
475  const DepositionType a_depositionType,
476  const bool a_forceIrregNGP = false);
477 
488  template <class P, RealVect (P::*particleScalarField)() const>
489  void
491  const ParticleContainer<P>& a_particles,
492  const DepositionType a_depositionType,
493  const bool a_forceIrregNGP = false);
494 
505  template <class P, const RealVect& (P::*particleScalarField)() const>
506  void
508  const ParticleContainer<P>& a_particles,
509  const DepositionType a_depositionType,
510  const bool a_forceIrregNGP = false);
511 
522  template <class P, RealVect (P::*particleScalarField)() const>
523  void
525  const ParticleContainer<P>& a_particles,
526  const DepositionType a_depositionType,
527  const bool a_forceIrregNGP = false);
528 };
529 
530 #include <CD_NamespaceFooter.H>
531 
533 
534 #endif
Declaration of deposition algorithms in an AMR context.
CoarseFineDeposition
Coarse-fine deposition types (see CD_EBAMRParticleMesh for how these are handled).
Definition: CD_CoarseFineDeposition.H:26
Declaration of deposition types.
DepositionType
Deposition types.
Definition: CD_DepositionType.H:23
Class for holding data across EBAMR hierarchies.
Implementation of CD_EBAMRParticleMesh.H.
Declaration of a class for handling particle deposition arithmetics near refinement boundaries.
Declaration of a class for handling particle-mesh interpolation and deposition.
Declaration of a class for holding particles on an AMR hierarchy.
Class for handling particle-mesh operations with AMR.
Definition: CD_EBAMRParticleMesh.H:47
int m_maxParticleWidth
Maximum particle width that will ever be used.
Definition: CD_EBAMRParticleMesh.H:267
IntVect m_ghost
Number of ghost cells.
Definition: CD_EBAMRParticleMesh.H:262
Vector< RefCountedPtr< EBCoarseFineParticleMesh > > & getEBCoarseFineParticleMesh() const
Get buffers for handling deposition over refinement boundaries.
virtual ~EBAMRParticleMesh()
Destructor (does nothing)
Definition: CD_EBAMRParticleMesh.cpp:39
Vector< RefCountedPtr< EBCoarseFineParticleMesh > > m_coarseFinePM
Buffers for handling arithmetic for mass moving from coarse to fine level and vice versa.
Definition: CD_EBAMRParticleMesh.H:305
Vector< Real > m_dx
Grid resolutions.
Definition: CD_EBAMRParticleMesh.H:287
void depositHaloNGP(EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const bool a_forceIrregNGP=false)
Just like the deposit function, but forced to use the "HaloNGP" algorithm for handling refinement bou...
Definition: CD_EBAMRParticleMeshImplem.H:508
void define(const Vector< RefCountedPtr< EBLevelGrid >> &a_eblgs, const Vector< int > &a_refRat, const Vector< Real > &a_dx, const RealVect &a_probLo, const IntVect &a_ghost, const int a_maxParticleWidth, const int a_finestLevel)
Define function.
Definition: CD_EBAMRParticleMesh.cpp:45
void defineEBParticleMesh()
Define EBParticleMesh objects.
Definition: CD_EBAMRParticleMesh.cpp:117
int m_finestLevel
Finest AMR level.
Definition: CD_EBAMRParticleMesh.H:272
RealVect m_probLo
Lower-left corner of physical domain.
Definition: CD_EBAMRParticleMesh.H:257
void interpolate(ParticleContainer< P > &a_particles, const EBAMRCellData &a_meshVectorField, const DepositionType a_interpType, const bool a_forceIrregNGP=false) const
Interpolate a scalar field onto the particle position.
Definition: CD_EBAMRParticleMeshImplem.H:612
bool m_isDefined
Is defined or not.
Definition: CD_EBAMRParticleMesh.H:252
Vector< RefCountedPtr< LayoutData< EBParticleMesh > > > m_ebParticleMesh
Regular particle-mesh object on each grid level.
Definition: CD_EBAMRParticleMesh.H:292
Vector< RefCountedPtr< EBLevelGrid > > m_eblgs
Grids on each level.
Definition: CD_EBAMRParticleMesh.H:277
Vector< Copier > m_levelCopiers
Copier for moving data from valid+ghost to valid on each AMR level.
Definition: CD_EBAMRParticleMesh.H:311
EBAMRParticleMesh()
Default constructor. Leaves object in undefined state and thus requires the user to call define.
Definition: CD_EBAMRParticleMesh.cpp:19
void deposit(EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const CoarseFineDeposition a_coarseFineDeposition, const bool a_forceIrregNGP=false)
Class for deposition of particles of a type P to the mesh. This does scalar quantities.
Definition: CD_EBAMRParticleMeshImplem.H:29
void depositInterp(EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const bool a_forceIrregNGP=false)
Just like the deposit function, but forced to use the "PVR" algorithm for handling refinement boundar...
Definition: CD_EBAMRParticleMeshImplem.H:176
const EBParticleMesh & getEBParticleMesh(const int a_lvl, const DataIndex &a_dit) const
Get EBParticleMesh deposition/interpolation object for specified grid patch.
Definition: CD_EBAMRParticleMesh.cpp:187
void depositHalo(EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const bool a_forceIrregNGP=false)
Just like the deposit function, but forced to use the "Halo" algorithm for handling refinement bounda...
Definition: CD_EBAMRParticleMeshImplem.H:289
Vector< RefCountedPtr< LayoutData< EBParticleMesh > > > m_ebParticleMeshFiCo
Special particle-mesh objects for depositing on the coarsened fine grid.
Definition: CD_EBAMRParticleMesh.H:299
void defineCoarseFineMotion()
Define coarse-fine data motion operators.
Definition: CD_EBAMRParticleMesh.cpp:96
void defineLevelMotion()
Define level copiers.
Definition: CD_EBAMRParticleMesh.cpp:71
Vector< int > m_refRat
Refinement ratios between levels.
Definition: CD_EBAMRParticleMesh.H:282
A class for depositing and interpolating particles. Contains various useful routines for interpolatio...
Definition: CD_EBParticleMesh.H:34
Templated class for holding particles on an AMR hierarchy with particle remapping.
Definition: CD_ParticleContainer.H:50