CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Periodically ignore removal by purgeWrite (https://www.cfd-online.com/Forums/openfoam-solving/107703-periodically-ignore-removal-purgewrite.html)

Bernhard October 4, 2012 08:41

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

Code:

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
Code:

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)
Code:

        if (writeOK && purgeWrite_)
        {
            previousOutputTimes_.push(timeName());

            while (previousOutputTimes_.size() > purgeWrite_)
            {
                rmDir(objectRegistry::path(previousOutputTimes_.pop()));
            }
        }

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.
Quote:

*** glibc detected *** myIcoFoam: double free or corruption (!prev): 0x000000000072fee0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x75558)[0x7f299f250558]
/lib64/libc.so.6(cfree+0x6c)[0x7f299f2554fc]
/me/OpenFOAM/me-2.1.0/platforms/linux64GccDPOpt/lib/libmyOpenFOAM.so(_ZN4Foam10dictionaryD2Ev+0x86)[0x7f29a00e6366]
/lib64/libc.so.6(__cxa_finalize+0xa5)[0x7f299f210b95]
/opt/apps/openfoam-2.1.0/OpenFOAM-2.1.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so(+0x161c16)[0x7f299e7f2c16]
======= 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 libOpenFOAM.so using wmake?

arunPandey August 19, 2022 09:19

I am trying to do this using secondaryWriteControl but have not succeeded yet. Have you got any solution?


All times are GMT -4. The time now is 23:45.