Time Step Models
Fixed Step Loop
Repeated Updates
A fixed-step loop applies the same update rule for a known number of steps.
Program
Play the program to choose how many repeated updates advance the value.
fixed_step_loop.f90
program fixed_step_loop_demo
implicit none
integer :: step
integer :: step_count
real :: dt
real :: rate
real :: value
step_count =
dt = 0.5
rate = 2.0
value = 10.0
do step = 1, step_count
value = value + rate * dt
end do
print '(I0, 1X, F0.1)', step_count, value
end program fixed_step_loop_demo
program fixed_step_loop_demo
implicit none
integer :: step
integer :: step_count
real :: dt
real :: rate
real :: value
step_count =
dt = 0.5
rate = 2.0
value = 10.0
do step = 1, step_count
value = value + rate * dt
end do
print '(I0, 1X, F0.1)', step_count, value
end program fixed_step_loop_demo
program fixed_step_loop_demo
implicit none
integer :: step
integer :: step_count
real :: dt
real :: rate
real :: value
step_count =
dt = 0.5
rate = 2.0
value = 10.0
do step = 1, step_count
value = value + rate * dt
end do
print '(I0, 1X, F0.1)', step_count, value
end program fixed_step_loop_demo
fixed step
A fixed-step model repeats the same update formula.
loop counter
`step` records which update is currently being applied.
accumulated state
`value` carries the result from one step into the next.