GeographicLib  1.21
Public Member Functions | Friends
GeographicLib::GravityCircle Class Reference

Gravity on a circle of latitude. More...

#include <GeographicLib/GravityCircle.hpp>

List of all members.

Public Member Functions

 GravityCircle ()
Compute the gravitational field
Math::real Gravity (real lon, real &gx, real &gy, real &gz) const throw ()
Math::real Disturbance (real lon, real &deltax, real &deltay, real &deltaz) const throw ()
Math::real GeoidHeight (real lon) const throw ()
void SphericalAnomaly (real lon, real &Dg01, real &xi, real &eta) const throw ()
Math::real W (real lon, real &gX, real &gY, real &gZ) const throw ()
Math::real V (real lon, real &GX, real &GY, real &GZ) const throw ()
Math::real T (real lon, real &deltaX, real &deltaY, real &deltaZ) const throw ()
Math::real T (real lon) const throw ()
Inspector functions
bool Init () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
Math::real Latitude () const throw ()
Math::real Height () const throw ()
unsigned Capabilities () const throw ()
bool Capabilities (unsigned testcaps) const throw ()

Friends

class GravityModel

Detailed Description

Gravity on a circle of latitude.

Evaluate the earth's gravity field on a circle of constant height and latitude. This uses a CircleEngine 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 GravityModel::Circle to create a GravityCircle object. (The constructor for this class is private.)

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.

Example of use:

// Example of using the GeographicLib::GravityCircle class
// $Id: dc7c895cc248cee01a434ea3df1b31771ffb6ad2 $

#include <iostream>
#include <exception>
#include <GeographicLib/GravityModel.hpp>
#include <GeographicLib/GravityCircle.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    GravityModel grav("egm96");
    double lat = 27.99, lon0 = 86.93, h = 8820; // 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 gx, gy, gz;
        grav.Gravity(lat, lon, h, gx, gy, gz);
        cout << lon << " " << gx << " " << gy << " " << gz << "\n";
      }
    }
    {
      // Fast method of evaluating the values at several points on a circle of
      // latitude using GravityCircle.
      GravityCircle circ = grav.Circle(lat, h);
      for (int i = -5; i <= 5; ++i) {
        double lon = lon0 + i * 0.2;
        double gx, gy, gz;
        circ.Gravity(lon, gx, gy, gz);
        cout << lon << " " << gx << " " << gy << " " << gz << "\n";
      }
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
  return 0;
}

Gravity is a command-line utility providing access to the functionality of GravityModel and GravityCircle.


Constructor & Destructor Documentation

GeographicLib::GravityCircle::GravityCircle ( ) [inline]

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

Definition at line 107 of file GravityCircle.hpp.


Member Function Documentation

Math::real GeographicLib::GravityCircle::Gravity ( real  lon,
real &  gx,
real &  gy,
real &  gz 
) const throw ()

Evaluate the gravity.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]gxthe easterly component of the acceleration (m s-2).
[out]gythe northerly component of the acceleration (m s-2).
[out]gzthe upward component of the acceleration (m s-2); this is usually negative.
Returns:
W the sum of the gravitational and centrifugal potentials.

The function includes the effects of the earth's rotation.

Definition at line 27 of file GravityCircle.cpp.

Math::real GeographicLib::GravityCircle::Disturbance ( real  lon,
real &  deltax,
real &  deltay,
real &  deltaz 
) const throw ()

Evaluate the gravity disturbance vector.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]deltaxthe easterly component of the disturbance vector (m s-2).
[out]deltaythe northerly component of the disturbance vector (m s-2).
[out]deltazthe upward component of the disturbance vector (m s-2).
Returns:
T the corresponding disturbing potential.

Definition at line 37 of file GravityCircle.cpp.

Math::real GeographicLib::GravityCircle::GeoidHeight ( real  lon) const throw ()

Evaluate the geoid height.

Parameters:
[in]lonthe geographic longitude (degrees).
Returns:
N the height of the geoid above the reference ellipsoid (meters).

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 47 of file GravityCircle.cpp.

void GeographicLib::GravityCircle::SphericalAnomaly ( real  lon,
real &  Dg01,
real &  xi,
real &  eta 
) const throw ()

Evaluate the components of the gravity anomaly vector using the spherical approximation.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]Dg01the gravity anomaly (m s-2).
[out]xithe northerly component of the deflection of the vertical (degrees).
[out]etathe 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 57 of file GravityCircle.cpp.

Math::real GeographicLib::GravityCircle::W ( real  lon,
real &  gX,
real &  gY,
real &  gZ 
) const throw () [inline]

Evaluate the components of the acceleration due to gravity and the centrifugal acceleration in geocentric coordinates.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]gXthe X component of the acceleration (m s-2).
[out]gYthe Y component of the acceleration (m s-2).
[out]gZthe Z component of the acceleration (m s-2).
Returns:
W = V + Phi the sum of the gravitational and centrifugal potentials (m2 s-2).

Definition at line 188 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::V ( real  lon,
real &  GX,
real &  GY,
real &  GZ 
) const throw () [inline]

Evaluate the components of the acceleration due to gravity in geocentric coordinates.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]GXthe X component of the acceleration (m s-2).
[out]GYthe Y component of the acceleration (m s-2).
[out]GZthe Z component of the acceleration (m s-2).
Returns:
V = W - Phi the gravitational potential (m2 s-2).

Definition at line 208 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::T ( real  lon,
real &  deltaX,
real &  deltaY,
real &  deltaZ 
) const throw () [inline]

Evaluate the components of the gravity disturbance in geocentric coordinates.

Parameters:
[in]lonthe geographic longitude (degrees).
[out]deltaXthe X component of the gravity disturbance (m s-2).
[out]deltaYthe Y component of the gravity disturbance (m s-2).
[out]deltaZthe Z component of the gravity disturbance (m s-2).
Returns:
T = W - U the disturbing potential (also called the anomalous potential) (m2 s-2).

Definition at line 229 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::T ( real  lon) const throw () [inline]

Evaluate disturbing potential in geocentric coordinates.

Parameters:
[in]lonthe geographic longitude (degrees).
Returns:
T = W - U the disturbing potential (also called the anomalous potential) (m2 s-2).

Definition at line 243 of file GravityCircle.hpp.

bool GeographicLib::GravityCircle::Init ( ) const throw () [inline]
Returns:
true if the object has been initialized.

Definition at line 257 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::MajorRadius ( ) const throw () [inline]
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the GravityModel object used in the constructor.

Definition at line 264 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::Flattening ( ) const throw () [inline]
Returns:
f the flattening of the ellipsoid. This is the value inherited from the GravityModel object used in the constructor.

Definition at line 271 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::Latitude ( ) const throw () [inline]
Returns:
the latitude of the circle (degrees).

Definition at line 277 of file GravityCircle.hpp.

Math::real GeographicLib::GravityCircle::Height ( ) const throw () [inline]
Returns:
the height of the circle (meters).

Definition at line 283 of file GravityCircle.hpp.

unsigned GeographicLib::GravityCircle::Capabilities ( ) const throw () [inline]
Returns:
caps the computational capabilities that this object was constructed with.

Definition at line 290 of file GravityCircle.hpp.

bool GeographicLib::GravityCircle::Capabilities ( unsigned  testcaps) const throw () [inline]
Parameters:
[in]testcapsa set of bitor'ed GeodesicLine::mask values.
Returns:
true if the GeodesicLine object has all these capabilities.

Definition at line 296 of file GravityCircle.hpp.


Friends And Related Function Documentation

friend class GravityModel [friend]

Definition at line 93 of file GravityCircle.hpp.


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