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(6) :: x 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 t = me%data%t0 * day2sec ! initial time in seconds from epoch tf = me%data%tf * day2sec ! final time in seconds from epoch x = me%data%x0 ! inertial state !write(*,*) '' !write(*,*) 'propagate segment '//me%name, t0, tf !write(*,*) 't0:',t0 !write(*,'(A,*(F15.3,1X))') 'x0:',x !write(*,*) 'tf:',tf call me%first_call() !restarting the integration if (present(tstep)) then call me%integrate(t,x,tf,idid=idid,integration_mode=integration_mode,tstep=tstep) else call me%integrate(t,x,tf,idid=idid,integration_mode=integration_mode) end if if (idid<0) then write(*,'(A,*(I5/))') 'idid: ',idid error stop 'error in integrator' end if xf = x ! final state [inertial frame] ! also save the rotating frame state at tf (to compute the constraint violations): etf = me%data%et_ref + tf ! 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(x,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