collisionless-shocks-in-1d-and-2d
Investigqtion of Collisionless shocks in 1D and 2D
https://github.com/redaelassooudi/collisionless-shocks-in-1d-and-2d
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.3%) to scientific vocabulary
Repository
Investigqtion of Collisionless shocks in 1D and 2D
Basic Info
- Host: GitHub
- Owner: RedaElassooudi
- License: apache-2.0
- Language: Python
- Default Branch: main
- Size: 183 KB
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Collisionless Shock Simulation using Particle-in-Cell (PIC) Method
Author
Harikrishnan Aravindakshan, Reda Elassooudi, Simon Desimpelaere, Bodhisatwa Datta, Robbe Alliet
Last Updated
November 1, 2024
Overview
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.
Code Purpose
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.
Simulation Outline
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.
Key Improvements Implemented
1. Accurate Potential Calculation
- 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.
2. Cloud-In-Cell (CIC) Weighting for Charge Assignment
- Improved charge density distribution using CIC, which reduces numerical noise compared to the Nearest Grid Point (NGP) method.
3. Linear Electric Field Interpolation
- Applied a linear interpolation of electric field values at particle positions to smoothen force calculations and improve consistency with CIC weighting.
4. Energy Conservation with Leapfrog Integration
- Incorporated a leapfrog integration scheme to better conserve total energy throughout the simulation, enhancing numerical stability.
5. Boundary Conditions
- Implemented open or absorbing boundaries to prevent artificial reflections, with options for outflow of particles or damping zones.
6. Random Seed for Reproducibility
- Set a random seed for consistent results across runs, aiding in debugging and result validation.
Plasma Instabilities Exploration
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.
Getting Started
Prerequisites
- Python 3.x and libraries:
numpy,matplotlib.
Installation
- Clone the repository:
bash git clone https://github.com/username/repo-name.git - Install dependencies:
bash pip install numpy matplotlib
Running the Simulation
- Open the main script (e.g.,
collisionless_shock_simulation.py). - Set parameters in the
Simulation Parameterssection. - Run the script:
bash python collisionless_shock_simulation.py - Use the plotting functions provided to visualize results for electric field, density profiles, phase space, and energy evolution.
Diagnostics and Visualizations
- 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.
Future Enhancements
- 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.
References
- 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.
Owner
- Login: RedaElassooudi
- Kind: user
- Repositories: 1
- Profile: https://github.com/RedaElassooudi
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: >-
Introduction to Plasma Dynamics - group project - code
repository
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Simon
family-names: Desimpelaere
- given-names: Robbe
family-names: Alliet
- given-names: Harikrishnan
family-names: Aravindakshan
- given-names: Reda
family-names: Elassooudi
- given-names: Bodhisatwa
family-names: Datta
- given-names: Maximilien
family-names: Péters de Bonhomme
repository-code: >-
https://github.com/RedaElassooudi/collisionless-shocks-in-1D-and-2D
license: Apache-2.0