PLUTO  4.4-patch2
Functions
particles_deposit.c File Reference

Particle to grid deposition functions. More...

#include "pluto.h"

Functions

void Particles_Deposit (particleNode *PHead, void(*Func)(Particle *, double *), Data_Arr Q, int nelem, Grid *grid)
 
void Particles_DepositBoundaryExchange (Data_Arr Q, int nelem, Grid *grid)
 
void Particles_Density (Particle *p, double *qd)
 

Detailed Description

Transfer particle quantities to the grid using deposition:

\[ Q_{ijk} = \sum_p W_p(x_{ijk}-x_p)q_p \]

where qp is a particle-related quantities (e.g. energy or mass). For deposition to be consistently done, particles can be everywhere in the domain, including ghost zones with the important exception of the very first and very last one. An error will occur in Particles_GetWeights() otherwise.

Alternatively, integer deposition can be used to verify the correctness of serial/parallel implementation:

\[ Q_{ijk} = \frac{q_{\max}}{C} \sum_p {\rm int}\left(C W_p(x_{ijk}-x_p) \frac{q_p}{q_{\max}}\right) \]

where C is a large number (1.e6 by default) while q_max is the maximum value of qp over all particles.

Deposition is always followed by a boundary condition call, since quantities deposited in the ghost zones must be exchanged with neighbour processors.

Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
References
Date
August 06, 2018

Function Documentation

◆ Particles_Density()

void Particles_Density ( Particle *  p,
double *  qd 
)

Simple deposition function used to compute particle density on the grid.

◆ Particles_Deposit()

void Particles_Deposit ( particleNode *  PHead,
void(*)(Particle *, double *)  Func,
Data_Arr  Q,
int  nelem,
Grid grid 
)
Parameters
[in]PHeadpointer to particle Node
[in]Func()pointe to function containing the quantity to be deposited on the grid
[out]QThe 4D data array on which func is deposited
[in]nelemthe number of elements
[in]GridPointer to a grid structure

◆ Particles_DepositBoundaryExchange()

void Particles_DepositBoundaryExchange ( Data_Arr  Q,
int  nelem,
Grid grid 
)

Exchange boundary values between processors to complete the deposition process. If Q contains quantities in the boundaries, we first copy these values into auxiliary buffers snd_bufL and snd_bufR and then transfer them through an MPI Send/Recv call:

Rank #0 A0|B0------C0|D0
^ |
| v
Rank #1 A1|B1------C1|D1
^ |
| v
Rank #2 A2|B2------C2|D2

Seen from rank # 1, we have

  • A1 = snd_bufL
  • D1 = snd_bufR
  • D0 = rcv_bufL
  • A2 = rcv_bufR

Here 'L' or 'R' refer to the processor to the left (rank #0) and to the right (rank #2), respectively. In 2D or 3D we iterate over dimensions.