Software for simulation of the dynamics of charged particles with periodic boundary conditions.
If you want the program to run much faster, I encourage you to use the C++ version.
You need Python3 with the following modules:
- NumPy
- tqdm
- Click
- Matplotlib
These can be installed via
$ pip install numpy tqdm click matplotlib
or
$ conda install numpy tqdm click matplotlib
- Clone or download the repository.
- Open a terminal and simply type
$ python3 main.py path/to/jsonfile.json
Of course, you must know how to build that JSON file and what it contains. This is further explained in the Wiki of this repository.
Let's perform a simulation of a two-stream instability. For this, there is a script called build_two_stream.py
which creates the sample file as well as the .json
file. You can set the parameters you prefer. Note: for this example, let's pretend you didn't modified it.
- Open a terminal inside the repository folder.
- Run the sample script
$ python3 build_two_stream.py
This will create a folder with the name specified in the output
variable. Inside that folder you can find both the sample and the .json
file. The sample file is called two_stream.dat
and the JSON file sim_two_stream.json
.
- Run the simulation
$ python3 main.py electrostatic/sim_two_stream.json
- Plot the energy
$ python3 plotters/plot_energy.py electrostatic/sim_two_stream.json
- Plot the phase space in the step 150
$ python3 plotters/plot_phase_space.py electrostatic/sim_two_stream.json 150