Skip to content

Class inertialsim::geodesy::WorldMagneticModel

ClassList > inertialsim > geodesy > WorldMagneticModel

World Magnetic Model implementation. More...

  • #include <magnetic_field.h>

Inherits the following classes: inertialsim::geodesy::Field

Public Functions

Type Name
virtual Scalar1D Magnitude (const Coordinates & coordinates) override const
Return magnetic field magnitude at the given coordinates.
virtual Scalar1D Magnitude (const Coordinates & coordinates) const
Return magnitude at the given coordinates.
Scalar1D Magnitude (const Array3D & coordinates, CoordinateSystem default_frame=CoordinateSystem::GEODETIC) const
Return magnitude at the given coordinates.
Scalar1D Magnitude (const geometry::Vector & coordinates, CoordinateSystem default_frame=CoordinateSystem::LOCAL) const
Return magnitude at the given coordinates.
Scalar1D Magnitude (const Vector3D & coordinates, CoordinateSystem default_frame=CoordinateSystem::LOCAL) const
Return magnitude at the given coordinates.
Vector3D Vector (const Coordinates & coordinates, const std::optional< CoordinateSystem > & basis=std::nullopt) const
Return the vector field at the given coordinates.
Vector3D Vector (const Array3D & coordinates, CoordinateSystem default_frame=CoordinateSystem::GEODETIC, const std::optional< CoordinateSystem > & basis=std::nullopt) const
Return the vector field at the given coordinates.
Vector3D Vector (const geometry::Vector & coordinates, CoordinateSystem default_frame=CoordinateSystem::LOCAL, const std::optional< CoordinateSystem > & basis=std::nullopt) const
Return the vector field at the given coordinates.
Vector3D Vector (const Vector3D & coordinates, CoordinateSystem default_frame=CoordinateSystem::LOCAL, const std::optional< CoordinateSystem > & basis=std::nullopt) const
Return the vector field at the given coordinates.
WorldMagneticModel (double date, const MagneticDatum & datum=WMM2025)
Construct a World Magnetic Model instance.
double date () const
Get the date (decimal year) of the model.
MagneticDatum datum () const
Get the magnetic datum.

Public Functions inherited from inertialsim::geodesy::Field

See inertialsim::geodesy::Field

Type Name
virtual Scalar1D Magnitude (const Coordinates & coordinates) const
Return magnitude at the given coordinates.
Scalar1D Magnitude (const Array3D & coordinates, CoordinateSystem default_frame=CoordinateSystem::GEODETIC) const
Return magnitude at the given coordinates.
Scalar1D Magnitude (const geometry::Vector & coordinates, CoordinateSystem default_frame=CoordinateSystem::LOCAL) const
Return magnitude at the given coordinates.
Scalar1D Magnitude (const Vector3D & coordinates, CoordinateSystem default_frame=CoordinateSystem::LOCAL) const
Return magnitude at the given coordinates.
Vector3D Vector (const Coordinates & coordinates, const std::optional< CoordinateSystem > & basis=std::nullopt) const
Return the vector field at the given coordinates.
Vector3D Vector (const Array3D & coordinates, CoordinateSystem default_frame=CoordinateSystem::GEODETIC, const std::optional< CoordinateSystem > & basis=std::nullopt) const
Return the vector field at the given coordinates.
Vector3D Vector (const geometry::Vector & coordinates, CoordinateSystem default_frame=CoordinateSystem::LOCAL, const std::optional< CoordinateSystem > & basis=std::nullopt) const
Return the vector field at the given coordinates.
Vector3D Vector (const Vector3D & coordinates, CoordinateSystem default_frame=CoordinateSystem::LOCAL, const std::optional< CoordinateSystem > & basis=std::nullopt) const
Return the vector field at the given coordinates.
virtual ~Field () = default
Virtual destructor.

Protected Functions

Type Name
virtual Vector3D VectorImpl (const Coordinates & coordinates, const std::optional< CoordinateSystem > & basis) override const
Return Earth's magnetic field vector.

Protected Functions inherited from inertialsim::geodesy::Field

See inertialsim::geodesy::Field

Type Name
virtual Vector3D VectorImpl (const Coordinates & coordinates, const std::optional< CoordinateSystem > & basis) const = 0
Vector implementation to be overridden by subclasses.

Detailed Description

Earth's magnetic field is modeled empirically by the World Magnetic Model (WMM) standard (Standard [08]). This model includes so-called "internal" sources of magnetism (Earth's liquid-iron outer core, magnetic minerals in the crust, etc.) but does NOT include external "disturbance fields" from solar wind, ionospheric currents, and other transient phenomena.

The World Magnetic Model is published in 5-year cycles by NOAA and the British Geological Survey. Each model provides coefficients for spherical harmonic representation of the field, valid for the 5-year period starting from the model epoch.

Note:

Special handling is applied at polar regions where the spherical harmonic representation may become less accurate.

Note:

The model requires a date specified as a decimal year (e.g., 2025.5 for mid-2025) or can be constructed from a standard date type. The date must be within the valid period of the associated magnetic datum.

See also: MagneticDatum for available WMM coefficient sets

See also: Standard [08] for the World Magnetic Model specification

Public Functions Documentation

function Magnitude [⅕]

Return magnetic field magnitude at the given coordinates.

virtual Scalar1D inertialsim::geodesy::WorldMagneticModel::Magnitude (
    const Coordinates & coordinates
) override const

Parameters:

  • coordinates Array of coordinates.

Returns:

Array of magnitudes.

Implements inertialsim::geodesy::Field::Magnitude


function Magnitude [⅖]

Return magnitude at the given coordinates.

virtual Scalar1D inertialsim::geodesy::WorldMagneticModel::Magnitude (
    const Coordinates & coordinates
) const

Parameters:

  • coordinates Array of coordinates.

Returns:

Array of magnitudes.

Implements inertialsim::geodesy::Field::Magnitude


function Magnitude [⅗]

Return magnitude at the given coordinates.

Scalar1D inertialsim::geodesy::WorldMagneticModel::Magnitude (
    const Array3D & coordinates,
    CoordinateSystem default_frame=CoordinateSystem::GEODETIC
) const

Parameters:

  • coordinates Array of raw coordinates (e.g. geodetic).
  • default_frame Coordinate system corresponding to the coordinate input.

Returns:

Array of magnitudes.


function Magnitude [⅘]

Return magnitude at the given coordinates.

Scalar1D inertialsim::geodesy::WorldMagneticModel::Magnitude (
    const geometry::Vector & coordinates,
    CoordinateSystem default_frame=CoordinateSystem::LOCAL
) const

Parameters:

  • coordinates Array of coordinates as geometry::Vector.
  • default_frame Coordinate system corresponding to the coordinate input.

Returns:

Array of magnitudes.


function Magnitude [5/5]

Return magnitude at the given coordinates.

Scalar1D inertialsim::geodesy::WorldMagneticModel::Magnitude (
    const Vector3D & coordinates,
    CoordinateSystem default_frame=CoordinateSystem::LOCAL
) const

Parameters:

  • coordinates Array of raw coordinates (e.g. local xyz).
  • default_frame Coordinate system corresponding to the coordinate input.

Returns:

Array of magnitudes.


function Vector [¼]

Return the vector field at the given coordinates.

inline Vector3D inertialsim::geodesy::WorldMagneticModel::Vector (
    const Coordinates & coordinates,
    const std::optional< CoordinateSystem > & basis=std::nullopt
) const

By default, the vector components will be expressed in the basis associated with the coordinates. For curvilinear systems (e.g. geodetic), the basis is the local basis at the given coordinates. If basis is supplied, it will be used instead.

Note:

For curvilinear coordinate systems like geodetic coordinates, the default basis is the local tangent plane basis at each coordinate location. For Cartesian systems like ECEF, the basis is constant.

Parameters:

  • coordinates Array of coordinates.
  • basis Optional basis in which to return the vector. If not specified, uses the basis associated with the coordinates.

Returns:

Array of vectors (3xN).


function Vector [2/4]

Return the vector field at the given coordinates.

Vector3D inertialsim::geodesy::WorldMagneticModel::Vector (
    const Array3D & coordinates,
    CoordinateSystem default_frame=CoordinateSystem::GEODETIC,
    const std::optional< CoordinateSystem > & basis=std::nullopt
) const

Parameters:

  • coordinates Array of raw coordinates (e.g. geodetic).
  • default_frame Coordinate system corresponding to the coordinate input.
  • basis Optional basis in which to return the vector.

Returns:

Array of vectors.


function Vector [¾]

Return the vector field at the given coordinates.

Vector3D inertialsim::geodesy::WorldMagneticModel::Vector (
    const geometry::Vector & coordinates,
    CoordinateSystem default_frame=CoordinateSystem::LOCAL,
    const std::optional< CoordinateSystem > & basis=std::nullopt
) const

Parameters:

  • coordinates Array of coordinates as geometry::Vector.
  • default_frame Coordinate system corresponding to the coordinate input.
  • basis Optional basis in which to return the vector.

Returns:

Array of vectors.


function Vector [4/4]

Return the vector field at the given coordinates.

Vector3D inertialsim::geodesy::WorldMagneticModel::Vector (
    const Vector3D & coordinates,
    CoordinateSystem default_frame=CoordinateSystem::LOCAL,
    const std::optional< CoordinateSystem > & basis=std::nullopt
) const

Parameters:

  • coordinates Vector of raw coordinates (e.g. local xyz)
  • default_frame Coordinate system corresponding to the coordinate input.
  • basis Optional basis in which to return the vector.

Returns:

Array of vectors.


function WorldMagneticModel

Construct a World Magnetic Model instance.

explicit inertialsim::geodesy::WorldMagneticModel::WorldMagneticModel (
    double date,
    const MagneticDatum & datum=WMM2025
) 

The model is initialized with a date and a World Magnetic Model (WMM) datum. Methods return the value of Earth's magnetic field in the local basis of various frames at the input coordinates and date.

Parameters:

  • date Date as decimal year (e.g., 2025.5).
  • datum World Magnetic Model datum.

Exception:

  • std::invalid_argument if date is prior to datum epoch.

function date

Get the date (decimal year) of the model.

inline double inertialsim::geodesy::WorldMagneticModel::date () const

Returns:

Date as decimal year.


function datum

Get the magnetic datum.

inline MagneticDatum inertialsim::geodesy::WorldMagneticModel::datum () const

Returns:

Reference to the magnetic datum.


Protected Functions Documentation

function VectorImpl

Return Earth's magnetic field vector.

virtual Vector3D inertialsim::geodesy::WorldMagneticModel::VectorImpl (
    const Coordinates & coordinates,
    const std::optional< CoordinateSystem > & basis
) override const

By default, the magnetic field vector components will be expressed in the basis of the input coordinates. For curvilinear systems (e.g. geodetic), the basis is the local basis at the given coordinates. If basis is supplied, it will be used instead.

Parameters:

  • coordinates Array of coordinates.
  • basis Optional basis in which to return the magnetic field vector.

Returns:

Array of magnetic field vectors in Tesla (3xN).

Exception:

  • std::invalid_argument if basis is not a global coordinate system.

Implements inertialsim::geodesy::Field::VectorImpl



The documentation for this class was generated from the following file cpp/include/inertialsim/geodesy/magnetic_field.h