As described in https://openfoam.com/documentation/user-guide/controlDict.php I can use

writeControl    timeStep
writeInterval   1
purgeWrite      10

to keep the last ten timesteps while purging older ones. On the other hand I can use

writeControl    runTime
writeInterval   0.1

(without purgeWrite) to get a permanent output of every 100ms simulated time. But is there any way to combine this, i.e. temporarily keep the last ten timesteps while permanently keeping the 100ms outputs? Especially for complex simulations it would be nice to directly identify the culprit of a divergence without having to resume from the last output time which might be minutes if not hours of real time ago, while keeping all timesteps and filtering afterwards also doesn't sound good...


1 Answer 1


While the OpenFOAM Forum is the proper place to ask, I will give it a shot.

Write control can be set to follow only one rule: either write every time step, or write every 100 ms. There is no way around this, however, you can work your around with a little help from a friendly functionObject.

  • Set up your case to write every time step to disk
  • Use the systemCall functionObject to delete every time step, except those falling into the 100 ms interval, and the last 10 time steps.

I have never attempted anything like this, so I can't share snippets of script; but you should get the idea.

  • $\begingroup$ I guess that's the best bet, thanks $\endgroup$ Commented Feb 20, 2020 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.