The magnetic field 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 implement an idealized Earth-centered magnetic dipole model. This approximation is standard in inner-magnetosphere wave-particle interaction studies and provides analytically tractable expressions for field strength, field-line geometry, and the gradient of B — quantities that drive particle mirroring and bounce motion. All functions assume a geocentric dipole with an equatorial surface field of .
Bmag_dipole
Calculates the magnitude of Earth’s geomagnetic dipole field at a given L-shell and magnetic latitude.
The dipole field magnitude follows:
where is the equatorial surface field, is the L-shell, and is the magnetic latitude.
Reference: Parks, G. K. (1991). Physics of Space Plasmas: An Introduction, 1st ed. Addison-Wesley, p. 54.
Parameters
L-shell value (dimensionless). Represents the equatorial crossing distance of the field line in units of Earth radii. Typical inner-magnetosphere range: 1.5 – 8.
Magnetic latitude in radians. The equator corresponds to
lamda_arg = 0. Valid range: to .Returns
Geomagnetic dipole field magnitude in Tesla (T).
Example
lamda_arg must be in radians, not degrees. Use numpy.radians() to convert. The formula becomes singular as (at the magnetic poles); avoid evaluating near the poles.dB_ds
Calculates the gradient of the magnetic field strength with respect to arc length along the magnetic field line, . This quantity appears directly in the mirror force on a charged particle and is needed for bounce motion calculations.
The gradient is given by:
where is Earth’s mean radius.
Parameters
Dipole magnetic field strength at the point of interest, in Tesla (T). Typically obtained from
Bmag_dipole(L_arg, lamda_arg).Magnetic latitude in radians. Must match the latitude at which
B_arg was evaluated.L-shell value (dimensionless).
Returns
Gradient of the geomagnetic field along the field line in T/m (Tesla per metre). The sign is positive for increasing B (towards the mirror points) and zero at the equator where .
Example
At the magnetic equator (
lamda_arg = 0) the gradient is exactly zero by symmetry — the equator is the field minimum and the particle bounce point occurs away from the equator for non-zero pitch angles. B_arg and lamda_arg must refer to the same point on the field line.Lshell
Computes the L-shell (McIlwain L parameter) of a point given its geocentric distance and magnetic latitude. The L-shell is defined as the equatorial crossing distance of the dipole field line passing through the point, measured in units of Earth radii.
The relation is:
where is the geocentric distance in metres and is Earth’s mean radius.
Reference: Tao, X., et al. (2012). “Effects of amplitude modulation on nonlinear interactions between electrons and chorus waves.” Geophysical Research Letters, 39(6).
Parameters
Geocentric distance in metres (m). This is the distance from Earth’s centre to the point of interest. For reference, Earth’s surface corresponds to
r ≈ 6.378 × 10⁶ m (i.e., env.const.Re). The function divides by const.Re internally so the input must be in metres.Magnetic latitude in radians. The parameter is named
lat_arg internally (the docstring labels it lamda_arg).Returns
L-shell value (dimensionless). Equal to the equatorial crossing distance of the field line in units of Earth radii.
Example
r_arg is in metres, not kilometres. Multiply kilometre values by 1000 before passing to this function. The result is the standard dipole McIlwain L parameter, valid only under the magnetic dipole approximation.