unnormalize_variables Subroutine

public subroutine unnormalize_variables(mu1, mu2, d12, x_crtbp, m_crtbp, t_crtbp, x, m, t)

Convert normalized CRTBP state to km, km/s units.

Notes:

See also: http://www.spaceatdia.org/uploads/mariano/ss1/2012SSLecture3.pdf

m1 = one - mu ! mass of body 1 m2 = mu ! mass of body 2

x1 = -mu ! location of body 1 x2 = one - mu ! location of body 2

normalized mass : 1 MU -> (m1 + m2) kg normalized position : 1 DU -> d12 km normalized time : 1 TU -> 1/n sec (2pi TU -> 1 rev -> 2pi/n)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: mu1

grav. param. of body 1

real(kind=wp), intent(in) :: mu2

grav. param. of body 2

real(kind=wp), intent(in) :: d12

distance between body 1 and body 2 [km]

real(kind=wp), intent(in), optional, dimension(6) :: x_crtbp

CRTBP normalized state

real(kind=wp), intent(in), optional :: m_crtbp

CRTBP normalized mass

real(kind=wp), intent(in), optional :: t_crtbp

CRTBP normalized time

real(kind=wp), intent(out), optional, dimension(6) :: x

unnormalized state w.r.t. barycenter [km,km/s]

real(kind=wp), intent(out), optional :: m

unnormalized mass [kg]

real(kind=wp), intent(out), optional :: t

unnormalized time [sec]


Source Code

    subroutine unnormalize_variables(mu1,mu2,d12,x_crtbp,m_crtbp,t_crtbp,x,m,t)

    implicit none

    real(wp),intent(in)                        :: mu1      !! grav. param. of body 1 \( [\mathrm{km}^3/\mathrm{s}^2] \)
    real(wp),intent(in)                        :: mu2      !! grav. param. of body 2 \( [\mathrm{km}^3/\mathrm{s}^2] \)
    real(wp),intent(in)                        :: d12      !! distance between body 1 and body 2 [km]
    real(wp),dimension(6),intent(in),optional  :: x_crtbp  !! CRTBP normalized state
    real(wp),intent(in),optional               :: m_crtbp  !! CRTBP normalized mass
    real(wp),intent(in),optional               :: t_crtbp  !! CRTBP normalized time
    real(wp),dimension(6),intent(out),optional :: x        !! unnormalized state w.r.t. barycenter [km,km/s]
    real(wp),intent(out),optional              :: m        !! unnormalized mass [kg]
    real(wp),intent(out),optional              :: t        !! unnormalized time [sec]

    real(wp) :: tp,n,tu,du,mu

    n = sqrt((mu1+mu2)/d12**3)  !mean motion (rad/sec)
    tu = one/n  !time unit
    du = d12    !distance unit

    if (present(x) .and. present(x_crtbp)) then
        x(1:3) = x_crtbp(1:3) * du       !unscale distance
        x(4:6) = x_crtbp(4:6) * (du/tu)  !unscale velocity
    end if

    if (present(m) .and. present(m_crtbp)) then
        mu = (mu1 + mu2)/universal_grav_constant    !mass unit
        m = m_crtbp * mu  !unscale mass
    end if

    if (present(t) .and. present(t_crtbp)) t = t_crtbp * tu  !unscale time

    end subroutine unnormalize_variables