Compute the incoming and/or outgoing v-infinity vectors, given the position and velocity of a hyperbola.
Note
This is for testing the other routines.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | mu |
central body gravitational parameter |
||
real(kind=wp), | intent(in), | dimension(6) | :: | rv |
position,velocity vector |
|
real(kind=wp), | intent(out), | optional, | dimension(3) | :: | vinfin |
incoming v-infinity vector |
real(kind=wp), | intent(out), | optional, | dimension(3) | :: | vinfout |
outgoing v-infinity vector |
subroutine compute_vinf_vectors(mu,rv,vinfin,vinfout) implicit none real(wp),intent(in) :: mu !! central body gravitational parameter real(wp),dimension(6),intent(in) :: rv !! position,velocity vector real(wp),dimension(3),intent(out),optional :: vinfin !! incoming v-infinity vector real(wp),dimension(3),intent(out),optional :: vinfout !! outgoing v-infinity vector real(wp),dimension(3) :: h,e,p,q,r,v real(wp) :: rmag,vmag,vinfmag,emag,qmag,cbeta,sbeta if (present(vinfin) .or. present(vinfout)) then r = rv(1:3) v = rv(4:6) rmag = norm2(r) vmag = norm2(v) h = cross(r,v) q = cross(v,h) vinfmag = sqrt(vmag*vmag-two*mu/rmag) e = q/mu-r/rmag emag = norm2(e) q = cross(h,e) qmag = norm2(q) cbeta = one/emag sbeta = sqrt(one-cbeta*cbeta) p = e/emag q = q/qmag if (present(vinfin)) vinfin = vinfmag*( cbeta*p+sbeta*q) if (present(vinfout)) vinfout = vinfmag*(-cbeta*p+sbeta*q) end if end subroutine compute_vinf_vectors