Propagate a segment with its state transition matrix, and compute the analytic
partials of its final rotating-frame state (for jacobian_mode=2):
dxf_dx0 : w.r.t. the initial rotating-frame state,dxf_dt0 : w.r.t. the
initial epoch (at fixed final epoch, and fixed rotating-frame initial state ),dxf_dtf : w.r.t. the final epoch,where is the inertial state transition matrix, the equations of motion, and , the inertial-to-rotating and rotating-to-inertial transformations (see two_body_rotating_frame_matrices). The epoch partial uses .
The final state (and its rotating-frame version) is also set, as by propagate_segment.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(segment), | intent(inout) | :: | me |
subroutine propagate_segment_stm(me) implicit none class(segment),intent(inout) :: me integer :: idid real(wp) :: t, t0, tf, et0, etf real(wp),dimension(n_eoms_stm) :: x real(wp),dimension(6) :: xf, xf_rotating, f0, ff real(wp),dimension(6,6) :: phi, m_f, mdot_f, n_0, ndot_0 type(icrf_frame) :: inertial type(two_body_rotating_frame) :: rotating logical :: status_ok if (.not. me%stm_mode) error stop 'error: propagate_segment_stm requires stm_mode' t0 = me%data%t0 * day2sec ! initial time in seconds from epoch tf = me%data%tf * day2sec ! final time in seconds from epoch x(1:n_eoms) = me%data%x0 ! inertial state x(n_eoms+1:) = identity_stm() ! integrate in local time (from 0 at t0), see t_offset: me%t_offset = t0 t = zero me%compute_stm = .true. call me%first_call() call me%integrate(t,x,(me%data%tf - me%data%t0) * day2sec,idid=idid,integration_mode=1) me%compute_stm = .false. me%t_offset = zero ! (the calls below use the time from epoch) me%failed = .false. if (idid<0) then if (me%soft_fail) then me%failed = .true. me%dxf_dx0 = zero; me%dxf_dt0 = zero; me%dxf_dtf = zero return end if write(*,'(A,*(I5/))') 'idid: ',idid error stop 'error in integrator' end if xf = x(1:n_eoms) phi = reshape(x(n_eoms+1:), [6,6]) ! the final state in the rotating frame (as in propagate_segment): etf = me%data%et_ref + tf inertial = icrf_frame(b=body_moon) rotating = two_body_rotating_frame(primary_body=body_earth,& secondary_body=body_moon,& center=center_at_secondary_body,& et=etf) call inertial%transform(xf,rotating,etf,me%eph,xf_rotating,status_ok) if (.not. status_ok) error stop 'transformation error in propagate_segment_stm' call me%set_outputs(xf,xf_rotating) ! the frame transformations and their time derivatives: et0 = me%data%et_ref + t0 call earth_moon_frame_matrices(me, et0, n=n_0, ndot=ndot_0) call earth_moon_frame_matrices(me, etf, m=m_f, mdot=mdot_f) ! equations of motion at the start and the end: call ballistic_derivs(me, t0, me%data%x0, f0) call ballistic_derivs(me, tf, xf, ff) me%dxf_dx0 = matmul(m_f, matmul(phi, n_0)) me%dxf_dt0 = matmul(m_f, matmul(phi, matmul(ndot_0, me%data%x0_rotating) - f0)) me%dxf_dtf = matmul(mdot_f, xf) + matmul(m_f, ff) end subroutine propagate_segment_stm