Third-body (pointmass) gravitational acceleration.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(3) | :: | r |
satellite position vector [km] |
|
real(kind=wp), | intent(in), | dimension(3) | :: | rb |
third-body position vector [km] |
|
real(kind=wp), | intent(in) | :: | mu |
third-body gravitational parameter [km^3/s^2] |
||
real(kind=wp), | intent(out), | dimension(3) | :: | acc |
gravity acceleration vector [km/s^2] |
subroutine third_body_gravity(r,rb,mu,acc) implicit none real(wp),dimension(3),intent(in) :: r !! satellite position vector [km] real(wp),dimension(3),intent(in) :: rb !! third-body position vector [km] real(wp),intent(in) :: mu !! third-body gravitational parameter [km^3/s^2] real(wp),dimension(3),intent(out) :: acc !! gravity acceleration vector [km/s^2] real(wp),dimension(3) :: r_sc_b !! vector from third-body to spacecraft [km] real(wp) :: rb_mag !! distance between origin and third-body [km] real(wp) :: r_sc_b_mag !! distance between spacecraft and third-body [km] r_sc_b = rb - r r_sc_b_mag = norm2(r_sc_b) rb_mag = norm2(rb) acc = (mu/r_sc_b_mag**3)*r_sc_b - (mu/rb_mag**3)*rb end subroutine third_body_gravity