Introduction¶
POSTPIC |
The open source particle-in-cell post processor.
Particle-in-cell simulations are a valuable tool for the simulation of non-equelibrium systems in plasma- or astrophysics. Such simulations usually produce a large amount of data consisting of electric and magnetic field data as well as particle positions and momenta. While there are various PIC codes freely available, the task of post-processing – essentially condensing the large amounts of data into small units suitable for plotting routines – is typically left to each user individually. As post-processing may be a time consuming and error-prone process, this python package has been developed.
Postpic can handle two different types of data:
- Field data
which is data sampled on a predefined grid, such as electic and magnetic fields, particle- or charge densities, currents, etc. Fields are usually the data, which can be plotted directly. See
postpic.Field
.- Particle data
which is data of multiple particles and for each particle positions (x, y, z) and momenta (px, py, pz) are known. Particles usually also have weight, charge, time and a unique id. Postpic can transform particle data to field data using the same algorithm and particle shapes, which are used in most PIC Simulations. The particle-to-grid routines are written in C for maximum performance. See
postpic.MultiSpecies
.
What is postpic?¶
Postpic is an open-source package aiming to ease the postprocessing of particle-in-cell simulation data. Particle-in-cell simulations are often used to simulate the behaviour of plasmas in non-equilibrium states.
The Datareader package contains methods and interfaces to read data from any Simulation.
The basic concept consits of two different types of readers:
The Dumpreader¶
This has to be subclassed from Dumpreader_ifc and allows to read a single dump created by the simulation. To identify which dump should be read its initialized with a dumpidentifier. This dumpidentifier can be almost anything, but in the easiest case this is the filepath pointing to a single file containing every information about this simulation dump. With this information the dumpreader must be able to read all data regarding this dump (which is a lot: X, Y, Z, Px, Py, Py, weight, mass, charge, ID,.. for all particle species, electric and magnetic fields on grid, the grid itself, mabe particle ids,…)
The Simulationreader¶
This has to be subclassed from Simulationreader_ifc and allows to read a full list of simulation dumps. Thus an alternate Name for this class could be “Dumpsequence”. This allows the code to track particles from different times of the simulation or create plots with a time axis.
Stephan Kuschel 2014
-
postpic.
readDump
(dumpidentifier, **kwargs)[source]¶ After using the fucntion
postpic.chooseCode()
, this function should be the main function for reading a dump into postpic.- Parameters
dumpidentifier (str) – Identifies the dump. For most dumpreaders this is a string poining to the file or folder. See what the specific reader of your format expects.
**kwargs – will be forwarded to the dumpreader.
- Returns
the dumpreader for this specific data dump.
- Return type
Dumpreader
-
postpic.
readSim
(simidentifier, **kwargs)[source]¶ After using the function
postpic.chooseCode()
, this function should be the main function for reading a simulation into postpic. A simulation is equivalent to a series of dumps in a specific order (not neccessarily time order).- Parameters
simidentifier (str) – Identifies the simulation. For EPOCH this should be a string pointing to a .visit file. Specifics depend on the current simreader class, as set by chooseCode.
**kwargs – will be forwarded to the simreader.
- Returns
the Simulationreader