from_ijk_to_rsw_mat Subroutine

private subroutine from_ijk_to_rsw_mat(r, v, a, c, cdot)

Uses

  • proc~~from_ijk_to_rsw_mat~~UsesGraph proc~from_ijk_to_rsw_mat relative_motion_module::from_ijk_to_rsw_mat module~vector_module vector_module proc~from_ijk_to_rsw_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 RSW.

Arguments

Type IntentOptional Attributes Name
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_rsw_mat~~CallsGraph proc~from_ijk_to_rsw_mat relative_motion_module::from_ijk_to_rsw_mat proc~cross vector_module::cross proc~from_ijk_to_rsw_mat->proc~cross proc~uhat_dot vector_module::uhat_dot proc~from_ijk_to_rsw_mat->proc~uhat_dot proc~unit vector_module::unit proc~from_ijk_to_rsw_mat->proc~unit

Called by

proc~~from_ijk_to_rsw_mat~~CalledByGraph proc~from_ijk_to_rsw_mat relative_motion_module::from_ijk_to_rsw_mat interface~from_ijk_to_rsw relative_motion_module::from_ijk_to_rsw interface~from_ijk_to_rsw->proc~from_ijk_to_rsw_mat proc~from_ijk_to_rsw_rv relative_motion_module::from_ijk_to_rsw_rv interface~from_ijk_to_rsw->proc~from_ijk_to_rsw_rv proc~from_ijk_to_rsw_rv->interface~from_ijk_to_rsw proc~from_rsw_to_ijk_mat relative_motion_module::from_rsw_to_ijk_mat proc~from_rsw_to_ijk_mat->interface~from_ijk_to_rsw proc~relative_motion_test relative_motion_module::relative_motion_test proc~relative_motion_test->interface~from_ijk_to_rsw interface~from_rsw_to_ijk relative_motion_module::from_rsw_to_ijk interface~from_rsw_to_ijk->proc~from_rsw_to_ijk_mat proc~from_rsw_to_ijk_rv relative_motion_module::from_rsw_to_ijk_rv interface~from_rsw_to_ijk->proc~from_rsw_to_ijk_rv proc~from_rsw_to_ijk_rv->interface~from_rsw_to_ijk

Source Code

    subroutine from_ijk_to_rsw_mat(r,v,a,c,cdot)

    use vector_module, only: unit, cross, uhat_dot

    implicit none

    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

    h      = cross(r,v)
    h_hat  = unit(h)
    ex_hat = unit(r)
    ez_hat = h_hat
    ey_hat = cross(ez_hat,ex_hat)

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

    !... need to verify the following ...

    if (present(cdot)) then

        ex_hat_dot = uhat_dot(r,v)

        if (present(a)) then
            h_dot      = cross(r,a)
            ez_hat_dot = uhat_dot(h, h_dot)
            ey_hat_dot = cross(ez_hat_dot,ex_hat) + cross(ez_hat,ex_hat_dot)
        else !assume no external torque
            ez_hat_dot = zero
            ey_hat_dot = cross(ez_hat,ex_hat_dot)
        end if

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

    end if

    end subroutine from_ijk_to_rsw_mat