NETGeographicLib  1.49
Public Types | Public Member Functions | Static Public Member Functions | List of all members
NETGeographicLib::NormalGravity Class Reference

.NET wrapper for GeographicLib::NormalGravity. More...

#include <NETGeographicLib/NormalGravity.h>

Public Types

enum  StandardModels { StandardModels::WGS84, StandardModels::GRS80 }
 The enumerated standard gravity models. More...
 

Public Member Functions

 ~NormalGravity ()
 
Setting up the normal gravity
 NormalGravity (double a, double GM, double omega, double f_J2, bool geometricp)
 
 NormalGravity (StandardModels model)
 
 NormalGravity (const GeographicLib::NormalGravity &g)
 
Compute the gravity
double SurfaceGravity (double lat)
 
double Gravity (double lat, double h, [System::Runtime::InteropServices::Out] double% gammay, [System::Runtime::InteropServices::Out] double% gammaz)
 
double U (double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% gammaX, [System::Runtime::InteropServices::Out] double% gammaY, [System::Runtime::InteropServices::Out] double% gammaZ)
 
double V0 (double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% GammaX, [System::Runtime::InteropServices::Out] double% GammaY, [System::Runtime::InteropServices::Out] double% GammaZ)
 
double Phi (double X, double Y, [System::Runtime::InteropServices::Out] double% fX, [System::Runtime::InteropServices::Out] double% fY)
 

Static Public Member Functions

static NormalGravityWGS84 ()
 
static NormalGravityGRS80 ()
 
static double J2ToFlattening (double a, double GM, double omega, double J2)
 
static double FlatteningToJ2 (double a, double GM, double omega, double f)
 

Inspector functions

double MajorRadius [get]
 
double MassConstant [get]
 
double AngularVelocity [get]
 
double Flattening [get]
 
double EquatorialGravity [get]
 
double PolarGravity [get]
 
double GravityFlattening [get]
 
double SurfacePotential [get]
 
double DynamicalFormFactor (int n)
 
GeocentricEarth ()
 

Detailed Description

.NET wrapper for GeographicLib::NormalGravity.

This class allows .NET applications to access GeographicLib::NormalGravity.

"Normal" gravity refers to an idealization of the earth which is modeled as an rotating ellipsoid. The eccentricity of the ellipsoid, the rotation speed, and the distribution of mass within the ellipsoid are such that the surface of the ellipsoid is a surface of constant potential (gravitational plus centrifugal). The acceleration due to gravity is therefore perpendicular to the surface of the ellipsoid.

There is a closed solution to this problem which is implemented here. Series "approximations" are only used to evaluate certain combinations of elementary functions where use of the closed expression results in a loss of accuracy for small arguments due to cancellation of the two leading terms. However these series include sufficient terms to give full machine precision.

Definitions:

References:

C# Example:

using System;
namespace example_NormalGravity
{
class Program
{
static void Main(string[] args)
{
try {
NormalGravity grav = new NormalGravity(NormalGravity.StandardModels.WGS84);
double lat = 27.99, h = 8820; // Mt Everest
double gammay, gammaz;
grav.Gravity(lat, h, out gammay, out gammaz);
Console.WriteLine(String.Format("{0} {1}", gammay, gammaz));
}
catch (GeographicErr e) {
Console.WriteLine(String.Format("Caught exception: {0}", e.Message));
}
}
}
}

Managed C++ Example:

using namespace System;
using namespace NETGeographicLib;
int main(array<System::String ^> ^/*args*/)
{
try {
double lat = 27.99, h = 8820; // Mt Everest
double gammay, gammaz;
grav->Gravity(lat, h, gammay, gammaz);
Console::WriteLine(String::Format("{0} {1}", gammay, gammaz));
}
catch (GeographicErr^ e) {
Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
return -1;
}
return 0;
}

Visual Basic Example:

Imports NETGeographicLib
Module example_NormalGravity
Sub Main()
Try
Dim grav As NormalGravity = New NormalGravity(NormalGravity.StandardModels.WGS84)
Dim lat As Double = 27.99, h = 8820 ' Mt Everest
Dim gammay, gammaz As Double
grav.Gravity(lat, h, gammay, gammaz)
Console.WriteLine(String.Format("{0} {1}", gammay, gammaz))
Catch ex As GeographicErr
Console.WriteLine(String.Format("Caught exception: {0}", ex.Message))
End Try
End Sub
End Module

INTERFACE DIFFERENCES:
A constructor has been provided for creating standard WGS84 and GRS80 gravity models.

The following functions are implemented as properties: MajorRadius, MassConstant, AngularVelocity, Flattening, EquatorialGravity, PolarGravity, GravityFlattening, SurfacePotential.

Definition at line 71 of file NormalGravity.h.

Member Enumeration Documentation

◆ StandardModels

The enumerated standard gravity models.

Enumerator
WGS84 

WGS84 gravity model.

GRS80 

GRS80 gravity model.

Definition at line 81 of file NormalGravity.h.

Constructor & Destructor Documentation

◆ NormalGravity() [1/3]

NETGeographicLib::NormalGravity::NormalGravity ( double  a,
double  GM,
double  omega,
double  f_J2,
bool  geometricp 
)

Constructor for the normal gravity.

Parameters
[in]aequatorial radius (meters).
[in]GMmass constant of the ellipsoid (meters3/seconds2); this is the product of G the gravitational constant and M the mass of the earth (usually including the mass of the earth's atmosphere).
[in]omegathe angular velocity (rad s−1).
[in]f_J2either the flattening of the ellipsoid f or the the dynamical form factor J2.
[out]geometricpif true, then f_J2 denotes the flattening, else it denotes the dynamical form factor J2.
Exceptions
ifa is not positive or if the other parameters do not obey the restrictions given below.

The shape of the ellipsoid can be given in one of two ways:

  • geometrically (geomtricp = true), the ellipsoid is defined by the flattening f = (ab) / a, where a and b are the equatorial radius and the polar semi-axis. The parameters should obey a > 0, f < 1. There are no restrictions on GM or omega, in particular, GM need not be positive.
  • physically (geometricp = false), the ellipsoid is defined by the dynamical form factor J2 = (CA) / Ma2, where A and C are the equatorial and polar moments of inertia and M is the mass of the earth. The parameters should obey a > 0, GM > 0 and J2 < 1/3 − (omega2a3/GM) 8/(45π). There is no restriction on omega.

Referenced by ~NormalGravity().

◆ NormalGravity() [2/3]

NETGeographicLib::NormalGravity::NormalGravity ( StandardModels  model)

A constructor for creating standard gravity models..

Parameters
[in]modelSpecifies the desired model.

◆ NormalGravity() [3/3]

NETGeographicLib::NormalGravity::NormalGravity ( const GeographicLib::NormalGravity g)

A constructor that accepts a GeographicLib::NormalGravity. For internal use only.

Parameters
gAn existing GeographicLib::NormalGravity.

◆ ~NormalGravity()

NETGeographicLib::NormalGravity::~NormalGravity ( )
inline

The destructor calls the finalizer.

Definition at line 140 of file NormalGravity.h.

References NormalGravity().

Member Function Documentation

◆ SurfaceGravity()

double NETGeographicLib::NormalGravity::SurfaceGravity ( double  lat)

Evaluate the gravity on the surface of the ellipsoid.

Parameters
[in]latthe geographic latitude (degrees).
Returns
γ the acceleration due to gravity, positive downwards (m s−2).

Due to the axial symmetry of the ellipsoid, the result is independent of the value of the longitude. This acceleration is perpendicular to the surface of the ellipsoid. It includes the effects of the earth's rotation.

◆ Gravity()

double NETGeographicLib::NormalGravity::Gravity ( double  lat,
double  h,
[System::Runtime::InteropServices::Out] double%  gammay,
[System::Runtime::InteropServices::Out] double%  gammaz 
)

Evaluate the gravity at an arbitrary point above (or below) the ellipsoid.

Parameters
[in]latthe geographic latitude (degrees).
[in]hthe height above the ellipsoid (meters).
[out]gammaythe northerly component of the acceleration (m s−2).
[out]gammazthe upward component of the acceleration (m s−2); this is usually negative.
Returns
U the corresponding normal potential.

Due to the axial symmetry of the ellipsoid, the result is independent of the value of the longitude and the easterly component of the acceleration vanishes, gammax = 0. The function includes the effects of the earth's rotation. When h = 0, this function gives gammay = 0 and the returned value matches that of NormalGravity::SurfaceGravity.

◆ U()

double NETGeographicLib::NormalGravity::U ( double  X,
double  Y,
double  Z,
[System::Runtime::InteropServices::Out] double%  gammaX,
[System::Runtime::InteropServices::Out] double%  gammaY,
[System::Runtime::InteropServices::Out] double%  gammaZ 
)

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

Parameters
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
[out]gammaXthe X component of the acceleration (m s−2).
[out]gammaYthe Y component of the acceleration (m s−2).
[out]gammaZthe Z component of the acceleration (m s−2).
Returns
U = V0 + Φ the sum of the gravitational and centrifugal potentials (m2 s−2).

The acceleration given by γ = ∇U = ∇V0 + ∇Φ = Γ + f.

◆ V0()

double NETGeographicLib::NormalGravity::V0 ( double  X,
double  Y,
double  Z,
[System::Runtime::InteropServices::Out] double%  GammaX,
[System::Runtime::InteropServices::Out] double%  GammaY,
[System::Runtime::InteropServices::Out] double%  GammaZ 
)

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

Parameters
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[in]Zgeocentric coordinate of point (meters).
[out]GammaXthe X component of the acceleration due to gravity (m s−2).
[out]GammaYthe Y component of the acceleration due to gravity (m s−2).
[out]GammaZthe Z component of the acceleration due to gravity (m s−2).
Returns
V0 the gravitational potential (m2 s−2).

This function excludes the centrifugal acceleration and is appropriate to use for space applications. In terrestrial applications, the function NormalGravity::U (which includes this effect) should usually be used.

◆ Phi()

double NETGeographicLib::NormalGravity::Phi ( double  X,
double  Y,
[System::Runtime::InteropServices::Out] double%  fX,
[System::Runtime::InteropServices::Out] double%  fY 
)

Evaluate the centrifugal acceleration in geocentric coordinates.

Parameters
[in]Xgeocentric coordinate of point (meters).
[in]Ygeocentric coordinate of point (meters).
[out]fXthe X component of the centrifugal acceleration (m s−2).
[out]fYthe Y component of the centrifugal acceleration (m s−2).
Returns
Φ the centrifugal potential (m2 s−2).

Φ is independent of Z, thus fZ = 0. This function NormalGravity::U sums the results of NormalGravity::V0 and NormalGravity::Phi.

◆ DynamicalFormFactor()

double NETGeographicLib::NormalGravity::DynamicalFormFactor ( int  n)
Returns
Jn the dynamical form factors of the ellipsoid.

If n = 2 (the default), this is the value of J2 used in the constructor. Otherwise it is the zonal coefficient of the Legendre harmonic sum of the normal gravitational potential. Note that Jn = 0 if n is odd. In most gravity applications, fully normalized Legendre functions are used and the corresponding coefficient is Cn0 = −Jn / sqrt(2 n + 1).

◆ Earth()

Geocentric ^ NETGeographicLib::NormalGravity::Earth ( )
Returns
the Geocentric object used by this instance.

◆ WGS84()

static NormalGravity ^ NETGeographicLib::NormalGravity::WGS84 ( )
static

A global instantiation of NormalGravity for the WGS84 ellipsoid.

◆ GRS80()

static NormalGravity ^ NETGeographicLib::NormalGravity::GRS80 ( )
static

A global instantiation of NormalGravity for the GRS80 ellipsoid.

◆ J2ToFlattening()

static double NETGeographicLib::NormalGravity::J2ToFlattening ( double  a,
double  GM,
double  omega,
double  J2 
)
static

Compute the flattening from the dynamical form factor.

Parameters
[in]aequatorial radius (meters).
[in]GMmass constant of the ellipsoid (meters3/seconds2); this is the product of G the gravitational constant and M the mass of the earth (usually including the mass of the earth's atmosphere).
[in]omegathe angular velocity (rad s−1).
[in]J2the dynamical form factor.
Returns
f the flattening of the ellipsoid.

◆ FlatteningToJ2()

static double NETGeographicLib::NormalGravity::FlatteningToJ2 ( double  a,
double  GM,
double  omega,
double  f 
)
static

Compute the dynamical form factor from the flattening.

Parameters
[in]aequatorial radius (meters).
[in]GMmass constant of the ellipsoid (meters3/seconds2); this is the product of G the gravitational constant and M the mass of the earth (usually including the mass of the earth's atmosphere).
[in]omegathe angular velocity (rad s−1).
[in]fthe flattening of the ellipsoid.
Returns
J2 the dynamical form factor.

Property Documentation

◆ MajorRadius

double NETGeographicLib::NormalGravity::MajorRadius
get
Returns
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 261 of file NormalGravity.h.

◆ MassConstant

double NETGeographicLib::NormalGravity::MassConstant
get
Returns
GM the mass constant of the ellipsoid (m3 s−2). This is the value used in the constructor.

Definition at line 268 of file NormalGravity.h.

◆ AngularVelocity

double NETGeographicLib::NormalGravity::AngularVelocity
get
Returns
ω the angular velocity of the ellipsoid (rad s−1). This is the value used in the constructor.

Definition at line 287 of file NormalGravity.h.

◆ Flattening

double NETGeographicLib::NormalGravity::Flattening
get
Returns
f the flattening of the ellipsoid (ab)/a.

Definition at line 293 of file NormalGravity.h.

◆ EquatorialGravity

double NETGeographicLib::NormalGravity::EquatorialGravity
get
Returns
γe the normal gravity at equator (m s−2).

Definition at line 299 of file NormalGravity.h.

◆ PolarGravity

double NETGeographicLib::NormalGravity::PolarGravity
get
Returns
γp the normal gravity at poles (m s−2).

Definition at line 305 of file NormalGravity.h.

◆ GravityFlattening

double NETGeographicLib::NormalGravity::GravityFlattening
get
Returns
f* the gravity flattening (γp − γe) / γe.

Definition at line 311 of file NormalGravity.h.

◆ SurfacePotential

double NETGeographicLib::NormalGravity::SurfacePotential
get
Returns
U0 the constant normal potential for the surface of the ellipsoid (m2 s−2).

Definition at line 317 of file NormalGravity.h.


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