CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Periodically ignore removal by purgeWrite (

Bernhard October 4, 2012 08:41

Periodically ignore removal by purgeWrite
Suppose I have the following settings in my controlDict


writeControl    adjustableRunTime;
writeInterval  0.02;
purgeWrite      3;

Suppose I am at t=5.67, then I will have the time-steps 5.62, 5.64 and 5.66 stored. When time goes beyond 5.68, the output from t=5.62 will get removed. This is expected purgeWrite behavior.

What I want to do now, is using the purgeWrite option, but keeping some more timesteps (or not removing them). Suppose I had a flag

keepEach  1.0
The expected behavior in the above example, is that I have the following timesteps stored:
1, 2, 3, 4, 5, 5.62, 5.64, 5.66

Any suggestions on how to do this? Is there such a flag, or should I put it as a feature request on the bugtracker?

Bernhard October 8, 2012 04:40

The purgeWrite code is defined in:/src/OpenFOAM/db/Time/TimeIO.C (318-326)

        if (writeOK && purgeWrite_)

            while (previousOutputTimes_.size() > purgeWrite_)

This obviously confirms that there is no such flag by default.

With adding a dictionary input and an if-statement in the while loop, this can easily be implemented, I suppose.

Is it possible to compile this into a library, and put it as a library in the controlDict, allowing to add the required flag? My impression is that the answer would be no, because I need to recompile the solver at least. Any hints on library linking is welcome here.

Bernhard October 10, 2012 03:14

I tried compiling some libmyOpenFOAM and without new changes, I compiled it with myIcoFoam. Now I get a conflict between libOpenFOAM and libmyOpenFOAM.

*** glibc detected *** myIcoFoam: double free or corruption (!prev): 0x000000000072fee0 ***
======= Backtrace: =========
======= Memory map: ========
Which occurs at the end of the run after completing.

I tried to compile myIcoFoam manually, by stripping the references to lOpenFOAM and src/OpenFOAM/lnInclude, but, without any success until now. Any hints to not use using wmake?

All times are GMT -4. The time now is 18:28.