Species are created by using the Species class (defined in scripts/species.py) . For example:
The color argument specifies the color of the markers that will be used when plotting particles of the species (defaulting to black). The Species instance can be used to access information about the species. For example:
These can be use to set the quantities as well. For example:
More things are available as well. For example
The particle data can be accessed in one of two ways. The arrays can be accessed directly - for example beam.xp will directly access the arrays holding the x coordinates. The data can be obtained indirectly as well, via the "get" routines. For example beam.getx(). In serial, beam.getx() will return the same array as beam.xp, but in parallel, beam.getx() will gather the data from all of the processors, whereas beam.xp is only the data for particles in the local domain. The "get" routines can be used for down selection of the particles, for instance beam.getz(xl=0.1, xu=0.2) will get the z of particle within (0.1 <= x <= 0.2).
In addition to the basic particle quantities, further quantities can be added. These are quantities that are saved for each particles and are carried with them. There are a number of quantities that are automatically initialized by Warp. For example, setting
will save the time of birth for each particle. The routine "nextpid()" sets up the space for the new quantity. The birth time for each particle can later be retrieved using the species instance - beam.tbirth, or beam.gettbirth(). Other built in quantities include saving additional information about the particle's birth and the data from the previous time step. See the Particles module in top.v for the list of built in quantities that can be setup.
The species instance allows one to add user defined particle quantities. For instance, a quantity called alpha can be created.
The quantity would need to be setup by the user. For example, it could be passed into the particle creation routines,
or set directly,
The data can be obtained either directly, via beam.alpha, or indirectly, via beam.getalpha().
An important note is that when a quantity is setup for one species, it will then be available in all species. So, with the example of "alpha", one would also have the data plasma_ions.alpha.