GeographicLib 2.5.2

Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
GeographicLib::MagneticCircle Class Reference

Geomagnetic field on a circle of latitude. More...

`#include <GeographicLib/MagneticCircle.hpp>`

## Public Member Functions
| MagneticCircle ()
Compute the magnetic field
void | operator() (real lon, real &Bx, real &By, real &Bz) const
void | operator() (real lon, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const
void | FieldGeocentric (real lon, real &BX, real &BY, real &BZ, real &BXt, real &BYt, real &BZt) const
Inspector functions
bool | Init () const
Math::real | EquatorialRadius () const
Math::real | Flattening () const
Math::real | Latitude () const
Math::real | Height () const
Math::real | Time () const

## Friends
class | MagneticModel

## Detailed Description

Geomagnetic field on a circle of latitude.

Evaluate the earth's magnetic field on a circle of constant height and latitude. This uses a CircularEngine to pre-evaluate the inner sum of the spherical harmonic sum, allowing the values of the field at several different longitudes to be evaluated rapidly.

Use MagneticModel::Circle to create a MagneticCircle object. (The constructor for this class is private.)

Example of use:

// Example of using the GeographicLib::MagneticCircle class
// This requires that the wmm2010 magnetic model be installed; see
// https://geographiclib.sourceforge.io/C++/doc/magnetic.html#magneticinst
#include <iostream>
#include <exception>
#include <GeographicLib/MagneticModel.hpp>
#include <GeographicLib/MagneticCircle.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
MagneticModel mag("wmm2010");
double lat = 27.99, lon0 = 86.93, h = 8820, t = 2012; // Mt Everest
{
// Slow method of evaluating the values at several points on a circle of
// latitude.
for (int i = -5; i <= 5; ++i) {
double lon = lon0 + i * 0.2;
double Bx, By, Bz;
mag(t, lat, lon, h, Bx, By, Bz);
cout << lon << " " << Bx << " " << By << " " << Bz << "\n";
}
}
{
// Fast method of evaluating the values at several points on a circle of
// latitude using MagneticCircle.
MagneticCircle circ = mag.Circle(t, lat, h);
for (int i = -5; i <= 5; ++i) {
double lon = lon0 + i * 0.2;
double Bx, By, Bz;
circ(lon, Bx, By, Bz);
cout << lon << " " << Bx << " " << By << " " << Bz << "\n";
}
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}
main
int main(int argc, const char *const argv[])
Definition CartConvert.cpp:28
MagneticCircle.hpp
Header for GeographicLib::MagneticCircle class.
MagneticModel.hpp
Header for GeographicLib::MagneticModel class.
GeographicLib::MagneticCircle
Geomagnetic field on a circle of latitude.
Definition MagneticCircle.hpp:37
GeographicLib::MagneticModel
Model of the earth's magnetic field.
Definition MagneticModel.hpp:79
GeographicLib
Namespace for GeographicLib.
Definition Accumulator.cpp:12
std
Definition NearestNeighbor.hpp:806

MagneticField is a command-line utility providing access to the functionality of MagneticModel and MagneticCircle.

Definition at line 37 of file MagneticCircle.hpp.

## Constructor & Destructor Documentation

## ◆ MagneticCircle()

GeographicLib::MagneticCircle::MagneticCircle | ( |  | ) |
| inline

A default constructor for the normal gravity. This sets up an uninitialized object which can be later replaced by the MagneticModel::Circle.

Definition at line 102 of file MagneticCircle.hpp.

## Member Function Documentation

## ◆ operator()() [1/2]

void GeographicLib::MagneticCircle::operator() | ( | real | lon,
|  | real & | Bx,
|  | real & | By,
|  | real & | Bz ) const
| inline

Evaluate the components of the geomagnetic field at a particular longitude.

Parameters

  [in] | lon | longitude of the point (degrees).
  [out] | Bx | the easterly component of the magnetic field (nanotesla).
  [out] | By | the northerly component of the magnetic field (nanotesla).
  [out] | Bz | the vertical (up) component of the magnetic field (nanotesla).

Definition at line 118 of file MagneticCircle.hpp.

## ◆ operator()() [2/2]

void GeographicLib::MagneticCircle::operator() | ( | real | lon,
|  | real & | Bx,
|  | real & | By,
|  | real & | Bz,
|  | real & | Bxt,
|  | real & | Byt,
|  | real & | Bzt ) const
| inline

Evaluate the components of the geomagnetic field and their time derivatives at a particular longitude.

Parameters

  [in] | lon | longitude of the point (degrees).
  [out] | Bx | the easterly component of the magnetic field (nanotesla).
  [out] | By | the northerly component of the magnetic field (nanotesla).
  [out] | Bz | the vertical (up) component of the magnetic field (nanotesla).
  [out] | Bxt | the rate of change of Bx (nT/yr).
  [out] | Byt | the rate of change of By (nT/yr).
  [out] | Bzt | the rate of change of Bz (nT/yr).

Definition at line 137 of file MagneticCircle.hpp.

## ◆ FieldGeocentric()

void GeographicLib::MagneticCircle::FieldGeocentric | ( | real | lon,
|  | real & | BX,
|  | real & | BY,
|  | real & | BZ,
|  | real & | BXt,
|  | real & | BYt,
|  | real & | BZt ) const

Evaluate the components of the geomagnetic field and their time derivatives at a particular longitude.

Parameters

  [in] | lon | longitude of the point (degrees).
  [out] | BX | the X component of the magnetic field (nT).
  [out] | BY | the Y component of the magnetic field (nT).
  [out] | BZ | the Z component of the magnetic field (nT).
  [out] | BXt | the rate of change of BX (nT/yr).
  [out] | BYt | the rate of change of BY (nT/yr).
  [out] | BZt | the rate of change of BZ (nT/yr).

Definition at line 45 of file MagneticCircle.cpp.

References GeographicLib::Math::sincosd().

## ◆ Init()

bool GeographicLib::MagneticCircle::Init | ( |  | ) | const
| inline

Returns
  true if the object has been initialized.

Definition at line 164 of file MagneticCircle.hpp.

## ◆ EquatorialRadius()

Math::real GeographicLib::MagneticCircle::EquatorialRadius | ( |  | ) | const
| inline

Returns
  a the equatorial radius of the ellipsoid (meters). This is the value inherited from the MagneticModel object used in the constructor.

Definition at line 170 of file MagneticCircle.hpp.

## ◆ Flattening()

Math::real GeographicLib::MagneticCircle::Flattening | ( |  | ) | const
| inline

Returns
  f the flattening of the ellipsoid. This is the value inherited from the MagneticModel object used in the constructor.

Definition at line 176 of file MagneticCircle.hpp.

## ◆ Latitude()

Math::real GeographicLib::MagneticCircle::Latitude | ( |  | ) | const
| inline

Returns
  the latitude of the circle (degrees).

Definition at line 181 of file MagneticCircle.hpp.

## ◆ Height()

Math::real GeographicLib::MagneticCircle::Height | ( |  | ) | const
| inline

Returns
  the height of the circle (meters).

Definition at line 186 of file MagneticCircle.hpp.

## ◆ Time()

Math::real GeographicLib::MagneticCircle::Time | ( |  | ) | const
| inline

Returns
  the time (fractional years).

Definition at line 191 of file MagneticCircle.hpp.

## Friends And Related Symbol Documentation

## ◆ MagneticModel

friend class MagneticModel
| friend

Definition at line 93 of file MagneticCircle.hpp.

The documentation for this class was generated from the following files:

- MagneticCircle.hpp
- MagneticCircle.cpp