The particle parameter functions inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/stourgai/WPIT/llms.txt
Use this file to discover all available pages before exploring further.
Environment_mod compute single-particle dynamic quantities that characterise the motion of charged particles trapped in Earth’s magnetic field. These include geometric properties (loss cone, Larmor radius), periodic motions (bounce period, drift period), conserved quantities (first adiabatic invariant), coordinate transforms between pitch angle reference frames, and plasma screening properties (Debye length). Collectively these functions underpin the setup of initial particle distributions and the interpretation of diffusion and transport calculations in WPIT.
Loss Cone
loss_cone
Calculates the equatorial loss cone half-angle for a magnetic dipole field line. Particles with equatorial pitch angles smaller than this angle are not magnetically mirrored above the atmosphere and are lost to precipitation.
The loss cone angle is:
Reference: Kivelson, M. G., and Russell, C. T. (Eds.). (1995). Introduction to Space Physics. Cambridge University Press.
Parameters
L-shell value (dimensionless). As L increases, the loss cone angle decreases — particles at higher L are more easily trapped.
Returns
Loss cone half-angle in radians, measured from the field-aligned direction (not from the perpendicular). Convert to degrees with
numpy.degrees().Example
loss_cone_v2
Calculates the loss cone half-angle for a specified mirror altitude above Earth’s surface. Unlike loss_cone, which assumes the atmosphere begins at Earth’s surface (the dipole field line footprint), loss_cone_v2 explicitly accounts for a finite atmospheric mirror altitude , giving a more physically precise result.
The formula is:
Reference: Lauben, D. S., Inan, U. S., and Bell, T. F. (2001). “Precipitation of radiation belt electrons induced by obliquely propagating lightning-generated whistlers.” J. Geophys. Res.: Space Physics, 106, 29745–29770.
Parameters
L-shell value (dimensionless).
Mirror altitude above Earth’s surface in metres (m). Typical ionospheric base altitude: 100 km =
100e3 m.Returns
Loss cone half-angle in radians.
Example
h_arg is in metres. Altitudes in kilometres must be multiplied by 1000. A typical ionospheric lower boundary is 100 km.Bounce Period
T_bounce
Calculates the bounce period of a magnetically trapped particle — the time for a particle to travel from one mirror point, to the conjugate mirror point, and back. The approximate formula accounts for the pitch-angle dependence of the mirror latitude.
where is the speed of light and is the particle speed.
References:
- Öztürk, M. K. (2012). “Trajectories of charged particles trapped in Earth’s magnetic field.” American Journal of Physics, 80(5), 420–428.
- Sturrock, P. A. (1994). Plasma Physics: An Introduction to the Theory of Astrophysical, Geophysical, and Laboratory Plasmas. Cambridge University Press.
Parameters
L-shell value (dimensionless). The bounce period scales linearly with L.
Particle speed in m/s. For a particle with kinetic energy use
initial_velocity to obtain this. Note: this is the total speed, not a velocity component.Equatorial pitch angle in radians. Particles with larger equatorial pitch angles (more perpendicular) have shorter bounce periods because their mirror points are closer to the equator.
Returns
Bounce period in seconds (s).
Example
Drift Period
T_drift
Calculates the azimuthal drift period of a magnetically trapped particle — the time for a particle to complete one full drift around Earth due to the gradient and curvature drift of the magnetic field. The formula accounts for the pitch-angle dependence of the drift velocity.
References:
- Öztürk, M. K. (2012). “Trajectories of charged particles trapped in Earth’s magnetic field.” American Journal of Physics, 80(5), 420–428.
- Sturrock, P. A. (1994). Plasma Physics: An Introduction to the Theory of Astrophysical, Geophysical, and Laboratory Plasmas. Cambridge University Press.
Parameters
Magnetic field strength in Tesla (T). Use the equatorial dipole field
Bmag_dipole(L, 0).Particle mass in kg. Use
env.const.me for electrons.Particle speed in m/s.
L-shell value (dimensionless).
Equatorial pitch angle in radians.
Returns
Drift period in seconds (s).
Example
T_drift hardcodes env.const.qe as the charge in the drift formula. It is designed for electrons. Do not use it directly for ion drift period calculations without modifying the charge term.R_Larmor
Calculates the Larmor (gyro) radius of a relativistic charged particle. The Larmor radius is the radius of the helical trajectory of a particle gyrating around a magnetic field line and is important for finite Larmor radius effects in wave-particle interactions.
Reference: Parks, G. K. (1991). Physics of Space Plasmas: An Introduction. Addison-Wesley.
Parameters
Perpendicular (to the magnetic field) component of the particle velocity in m/s. Obtain from
initial_velocity as uper0.Relativistic Lorentz factor (dimensionless, ≥ 1). Obtain from
initial_velocity as gamma0.Magnetic field strength in Tesla (T).
Particle mass in kg.
Particle charge in Coulombs (C) (positive value).
Returns
Larmor radius in metres (m).
Example
mu_adiabatic
Calculates the first adiabatic invariant — the magnetic moment of a particle’s gyration. In the absence of rapid field changes, is conserved along a particle’s drift path and is the fundamental quantity that drives pitch angle diffusion in wave-particle interaction theory.
where is the relativistic perpendicular momentum.
Reference: Tao, X., et al. (2012). “Effects of amplitude modulation on nonlinear interactions between electrons and chorus waves.” Geophys. Res. Lett., 39(6).
Parameters
Perpendicular component of the relativistic momentum in kg m/s (N·s). This is . Obtain from
initial_velocity as pper0.Magnetic field strength at the particle’s location in Tesla (T).
Particle mass in kg.
Returns
First adiabatic invariant in J/T (Joules per Tesla).
Example
initial_velocity
Converts a particle’s kinetic energy and local pitch angle into velocity components, momenta, and the Lorentz factor. This is typically the first step in setting up a particle’s initial conditions for a simulation.
The conversion is fully relativistic:
Parameters
Particle kinetic energy in keV (kilo-electron volts). Note: the internal conversion uses .
Local pitch angle in radians — the angle between the particle velocity and the magnetic field direction at the particle’s current location.
Particle mass in kg. Use
env.const.me for electrons, env.const.mH for protons.Returns
Parallel velocity component in m/s.
Perpendicular velocity component in m/s.
Parallel relativistic momentum in kg m/s.
Perpendicular relativistic momentum in kg m/s.
Relativistic Lorentz factor (dimensionless, ≥ 1). Equal to 1 for a non-relativistic particle.
Example
Energy input is in keV, not eV or Joules. The function uses
1 keV = 1.602176487 × 10⁻¹⁶ J. For MeV energies, multiply by 1000 before passing.Pitch Angle Transforms
aeq2alpha
Converts an equatorial pitch angle to the local pitch angle at a given magnetic latitude on the same field line. The conversion uses the dipole mirror ratio between the local field and the equatorial field :
Parameters
L-shell value (dimensionless).
Target magnetic latitude in radians where the local pitch angle is desired.
Equatorial pitch angle in radians.
Returns
Local pitch angle in radians at the specified magnetic latitude.
Example
alpha2aeq
Converts a local pitch angle at a given magnetic latitude to the equivalent equatorial pitch angle on the same field line. This is the inverse of aeq2alpha and uses the same mirror ratio:
Parameters
L-shell value (dimensionless).
Magnetic latitude in radians where the local pitch angle is measured.
Local pitch angle in radians at the given latitude.
Returns
Equatorial pitch angle in radians.
Example
debye_length
Calculates the Debye shielding length — the characteristic scale over which electrostatic potentials are screened in a plasma. The Debye length is important for verifying that the plasma approximation holds (particle separations must be much smaller than the Debye length) and appears in small-angle Coulomb scattering calculations.
Reference: Parks, G. K. (1991). Physics of Space Plasmas: An Introduction, p. 22.
The implementation in
debye_length omits the square root present in the standard textbook formula . The function returns (the square of the Debye length) rather than itself. Take numpy.sqrt() of the result to obtain the true Debye length in metres.Parameters
Electron number density in m⁻³ (SI). Density model outputs in cm⁻³ must be multiplied by .
Electron temperature in Kelvin (K). To convert from eV: .
Returns
Returns , which equals in m². Take
numpy.sqrt() to obtain the Debye length in metres.