Subsections


20.2 Mesh/Particle Mapping

Particles behave in a fundamentally different way than grid-based quantities. Lagrangian, or passive particles are essentially independent of the grid mesh and move along with the velocity field. Active particles may be located independently of mesh refinement. In either case, there is a need to convert grid-based quantities into similar attributes defined on particles, or vice versa. The method for interpolating mesh quantities to tracer particle positions must be consistent with the numerical method to avoid introducing systematic error. In the case of a finite-volume methods such as those used in FLASH4, the mesh quantities have cell-averaged rather than point values, which requires that the interpolation function for the particles also represent cell-averaged values. Cell averaged quantities are defined as

$\displaystyle f_i\left(x\right) \: \equiv \: \frac{1}{\Delta x} \int_{x_{i-1/2}}^{x_{i-1/2}} f\left(x^\prime \right) dx^\prime$ (20.15)

where $ i$ is the cell index and $ \Delta x$ is the spatial resolution. The mapping back and forth from the mesh to the particle properties are defined in the routines Particles_mapFromMesh and Particles_mapToMeshOneBlk.

Specifying the desired mapping method is accomplished by designating the MAPMETHOD in the Simulation Config file for each type of particle. See Sec:FlashHparttypes for more details.

20.2.1 Quadratic Mesh Mapping

The quadratic mapping package defines an interpolation back and forth to the mesh which is second order. This implementation is primarily meant to be used with passive tracer particles.

To derive it, first consider a second-order interpolation function of the form

$\displaystyle f\left(x\right) \: = \: A + B \left(x - x_i\right) + C \left(x - x_i\right)^2 \; .$ (20.16)

Then integrating gives
$\displaystyle f_{i-1} \:$ $\displaystyle =$ $\displaystyle \: \frac{1}{\Delta x}\left[ A + \left. \frac{1}{2}
B \left(x - x_...
...frac{1}{3}
C \left(x - x_i\right)^3 \right\vert^{x_{i-1/2}}_{x_{i-3/2}} \right]$  
  $\displaystyle =$ $\displaystyle \: A - B\Delta x + \frac{13}{12} C \Delta x^2 \;,$ (20.17)


$\displaystyle f_{i} \:$ $\displaystyle =$ $\displaystyle \: \frac{1}{\Delta x}\left[ A + \left. \frac{1}{2} B \left(x - x_...
...frac{1}{3} C \left(x - x_i\right)^3 \right\vert^{x_{i+1/2}}_{x_{i-1/2}} \right]$  
  $\displaystyle =$ $\displaystyle \: A + \frac{1}{12} C \Delta x^2 \; ,$ (20.18)

and
$\displaystyle f_{i+1} \:$ $\displaystyle =$ $\displaystyle \: \frac{1}{\Delta x}\left[ A + \left. \frac{1}{2}
B \left(x - x_...
...frac{1}{3}
C \left(x - x_i\right)^3 \right\vert^{x_{i-1/2}}_{x_{i-3/2}} \right]$  
  $\displaystyle =$ $\displaystyle \: A - B\Delta x + \frac{13}{12} C \Delta x^2 \;,$ (20.19)

We may write these as

$\displaystyle \left[ \begin{array}{c} f_{i+1}  f_{i}  f_{i-1} \end{array} \...
...eft[ \begin{array}{ccc} A  B\Delta x  C \Delta x^2 \end{array} \right] \; .$ (20.20)

Inverting this gives expressions for $ A$, $ B$, and $ C$,

$\displaystyle \left[ \begin{array}{c} A  B\Delta x  C \Delta x^2 \end{array...
... \left[ \begin{array}{ccc} f_{i+1}  f_{i}  f_{i-1} \end{array} \right] \; .$ (20.21)

In two dimensions, we want a second-order interpolation function of the form

$\displaystyle f\left(x,y\right) \: = \: A + B \left(x - x_i\right) + C \left(x ...
...t) + E \left(y - y_j\right)^2 + F \left(x - x_i\right)\left(y - y_j\right) \; .$ (20.22)

In this case, the cell averaged quantities are given by

$\displaystyle f_{i,j}\left(x,y\right) \: \equiv \: \frac{1}{\Delta y}{\Delta x}...
...me \int_{y_{j-1/2}}^{x_{j-1/2}} dy^\prime f\left(x^\prime,y^\prime \right) \; .$ (20.23)

Integrating the 9 possible cell averages gives, after some algebra,

$\displaystyle \left[ \begin{array}{c} f_{i-1,j-1}  f_{i,j-1}  f_{i+1,j-1} \...
...2  D \Delta y  E \Delta y^2  F \Delta x \Delta y \end{array} \right] \; .$ (20.24)

At this point we note that there are more constraints than unknowns, and we must make a choice of the constraints. We chose to ignore the cross terms and take only the face-centered cells next to the cell containing the particle, giving

$\displaystyle \left[ \begin{array}{c} f_{i,j-1}  f_{i-1,j}  f_{i,j}  f_{i...
...\Delta x  C \Delta x^2  D \Delta y  E \Delta y^2 \end{array} \right] \; .$ (20.25)

Inverting gives

$\displaystyle \left[ \begin{array}{c} A  B\Delta x  C \Delta x^2  D \Delt...
...j-1}  f_{i-1,j}  f_{i,j}  f_{i+1,j}  f_{i,j+1} \end{array} \right] \; .$ (20.26)

Similarly, in three dimensions, the interpolation function is

$\displaystyle f\left(x,y,z\right) \: = \: A + B \left(x - x_i\right) + C \left(...
...\left(y - y_j\right)^2 + F \left(z - z_k\right) + G \left(z - z_k\right)^2 \; .$ (20.27)

and we have

$\displaystyle \left[ \begin{array}{c} A  B \Delta x  C {\Delta x}^2  D \D...
...f_{i,j,k}  f_{i+1,j,k}  f_{i,j+1,k}  f_{i,j,k+1} \end{array} \right] \; .$ (20.28)

Finally, the above expressions apply only to Cartesian coordinates. In the case of cylindrical $ \left(r,z\right)$ coordinates, we have
$\displaystyle f\left(r,z\right) \; =$      
  $\displaystyle A + B \left(r - r_i\right) + C \left(r - r_i\right)^2
+ D \left(z - z_j\right)$    
  $\displaystyle + E \left(z - z_j\right)^2 +
F \left(r - r_i\right)\left(z - z_j\right) \; .$   (20.29)

and
$\displaystyle \left[ \begin{array}{c}
A  B\Delta r  C\Delta r^{\frac{2}{6}}  D\Delta z  E \Delta z^2
\end{array} \right] \: = \hspace{-1.0in}$      
  $\displaystyle \left[ \begin{array}{cccccc}
-\frac{1}{24} & -\frac{h_1-1}{24h_1}...
...-1}  f_{i-1,j}  f_{i,j} \\
f_{i+1,j}  f_{i,j+1}
\end{array} \right] \; .$   (20.30)


20.2.2 Cloud in Cell Mapping

Other interpolation routines can be defined that take into account the actual quantities defined on the grid. These “mesh-based” algorithms are represented in FLASH4 by the Cloud-in-Cell mapping, where the interpolation to/from the particles is defined as a simple linear weighting from nearby grid points. The weights are defined by considering only the region of one “cell” size around each particle location; the proportional volume of the particle “cloud” corresponds to the amount allocated to/from the mesh. The CIC method can be used with both types of particles. When using it with active particles the MapToMesh methods should also be selected. In order to include the CIC method with passive particles, the setup command line option is -with-unit=Particles/ParticlesMapping/CIC. Two additional command line option -with-unit=Particles/ParticlesMapping/MapToMesh and -with-unit=Grid/GridParticles/MapToMesh are necessary when using the active particles. All of these command line options can be replaced by placing the appropriate REQUIRES/REQUESTS directives in the Simulation Config file.