Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ZINZINBIN/PIC-plasma-simulation

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Electrostatic Particle-In-Cell Plasma Simulation

Introduction

This is a github repository of Particle-In-Cell (PIC) python code for 1-dimensional electrostatic plasma. The baseline code is referred from Philip Mocz. See the github link for original code of Philip Mocz. For the faster computation in field solver, Tri-diagonal Gaussian elimiation method is utilized for 1-dimensional two-stream instability simulation and SOR is applied for bump-on-tail instability simulation. You can adapt different mesh interpolation methods and time integration algorithms. This code provides Cloud-In-Cell (CIC), high-order spline method (TSC) for mesh interpolation, and leapfrog, verlet, midpoint method for time integration. Each simulation code can take initial sinusoidal perturbation with different modes in electron velocity distribution. The arguments for initial perturbations depends on the simulation and the detailed information can be checked from the code.

How to execute

Two-stream instability simulation

    python3 pic_1d_two_stream.py    --num_particles {# of particles} 
                                    --num_mesh {# of mesh grid}
                                    --method {"midpoint","implicit","leapfrog","verlet"}
                                    --solver {"Gauss", "SOR"}
                                    --interpol {"CIC","TSC"}
                                    --vb {beam velocity}
                                    --vth {thermal velocity}
                                    --A {Amplitude of perturbation}
                                    --n_mode {mode number of perturbation}

Bump-on-tail instability simluation

    python3 pic_1d_bump_on_tail.py  --num_particles {# of particles} 
                                    --num_mesh {# of mesh grid}
                                    --method {"midpoint","implicit","leapfrog","verlet"}
                                    --solver {"Gauss", "SOR"}
                                    --interpol {"CIC","TSC"}
                                    --v0 {high energy electron velocity}
                                    --a {ratio of perturbation}
                                    --sigma {Deviation of distribution}
                                    --A {Amplitude of perturbation}
                                    --n_mode {mode number of perturbation}

Simulation

Two-stream instability

We developed two-stream instability simulation for 1D case using PIC method. The below shows the result of 1D case with leapfrog method (left) and implicit midpoint method (right).

In this code, we assumed 1D space with periodic condition for solving electrostatic electron plasmas with applying the velocity perturbation. Two different beam streams of plasmas shows interesting motion of electrons as you can see above. I will develop more complex situations including 2D case and develop the code based on parallel computation. Since the explicit leapfrog method is not a symplectic integrator, we also developed implicit midpoint method for preserving hamiltonian. The below describes two different results obtained from leapfrog (left) and implicit midpoint method (right).

The distribution of the particles along the time can be represented as below. The two-stream instability simulation assumed the perturbation of the velocity distribution with high drift velocity induced by two injected electron beams in the periodic system. We can see two different distribution functions at a initial time have been merged due to the interaction eventually.

Bump-on-tail instability

This code also simulates any initial condition which is given by any probability distribution. Rejection sampling is used to select random particles following the distribution, while the SOR algorithm is applied for stable computation during the simulation. The initial distribution is given as bump-on-tail distribution for example, which can be executed via pic_1d_bump_on_tail.py. It is available to simulate other initial distribution function by modifying dist.py.

The distribution of the particles along the time in this case shows that the Landau damping process, which indicates the quasi-linear diffusion of the velocity distribution due to wave-particle interaction.

Reference

About

Particle-In-Cell simulation code for 1D electrostatic plasma

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.