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/)
-   -   How to restart simulation without being forced to write each variable ? (https://www.cfd-online.com/Forums/openfoam-solving/227766-how-restart-simulation-without-being-forced-write-each-variable.html)

pvergnol June 9, 2020 09:32

How to restart simulation without being forced to write each variable ?
 
1 Attachment(s)
Hello everyone,

In order to save some disk space, I use a function object in my controlDict in order to write only some variables.
It works perfectly well, except that when I pause a simulation and want to resume it, an error message tells me that the files for the other variables (the ones that were not written) are missing and the simulation cannot resume.
So I am stuck having to choose between being able to resume stopped simulations or being able to have enough disk space left.

Do you have an idea how to deal with this ?

I use OF v7.
Here is my controlDict and the error message is in the attached file :

Code:

application    compressibleInterFoam;

startFrom      latestTime;

startTime      0;

stopAt          endTime;

endTime        25;

deltaT          0.001;

writeControl    runTime;

writeInterval  26;

purgeWrite      0;

writeFormat    ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision  6;

runTimeModifiable false;

adjustTimeStep  yes;

maxCo          1;
maxAlphaCo      0.2;
maxDeltaT      0.01;

functions
{

        writeObjects2
                {
                        type                        writeObjects;
                        libs                        ("libutilityFunctionObjects.so");
                        objects                    (U p p_rgh T alpha.water);
                        writeOption                autoWrite;
                        writeControl            adjustableRunTime;
                        writeInterval                  0.02;
                }
}

Thank you in advance.

Flowkersma June 9, 2020 09:54

Hi Philomène,

Have you considered using purgeWrite? Then you can only keep the most recent restart file(s) and the rest of them are deleted. In addition to this you could define function objects to save other transient data that you want for post-processing.

Best, Mikko

pvergnol June 11, 2020 04:38

Hello Mikko,
This is a great idea and I am trying it, but I doesn't seem to work at the moment :
I put purgeWrite = 2 in the controlDict, and let the rest of the parameters the same.
This way, I thought there would be every restart variables written in the 2 last time directories, and for the rest of the directories only the ones I want for post-processing.
Unfortunately there are only the "post-process variables" in each time directory, even in the last two.
It seems that the function object sort of "overrules" the purgeWrite parameter.
Any idea ?

Thank you,
Philomène

pvergnol June 11, 2020 04:49

Hello again,

Actually I had forgotten to change the writeControl , for which I had put a value larger than the simulation time in order to have only the results from the function object written.
I changed it to writeControl = timeStep and writeInterval = 1 to have them written each time step.
Now the purgeWrite works well : I only have the last 2 time directories that are kept with all the "restart variables", but it also erases the results from the function object ("post-process variables" that are supposed to be written every 2 time steps).
This time it seems that the purgeWrite kind of "overrules" the function object.
How can one make them work together ?

Best,
Philomène

Ship Designer June 12, 2020 19:03

Hello Philomène,

Did I understand correctly, do you want to keep only the last two time folders (steps) but the data written to postProcessing for all the time steps you specified? How do you "pause" the simulation, by pausing the execution of the program (e.g. key combination in Terminal) or by modifying endTime and restarting it later on?

To save disk space you could try using writeFormat binary; instead of ascii.

pvergnol June 15, 2020 04:14

Hello Claudio,

I would like to keep the data folders (time + postprocessing variables) for the time steps I specified in the writeObject function : every 0.02 s.
In addition to that, I would like to keep the last 2 data folders that contain all the variables that are needed to restart the simulation.

I stop the simulation using CTRL+C in the terminal.
I restart it the same way I started it at the beginning, but latestTime is used for startTime.

And I will also try writeFormat binary, thank you.


All times are GMT -4. The time now is 05:01.