# Particle sampling

GEMPIC.ParticleSamplerType
ParticleSampler{D,V}( sampling_type, symmetric, dims, n_particles)

Particle initializer class with various functions to initialize a particle.

• sampling_type : :random or :sobol
• symmetric : true or false
• n_particles : number of particles
GEMPIC.newtonMethod
 newton(r, α, k)

Function to solve $P(x) - r = 0$ where $r \in [0, 2π/k]$

where $P$ is the cdf of $f(x) = 1 + α \cos(k x)$

GEMPIC.sample!Method
sample!( pg::ParticleGroup{1,1}, α, k, σ, mesh::OneDGrid)

Sampling from a probability distribution to initialize a Landau damping in 1D1V space.

$$$f_0(x,v,t) = \frac{n_0}{\sqrt{2π} v_{th}} ( 1 + \alpha cos(k_x x)) exp( - \frac{v^2}{2 v_{th}^2})$$$
GEMPIC.sample!Method
sample!( pg::ParticleGroup{2,1}, α, k, σ, mesh::OneDGrid)

Sampling from a probability distribution to initialize a Landau damping in 1D1V space.

$$$f_0(x,v,t) = \frac{n_0}{2π v_{th}^2} ( 1 + \alpha cos(k_x x)) exp( - \frac{v^2}{2 v_{th}^2})$$$
GEMPIC.sample!Method
sample!( pg, ps, df, mesh)

Sample from a Particle sampler

• pg : Particle group
• ps : Particle sampler
• df : Distribution function
• xmin : lower bound of the domain
• dimx : length of the domain.

## Special case of the Landau Damping

GEMPIC.LandauDampingType
Landau( α, kx)

Test structure to initialize a particles distribtion for Landau damping test case in 1D1V and 1D2V

GEMPIC.sample!Method
sample!(d, pg)

Sampling from a probability distribution to initialize a Landau damping in 1D2V space.

$$$f_0(x,v,t) = \frac{n_0}{2π v_{th}^2} ( 1 + \alpha cos(k_x x)) exp( - \frac{v_x^2+v_y^2}{2 v_{th}^2})$$$

The newton function solves the equation $P(x)-r=0$ with Newton’s method

$$$x^{n+1} = x^n – (P(x)-(2\pi r / k)/f(x)$$$

with

$$$P(x) = \int_0^x (1 + \alpha cos(k_x y)) dy = x + \frac{\alpha}{k_x} sin(k_x x)$$$