compute the rmag and rdot vectors, given the state vectors
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in), | dimension(:) | :: | x |
x-position component |
|
| real(kind=wp), | intent(in), | dimension(:) | :: | y |
y-position component |
|
| real(kind=wp), | intent(in), | dimension(:) | :: | z |
z-position component |
|
| real(kind=wp), | intent(in), | dimension(:) | :: | vx |
x-velocity component |
|
| real(kind=wp), | intent(in), | dimension(:) | :: | vy |
y-velocity component |
|
| real(kind=wp), | intent(in), | dimension(:) | :: | vz |
z-velocity component |
|
| real(kind=wp), | intent(out), | dimension(:), allocatable | :: | rmag |
magnitude of position vector [km] |
|
| real(kind=wp), | intent(out), | dimension(:), allocatable | :: | rdot |
derivative of radius magniutde [km/s] |
subroutine compute_rdot_vecs(x,y,z,vx,vy,vz,rmag,rdot) real(wp),dimension(:),intent(in) :: x !! x-position component real(wp),dimension(:),intent(in) :: y !! y-position component real(wp),dimension(:),intent(in) :: z !! z-position component real(wp),dimension(:),intent(in) :: vx !! x-velocity component real(wp),dimension(:),intent(in) :: vy !! y-velocity component real(wp),dimension(:),intent(in) :: vz !! z-velocity component real(wp),dimension(:),intent(out),allocatable :: rmag !! magnitude of position vector [km] real(wp),dimension(:),intent(out),allocatable :: rdot !! derivative of radius magniutde [km/s] integer :: i !! counter real(wp),dimension(3) :: r, v allocate(rdot(size(x)),rmag(size(x))) do i = 1, size(x) r = [x(i), y(i), z(i)] v = [vx(i), vy(i), vz(i)] rmag(i) = norm2(r) rdot(i) = dot_product(r,v) / rmag(i) end do end subroutine compute_rdot_vecs