GeographicLib 2.1.2
|
Model of the earth's gravity field. More...
#include <GeographicLib/GravityModel.hpp>
Public Types | |
enum | mask { NONE , GRAVITY , DISTURBANCE , DISTURBING_POTENTIAL , SPHERICAL_ANOMALY , GEOID_HEIGHT , ALL } |
Public Member Functions | |
Setting up the gravity model | |
GravityModel (const std::string &name, const std::string &path="", int Nmax=-1, int Mmax=-1) | |
Compute gravity in geodetic coordinates | |
Math::real | Gravity (real lat, real lon, real h, real &gx, real &gy, real &gz) const |
Math::real | Disturbance (real lat, real lon, real h, real &deltax, real &deltay, real &deltaz) const |
Math::real | GeoidHeight (real lat, real lon) const |
void | SphericalAnomaly (real lat, real lon, real h, real &Dg01, real &xi, real &eta) const |
Compute gravity in geocentric coordinates | |
Math::real | W (real X, real Y, real Z, real &gX, real &gY, real &gZ) const |
Math::real | V (real X, real Y, real Z, real &GX, real &GY, real &GZ) const |
Math::real | T (real X, real Y, real Z, real &deltaX, real &deltaY, real &deltaZ) const |
Math::real | T (real X, real Y, real Z) const |
Math::real | U (real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const |
Math::real | Phi (real X, real Y, real &fX, real &fY) const |
Compute gravity on a circle of constant latitude | |
GravityCircle | Circle (real lat, real h, unsigned caps=ALL) const |
Inspector functions | |
const NormalGravity & | ReferenceEllipsoid () const |
const std::string & | Description () const |
const std::string & | DateTime () const |
const std::string & | GravityFile () const |
const std::string & | GravityModelName () const |
const std::string & | GravityModelDirectory () const |
Math::real | EquatorialRadius () const |
Math::real | MassConstant () const |
Math::real | ReferenceMassConstant () const |
Math::real | AngularVelocity () const |
Math::real | Flattening () const |
int | Degree () const |
int | Order () const |
Static Public Member Functions | |
static std::string | DefaultGravityPath () |
static std::string | DefaultGravityName () |
Friends | |
class | GravityCircle |
Model of the earth's gravity field.
Evaluate the earth's gravity field according to a model. The supported models treat only the gravitational field exterior to the mass of the earth. When computing the field at points near (but above) the surface of the earth a small correction can be applied to account for the mass of the atmosphere above the point in question; see The effect of the mass of the atmosphere. Determining the height of the geoid above the ellipsoid entails correcting for the mass of the earth above the geoid. The egm96 and egm2008 include separate correction terms to account for this mass.
Definitions and terminology (from Heiskanen and Moritz, Sec 2-13):
See Gravity models for details of how to install the gravity models and the data format.
References:
Example of use:
Gravity is a command-line utility providing access to the functionality of GravityModel and GravityCircle.
Definition at line 83 of file GravityModel.hpp.
Bit masks for the capabilities to be given to the GravityCircle object produced by Circle.
Enumerator | |
---|---|
NONE | No capabilities. |
GRAVITY | Allow calls to GravityCircle::Gravity, GravityCircle::W, and GravityCircle::V. |
DISTURBANCE | Allow calls to GravityCircle::Disturbance and GravityCircle::T. |
DISTURBING_POTENTIAL | Allow calls to GravityCircle::T(real lon) (i.e., computing the disturbing potential and not the gravity disturbance vector). |
SPHERICAL_ANOMALY | Allow calls to GravityCircle::SphericalAnomaly. |
GEOID_HEIGHT | Allow calls to GravityCircle::GeoidHeight. |
ALL | All capabilities. |
Definition at line 123 of file GravityModel.hpp.
|
explicit |
Construct a gravity model.
[in] | name | the name of the model. |
[in] | path | (optional) directory for data file. |
[in] | Nmax | (optional) if non-negative, truncate the degree of the model this value. |
[in] | Mmax | (optional) if non-negative, truncate the order of the model this value. |
GeographicErr | if the data file cannot be found, is unreadable, or is corrupt, or if Mmax > Nmax. |
std::bad_alloc | if the memory necessary for storing the model can't be allocated. |
A filename is formed by appending ".egm" (World Gravity Model) to the name. If path is specified (and is non-empty), then the file is loaded from directory, path. Otherwise the path is given by DefaultGravityPath().
This file contains the metadata which specifies the properties of the model. The coefficients for the spherical harmonic sums are obtained from a file obtained by appending ".cof" to metadata file (so the filename ends in ".egm.cof").
If Nmax ≥ 0 and Mmax < 0, then Mmax is set to Nmax. After the model is loaded, the maximum degree and order of the model can be found by the Degree() and Order() methods.
Definition at line 38 of file GravityModel.cpp.
References GeographicLib::SphericalHarmonic::Coefficients(), DefaultGravityPath(), GeographicLib::NormalGravity::MassConstant(), GeographicLib::SphericalEngine::coeff::mmx(), GeographicLib::SphericalEngine::coeff::N(), GeographicLib::SphericalEngine::coeff::nmx(), GeographicLib::SphericalEngine::coeff::readcoeffs(), and GeographicLib::Math::sq().
Math::real GeographicLib::GravityModel::Gravity | ( | real | lat, |
real | lon, | ||
real | h, | ||
real & | gx, | ||
real & | gy, | ||
real & | gz | ||
) | const |
Evaluate the gravity at an arbitrary point above (or below) the ellipsoid.
[in] | lat | the geographic latitude (degrees). |
[in] | lon | the geographic longitude (degrees). |
[in] | h | the height above the ellipsoid (meters). |
[out] | gx | the easterly component of the acceleration (m s−2). |
[out] | gy | the northerly component of the acceleration (m s−2). |
[out] | gz | the upward component of the acceleration (m s−2); this is usually negative. |
The function includes the effects of the earth's rotation.
Definition at line 304 of file GravityModel.cpp.
References GeographicLib::NormalGravity::Earth(), and W().
Referenced by main().
Math::real GeographicLib::GravityModel::Disturbance | ( | real | lat, |
real | lon, | ||
real | h, | ||
real & | deltax, | ||
real & | deltay, | ||
real & | deltaz | ||
) | const |
Evaluate the gravity disturbance vector at an arbitrary point above (or below) the ellipsoid.
[in] | lat | the geographic latitude (degrees). |
[in] | lon | the geographic longitude (degrees). |
[in] | h | the height above the ellipsoid (meters). |
[out] | deltax | the easterly component of the disturbance vector (m s−2). |
[out] | deltay | the northerly component of the disturbance vector (m s−2). |
[out] | deltaz | the upward component of the disturbance vector (m s−2). |
Definition at line 312 of file GravityModel.cpp.
References GeographicLib::NormalGravity::Earth().
Referenced by main().
Math::real GeographicLib::GravityModel::GeoidHeight | ( | real | lat, |
real | lon | ||
) | const |
Evaluate the geoid height.
[in] | lat | the geographic latitude (degrees). |
[in] | lon | the geographic longitude (degrees). |
This calls NormalGravity::U for ReferenceEllipsoid(). Some approximations are made in computing the geoid height so that the results of the NGA codes are reproduced accurately. Details are given in Details of the geoid height and anomaly calculations.
Definition at line 290 of file GravityModel.cpp.
References GeographicLib::NormalGravity::Earth(), GeographicLib::NormalGravity::SurfaceGravity(), and T().
Referenced by main().
void GeographicLib::GravityModel::SphericalAnomaly | ( | real | lat, |
real | lon, | ||
real | h, | ||
real & | Dg01, | ||
real & | xi, | ||
real & | eta | ||
) | const |
Evaluate the components of the gravity anomaly vector using the spherical approximation.
[in] | lat | the geographic latitude (degrees). |
[in] | lon | the geographic longitude (degrees). |
[in] | h | the height above the ellipsoid (meters). |
[out] | Dg01 | the gravity anomaly (m s−2). |
[out] | xi | the northerly component of the deflection of the vertical (degrees). |
[out] | eta | the easterly component of the deflection of the vertical (degrees). |
The spherical approximation (see Heiskanen and Moritz, Sec 2-14) is used so that the results of the NGA codes are reproduced accurately. approximations used here. Details are given in Details of the geoid height and anomaly calculations.
Definition at line 264 of file GravityModel.cpp.
References GeographicLib::Math::degree(), GeographicLib::NormalGravity::Earth(), T(), and GeographicLib::NormalGravity::U().
Referenced by main().
Math::real GeographicLib::GravityModel::W | ( | real | X, |
real | Y, | ||
real | Z, | ||
real & | gX, | ||
real & | gY, | ||
real & | gZ | ||
) | const |
Evaluate the components of the acceleration due to gravity and the centrifugal acceleration in geocentric coordinates.
[in] | X | geocentric coordinate of point (meters). |
[in] | Y | geocentric coordinate of point (meters). |
[in] | Z | geocentric coordinate of point (meters). |
[out] | gX | the X component of the acceleration (m s−2). |
[out] | gY | the Y component of the acceleration (m s−2). |
[out] | gZ | the Z component of the acceleration (m s−2). |
This calls NormalGravity::U for ReferenceEllipsoid().
Definition at line 255 of file GravityModel.cpp.
References GeographicLib::NormalGravity::Phi(), and V().
Referenced by Gravity().
Math::real GeographicLib::GravityModel::V | ( | real | X, |
real | Y, | ||
real | Z, | ||
real & | GX, | ||
real & | GY, | ||
real & | GZ | ||
) | const |
Evaluate the components of the acceleration due to gravity in geocentric coordinates.
[in] | X | geocentric coordinate of point (meters). |
[in] | Y | geocentric coordinate of point (meters). |
[in] | Z | geocentric coordinate of point (meters). |
[out] | GX | the X component of the acceleration (m s−2). |
[out] | GY | the Y component of the acceleration (m s−2). |
[out] | GZ | the Z component of the acceleration (m s−2). |
Definition at line 243 of file GravityModel.cpp.
Referenced by W().
|
inline |
Evaluate the components of the gravity disturbance in geocentric coordinates.
[in] | X | geocentric coordinate of point (meters). |
[in] | Y | geocentric coordinate of point (meters). |
[in] | Z | geocentric coordinate of point (meters). |
[out] | deltaX | the X component of the gravity disturbance (m s−2). |
[out] | deltaY | the Y component of the gravity disturbance (m s−2). |
[out] | deltaZ | the Z component of the gravity disturbance (m s−2). |
Definition at line 337 of file GravityModel.hpp.
Referenced by GeoidHeight(), and SphericalAnomaly().
|
inline |
Evaluate disturbing potential in geocentric coordinates.
[in] | X | geocentric coordinate of point (meters). |
[in] | Y | geocentric coordinate of point (meters). |
[in] | Z | geocentric coordinate of point (meters). |
Definition at line 350 of file GravityModel.hpp.
|
inline |
Evaluate the components of the acceleration due to normal gravity and the centrifugal acceleration in geocentric coordinates.
[in] | X | geocentric coordinate of point (meters). |
[in] | Y | geocentric coordinate of point (meters). |
[in] | Z | geocentric coordinate of point (meters). |
[out] | gammaX | the X component of the normal acceleration (m s−2). |
[out] | gammaY | the Y component of the normal acceleration (m s−2). |
[out] | gammaZ | the Z component of the normal acceleration (m s−2). |
This calls NormalGravity::U for ReferenceEllipsoid().
Definition at line 374 of file GravityModel.hpp.
References GeographicLib::NormalGravity::U().
|
inline |
Evaluate the centrifugal acceleration in geocentric coordinates.
[in] | X | geocentric coordinate of point (meters). |
[in] | Y | geocentric coordinate of point (meters). |
[out] | fX | the X component of the centrifugal acceleration (m s−2). |
[out] | fY | the Y component of the centrifugal acceleration (m s−2). |
This calls NormalGravity::Phi for ReferenceEllipsoid().
Definition at line 392 of file GravityModel.hpp.
References GeographicLib::NormalGravity::Phi().
GravityCircle GeographicLib::GravityModel::Circle | ( | real | lat, |
real | h, | ||
unsigned | caps = ALL |
||
) | const |
Create a GravityCircle object to allow the gravity field at many points with constant lat and h and varying lon to be computed efficiently.
[in] | lat | latitude of the point (degrees). |
[in] | h | the height of the point above the ellipsoid (meters). |
[in] | caps | bitor'ed combination of GravityModel::mask values specifying the capabilities of the resulting GravityCircle object. |
std::bad_alloc | if the memory necessary for creating a GravityCircle can't be allocated. |
The GravityModel::mask values are
The default value of caps is GravityModel::ALL which turns on all the capabilities. If an unsupported function is invoked, it will return NaNs. Note that GravityModel::GEOID_HEIGHT will only be honored if h = 0.
If the field at several points on a circle of latitude need to be calculated then creating a GravityCircle object and using its member functions will be substantially faster, especially for high-degree models. See Geoid heights on a multi-processor system for an example of using GravityCircle (together with OpenMP) to speed up the computation of geoid heights.
Definition at line 322 of file GravityModel.cpp.
References GeographicLib::SphericalHarmonic::Circle(), GeographicLib::SphericalHarmonic1::Circle(), GeographicLib::NormalGravity::Earth(), GravityCircle, GeographicLib::Math::NaN(), GeographicLib::NormalGravity::Phi(), GeographicLib::NormalGravity::SurfaceGravity(), and GeographicLib::NormalGravity::U().
Referenced by main().
|
inline |
Definition at line 441 of file GravityModel.hpp.
|
inline |
Definition at line 447 of file GravityModel.hpp.
Referenced by main().
|
inline |
Definition at line 452 of file GravityModel.hpp.
Referenced by main().
|
inline |
Definition at line 457 of file GravityModel.hpp.
Referenced by main().
|
inline |
Definition at line 463 of file GravityModel.hpp.
Referenced by main().
|
inline |
Definition at line 468 of file GravityModel.hpp.
|
inline |
Definition at line 473 of file GravityModel.hpp.
References GeographicLib::NormalGravity::EquatorialRadius().
|
inline |
Definition at line 481 of file GravityModel.hpp.
|
inline |
Definition at line 487 of file GravityModel.hpp.
References GeographicLib::NormalGravity::MassConstant().
|
inline |
Definition at line 494 of file GravityModel.hpp.
References GeographicLib::NormalGravity::AngularVelocity().
|
inline |
Definition at line 500 of file GravityModel.hpp.
References GeographicLib::NormalGravity::Flattening().
|
inline |
Definition at line 505 of file GravityModel.hpp.
|
inline |
Definition at line 510 of file GravityModel.hpp.
|
static |
This is the value of the environment variable GEOGRAPHICLIB_GRAVITY_PATH, if set; otherwise, it is $GEOGRAPHICLIB_DATA/gravity if the environment variable GEOGRAPHICLIB_DATA is set; otherwise, it is a compile-time default (/usr/local/share/GeographicLib/gravity on non-Windows systems and C:/ProgramData/GeographicLib/gravity on Windows systems).
Definition at line 356 of file GravityModel.cpp.
References GEOGRAPHICLIB_DATA.
Referenced by GravityModel().
|
static |
This is the value of the environment variable GEOGRAPHICLIB_GRAVITY_NAME, if set; otherwise, it is "egm96". The GravityModel class does not use this function; it is just provided as a convenience for a calling program when constructing a GravityModel object.
Definition at line 369 of file GravityModel.cpp.
References GEOGRAPHICLIB_GRAVITY_DEFAULT_NAME.
|
friend |
Definition at line 86 of file GravityModel.hpp.
Referenced by Circle().