returns the state of the frame center w.r.t. the frame primary body.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(two_body_rotating_frame), | intent(in) | :: | me | |||
class(ephemeris_class), | intent(inout) | :: | eph |
for ephemeris computations (assumed to have already been initialized) |
||
real(kind=wp), | intent(in) | :: | et |
ephemeris time [sec] |
||
real(kind=wp), | intent(out), | dimension(6) | :: | rc |
state of frame center w.r.t. primary body [inertial] |
|
logical, | intent(out) | :: | status_ok |
true if no errors. |
subroutine from_primary_to_center(me,eph,et,rc,status_ok) !! returns the state of the frame center w.r.t. the frame primary body. implicit none class(two_body_rotating_frame),intent(in) :: me class(ephemeris_class),intent(inout) :: eph !! for ephemeris computations (assumed to have already been initialized) real(wp),intent(in) :: et !! ephemeris time [sec] real(wp),dimension(6),intent(out) :: rc !! state of frame center w.r.t. primary body [inertial] logical,intent(out) :: status_ok !! true if no errors. real(wp) :: mu1 !! gravitational parameter of primary body real(wp) :: mu2 !! gravitational parameter of secondary body if (me%center == center_at_primary_body) then rc = zero else ! primary body -> secondary body state [inertial]: call eph%get_rv(et,me%secondary_body,me%primary_body,rc,status_ok) if (status_ok) then if (me%center == center_at_barycenter) then mu1 = me%primary_body%mu mu2 = me%secondary_body%mu rc = rc * ( mu2/(mu1 + mu2) ) elseif (me%center == center_at_secondary_body) then !frame center is secondary body (rc already computed) else error stop 'invalid rotating frame center selection.' end if else write(error_unit,'(A)') 'Error in from_primary_to_center: '//& 'Could not compute primary to secondary body state.' end if end if end subroutine from_primary_to_center