-
parameters.py- simulation & plasma parameters -
generation.py- various function to generate plasma -
cycle.py- basic [backwards]weighting and solution functions -
main.py- the main part containing the whole p-i-c cycle and data export -
plotter.py- for creating animation from data exported to.datfiles -
helpers.py- progress-bar and timing functions
The program can be started by calling python main.py. Make sure to modify output paths in main.py and input in parameters.py:
NAME = ‘input_value_name’This NAME determines what primary configuration is used:
’plasma_fluc’- simple plasma fluctuations (see video)’two-stream’- two-stream instability (uniform distribution) (see video)’two-stream_r’- two-stream instability (random distribution) (see video)’four-stream’- "four-stream" instability (kind of) (see video)’beam_instability’- beam instability (see video)
Plotter works distinctly by calling python plotter.py. To simply view the animation comment out anim.save(…) leaving plt.show(). To save the animation, make sure to put ffmpeg codecs from here to your /usr/local/bin/ directory (necessary for OS X).
Feel free to create your own plasma generation functions. Add the NAME parameter for it in parameters.py and add the elif case in main.py.
The only thing you need to keep in mind, is to keep the overall charge density neutral. You can check that by doing
numpy.sum(density(particles)[:-1])[:-1] here is because of the periodic boundary conditions and density[NODES - 1] equals to density[0].
Particles can be movable, i.e., particle.mv = True, or permanently nailed in place, particle.mv = False.
This class contains the info about particles.
It accepts:
pos: positionvel: velocityomegaP: plasma frequencyQoverM: charge-to-mass ratiomove:Trueif particle is movable,Falseif it’s not
It contains:
-
particle.xandparticle.v: [acceptsfloat] logical position and velocity of the particle -
particle.qm: [acceptsfloat] charge/mass ratio for the particle -
particle.q: particle charge determined by the equationself.q = omega_p**2 * (1 / qm) * eps_0 * (L / N)
omega_pis the given plasma frequencyeps_0is the vacuum permittivity (set to be 1)L / Nis the number density of particle specie
-
particle.mv: [acceptsbool] the particle is either movable or not
- Birdsall, C. K., & Langdon, A. B., 1991, Plasma Physics via Computer Simulation, The Adam Hilger Series on Plasma Physics, edited by C. Birdsall & A. Langdon. Adam Hilger, Bristol, England (ISBN: 0-07-005371-5)
- Hockney, R. W., & Eastwood, J. W., 1988, Computer Simulation Using Particles, Bristol: Hilger (ISBN: 978-0852743928)