Harikrishnan Aravindakshan, Reda Elassooudi, Simon Desimpelaere, Bodhisatwa Datta, Robbe Alliet
November 1, 2024
This repository contains a Python-based simulation of collisionless shocks in a plasma, leveraging the Particle-in-Cell (PIC) method. The primary goal is to model shock formation and study instabilities in one-dimensional plasma without direct particle collisions, using electric and magnetic fields generated by collective particle dynamics.
The code models the formation and evolution of collisionless shocks by simulating the dynamics of electrons and ions in a plasma environment. The simulation monitors parameters like particle positions, velocities, and electric fields, generating diagnostic data for analyzing shock dynamics.
The simulation works through the following main stages:
- Initialization: Particles (ions and electrons) are initialized with specific velocity distributions and density gradients to create conditions favorable for shock formation.
- Time Evolution Loop: The code advances over discrete time steps, updating particle positions and velocities based on the computed electromagnetic fields.
- Charge Assignment and Field Calculation: Charge density is calculated at each time step and used to solve Poisson’s equation, deriving electric fields and potential.
- Boundary Conditions: Reflective and periodic boundary conditions are applied to simulate shock boundaries and particle reflection accurately.
- Diagnostics and Visualization: Data is collected and visualized, capturing shock characteristics in electric field strength, particle density, and energy metrics.
- Enhanced by replacing simple cumulative sums with methods like Successive Over-Relaxation (SOR) and Fast Fourier Transform (FFT), improving electric field accuracy and energy conservation.
- Improved charge density distribution using CIC, which reduces numerical noise compared to the Nearest Grid Point (NGP) method.
- Applied a linear interpolation of electric field values at particle positions to smoothen force calculations and improve consistency with CIC weighting.
- Incorporated a leapfrog integration scheme to better conserve total energy throughout the simulation, enhancing numerical stability.
- Implemented open or absorbing boundaries to prevent artificial reflections, with options for outflow of particles or damping zones.
- Set a random seed for consistent results across runs, aiding in debugging and result validation.
The project extends to study fundamental plasma instabilities such as two-stream and bump-on-tail instabilities:
-
Two-Stream Instability: Caused by two opposing particle streams, leading to wave amplification.
- Modifications include initializing particle velocities in opposite directions, setting periodic boundary conditions, and adjusting time and space resolution to capture instability growth.
-
Bump-on-Tail Instability: Triggered by a high-velocity particle surplus on the tail of the velocity distribution, leading to wave growth due to inverse Landau damping.
- The electron distribution is modified to include a "bump," while diagnostics track wave amplification and distribution flattening.
- Python 3.x and libraries:
numpy
,matplotlib
.
- Clone the repository:
git clone https://github.com/username/repo-name.git
- Install dependencies:
pip install numpy matplotlib
- Open the main script (e.g.,
collisionless_shock_simulation.py
). - Set parameters in the
Simulation Parameters
section. - Run the script:
python collisionless_shock_simulation.py
- Use the plotting functions provided to visualize results for electric field, density profiles, phase space, and energy evolution.
- Electric Field: Shows shock front propagation.
- Density Profiles: Visualizes particle compressions and expansions.
- Phase Space Plots: Illustrates changes in particle velocities and positions.
- Energy Evolution: Tracks kinetic, potential, and total energies over time, validating energy conservation.
- 3D Extension: Expanding the simulation to three dimensions for more complex shock scenarios.
- Additional Instabilities: Investigating more advanced plasma instabilities.
- Optimization: Improving computational performance for large-scale simulations.
- Birdsall, C.K., & Langdon, A.B. Plasma Physics via Computer Simulation.
- Hockney, R.W., & Eastwood, J.W. Computer Simulation Using Particles.
- Nicholson, D.R. Introduction to Plasma Theory.