Time Step Models
Single Time Step
State Update
A time-step model updates state by applying a rate over a fixed interval.
Program
Play the program to change the interval and watch the position update.
single_time_step.f90
Replay: real traced execution (multi-file project)
program single_time_step_demo
implicit none
real :: position
real :: velocity
real :: dt
position = 0.0
velocity = 4.0
dt = 1.0
position = position + velocity * dt
print '(F0.1)', position
end program single_time_step_demo
program single_time_step_demo
implicit none
real :: position
real :: velocity
real :: dt
position = 0.0
velocity = 4.0
dt = 0.5
position = position + velocity * dt
print '(F0.1)', position
end program single_time_step_demo
program single_time_step_demo
implicit none
real :: position
real :: velocity
real :: dt
position = 0.0
velocity = 4.0
dt = 2.0
position = position + velocity * dt
print '(F0.1)', position
end program single_time_step_demo
position ← 0.0
7position = 0.08velocity = 4.0values this step0.0positionvelocity ← 4.0
7position = 0.08velocity = 4.09dt = 1.0values this step4.0velocitydt ← 1.0
8velocity = 4.09dt = 1.010position = position + velocity * dtvalues this step1.0dtposition ← 4.0
9dt = 1.010position = position + velocity * dt11print '(F0.1)', positionvalues this step0.0 → 4.0position4.0velocity * dtprint '(F0.1)', position
10 position = position + velocity * dt11 print '(F0.1)', position12end program single_time_step_demooutput4.0values this step4.0position
position ← 0.0
7position = 0.08velocity = 4.0values this step0.0positionvelocity ← 4.0
7position = 0.08velocity = 4.09dt = 0.5values this step4.0velocitydt ← 0.5
8velocity = 4.09dt = 0.510position = position + velocity * dtvalues this step0.5dtposition ← 2.0
9dt = 0.510position = position + velocity * dt11print '(F0.1)', positionvalues this step0.0 → 2.0position2.0velocity * dtprint '(F0.1)', position
10 position = position + velocity * dt11 print '(F0.1)', position12end program single_time_step_demooutput2.0values this step2.0position
position ← 0.0
7position = 0.08velocity = 4.0values this step0.0positionvelocity ← 4.0
7position = 0.08velocity = 4.09dt = 2.0values this step4.0velocitydt ← 2.0
8velocity = 4.09dt = 2.010position = position + velocity * dtvalues this step2.0dtposition ← 8.0
9dt = 2.010position = position + velocity * dt11print '(F0.1)', positionvalues this step0.0 → 8.0position8.0velocity * dtprint '(F0.1)', position
10 position = position + velocity * dt11 print '(F0.1)', position12end program single_time_step_demooutput8.0values this step8.0position
time step
`dt` is the modeled amount of time advanced by one update.
rate update
`velocity * dt` converts a rate into a position change.
state variable
`position` is updated in place to hold the new state.