PLUTO  4.4-patch2
Macros | Functions
particles.h File Reference

Particle module header file. More...

Go to the source code of this file.

Macros

#define PARTICLES_CR_GC   NO
 
#define PARTICLES_CR_C   1.0
 
#define PARTICLES_CR_E_MC   1.0
 
#define PARTICLES_CR_E_MC_GAS   1.0
 
#define PARTICLES_CR_FEEDBACK   YES
 
#define PARTICLES_CR_LARMOR_EPS   0.3
 
#define PARTICLES_CR_NCELL_MAX   1.8
 
#define PARTICLES_CR_NSUB   1
 
#define PARTICLES_CR_PREDICTOR   2
 
#define PARTICLES_CR_MAX_FILE_SIZE   1.9 /* In GB */
 
#define PARTICLES_DUST_FEEDBACK   YES
 
#define PARTICLES_DUST_TIME_STEPPING   EXP_MIDPOINT
 
#define PARTICLES_DUST_STOPPING_TIME   CONSTANT
 
#define PARTICLES_DUST_MAX_FILE_SIZE   1.9 /* In GB */
 
#define PARTICLES_LP_MAX_FILE_SIZE   1.9 /* In GB */
 

Functions

void Particles_Boundary (Data *, Grid *)
 
void Particles_BoundaryExchange (Data *, Grid *)
 
int Particles_BoundaryCheck (Particle *p, Grid *grid)
 
long Particles_CheckAll (particleNode *, int, Grid *)
 
int Particles_CheckSingle (Particle *, int, Grid *)
 
void Particles_CR_ComputeCurrent (const Data *, Grid *)
 
void Particles_CR_ComputeForce (Data_Arr, const Data *, Grid *)
 
void Particles_CR_ConservativeFeedback (Data_Arr, Data_Arr, double, RBox *)
 
void Particles_CR_Flux (const State *, int, int)
 
void Particles_CR_Predictor (Data *, double, Grid *)
 
void Particles_CR_States1DCopy (const Data *, const Sweep *, int, int)
 
void Particles_CR_StatesSource (const Sweep *, double, int, int, Grid *)
 
void Particles_CR_Update (Data *, timeStep *, double, Grid *)
 
void Particles_Density (Particle *, double *)
 
void Particles_Deposit (particleNode *, void(*Func)(Particle *, double *), Data_Arr, int, Grid *)
 
void Particles_DepositBoundaryExchange (Data_Arr, int, Grid *)
 
void Particles_Destroy (particleNode *, Data *)
 
void Particles_Display (Particle *)
 
void Particles_Dust_ConservativeFeedback (Data_Arr, Data_Arr, double, RBox *)
 
void Particles_Dust_StatesSource (Sweep *, Data_Arr, double, int, int, Grid *)
 
void Particles_Dust_Update (Data *, timeStep *, double, Grid *)
 
void Particles_GetWeights (Particle *, int *, double ***, Grid *)
 
void Particles_Init (Data *, Grid *)
 
void Particles_Inject (Data *d, Grid *grid)
 
int Particles_Insert (Particle *, Data *, char, Grid *)
 
double Particles_Interpolate (double ***, double ***, int *)
 
void Particles_InterpolateArr (Data_Arr, int, double ***, int *, double *)
 
void Particles_ListToArray (Data *d)
 
void Particles_LoadUniform (int, int, double *, double *, double *)
 
int Particles_LocateCell (double *, int *, Grid *)
 
void Particles_LP_Update (Data *, timeStep *, double, Grid *)
 
void Particles_LP_ComputeShockNormalSpeed (Particle *, double *, double *)
 
void Particles_LP_FixValue (Particle *, particleProbe *, Data *, Grid *)
 
void Particles_LP_FlagShock (Data *, char ***, Grid *)
 
double Particles_LP_GetEmaxAtShock (Particle *, particleProbe *, double, Grid *)
 
void Particles_LP_Get_4vel (double *, double *, double *)
 
void Particles_LP_Get_3mag (double *, double, double *)
 
void Particles_LP_IC_Emissivity (Particle *, double, double, double *)
 
void Particles_LP_InitSpectra (Particle *)
 
void Particles_LP_IntegrateSpectra (Particle *, double, double *)
 
void Particles_LP_SampleShock (Particle *, particleProbe *, Grid *)
 
void Particles_LP_UpdateSpectra (Data *, double, Grid *)
 
void Particles_LP_Sync_Emissivity (Particle *, double, double, double *, double *, double *)
 
int Particles_Number (particleNode *)
 
void Particles_Restart (Data *, int, Grid *)
 
Particle * Particles_Select (particleNode *, int)
 
void Particles_Set (Data *, Grid *)
 
void Particles_SetID (particleNode *)
 
void Particles_SetOutput (Data *, Runtime *)
 
void Particles_ShowList (particleNode *, int)
 
void Particles_WriteBinary (particleNode *, double, Output *, char *)
 
void Particles_WriteData (Data *d, Output *, Grid *)
 
void Particles_WriteTrajectory (Particle *, char)
 

Detailed Description

Contains basic macro definitions, structure definitions and global variable declarations used by the Particle module.

Author
A. Mignone (migno.nosp@m.ne@t.nosp@m.o.inf.nosp@m.n.it)
B. Vaidya D. Mukherjee
Date
March 19, 2021

Macro Definition Documentation

◆ PARTICLES_CR_C

#define PARTICLES_CR_C   1.0

Sets the artificial value of the speed of light

◆ PARTICLES_CR_E_MC

#define PARTICLES_CR_E_MC   1.0

Charge to mass ratio for CR particles [CR particles].

◆ PARTICLES_CR_E_MC_GAS

#define PARTICLES_CR_E_MC_GAS   1.0

Charge to mass ratio for the fluid [CR Particles].

◆ PARTICLES_CR_FEEDBACK

#define PARTICLES_CR_FEEDBACK   YES

Enable / disable CR particle feedback onto the gas [CR particles].

◆ PARTICLES_CR_GC

#define PARTICLES_CR_GC   NO

Set Guiding center approx to NO by default.

◆ PARTICLES_CR_LARMOR_EPS

#define PARTICLES_CR_LARMOR_EPS   0.3

Fraction of Larmor time (1/OmegaL) covered during one hydro time step [CR particles]

◆ PARTICLES_CR_MAX_FILE_SIZE

#define PARTICLES_CR_MAX_FILE_SIZE   1.9 /* In GB */

Default size of particle binary files

◆ PARTICLES_CR_NCELL_MAX

#define PARTICLES_CR_NCELL_MAX   1.8

Maximum number of zones crossed during one sub-cycle [CR particles].

◆ PARTICLES_CR_NSUB

#define PARTICLES_CR_NSUB   1

Max number of particles time steps per hydro step. When set to a negative integer, force sub-stepping to be the same [CR particles].

◆ PARTICLES_CR_PREDICTOR

#define PARTICLES_CR_PREDICTOR   2

Predictor step in mover. This makes the scheme 2nd order [CR particles].

◆ PARTICLES_DUST_FEEDBACK

#define PARTICLES_DUST_FEEDBACK   YES

Enable / disable dust particle feedback onto the gas [Dust particles].

◆ PARTICLES_DUST_MAX_FILE_SIZE

#define PARTICLES_DUST_MAX_FILE_SIZE   1.9 /* In GB */

Default size of particle binary files

◆ PARTICLES_DUST_STOPPING_TIME

#define PARTICLES_DUST_STOPPING_TIME   CONSTANT

Set the particle stopping time to be consant (CONSTANT) or user-defined (USERDEF).

◆ PARTICLES_DUST_TIME_STEPPING

#define PARTICLES_DUST_TIME_STEPPING   EXP_MIDPOINT

Particles pusher (EXP_MIDPOINT or SEMI_IMPLICIT) [Dust particles].

◆ PARTICLES_LP_MAX_FILE_SIZE

#define PARTICLES_LP_MAX_FILE_SIZE   1.9 /* In GB */

Default size of particle binary files

Function Documentation

◆ Particles_Boundary()

void Particles_Boundary ( Data d,
Grid grid 
)

Sets physical boundary conditions on particles.

Parameters
[in]dPointer to PLUTO data structure.
[in]gridPointer to PLUTO grid structure.

◆ Particles_BoundaryCheck()

int Particles_BoundaryCheck ( Particle *  p,
Grid grid 
)

Check if a particle is in the ghost zones or outside the whole computational domain.

 <--------->                               <--------->
| last |      |  .... Active Domain ....    |      | last |

xb2 xb1 xb0 xe0 xe1 xe2

Here 'last' marks the very last (or first) ghost zones. If a particle lies here, then deposition may not be done correctly.

Returns
This function returns:
  • 0 if the particle is in the active domain
  • 1 if the particle is in the ghost zones, but in the last one
  • 2 if the particle is in the last ghost zone
  • 3 if the particle is outside the whole comput. domain

◆ Particles_BoundaryExchange()

void Particles_BoundaryExchange ( Data d,
Grid grid 
)

In parallel mode, exchange/duplicate particles between neighbour processor. The function is done direction-wise: if a particle escapes from the left (right) boundary it is sent to the left (right) processor. The exchange is repeated direction by direction.

Parameters
[in]dPointer to PLUTO data structure.
[in]gridPointer to the PLUTO grid structure.

◆ 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_CR_ComputeCurrent()

void Particles_CR_ComputeCurrent ( const Data d,
Grid grid 
)

Compute Fcr (Lorentz force felt by particles and fluid) at cell centers. Force is computed by depositing charge and current from individual particles to the grid.

Parameters
[in]V3D array of primitive variables, V[nv][k][j][i]
[in,out]dPLUTO Data structure, containing d->Fcr[]
[in]gridarray of grid structures

◆ Particles_CR_ComputeForce()

void Particles_CR_ComputeForce ( Data_Arr  V,
const Data data,
Grid grid 
)
Parameters
[in]V3D array of primitive variables, V[nv][k][j][i]
[in,out]dataPLUTO Data structure, containing d->Fcr[]
[in]gridarray of grid structures

◆ Particles_CR_ConservativeFeedback()

void Particles_CR_ConservativeFeedback ( Data_Arr  U,
Data_Arr  Fcr,
double  dt,
RBox box 
)

Add source term to the right hand side of the conservative MHD equations.

Parameters
[out]UAn array of conserved quantities, U[k][j][i][nv]
[in]FcrAn array containing the CR feedback, Fcr[4][k][j][i]
[in]dtThe time step increment
[in]boxA pointer to a RBox structure.

◆ Particles_CR_Flux()

void Particles_CR_Flux ( const State state,
int  beg,
int  end 
)

Add CR flux contribution to MHD fluxes. On input, it requires state->Fcr to be already computed. On output, it returns state->fluxCR.

◆ Particles_CR_Predictor()

void Particles_CR_Predictor ( Data data,
double  dt,
Grid grid 
)

Advance particle velocity and speed by dt using an implicit-explicit 1st order scheme. Compute Fcr at F(t+dt), then restore particles into their original position.

Parameters
data[in/out] PLUTO data array
dt[in] Time step to be achieved
grid[in] pointer to Grid structure

◆ Particles_CR_States1DCopy()

void Particles_CR_States1DCopy ( const Data d,
const Sweep sweep,
int  beg,
int  end 
)

Load Fcr from 3D data into 1D state structures. This is needed later to compute the flux (Particles_CR_Flux).

◆ Particles_CR_StatesSource()

void Particles_CR_StatesSource ( const Sweep sweep,
double  dt,
int  beg,
int  end,
Grid grid 
)

Add CR flux-difference and source term contributions to L/R primitive states during the predictor step of CTU algorithm. Note that, although the update should be done in conservative variables, we choose to directly update primitive variables by performing, in place, a conservative-to-primitive recovery so that:

\[ \left\{\begin{array}{lcl} \vec{m}_\pm &\leftarrow& \DS \vec{m}_\pm - \frac{\Delta t}{2}\vec{F}_{CR} \\ \noalign{\medskip} \vec{B}_\pm &\leftarrow& \DS \vec{B}_\pm + \frac{\Delta t}{2}\nabla_x\times \left(\frac{\vec{F}_{CR}}{q_g}\right) \\ \noalign{\medskip} {\cal E}_\pm &\leftarrow& \DS {\cal E}_\pm - \frac{\Delta t}{2}\nabla_x\cdot \left(\frac{\vec{F}_{CR}\times\vec{B}}{q_g} + \vec{F}_{CR}\cdot\vec{v}\right) \end{array}\right. \quad\Longrightarrow\quad \left\{\begin{array}{lcl} \vec{v}_1 &=& \vec{v}_0 + \Delta\vec{v} \\ \noalign{\medskip} \vec{B}_1 &=& \vec{B}_0 + \Delta\vec{B} \\ \noalign{\medskip} (\rho e)_1 &=& \DS (\rho e)_0 + \frac{\rho}{2}(\vec{v}_0^2 - \vec{v}_1^2) + \frac{1}{2}\left(\vec{B}_0^2-\vec{B}_1^2\right) + \Delta {\cal E}; \end{array}\right. \]

Note that curl and divergence operators are discretized using finite differences of fluxCR computed in Particles_CR_Flux().

This step is done only for the primitive Hancock / Char. Trac. schemes since these are carried out in primitive variables. This step is not needed for the conservative Hancock scheme since these terms are included during the predictor.

For source terms not involving derivatives, we include ALL of the components here since no other partcles-related source term will be added during the transverse predictors. For source terms involving derivatives, we include only the normal components since the transverse predictor will add the other components through Riemann solver.

◆ Particles_CR_Update()

void Particles_CR_Update ( Data data,
timeStep Dts,
double  dt,
Grid grid 
)

Advance particle by a step dt.

Parameters
[in,out]dData structure (contains paeticles list)
[in,out]DtstimeStep structure
[in]dttime time increment
[in]gridpointer to Grid structure

Update particles position and velocity by a step dt considering the guiding center approximation.

Parameters
[in,out]dData structure (contains particles list)
[in,out]DtstimeStep structure
[in]dttime increment
[in]gridpointer to Grid structure

◆ 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.

◆ Particles_Destroy()

void Particles_Destroy ( particleNode *  curr,
Data d 
)

Destroy the input node *curr and update linked list.

Parameters
[in]currpointer to concerned particleNode that has to be deleted from the list.
[in]dpointer to PLUTO Data structure

◆ Particles_Display()

void Particles_Display ( Particle *  p)

Prints the relevant quantities for particular particle.

Parameters
[in]ppointer to Particle structure whose values are to be printLoged.

◆ Particles_Dust_ConservativeFeedback()

void Particles_Dust_ConservativeFeedback ( Data_Arr  U,
Data_Arr  Fdust,
double  dt,
RBox box 
)

Conservative feedback:

( v)_g -= dt*rho(dust)*F

Here F is the acceleration drag.

◆ Particles_Dust_StatesSource()

void Particles_Dust_StatesSource ( Sweep sweep,
Data_Arr  Fdust,
double  dt,
int  beg,
int  end,
Grid grid 
)

Add drag source term to L/R sweeps during the predictor step of CTU algorithm.

◆ Particles_Dust_Update()

void Particles_Dust_Update ( Data d,
timeStep Dts,
double  dt,
Grid grid 
)

Position Verlet Algorithm for updating dust particles

With FARGO, we solve

dx/dt = v' dv'/dt = a'

A separate advection step is carried out to account for orbital advection (y -> y - q*Omega*dt)

◆ Particles_GetWeights()

void Particles_GetWeights ( Particle *  p,
int *  cell,
double ***  w,
Grid grid 
)

Compute particle weights such that

\[ q_p = \sum_{ij} w_{ij} Q_{ij} \]

Parameters
[in]ppointer to particle structure
[out]cella 3-element array containing the indices (i,j,k) of the grid cell that is closer and to the left of the particle.
[out]wa 3x3x3 array containing the weights
[in]grida pointer to an array of Grid structures

◆ Particles_Init()

void Particles_Init ( Data d,
Grid grid 
)

Sets initial conditions on particles.

Parameters
[in]dPointer to the PLUTO data structure.
[in]gridPointer to the PLUTO grid structure.

◆ Particles_Inject()

void Particles_Inject ( Data data,
Grid grid 
)

Inject particles as you wish.

Parameters
[in]dataPointer to the PLUTO data structure.
[in]gridPointer to the PLUTO grid structure.

◆ Particles_Insert()

int Particles_Insert ( Particle *  dummy,
Data d,
char  mode,
Grid grid 
)

Insert a new particle in the linked list, if it lies on the local processor domain. Particle id is set to -1 by default.

Parameters
[in]dummypointer to the particle structure to be added to the linked list.
[in,out]dpointer to the PLUTO Data structure.
[in]modespecifies the action (see table).
[in]gridpointer to an array of Grid structures.
Action Ownership CheckSet Id Insert
PARTICLES_CREATE Yes No Yes
PARTICLES_CREATE_WITH_ID Yes Yes Yes
PARTICLES_RESTART Yes No Yes
PARTICLES_TRANSFER No No Yes

Note that when mode == PARTICLES_TRANSFER we do not check the ownership since a particle in a corner boundary has to be transferred twice and only after the second call to Particles_Insert will actually lie in the active domain.

Returns
Return TRUE if particle was added to the list. 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_ListToArray()

void Particles_ListToArray ( Data d)

Convert a linked list into an array of pointers. This function must be called only after particles have been redistributed.

◆ Particles_LoadUniform()

void Particles_LoadUniform ( int  i,
int  ntot,
double *  xbeg,
double *  xend,
double *  coor 
)

Compute particles coordinate assuming a regular spacing given by l = 1/(n)^(1/d) where d is the number of spatial dimensions.

Parameters
[in]ian integer giving the particle counter inside the region [xbeg, xend]
[in]ntotthe total number of particles inside the region [xbeg, xend]
[in]xbegan array specifying the coordinates of the lower bound in the domain to be filled
[in]xendan array specifying the coordinates of the upper bound in the domain to be filled
[out]cooran array containing the particle position

◆ 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_LP_ComputeShockNormalSpeed()

void Particles_LP_ComputeShockNormalSpeed ( Particle *  pl,
double *  nhat,
double *  vshk 
)

Compute Shock speed and Normal Unit Vector using the Coplanarity theorem (See. Schwartz 1998 Chapter on Shocks).

Parameters
[in]plPointer to the Particle Structure.
[out]nhat1D Vector for the Shock Normal.
[out]vshkShock Speed.

◆ Particles_LP_FixValue()

void Particles_LP_FixValue ( Particle *  pl,
particleProbe *  probe,
Data d,
Grid grid 
)

This function finds the cell of the particles and fix all the phisical variables, interpolating them on the particle coordinates. Call this routine only after pl->coor have been correctly initialized or calculated.

Parameters
[in]plPointer to the Particle.
[in]dPointer to the Data structure.
[in]gridPointer to the PLUTO grid structure.

◆ Particles_LP_FlagShock()

void Particles_LP_FlagShock ( Data d,
char ***  flag2,
Grid grid 
)

Flag cells that are shocked. The condition used is same as that used for the fluid. i.e., divV < 0.0, |GradP|/P > Threshold.

Parameters
[in]dPointer to the data structure
[in]gridPointer to the grid structure
[out]flag23D Array of the flagged zones.

◆ Particles_LP_Get_3mag()

void Particles_LP_Get_3mag ( double *  b4,
double  lf,
double *  v3 
)

Computes the three components of magnetic field vector. from magnetic field four vector.

Parameters
[in]b4Output four magnetic field vector.
[in]lfLorentz factor.
[out]v31D Primitive vector with Magnetic field.

◆ Particles_LP_Get_4vel()

void Particles_LP_Get_4vel ( double *  v3,
double *  lf,
double *  u4 
)

Compute Four velocity from three velocity.

Parameters
[in]v31D Array of primitive variables.
[out]lfLorentz factor.
[out]u4Output four velocity vector.

◆ Particles_LP_GetEmaxAtShock()

double Particles_LP_GetEmaxAtShock ( Particle *  pl,
particleProbe *  probe,
double  AccEff,
Grid grid 
)

Compute the maximum energy of the injected energy spectrum that needs to be updated when the macro-particle crosses the shock. See Mimica 2009 & Fromm 2016.

Parameters
[in]plPointer to the Particle Structure.
[in]AccEffAcceleration Efficiency depends on Free Turbulence Parameter
Returns
Maximum energy [in code units] of the updated spectrum

◆ Particles_LP_IC_Emissivity()

void Particles_LP_IC_Emissivity ( Particle *  pl,
double  freq_GHz,
double  ThObs,
double *  JnuIC 
)

Estimates the power emitted by an ensemble of electron N(E) with Isotropic radiation field of CMB photons. For non-relativistic flow approximations in the Thompson's limit are taken from Petruk et. al. 2009, typically used for Supernovae. For the relativistic flow approximations in the Thompson's limit used here are adopted from Dermer et. al. 1995. The relativistic implementation therefore account of beaming of incident CMB photon and also related relativistic effects. The output –> Total InverseCompton emissivity at the prescribed frequency is obtained in units of ergs/(s*cm^3*str)

Parameters
[in]plPointer to the Particle Structure.
[in]freq_GHzObserved frequency of InverseCompton radiation in GHz.
[in]ThObsLine of Sight Angle subtended from the Z axis in degrees.
[out]JnuICTotal InverseCompton emissivity at the prescribed frequency

◆ Particles_LP_InitSpectra()

void Particles_LP_InitSpectra ( Particle *  pl)

Initialize spectra for each particle (only for LAGRANGIAN). Specify here the initial distribution of N(E) with E for each particle

Parameters
[in]plPointer to the Particle structure.

◆ Particles_LP_IntegrateSpectra()

void Particles_LP_IntegrateSpectra ( Particle *  pl,
double  density,
double *  totE 
)

Integrate particle spectrum to give total energy.

Parameters
[in]dPointer to the Particle structure
[in]densityThe fluid density interpolated on the particle. This must be provided even in pl->density is present, because IntegrateSpectra is called before LP_FIX at one time.
[out]totEIntegration of N(e)*e*de.

◆ Particles_LP_SampleShock()

void Particles_LP_SampleShock ( Particle *  pl,
particleProbe *  probe,
Grid grid 
)

Compute upstream and downstream fluid quantites as the particles crosses the shock. The density and velocity values are required for estimating the shock normal and shock speed and finally therefore the compression ratio.

Parameters
[in]dPointer to the data structure.
[in/out]pl Pointer to the Particle structure.
[in]gridPointer to the grid structure.

◆ Particles_LP_Sync_Emissivity()

void Particles_LP_Sync_Emissivity ( Particle *  pl,
double  freq_GHz,
double  ThObs,
double *  JnuSync,
double *  StkQ,
double *  StkU 
)

Routine that computes the total synchrotrn emissivity and polarised Stoke Parameters for a given observed frequency and line of sight angle. The output is obtained in cgs units : ergs/(s*cm^3*Hz*str)

Parameters
[in]plPointer to the Particle Structure.
[in]freq_GHzObserved frequency of synchrotron radiation in GHz.
[in]ThObsLine of Sight Angle subtended from the Z axis in degrees.
[out]JnuSyncTotal synchrotron emissivity at the prescribed frequency
[out]StkQStoke Q Value from Linear Polarised Synchrotron emission.
[out]StkUStoke U Value from Linear Polarised Synchrotron emission.

◆ Particles_LP_Update()

void Particles_LP_Update ( Data d,
timeStep Dts,
double  dt,
Grid grid 
)
Parameters
[in]dPointer to PLUTO data structure.
[in]dtTime step dt.
[in]gridPointer to the PLUTO grid structure.

◆ Particles_LP_UpdateSpectra()

void Particles_LP_UpdateSpectra ( Data d,
double  dt,
Grid grid 
)

Computes the spectral evolution of the particle. It detects if the particle has crossed the shock or not. If it has then the spectra is updated based on the compression ratio value of the shock. Otherwise, particle spectra is just updated accounting for radiative losses.

Parameters
[in]dPointer to the data structure.
[in]plPointer to the Particle structure.
[in]gridPointer to the grid structure.
[in]dtAdvection Time step.

◆ Particles_Number()

int Particles_Number ( particleNode *  PNodeRef)

Count and return the number of particles owned by the current process rnk.

Parameters
[in]PNodeRefpointer to headnode of the list whose count has to be estimated.

◆ Particles_Restart()

void Particles_Restart ( Data d,
int  nrestart,
Grid grid 
)

Routine for restarting from particles files.

Parameters
[in]dPointer to the PLUTO data structure.
[in]nrestartnumber of the restart data file given from command line
[in]gridPointer to the PLUTO grid structure.

◆ 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

◆ Particles_Set()

void Particles_Set ( Data d,
Grid grid 
)

Initialize particles on the grid and distribute them among processors.

Parameters
[in]dPointer to the PLUTO data structure.
[in]gridPointer to the PLUTO grid structure.

◆ Particles_SetID()

void Particles_SetID ( particleNode *  PHead)

Assign id to newly injected particles. The id is incrementally assigned starting from the global counter p_idCounter.

|--------------|--------------|--------------|--------------|

[A] 1,2,3 4,5 6 7,8 = N0

[B] +dn(0)=2 +dn(1)=5 +dn(2)=3 +dn(3)=4

The new id must take the value:

rank #0: 1,2,3, [N0+1, N0+dn(0)] rank #1: 4,5, [N0+dn(0)+1, N0+dn(0)+dn(1)+1] rank #2: 6, [N0+dn(0)+dn(1)+1, N0+dn(0)+dn(1)+dn(2)+1] ...

◆ Particles_SetOutput()

void Particles_SetOutput ( Data d,
Runtime runtime 
)

Set default attributes (variable names, pointers to data structures, filename extensions, etc...) of the particle output structures.

Parameters
[in]dpointer to Data structure
[in]runtimepointer to Runtime structure

◆ Particles_ShowList()

void Particles_ShowList ( particleNode *  PHead,
int  show_particles 
)

Prints the memory addresses (and relevant quantities of particles) of the linked list.

Parameters
[in]PHeadpointer to headnode of the particle list.
[in]show_particlesAn integer value, if set to 1 this routine will also display relevant quantities for every particle in the list.

◆ Particles_WriteBinary()

void Particles_WriteBinary ( particleNode *  PHeadRef,
double  dt_particles,
Output output,
char *  useless_fname 
)

Write particle data in single or double precision binary format. The binary file structure is:

<Header (ASCII) section> {field1, field2, ...}_p All fields are mapped from the particle structure into an array and thus converted to either single or double precision, depending on the function that is being called. Fields can be scalars or array: for each particle nelem indicates the number of elements written for each particle. The field order does not have to match the structure member order but it must be consistent with the sequence declared in Particles_SetOutput() function. Individual fields may be excluded by calling SetOutputVar() from ChangeOutputVar ().

Parameters
[in]PheadRefPointer to the Head Node of Particle List.
[in]dt_particlesParticle time step
[in]outputPointer to output structure

◆ Particles_WriteData()

void Particles_WriteData ( Data d,
Output output,
Grid grid 
)

Main driver of particles output data.

Parameters
[in]dPointer to the PLUTO data structure.
[in]outputPointer to the PLUTO Output strcuture.

◆ Particles_WriteTrajectory()

void Particles_WriteTrajectory ( Particle *  p,
char  mode 
)

Write particle coordinates to an ASCII file, named "particle.<id>.dat" where <id> is the particle id. The file used a multiple column format,

<t> <x1> <x2> <x3> <vx1> <vx2> <vx3>

where <t> is the time column and the other contain coordinates and velocities.

Parameters
[in]pA pointer to a particle structure
[in]modeEither "w" or "a" to write or append to the file.