Examples

This section contains thorough examples for using TestParticle.jl. If you prefer to run the demos on your local computer with interactive support, we suggest switching from using CairoMakie (which is a Makie frontend for static 2D rendering) to using GLMakie (which is another Makie frontend for interactive 3D rendering).


Basics

Demonstrate energy conservation in uniform fields.

Simple electron trajectory under uniform B and zero E

Simple proton trajectory under uniform B and zero E

Tracing charged particle in dimensionless units

Tracing charged particle in dimensionless units and periodic boundary

Tracing charged particle in both dimensional and dimensionless units.

Simple particle trajectories under uniform B and zero E

Tracing multiple charged particles in a static EM field

Simple ExB drift demonstration

Simple proton trajectory under uniform B and gravity

Simple magnetic field gradient drift demonstration

Simple magnetic field curvature drift demonstration

Finite Larmor radius effect demonstration using Makie

Simple polarization drift under time-varying E field

Advanced

Boris ensemble tracing with field out-of-domain check

Tracing multiple charged particles in a static EM field

Tracing one charged particle with additional diagnostics

Tracing multiple charged particles in a static EM field

Tracing charged particle in the Harris current sheet

Charged particle in the magnetic mirror

Tracing charged particle in a magnetic bottle

Tracing charged particle in a static analytic dipole magnetic field

Tracing charged particle in an analytical magnetosphere

Tracing charged particle in an MHD plane shock

Tracing protons in a Tokamak

Tracing passing and trapped proton in a Tokamak

This demo shows how to trace particles from structured SWMF outputs