# ParticleTracker

class plasmapy.simulation.particletracker.ParticleTracker(plasma, particle_type='p', n_particles=1, scaling=1, dt=<Quantity inf s>, nt=inf, integrator='explicit_boris')

Bases: object

Object representing a species of particles: ions, electrons, or simply a group of particles with a particular initial velocity distribution.

Parameters
x

Current position. Shape (n, 3).

Type

astropy.units.Quantity

v

Current velocity. Shape (n, 3).

Type

astropy.units.Quantity

position_history

History of position. Shape (nt, n, 3).

Type

astropy.units.Quantity

velocity_history

History of velocity. Shape (nt, n, 3).

Type

astropy.units.Quantity

q

Charge of particle.

Type

astropy.units.Quantity

m

Mass of particle.

Type

astropy.units.Quantity

eff_q

Total charge of macroparticle.

Type

astropy.units.Quantity

eff_m

Total mass of macroparticle.

Type

astropy.units.Quantity

Examples

Attributes Summary

 integrators kinetic_energy_history Calculate the kinetic energy history for each particle.

Methods Summary

 boris_push([init]) Implement the Boris algorithm for moving particles and updating their velocities. plot_time_trajectories([plot]) Draw position history versus time. Draw trajectory history. Run a simulation instance. Test conservation of kinetic energy.

Attributes Documentation

integrators = {'explicit_boris': <function boris_push>}
kinetic_energy_history

Calculate the kinetic energy history for each particle.

Returns

Array of kinetic energies, shape (nt, n).

Return type

Quantity

Methods Documentation

boris_push(init=False)

Implement the Boris algorithm for moving particles and updating their velocities.

Parameters

init (bool, optional) – If True, does not change the particle positions and sets dt to -dt/2.

Notes

The Boris algorithm is the standard energy conserving algorithm for particle movement in plasma physics. See 1 for more details.

Conceptually, the algorithm has three phases:

1. Add half the impulse from electric field.

2. Rotate the particle velocity about the direction of the magnetic field.

3. Add the second half of the impulse from the electric field.

This ends up causing the magnetic field action to be properly “centered” in time, and the algorithm conserves energy.

References

1

C. K. Birdsall, A. B. Langdon, “Plasma Physics via Computer Simulation”, 2004, p. 58-63

plot_time_trajectories(plot='xyz')

Draw position history versus time.

Parameters

plot (str, optional) – Enable plotting of position component x, y, z for each of these letters included in plot.

plot_trajectories()

Draw trajectory history.

run()

Run a simulation instance.

test_kinetic_energy()

Test conservation of kinetic energy.