compute time step when only the time itself is passed in a subroutine

Some subroutine templates give the user access to the time variable but not to the time step. By adding a simple if-statement logic the time step can be deducted.
data oldtime /0.0/
data currtime /0.0/
/* save oldtime, currtime */

if ( then
oldtime = currtime
currtime = time
currtime = time

dt = time - oldtime

Show Form
No comments yet. Be the first to add a comment!