! WGS-84 Constants.
!
! This module contains the defining and derived constants for the
! World Geodetic System-1984 reference ellipsoid.
!
! Reference: NIMA TR8350-2 3rd Edition.
!
! Josep M. Aparicio
! Meteorological Service of Canada, 2003
!

module modgps02wgs84const 1,1
  use modgps00base, only:dp
  implicit none

  !  ***********************************************************
  !  Defining constants:
  !  ***********************************************************
  
  ! Semimajor axis (a) (m)                             [*Defining constant*]
  real(dp), parameter :: WGS_a          = 6378137.0_dp
  
  ! Flattening (f)                                     [*Defining constant*]
  real(dp), parameter :: WGS_f          = 1._dp / 298.257223563_dp
  
  ! Earth's Gravitational Constant (GM) (m3/s2).       [*Defining constant*]
  ! This is the GM value with Earth's atmosphere included.
  real(dp), parameter :: WGS_GM         = 3986004.418e8_dp
  
  ! Angular velocity of the Earth (omega) (radians/s). [*Defining constant*]
  ! Standard Earth, rotating with a constant angular velocity.
  real(dp), parameter :: WGS_Omega      = 7292115.e-11_dp
  
  
  !  ***********************************************************
  !  Parameter values for special applications:
  !  ***********************************************************
  
  ! Earth's Gravitational Constant (GM_KEP) (m3/s2).
  !
  ! This is the old GM value with Earth's atmosphere included,
  ! but still used for consistency in the transformations
  ! instantaneous keplerian <-> cartesian state vector.
  real(dp), parameter :: WGS_GM_KEP     = 3986005.0e8_dp
  
  ! Earth's Atmosphere Gravitational Constant (GMA) (m3/s2).
  ! This is the GM value of the Earth's atmosphere alone.
  real(dp), parameter :: WGS_GMA        = 3.5e8_dp
  
  ! Earth's Gravitational Constant (GMPrime) (m3/s2).
  ! This is the GM value with Earth's atmosphere excluded.
  real(dp), parameter :: WGS_GMPrime    = 3986000.9e8_dp
  
  ! Angular velocity of the Earth (omegaPrime) (radians/s).
  ! Standard Earth, rotating with a constant angular velocity (IAU, GRS67).
  real(dp), parameter :: WGS_OmegaPrime = 7292115.1467e-11_dp
  
  ! Angular velocity of the Earth (omegaStar) (radians/s).
  ! Standard Earth, in a precessing frame (TU: Julian centuries since J2000.0)
  ! OmegaStar = OmegaStar0 + OmegaStar1 * TU
  real(dp), parameter :: WGS_OmegaStar0 = 7292115.8553e-11_dp
  real(dp), parameter :: WGS_OmegaStar1 = 4.3e-15_dp
  
  
  !  ***********************************************************
  !  Derived geometric constants:
  !  ***********************************************************
  
  ! Inverse flattening: 1/f = WGS_1f
  real(dp), parameter :: WGS_1f         = 298.257223563_dp
  
  ! Second degree zonal coefficient:
  real(dp), parameter :: WGS_C20        = -0.484166774985e-3_dp
  
  ! Semiminor axis:
  real(dp), parameter :: WGS_b          = 6356752.3142_dp
  
  ! First eccentricity:
  real(dp), parameter :: WGS_e          = 8.1819190842622e-2_dp
  
  ! First eccentricity squared:
  real(dp), parameter :: WGS_e2         = 6.69437999014e-3_dp
  
  ! Second eccentricity:
  real(dp), parameter :: WGS_ePrime     = 8.2094437949696e-2_dp
  
  ! Second eccentricity squared:
  real(dp), parameter :: WGS_ePrime2    = 6.73949674228e-3_dp
  
  ! Linear eccentricity:
  real(dp), parameter :: WGS_ELinear    = 5.2185400842339e5_dp
  
  ! Polar radius of curvature:
  real(dp), parameter :: WGS_c          = 6399593.6258_dp
  
  ! Focal length:
  real(dp), parameter :: WGS_EFocal     = 521854.00897_dp
  
  ! Axis ratio:
  real(dp), parameter :: WGS_ba         = 0.996647189335_dp
  
  ! Mean radius of semiaxes:
  real(dp), parameter :: WGS_R1         = 6371008.7714_dp
  
  ! Radius of sphere of equal area:
  real(dp), parameter :: WGS_R2         = 6371007.1809_dp
  
  ! Radius of sphere of equal volume:
  real(dp), parameter :: WGS_R3         = 6371000.7900_dp
  
  
  !  ***********************************************************
  !  Derived physical constants:
  !  ***********************************************************
  
  ! Theoretical (Normal) Gravity potential of the ellipsoid (m2/s2):
  real(dp), parameter :: WGS_U0         = 62636860.8497_dp
  
  ! Theoretical (Normal) Gravity at the equator (m/s2):
  real(dp), parameter :: WGS_GammaE     = 9.7803253359_dp
  
  ! Theoretical (Normal) Gravity at the pole (m/s2):
  real(dp), parameter :: WGS_GammaP     = 9.8321849378_dp
  
  ! Mean Value of the Theoretical (Normal) Gravity (m/s2):
  real(dp), parameter :: WGS_GammaM     = 9.7976432222_dp
  
  ! Theoretical (Normal) Gravity Formula Constant:
  real(dp), parameter :: WGS_TNGk       = 0.00193185265241_dp
  
  ! Mass of the Earth (Atmosphere Included):
  real(dp), parameter :: WGS_Mass       = 5.9733328e24_dp
  
  ! m = omega^2 a^2 b / GM
  real(dp), parameter :: WGS_m          = 0.00344978650684_dp
  
  ! Dynamical Ellipticity H:
  real(dp), parameter :: WGS_H          = 1._dp / 305.4413_dp
  
  ! Universal Constant of Gravitation (value used in WGS) (m3/kg*s2):
  real(dp), parameter :: WGS_G          = 6.673e-11_dp
  
  ! Earth's principal moments of inertia (A, B, C) (kg m2):
  real(dp), parameter :: WGS_PMI_A      = 8.0091029e37_dp
  real(dp), parameter :: WGS_PMI_B      = 8.0092559e37_dp
  real(dp), parameter :: WGS_PMI_C      = 8.0354872e37_dp
  
end module modgps02wgs84const