Retrieving Distribution Data in Interpreter It is easy to retrieving information about the particle distribution(s) in the interpreter for use in diagnostics, to save in external files, etc. Say you defined a species via:
then information on macroparticles defining the species selectrons can be obtained by running
Additional "get" scripts available that are applied analogously include:
Saving to an External FileData can be saved to external files using methods described in the How To Saving/Retrieving Data. Here we cover further examples in the context of particle distribution data. To save data to external file the following model can be used
Or if you want to order the data by PID: all = sorted(zip(pid,x,y,z)) and then in the for loop something like: myfile.write(' '.join(map(str, all[i]))
Saving data at a fixed z-position Warp has a way tp collecting particles at a given z location. You can use the ZCrossingParticles class. For example,
from extpart import ZCrossingParticles
targetz_particles = ZCrossingParticles(zz=targetz, laccumulate=1) During the run, this will save all particles as they cross targetz. Then after the simulation, you can do
x = targetz_particles.getx() And write out x etc. to a file. |