Propagate a segment (assumes the inputs have already been populated)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(segment), | intent(inout) | :: | me | |||
| integer, | intent(in), | optional | :: | mode |
1 - don't report steps, 2 - report steps (for plotting) |
|
| real(kind=wp), | intent(in), | optional | :: | tstep |
fixed time step for mode=2 |
subroutine propagate_segment(me,mode,tstep) implicit none class(segment),intent(inout) :: me integer,intent(in),optional :: mode !! 1 - don't report steps, 2 - report steps (for plotting) real(wp),intent(in),optional :: tstep !! fixed time step for mode=2 integer :: idid real(wp) :: t real(wp) :: tf real(wp),dimension(n_eoms_stm) :: x !! the integration state (only the first `n_eoms` are used !! unless `stm_mode`, see [[propagate_segment_stm]]) integer :: neq !! number of integrated variables type(icrf_frame) :: inertial type(two_body_rotating_frame) :: rotating real(wp) :: etf real(wp),dimension(6) :: xf !! inertial - from the propagation real(wp),dimension(6) :: xf_rotating logical :: status_ok integer :: integration_mode if (present(mode)) then integration_mode = mode else integration_mode = 1 end if ! integrate in local time (from 0 at t0), see t_offset: me%t_offset = me%data%t0 * day2sec t = zero tf = (me%data%tf - me%data%t0) * day2sec neq = merge(n_eoms_stm, n_eoms, me%stm_mode) x = zero x(1:n_eoms) = me%data%x0 ! inertial state if (me%stm_mode) x(n_eoms+1:neq) = identity_stm() ! (not integrated here: its derivatives are zero) !write(*,*) '' !write(*,*) 'propagate segment '//me%name, t0, tf !write(*,*) 't0:',t0 !write(*,'(A,*(F15.3,1X))') 'x0:',x !write(*,*) 'tf:',tf ! with `always_stm`, the STM is integrated here too, so that this propagation takes ! exactly the steps of [[propagate_segment_stm]] (the STM changes the integrator's ! steps, through its error norm and its initial step), and its final state is ! the one the solver converged with `func_with_stm`: me%compute_stm = me%always_stm call me%first_call() !restarting the integration if (present(tstep)) then call me%integrate(t,x(1:neq),tf,idid=idid,integration_mode=integration_mode,tstep=tstep) else call me%integrate(t,x(1:neq),tf,idid=idid,integration_mode=integration_mode) end if me%compute_stm = .false. me%t_offset = zero me%failed = .false. if (idid<0) then if (me%soft_fail) then me%failed = .true. return end if write(*,'(A,*(I5/))') 'idid: ',idid error stop 'error in integrator' end if xf = x(1:n_eoms) ! final state [inertial frame] ! also save the rotating frame state at tf (to compute the constraint violations): etf = me%data%et_ref + me%data%tf * day2sec ! convert to ephemeris time [sec] 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) ! from inertial to rotating: call inertial%transform(xf,rotating,etf,me%eph,xf_rotating,status_ok) if (.not. status_ok) error stop 'transformation error in propagate_segment' ! put final states in the segment: call me%set_outputs(xf,xf_rotating) end subroutine propagate_segment