PLUTO  4.4-patch2
Functions
particles_tools.c File Reference

Tools required to define the Particle MPI struct and Interpolating quantities from grid to particles. More...

#include "pluto.h"

Functions

long Particles_CheckAll (particleNode *PHead, int nbuf, Grid *grid)
 
int Particles_CheckSingle (Particle *p, int nbuf, Grid *grid)
 
double Particles_Interpolate (double ***V, double ***w, int *indx)
 
void Particles_InterpolateArr (double ****V, int nfield, double ***w, int *indx, double *v)
 
int Particles_LocateCell (double *xp, int *indx, Grid *grid)
 
Particle * Particles_Select (particleNode *PHead, int id)
 

Detailed Description

Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
B. Vaidya (bvaid.nosp@m.ya@u.nosp@m.nito..nosp@m.it)
Date
Mar 17, 2021

Function Documentation

◆ Particles_CheckAll()

long Particles_CheckAll ( particleNode *  PHead,
int  nbuf,
Grid grid 
)

Count and return the number of particles inside a given region of the computational domain. By default (buf=0) the region is the active part of the domain (ghost zone excluded). This region may be enlarged by an additional buffer of nbuf zones in the ghost zones

◆ Particles_CheckSingle()

int Particles_CheckSingle ( Particle *  p,
int  nbuf,
Grid grid 
)

Check if the particle belongs to the local processor domain

Parameters
[in]ppointer to Particle structure.
[in]nbufextra layer of ghost zones nbuf = 0 check if particle is in active domain; nbuf = 1 check if particle is in active zones + 1 layer of ghost zones, and so forth;
Returns
TRUE if the particle is inside the specified region. FALSE otherwise.

◆ Particles_Interpolate()

double Particles_Interpolate ( double ***  V,
double ***  w,
int *  indx 
)

Interpolate a grid quantity V to particle position x.

Parameters
[in]Va 3D array defined on the fluid grid->
[in]wa 3x3x3 array containing the weights
[in]indxa 3 element array giving the starting indices (i,j,k).
Returns
The interpolated value of V at the desired location.

◆ Particles_InterpolateArr()

void Particles_InterpolateArr ( double ****  V,
int  nfield,
double ***  w,
int *  indx,
double *  v 
)

Similar to Particles_Interpolate, but performs the interpolation on n_field directly

Parameters
[in]Va 4D array containing 3D arrays defined on the grid
[in]nfieldthe number of arrays to be interpolated
[in]wa 3x3x3 array containing the weights
[in]indxa 3 element array giving the starting indices (i,j,k).
[out]va nfield element array containing interpolated values

◆ Particles_LocateCell()

int Particles_LocateCell ( double *  xp,
int *  indx,
Grid grid 
)

Determine the index of the computational zone hosting the particle, $ x_{i-\HALF} <= x_p < x_{i+\HALF} $. The search extends to the entire computational domain, including active and ghost zones.

This function works for both uniform and stretched grids and employs a binary search algorithm.

Parameters
[in]xpa 3-element array specifying the particle position
[out]indxa 3-element array giving the cell coordinate (i,j,k)
[in]grida pointer to an array of grid structures.

Return 0 on success, 1 on error.

◆ Particles_Select()

Particle* Particles_Select ( particleNode *  PHead,
int  id 
)

Loop over particle and return the one with specified id.

Parameters
[in]PHeadpointer to the head node of the particle linked list.
[in]idthe particle id

Return the particle (if any), or NULL