from_ijk_to_vuw_mat Subroutine

private subroutine from_ijk_to_vuw_mat(mu, r, v, a, c, cdot)

Uses

  • proc~~from_ijk_to_vuw_mat~~UsesGraph proc~from_ijk_to_vuw_mat from_ijk_to_vuw_mat module~vector_module vector_module proc~from_ijk_to_vuw_mat->module~vector_module module~kind_module kind_module module~vector_module->module~kind_module module~numbers_module numbers_module module~vector_module->module~numbers_module iso_fortran_env iso_fortran_env module~kind_module->iso_fortran_env module~numbers_module->module~kind_module

Compute the transformation matrices to convert IJK to vuw.

Arguments

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

gravitational parameter [km^3/s^2] this is used here to assume instantaneous conic motion if a is not present.

real(kind=wp), intent(in), dimension(3) :: r

position vector of target [km]

real(kind=wp), intent(in), dimension(3) :: v

velocity vector of target [km/s]

real(kind=wp), intent(in), optional, dimension(3) :: a

acceleration vector of target [km/s^2] (if not present, then a torque-free force model is assumed)

real(kind=wp), intent(out), dimension(3,3) :: c

C transformation matrix

real(kind=wp), intent(out), optional, dimension(3,3) :: cdot

CDOT transformation matrix


Calls

proc~~from_ijk_to_vuw_mat~~CallsGraph proc~from_ijk_to_vuw_mat from_ijk_to_vuw_mat proc~cross cross proc~from_ijk_to_vuw_mat->proc~cross proc~uhat_dot uhat_dot proc~from_ijk_to_vuw_mat->proc~uhat_dot proc~unit unit proc~from_ijk_to_vuw_mat->proc~unit

Called by

proc~~from_ijk_to_vuw_mat~~CalledByGraph proc~from_ijk_to_vuw_mat from_ijk_to_vuw_mat interface~from_ijk_to_vuw from_ijk_to_vuw interface~from_ijk_to_vuw->proc~from_ijk_to_vuw_mat proc~from_vuw_to_ijk_mat from_vuw_to_ijk_mat proc~from_vuw_to_ijk_mat->interface~from_ijk_to_vuw interface~from_vuw_to_ijk from_vuw_to_ijk interface~from_vuw_to_ijk->proc~from_vuw_to_ijk_mat

Source Code

    subroutine from_ijk_to_vuw_mat(mu,r,v,a,c,cdot)

    use vector_module, only: unit, cross, uhat_dot

    implicit none

    real(wp),intent(in)                          :: mu     !! gravitational parameter [km^3/s^2]
                                                           !! this is used here to assume instantaneous conic motion if `a` is not present.
    real(wp),dimension(3),intent(in)             :: r      !! position vector of target [km]
    real(wp),dimension(3),intent(in)             :: v      !! velocity vector of target [km/s]
    real(wp),dimension(3),intent(in),optional    :: a      !! acceleration vector of target [km/s^2]
                                                           !! (if not present, then a torque-free force model is assumed)
    real(wp),dimension(3,3),intent(out)          :: c      !! C transformation matrix
    real(wp),dimension(3,3),intent(out),optional :: cdot   !! CDOT transformation matrix

    real(wp),dimension(3) :: ex_hat,ex_hat_dot
    real(wp),dimension(3) :: ey_hat,ey_hat_dot
    real(wp),dimension(3) :: ez_hat,ez_hat_dot
    real(wp),dimension(3) :: h,h_hat,h_dot,v_hat,a_conic
    real(wp) :: rmag !! position vector magniude

    h      = cross(r,v)
    h_hat  = unit(h)
    v_hat  = unit(v)

    ex_hat = v_hat
    ez_hat = h_hat
    ey_hat = cross(ez_hat,ex_hat)

    c(1,:) = ex_hat
    c(2,:) = ey_hat
    c(3,:) = ez_hat

    if (present(cdot)) then

        if (present(a)) then
            ex_hat_dot = uhat_dot(v,a)
            h_dot = cross(r,a)
        else
            rmag = norm2(r)
            ! is this as simple as we can make this?
            ! here we assume instantaneous conic motion
            a_conic = -mu/rmag**3 * r  ! accceleration for conic motion
            ex_hat_dot = uhat_dot(v,a_conic)
            h_dot = zero
        end if
        ez_hat_dot = uhat_dot(h,h_dot)
        ey_hat_dot = cross(ez_hat_dot,ex_hat) + cross(ez_hat,ex_hat_dot)

        cdot(1,:) = ex_hat_dot
        cdot(2,:) = ey_hat_dot
        cdot(3,:) = ez_hat_dot

    end if

    end subroutine from_ijk_to_vuw_mat