Gravity models for computing gravitational acceleration due to geopotential.
Each routine returns the acceleration in the body-fixed frame.
type(geopotential_model_mueller),target :: g
call g%initialize(gravfile,n,m,status_ok)
call g%get_acc(rvec,n,m,acc)
Note
Need to update to make sure they all work when N /= M
Interface to the acceleration function for the different methods
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(geopotential_model), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(3) | :: | r | ||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | m | |||
real(kind=wp), | intent(out), | dimension(3) | :: | a |
The base abstract class for the various geopotential models
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | name |
model name |
||
character(len=:), | public, | allocatable | :: | filename |
model file name |
||
integer, | public | :: | nmax | = | 0 |
degree of the model |
|
integer, | public | :: | mmax | = | 0 |
order of the model |
|
real(kind=wp), | public | :: | re | = | zero |
body radius [km] |
|
real(kind=wp), | public | :: | mu | = | zero |
body grav. parameter [km3/s2] |
procedure, public :: initialize => read_geopotential_file | |
procedure, public :: destroy => destroy_geopotential_model | |
procedure(acc_function), public, deferred :: get_acc |
The models where the C,S coefficients are stored in vectors
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | name |
model name |
||
character(len=:), | public, | allocatable | :: | filename |
model file name |
||
integer, | public | :: | nmax | = | 0 |
degree of the model |
|
integer, | public | :: | mmax | = | 0 |
order of the model |
|
real(kind=wp), | public | :: | re | = | zero |
body radius [km] |
|
real(kind=wp), | public | :: | mu | = | zero |
body grav. parameter [km3/s2] |
|
real(kind=wp), | public, | dimension(:), allocatable | :: | c | |||
real(kind=wp), | public, | dimension(:), allocatable | :: | s |
procedure, public :: initialize => read_geopotential_file | |
procedure, public :: destroy => destroy_geopotential_model | |
procedure(acc_function), public, deferred :: get_acc |
The models where the C,S coefficients are stored in matrices
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | name |
model name |
||
character(len=:), | public, | allocatable | :: | filename |
model file name |
||
integer, | public | :: | nmax | = | 0 |
degree of the model |
|
integer, | public | :: | mmax | = | 0 |
order of the model |
|
real(kind=wp), | public | :: | re | = | zero |
body radius [km] |
|
real(kind=wp), | public | :: | mu | = | zero |
body grav. parameter [km3/s2] |
|
real(kind=wp), | public, | dimension(:,:), allocatable | :: | cnm | |||
real(kind=wp), | public, | dimension(:,:), allocatable | :: | snm |
procedure, public :: initialize => read_geopotential_file | |
procedure, public :: destroy => destroy_geopotential_model | |
procedure(acc_function), public, deferred :: get_acc |
Mueller method
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | name |
model name |
||
character(len=:), | public, | allocatable | :: | filename |
model file name |
||
integer, | public | :: | nmax | = | 0 |
degree of the model |
|
integer, | public | :: | mmax | = | 0 |
order of the model |
|
real(kind=wp), | public | :: | re | = | zero |
body radius [km] |
|
real(kind=wp), | public | :: | mu | = | zero |
body grav. parameter [km3/s2] |
|
real(kind=wp), | public, | dimension(:), allocatable | :: | c | |||
real(kind=wp), | public, | dimension(:), allocatable | :: | s |
procedure, public :: initialize => read_geopotential_file | |
procedure, public :: destroy => destroy_geopotential_model | |
procedure, public :: get_acc => compute_gravity_acceleration_mueller |
Lear method
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | name |
model name |
||
character(len=:), | public, | allocatable | :: | filename |
model file name |
||
integer, | public | :: | nmax | = | 0 |
degree of the model |
|
integer, | public | :: | mmax | = | 0 |
order of the model |
|
real(kind=wp), | public | :: | re | = | zero |
body radius [km] |
|
real(kind=wp), | public | :: | mu | = | zero |
body grav. parameter [km3/s2] |
|
real(kind=wp), | public, | dimension(:,:), allocatable | :: | cnm | |||
real(kind=wp), | public, | dimension(:,:), allocatable | :: | snm |
procedure, public :: initialize => read_geopotential_file | |
procedure, public :: destroy => destroy_geopotential_model | |
procedure, public :: get_acc => compute_gravity_acceleration_lear |
Pines method
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | name |
model name |
||
character(len=:), | public, | allocatable | :: | filename |
model file name |
||
integer, | public | :: | nmax | = | 0 |
degree of the model |
|
integer, | public | :: | mmax | = | 0 |
order of the model |
|
real(kind=wp), | public | :: | re | = | zero |
body radius [km] |
|
real(kind=wp), | public | :: | mu | = | zero |
body grav. parameter [km3/s2] |
|
real(kind=wp), | public, | dimension(:,:), allocatable | :: | cnm | |||
real(kind=wp), | public, | dimension(:,:), allocatable | :: | snm |
procedure, public :: initialize => read_geopotential_file | |
procedure, public :: destroy => destroy_geopotential_model | |
procedure, public :: get_acc => compute_gravity_acceleration_pines |
Pines (normalized) method
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | name |
model name |
||
character(len=:), | public, | allocatable | :: | filename |
model file name |
||
integer, | public | :: | nmax | = | 0 |
degree of the model |
|
integer, | public | :: | mmax | = | 0 |
order of the model |
|
real(kind=wp), | public | :: | re | = | zero |
body radius [km] |
|
real(kind=wp), | public | :: | mu | = | zero |
body grav. parameter [km3/s2] |
|
real(kind=wp), | public, | dimension(:,:), allocatable | :: | cnm | |||
real(kind=wp), | public, | dimension(:,:), allocatable | :: | snm |
procedure, public :: initialize => read_geopotential_file | |
procedure, public :: destroy => destroy_geopotential_model | |
procedure, public :: get_acc => compute_gravity_acceleration_normalized_pines |
Kuga/Carrara method
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | name |
model name |
||
character(len=:), | public, | allocatable | :: | filename |
model file name |
||
integer, | public | :: | nmax | = | 0 |
degree of the model |
|
integer, | public | :: | mmax | = | 0 |
order of the model |
|
real(kind=wp), | public | :: | re | = | zero |
body radius [km] |
|
real(kind=wp), | public | :: | mu | = | zero |
body grav. parameter [km3/s2] |
|
real(kind=wp), | public, | dimension(:,:), allocatable | :: | cnm | |||
real(kind=wp), | public, | dimension(:,:), allocatable | :: | snm |
procedure, public :: initialize => read_geopotential_file | |
procedure, public :: destroy => destroy_geopotential_model | |
procedure, public :: get_acc => compute_gravity_acceleration_kuga_carrara |
Number of (c,s) coefficients for n x m geopotential model Starting with n=2,m=0.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n |
degree |
||
integer, | intent(in) | :: | m |
order |
number of coefficients
The FL factorial function from [1].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n |
Normalized Pines geopotential code.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | mu |
gravitational constant [km^3/s^2] |
||
real(kind=wp), | intent(in) | :: | req |
body equatorial radius [km] |
||
real(kind=wp), | intent(in), | dimension(3) | :: | r_f |
body-fixed Cartesian position vector [km] |
|
real(kind=wp), | intent(in), | dimension(:,0:) | :: | cnm |
c coefficients (Normalized) |
|
real(kind=wp), | intent(in), | dimension(:,0:) | :: | snm |
s coefficients (Normalized) |
|
integer, | intent(in) | :: | nmax |
desired degree |
||
integer, | intent(in) | :: | mmax |
desired order |
body-fixed Cartesian acceleration vector [km/s^2]
Destroy a gravity model.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(geopotential_model), | intent(inout) | :: | me |
Wrapper for Mueller method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(geopotential_model_mueller), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(3) | :: | r | ||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | m | |||
real(kind=wp), | intent(out), | dimension(3) | :: | a |
Wrapper for Pines method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(geopotential_model_pines), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(3) | :: | r | ||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | m | |||
real(kind=wp), | intent(out), | dimension(3) | :: | a |
Wrapper for Lear method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(geopotential_model_lear), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(3) | :: | r | ||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | m | |||
real(kind=wp), | intent(out), | dimension(3) | :: | a |
Wrapper for Kuga/Carrara method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(geopotential_model_kuga_carrara), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(3) | :: | r | ||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | m | |||
real(kind=wp), | intent(out), | dimension(3) | :: | a |
Wrapper for normalized Pines method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(geopotential_model_normalized_pines), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(3) | :: | r | ||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | m | |||
real(kind=wp), | intent(out), | dimension(3) | :: | a |
Read the gravity coefficient file. Example file: ftp://ftp.csr.utexas.edu/pub/grav/EGM96.GEO.Z
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(geopotential_model), | intent(inout) | :: | me | |||
character(len=*), | intent(in) | :: | filename | |||
integer, | intent(in) | :: | nmax | |||
integer, | intent(in) | :: | mmax | |||
logical, | intent(out) | :: | status_ok |
Returns the format statement from a line in a .GEO gravity coefficient file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str | |||
character(len=*), | intent(out) | :: | fmt |
Based on the CONVERT subroutine from [1]. Unnormalizes the C,S coefficients.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | nmodel | |||
real(kind=wp), | intent(inout), | dimension(nmodel,0:nmodel) | :: | cnm | ||
real(kind=wp), | intent(inout), | dimension(nmodel,0:nmodel) | :: | snm |
Spencer's implementation of the Pines algorithms from [1]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(3) | :: | r |
position vector |
|
integer, | intent(in) | :: | nmax |
degree/order |
||
real(kind=wp), | intent(in) | :: | re |
body radius |
||
real(kind=wp), | intent(in) | :: | mu |
grav constant |
||
real(kind=wp), | intent(in), | dimension(nmax,0:nmax) | :: | c |
C coefficients |
|
real(kind=wp), | intent(in), | dimension(nmax,0:nmax) | :: | s |
S coefficients |
|
real(kind=wp), | intent(out), | dimension(3) | :: | fg |
grav acceleration |
Compute the gravitational acceleration vector using the Mueller method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x |
position vector x-component |
||
real(kind=wp), | intent(in) | :: | y |
position vector y-component |
||
real(kind=wp), | intent(in) | :: | z |
position vector z-component |
||
integer, | intent(in) | :: | nmax |
degree of model |
||
integer, | intent(in) | :: | mmax |
order+1 of model |
||
real(kind=wp), | intent(in) | :: | re |
body radius |
||
real(kind=wp), | intent(in) | :: | ksq |
body GM |
||
real(kind=wp), | intent(in), | dimension(:) | :: | c |
C coefficients |
|
real(kind=wp), | intent(in), | dimension(:) | :: | s |
S coefficients |
|
real(kind=wp), | intent(out) | :: | fx |
gravitational acceleration x-component |
||
real(kind=wp), | intent(out) | :: | fy |
gravitational acceleration y-component |
||
real(kind=wp), | intent(out) | :: | fz |
gravitational acceleration z-component |
Based on the GRAV subroutine from [1].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | mu |
gravitational constant |
||
real(kind=wp), | intent(in), | dimension(3) | :: | rgr |
position vector [body-fixed coordinates] |
|
real(kind=wp), | intent(in) | :: | rbar |
gravitational scaling radius (generally the equatorial radius) |
||
integer, | intent(in) | :: | nmodel |
the degree of the gravity model (>=2) |
||
integer, | intent(in) | :: | mmodel |
the order of the gravity model (>=0, <=nmodel) |
||
real(kind=wp), | intent(in), | dimension(nmodel,0:nmodel) | :: | cnm |
C gravity coefficients |
|
real(kind=wp), | intent(in), | dimension(nmodel,0:nmodel) | :: | snm |
S gravity coefficients |
|
real(kind=wp), | intent(out), | dimension(3) | :: | agr |
gravitational acceleration vector [body-fixed coordinates] |
Compute geopotential acceleration using the Kuga/Carrara algorithm. Based on Leg_ForCol_Ac from [1].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | nmax |
max. order and degree loaded |
||
integer, | intent(in) | :: | nm |
desired order and degree (nm <= nmax) |
||
real(kind=wp), | intent(in) | :: | re |
body equatorial radius [km] |
||
real(kind=wp), | intent(in) | :: | gm |
gravitational constant [km3/s2] |
||
real(kind=wp), | intent(in), | dimension(nmax,0:nm) | :: | c |
c coefficients (Normalized) |
|
real(kind=wp), | intent(in), | dimension(nmax,0:nm) | :: | s |
s coefficients (Normalized) |
|
real(kind=wp), | intent(in), | dimension(3) | :: | x |
body-fixed cartesian position vector [km] |
|
real(kind=wp), | intent(out), | dimension(3) | :: | ac |
body-fixed cartesian acceleration vector [km/s2] |
Unit test routine for geopotential_module