Test particle code to study particle transport or energization. The code is parallelized using MPI and OpenMP, and it use HDF5 for output.
- You need a MPI library and parallel HDF5.
- You may need to change some variables in
Makfile
, includingCC
,LD
, andHDF5_ROOT
.
Then, simply make
in the root directory.
- Copy
config_files/init.dat
andconfig_files/test_particle.sh
into the directory that you are going to run the code. And you need to changeinit.dat
andtest_particle.sh
. The variables in the files should be self-explained.- The included
test_particle.sh
is designed for using the fields generated by 3D VPIC simulations. You may have to write some code and scripts to load the fields from your own simulations.
- The included
- You can run the code by
./test_particle.sh
. - In default, the code generates four files.
diff_coeffs.dat
(ASCII): diffusion coefficients. Please checkdiagnostics.c
for details.espectrum.dat
(ASCII): energy spectrum. The first row is particle energy bins. The rest rows are spectrum at a series of time frames.particle_diagnostics.h5
(HDF5): particle trajectories.particles_fields_init.h5
: initial particle information, including particle position, velocity, time, charge/mass, electric field, and magnetic field.
You can use the provided Python scripts to plot the data.
- Diffusion coefficients
python reconnection_analysis.py --run_name $run_name --run_dir $run_dir \
--tinterval $tinterval --tframe $tframe --diff_coeff --ptl_vel 0.7
where you have to define the simulation's parameters. For multiple injection velocity,
add --multi_vel
flag.
- Energy spectrum: change
--diff_coeff
toplot_spectrum
in the above script. - Particle trajectory:
particle_diagnostics.h5
saves each particle information in a dataset. In order to read the data using ParaView + H5Part, we need to transfer the HDF5 file to a H5Part file using
Then, we can load the generated file into ParaView and plot all particles at a single time step. You can generate time series be selecting one specific particles using ParaView's selection tools, but the process could be tedious. You's better write a python script to do that.python reconnection_analysis.py --run_name $run_name --run_dir $run_dir \ --tinterval $tinterval --tframe $tframe --tran_hdf5 --ptl_vel 0.7
- We can also generate piecewise trajectories for a single particle, so have a rough
idea of the trajectory curve. It uses pyetvk to generate a single
.vtu
file for each time step.
You may also need to specifypython reconnection_analysis.py --run_name $run_name --run_dir $run_dir \ --tinterval $tinterval --tframe $tframe --piecewise_traj --ptl_vel 0.7
--iptl
and--tint
to get a specific trajectory and the number of steps before and after current step. Then, you can load these.vtu
files into ParaView to show piecewise trajectories. You can use Paraview'sProgrammableFilter
to generatevtkPolyData
to make the trajectories curves. TheProgrammableFilter
is given invtu_vtkPolyData.py
. Then, you can use thetube
filter to make the trajectory look even better.