Chombo + EB + MF  3.2
MeshInterp.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _MESHINTERP_H_
12 #define _MESHINTERP_H_
13 
14 #include "Box.H"
15 #include "FArrayBox.H"
16 #include "REAL.H"
17 #include "Vector.H"
18 #include "RealVect.H"
19 #include "MeshInterpF_F.H"
20 
21 #include "NamespaceHeader.H"
22 
23 typedef enum {NGP, CIC, TSC, W4} InterpType;
24 
25 /**
26  This class is used for handling the interaction between the particles and the mesh
27  in PIC calculations. It handles depositing particle masses or charges onto the
28  mesh, and interpolating the result of the force solve back to the particle positions.
29  **/
31 {
32 public:
33 
34  MeshInterp();
35 
36  /// Full constructor
37  MeshInterp(const Box& a_domain,
38  const RealVect& a_dx,
39  const RealVect& m_domainLeftEdge);
40 
41  /// Define function
42  void define(const Box& a_domain,
43  const RealVect& a_dx,
44  const RealVect& m_domainLeftEdge);
45 
46  /// Deposit the particles in a_particleList onto a_rho.
47  /// The type of interpolation to perform is passed in as an argument.
48  template <class P>
49  void deposit(const List<P>& a_particleList,
50  FArrayBox& a_rho,
51  InterpType& a_interpType);
52 
53  /// Interpolate the field given by a_field onto the particles in a_particleList.
54  /// a_field must have SpaceDim components. The type of interpolation to perform
55  /// is passed in as an argument.
56  template <class P>
57  void interpolate(List<P>& a_particleList,
58  const FArrayBox& a_field,
59  InterpType& a_interpType);
60 
61 private:
62 
63  /// a wrapper function that deposits a single particle using the
64  /// interpolating functions defined in MeshInterpF.ChF
65  void depositParticle(FArrayBox& a_rho,
66  const RealVect& a_domainLeftEdge,
67  const RealVect& a_dx,
68  const RealVect& a_position,
69  const Real& a_strength,
70  const InterpType a_interpType);
71 
72  /// a wrapper function that interpolates the field to a single
73  /// particle position using the interpolating functions defined in
74  /// MeshInterpF.ChF
75  void interpolateParticle(RealVect& a_particleField,
76  const FArrayBox& a_field,
77  const RealVect& a_domainLeftEdge,
78  const RealVect& a_dx,
79  const RealVect& a_position,
80  const InterpType& a_interpType);
81 
85 };
86 
87 #include "NamespaceFooter.H"
88 
89 // implementation
90 #include "MeshInterpI.H"
91 
92 #endif // include guard
RealVect m_dx
Definition: MeshInterp.H:83
Definition: MeshInterp.H:23
Definition: MeshInterp.H:30
Definition: MeshInterp.H:23
Definition: MeshInterp.H:23
void define(const Box &a_domain, const RealVect &a_dx, const RealVect &m_domainLeftEdge)
Define function.
void deposit(const List< P > &a_particleList, FArrayBox &a_rho, InterpType &a_interpType)
Definition: MeshInterpI.H:17
InterpType
Definition: MeshInterp.H:23
double Real
Definition: REAL.H:33
void interpolateParticle(RealVect &a_particleField, const FArrayBox &a_field, const RealVect &a_domainLeftEdge, const RealVect &a_dx, const RealVect &a_position, const InterpType &a_interpType)
void depositParticle(FArrayBox &a_rho, const RealVect &a_domainLeftEdge, const RealVect &a_dx, const RealVect &a_position, const Real &a_strength, const InterpType a_interpType)
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Definition: MeshInterp.H:23
Box m_domain
Definition: MeshInterp.H:82
RealVect m_domainLeftEdge
Definition: MeshInterp.H:84
Definition: FArrayBox.H:45
void interpolate(List< P > &a_particleList, const FArrayBox &a_field, InterpType &a_interpType)
Definition: MeshInterpI.H:36