Skip to content

Commit 8a7178e

Browse files
committed
handle reset status in integrator even if intermediate outputs are not selected
1 parent bf48b7d commit 8a7178e

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

src/neptune.f90

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -971,25 +971,23 @@ subroutine propagate_set( &
971971
return
972972
end if
973973

974-
if(neptune%output%get_output_switch() .or. neptune%getStoreDataFlag()) then ! this has only to be done in a mode, where output is requested...
975-
if((.not. flag_backward .and. (lastPropCounterSuccess < lastPropCounter)) .or. &
976-
( flag_backward .and. (lastPropCounterSuccess > lastPropCounter))) then
977-
! This is the usual case when the intergator cannot go on and needs a valid state to restart from.
978-
state_out = last_state_out
979-
prop_counter = lastPropCounter
980-
else if ((.not. flag_backward .and. (prop_counter > request_time)) .or. &
981-
( flag_backward .and. (prop_counter < request_time))) then
982-
! This case may happen when the integrator oversteps the requested time
983-
! and usually would start interpolation. Though, due to integration issues
984-
! he never gets to the point of interpolation but sets the prop_counter anyway.
985-
! This leads to an invalid state, which is also written to output at a time,
986-
! which was not even requested.
987-
state_out = last_state_out
988-
prop_counter = lastPropCounter
989-
end if
990-
call message(' Resetting to: '//toString(epochs(1)%mjd + prop_counter/86400.d0)//'('//toString(prop_counter), LOGFILE)
991-
call message(' ... restoring state vector: '//toString(state_out%r(1))//', '//toString(state_out%r(2))//', '//toString(state_out%r(3))//', '//toString(state_out%v(1))//', '//toString(state_out%v(2))//', '//toString(state_out%v(3)), LOGFILE)
974+
if((.not. flag_backward .and. (lastPropCounterSuccess < lastPropCounter)) .or. &
975+
( flag_backward .and. (lastPropCounterSuccess > lastPropCounter))) then
976+
! This is the usual case when the intergator cannot go on and needs a valid state to restart from.
977+
state_out = last_state_out
978+
prop_counter = lastPropCounter
979+
else if ((.not. flag_backward .and. (prop_counter > request_time)) .or. &
980+
( flag_backward .and. (prop_counter < request_time))) then
981+
! This case may happen when the integrator oversteps the requested time
982+
! and usually would start interpolation. Though, due to integration issues
983+
! he never gets to the point of interpolation but sets the prop_counter anyway.
984+
! This leads to an invalid state, which is also written to output at a time,
985+
! which was not even requested.
986+
state_out = last_state_out
987+
prop_counter = lastPropCounter
992988
end if
989+
call message(' Resetting to: '//toString(epochs(1)%mjd + prop_counter/86400.d0)//'('//toString(prop_counter), LOGFILE)
990+
call message(' ... restoring state vector: '//toString(state_out%r(1))//', '//toString(state_out%r(2))//', '//toString(state_out%r(3))//', '//toString(state_out%v(1))//', '//toString(state_out%v(2))//', '//toString(state_out%v(3)), LOGFILE)
993991
else if((.not. flag_backward .and. (prop_counter > propCounterAtReset)) .or. &
994992
( flag_backward .and. (prop_counter < propCounterAtReset))) then ! reset 'nresets' flag
995993
nresets = 0

0 commit comments

Comments
 (0)