PLUTO  4.4-patch2
Functions
particles_cr_update_gc.c File Reference

Update CR particles (without feedback) using guiding center approximation. More...

#include "pluto.h"

Functions

static void Particles_CR_setGC (Data *d, Grid *grid)
 
static int Particles_CR_getGC (Particle *, Data *, double *, double, Grid *)
 
static void Particles_CR_destroyGCParticle (Particle *, particleNode *, Data *)
 
void Particles_CR_Update (Data *data, timeStep *Dts, double dt, Grid *grid)
 

Detailed Description

GCA algorithm for updating charged particles.

Loop on particles if first call {
Interpolate EM fields at particle position
Convert velocities to match GCA variables
p->speed[0] = \gamma v (4-velocity)
p->speed[1] = \gamma (Lorentz factor)
p->speed[2] = \mu (magnetic moment in lab frame)
}
Loop on particles{
Interpolate EM fields at particle position
Compute GC velocity and parallel acceleration dRdt[4]
x_i(n+1/2) = x_i(n) + (dt/2)*dRdt_i(n) (position)
u_\parallel(n+1/2) = u_\parallel(n) + (dt/2)*dRdt_3(n) (parallel velocity)
\gamma(n+1/2) = sqrt{1 + 2 \mu \omega (n+1/2) + u_\parallel(n+1/2)} (Lorentz factor)
Compute time step:
dt = min(dt_{old}, Ncell_{max}*dx/(v))
}

Time step restriction is computed by requiring that no particle travels more than Nmax = PARTICLES_CR_NCELL_MAX zones and that the Larmor scale is resolved with more than 1 cycle (see particles_cr_update.c documentation for more information)

Authors
H. Haudemand (herve.nosp@m.h96@.nosp@m.hotma.nosp@m.il.i.nosp@m.t), A. Mignone (migno.nosp@m.ne@t.nosp@m.o.inf.nosp@m.n.it), E. Puzzoni
References
Date
Mar 18, 2021

Function Documentation

◆ Particles_CR_destroyGCParticle()

void Particles_CR_destroyGCParticle ( Particle *  p,
particleNode *  CurNode,
Data data 
)
static

Destroys particle at CurNode and updates CurNode to the next node

Parameters
[in]pPointer to PLUTO particle data structure.
[in,out]CurNodeNode of the particle that will be destroyed
[in]dataPointer to PLUTO data structure

◆ Particles_CR_getGC()

int Particles_CR_getGC ( Particle *  p,
Data data,
double *  dRdt,
double  inv_dt,
Grid grid 
)
static

Compute the right hand side of particle equation in the guiding center approximation. Interpolate fields provided by Particles_CR_setGC at cell location. Conditions: 1) Larmor radius is required to be smaller than cell dimension 2) Larmor radius is required to be small compared to magnetic gradient scale

Parameters
[in]pPointer to PLUTO particle data structure.
[in]dataPointer to PLUTO data structure.
[in,out]dRdtdouble array containing GC speed and parallel 4-velocity.
[in]inv_dtInverse of time step, if <0 time derivatives are not computed.
[in]gridPointer to Grid PLUTO structure.
Returns
Return 0 on success, otherwise -1 for math errors (vE > 1, nan), 1 if gyroradius > dx, 2 if weakly varying field appproximation is not met.

CAMBIARE c

◆ Particles_CR_setGC()

void Particles_CR_setGC ( Data data,
Grid grid 
)
static

Define and compute 3D arrays on the grid (later needed for particle interpolation) NOTE: Vector fields are saved as static field[x/y/z][k cell number][j cell number][i cell number] b is magnetic versor field, u_E is the fluid velocity field, gc_Bmf1 is a scalar field

Parameters
[in]dData structure (contains particles list)
[in]gridpointer to Grid structure
[out]bGradb(b ) b vector field
[out]gc_vEGrad_b(vE ) b vector field
[out]gc_bGrad_vE(b vE) vector field
[out]gc_vEGrad_vE(vE vE) vector field
[out]gc_Grad_Bf1gc_Bmf1 vector field
[out]gc_Grad_BB vector field, needed to check validity of GCA

◆ Particles_CR_Update()

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

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