chombo-discharge
CD_EBParticleMesh.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_EBParticleMesh_H
13 #define CD_EBParticleMesh_H
14 
15 // CHombo includes
16 #include <EBISBox.H>
17 #include <EBCellFAB.H>
18 #include <Vector.H>
19 #include <RealVect.H>
20 
21 // Our includes
22 #include <CD_DepositionType.H>
23 #include <CD_NamespaceHeader.H>
24 
34 {
35 public:
40 
49  EBParticleMesh(const ProblemDomain& a_domain,
50  const Box& a_region,
51  const EBISBox& a_ebisbox,
52  const RealVect& a_dx,
53  const RealVect& a_probLo);
54 
63  void
64  define(const ProblemDomain& a_domain,
65  const Box& a_region,
66  const EBISBox& a_ebisbox,
67  const RealVect& a_dx,
68  const RealVect& a_probLo);
69 
85  template <class P, const Real& (P::*particleScalarField)() const>
86  void
87  deposit(const List<P>& a_particleList,
88  EBCellFAB& a_rho,
89  const DepositionType a_depositionType,
90  const bool a_forceIrregNGP = false) const;
91 
101  template <class P, Real (P::*particleScalarField)() const>
102  void
103  deposit(const List<P>& a_particleList,
104  EBCellFAB& a_rho,
105  const DepositionType a_depositionType,
106  const bool a_forceIrregNGP = false) const;
107 
123  template <class P, const Real& (P::*particleScalarField)() const>
124  void
125  deposit2(const List<P>& a_particleList,
126  EBCellFAB& a_rho,
127  const DepositionType a_depositionType,
128  const bool a_forceIrregNGP = false) const;
129 
139  template <class P, Real (P::*particleScalarField)() const>
140  void
141  deposit2(const List<P>& a_particleList,
142  EBCellFAB& a_rho,
143  const DepositionType a_depositionType,
144  const bool a_forceIrregNGP = false) const;
145 
161  template <class P, const Real& (P::*particleScalarField)() const>
162  void
163  deposit4(const List<P>& a_particleList,
164  EBCellFAB& a_rho,
165  const DepositionType a_depositionType,
166  const bool a_forceIrregNGP = false) const;
167 
177  template <class P, Real (P::*particleScalarField)() const>
178  void
179  deposit4(const List<P>& a_particleList,
180  EBCellFAB& a_rho,
181  const DepositionType a_depositionType,
182  const bool a_forceIrregNGP = false) const;
183 
199  template <class P, const RealVect& (P::*particleVectorField)() const>
200  void
201  deposit(const List<P>& a_particleList,
202  EBCellFAB& a_rho,
203  const DepositionType a_depositionType,
204  const bool a_forceIrregNGP = false) const;
205 
215  template <class P, RealVect (P::*particleVectorField)() const>
216  void
217  deposit(const List<P>& a_particleList,
218  EBCellFAB& a_rho,
219  const DepositionType a_depositionType,
220  const bool a_forceIrregNGP = false) const;
221 
237  template <class P, const RealVect& (P::*particleVectorField)() const>
238  void
239  deposit2(const List<P>& a_particleList,
240  EBCellFAB& a_rho,
241  const DepositionType a_depositionType,
242  const bool a_forceIrregNGP = false) const;
243 
253  template <class P, RealVect (P::*particleVectorField)() const>
254  void
255  deposit2(const List<P>& a_particleList,
256  EBCellFAB& a_rho,
257  const DepositionType a_depositionType,
258  const bool a_forceIrregNGP = false) const;
259 
275  template <class P, const RealVect& (P::*particleVectorField)() const>
276  void
277  deposit4(const List<P>& a_particleList,
278  EBCellFAB& a_rho,
279  const DepositionType a_depositionType,
280  const bool a_forceIrregNGP = false) const;
281 
291  template <class P, RealVect (P::*particleVectorField)() const>
292  void
293  deposit4(const List<P>& a_particleList,
294  EBCellFAB& a_rho,
295  const DepositionType a_depositionType,
296  const bool a_forceIrregNGP = false) const;
297 
312  template <class P, Real& (P::*particleScalarField)()>
313  void
314  interpolate(List<P>& a_particleList,
315  const EBCellFAB& a_meshScalarField,
316  const DepositionType a_interpType,
317  const bool a_forceIrregNGP = false) const;
318 
333  template <class P, RealVect& (P::*particleVectorField)()>
334  void
335  interpolate(List<P>& a_particleList,
336  const EBCellFAB& a_meshVectorField,
337  const DepositionType a_interpType,
338  const bool a_forceIrregNGP = false) const;
339 
340 protected:
352  inline void
353  depositParticle(EBCellFAB& a_rho,
354  const RealVect& a_probLo,
355  const RealVect& a_dx,
356  const RealVect& a_position,
357  const Real* a_strength,
358  const Interval a_components,
359  const DepositionType a_depositionType,
360  const bool a_forceIrregNGP) const;
361 
373  inline void
374  depositParticle2(EBCellFAB& a_rho,
375  const RealVect& a_probLo,
376  const RealVect& a_dx,
377  const RealVect& a_position,
378  const Real* a_strength,
379  const Interval a_components,
380  const DepositionType a_depositionType,
381  const bool a_forceIrregNGP) const;
382 
394  inline void
395  depositParticle4(EBCellFAB& a_rho,
396  const RealVect& a_probLo,
397  const RealVect& a_dx,
398  const RealVect& a_position,
399  const Real* a_strength,
400  const Interval a_components,
401  const DepositionType a_depositionType,
402  const bool a_forceIrregNGP) const;
403 
418  inline void
419  interpolateParticle(Real* a_particleField,
420  const EBCellFAB& a_field,
421  const Box& a_validBox,
422  const RealVect& a_probLo,
423  const RealVect& a_dx,
424  const RealVect& a_position,
425  const Interval& a_interval,
426  const DepositionType a_interpType,
427  const bool a_forceIrregNGP) const;
428 
432  ProblemDomain m_domain;
433 
437  Box m_region;
438 
442  EBISBox m_ebisbox;
443 
447  RealVect m_dx;
448 
452  RealVect m_probLo;
453 };
454 
455 #include <CD_NamespaceFooter.H>
456 
457 #include <CD_EBParticleMeshImplem.H>
458 
459 #endif
Declaration of deposition types.
DepositionType
Deposition types.
Definition: CD_DepositionType.H:23
Implementatoin of CD_EBParticleMesh.H.
A class for depositing and interpolating particles. Contains various useful routines for interpolatio...
Definition: CD_EBParticleMesh.H:34
Box m_region
Cell-centered box, i.e. valid region.
Definition: CD_EBParticleMesh.H:437
EBParticleMesh()
Default constructor. Must subsequently call define.
Definition: CD_EBParticleMesh.cpp:19
void define(const ProblemDomain &a_domain, const Box &a_region, const EBISBox &a_ebisbox, const RealVect &a_dx, const RealVect &a_probLo)
Define function.
Definition: CD_EBParticleMesh.cpp:36
void interpolate(List< P > &a_particleList, const EBCellFAB &a_meshScalarField, const DepositionType a_interpType, const bool a_forceIrregNGP=false) const
Interpolate a scalar field onto the particle position.
Definition: CD_EBParticleMeshImplem.H:340
void deposit2(const List< P > &a_particleList, EBCellFAB &a_rho, const DepositionType a_depositionType, const bool a_forceIrregNGP=false) const
Deposit particle onto the mesh using twice the standard cloud width.
Definition: CD_EBParticleMeshImplem.H:67
void interpolate(List< P > &a_particleList, const EBCellFAB &a_meshVectorField, const DepositionType a_interpType, const bool a_forceIrregNGP=false) const
Interpolate a vector field onto the particle position.
void interpolateParticle(Real *a_particleField, const EBCellFAB &a_field, const Box &a_validBox, const RealVect &a_probLo, const RealVect &a_dx, const RealVect &a_position, const Interval &a_interval, const DepositionType a_interpType, const bool a_forceIrregNGP) const
Wrapper function that interpolates a particle fields onto positions.
Definition: CD_EBParticleMeshImplem.H:824
void depositParticle(EBCellFAB &a_rho, const RealVect &a_probLo, const RealVect &a_dx, const RealVect &a_position, const Real *a_strength, const Interval a_components, const DepositionType a_depositionType, const bool a_forceIrregNGP) const
Wrapper function for depositing a single particle.
Definition: CD_EBParticleMeshImplem.H:460
void deposit4(const List< P > &a_particleList, EBCellFAB &a_rho, const DepositionType a_depositionType, const bool a_forceIrregNGP=false) const
Deposit particle onto the mesh using 4x the standard cloud width.
Definition: CD_EBParticleMeshImplem.H:121
void deposit(const List< P > &a_particleList, EBCellFAB &a_rho, const DepositionType a_depositionType, const bool a_forceIrregNGP=false) const
Deposit particle onto the mesh using a standard cloud width.
Definition: CD_EBParticleMeshImplem.H:25
RealVect m_dx
Grid resolution.
Definition: CD_EBParticleMesh.H:447
ProblemDomain m_domain
Problem domain.
Definition: CD_EBParticleMesh.H:432
void depositParticle2(EBCellFAB &a_rho, const RealVect &a_probLo, const RealVect &a_dx, const RealVect &a_position, const Real *a_strength, const Interval a_components, const DepositionType a_depositionType, const bool a_forceIrregNGP) const
Wrapper function for depositing a single particle which has twice the usual cloud width.
Definition: CD_EBParticleMeshImplem.H:619
EBISBox m_ebisbox
EBIS box.
Definition: CD_EBParticleMesh.H:442
RealVect m_probLo
Lower-left corner of computational domain.
Definition: CD_EBParticleMesh.H:452
void depositParticle4(EBCellFAB &a_rho, const RealVect &a_probLo, const RealVect &a_dx, const RealVect &a_position, const Real *a_strength, const Interval a_components, const DepositionType a_depositionType, const bool a_forceIrregNGP) const
Wrapper function for depositing a single particle which has four times the usual cloud width.
Definition: CD_EBParticleMeshImplem.H:722