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 (time.gt.currtime) then
oldtime = currtime
currtime = time
else
currtime = time
endif

dt = time - oldtime





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