CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Restarting simulation on where it had stopped (https://www.cfd-online.com/Forums/openfoam/64886-restarting-simulation-where-had-stopped.html)

ulisses May 27, 2009 10:37

Restarting simulation on where it had stopped
 
Hi people,

Someone knows how could I restart my simulation (at OpenFOAM) on where it had stopped?

Thanks for help.

hellorishi May 28, 2009 14:41

HI,

OpenFOAM writes out file at "writeIntervals" specified by you. Check your cse folder and see if you some folders with some number e.g. 0.001, 1e-5, 10, 1000, etc. If you see this then your intermediate results were stored. Otherwise your writeinterval was large and nothing was saved.

If you find such files then you can restart by using "latestTime" . Refer to pg 39 User Guide

"We can now run this case by restarting from the solution at the end of the cavity case run. To do this we can use the option of setting the startFrom keyword to latestTime so that icoFoam takes as its initial data the values stored in the directory corresponding to the most recent time, i.e.0.5. The endTime should be set to 2 s."

ulisses May 28, 2009 17:03

Hi hellorishi,

I've tried to select the option latestTime but when the simulation started the data (p and U) that it was put into the last paste it was the initial conditions. So the program started at the last time but it didn't read the last data (that it was available into the paste).

Thanks for the answer.:D

hellorishi May 29, 2009 03:23

I did not understand what you meant by "last paste" ?
= last result directory? (0.01, etc)
Did you visualize your data, to check if something was written out in the last time step?
Sometime if your disk is full during computation, your "last time" directory will exist, but it will not have correct data. Hence you will have to use "last -1" data directory and delete the last directory.

ulisses May 29, 2009 12:33

Quote:

Originally Posted by hellorishi (Post 217520)
I did not understand what you meant by "last paste" ?
= last result directory? (0.01, etc)
Did you visualize your data, to check if something was written out in the last time step?
Sometime if your disk is full during computation, your "last time" directory will be exist, but it will not have correct data. Hence in that you will have to use "last -1" data directory and delete the last directory.

Yes, last paste means last result directory.
I visualized my data and checked that there were something in the last time step.
What I think that it's strange is the fact that the OpenFOAM writes the initial conditions in the last result directory and starts the simulation from that.
But I'll try to use last -1 data directory.

Thanks a lot.

hellorishi May 29, 2009 12:49

To the best of my knowledge OF, does not write initial BC in last time step. You can check it with the standard icoFoam tutorials. I guess there might be some variable in your controlDict file, which is causing this abnormal behviour.

leonardo.morita June 2, 2009 03:09

Hi Ulisses,

I think it would be useful if you could send us a copy of your controlDict file.

Regards,

Leonardo

olesen June 2, 2009 04:14

Quote:

Originally Posted by hellorishi (Post 217618)
To the best of my knowledge OF, does not write initial BC in last time step. You can check it with the standard icoFoam tutorials. I guess there might be some variable in your controlDict file, which is causing this abnormal behviour.

In OpenFOAM, each field file (eg, U, T, k, epsilon, etc) contains both an internalField and a boundaryField. The internalField is either initial conditions or results, depending on how you view it. At the initial iteration (often 0/), you'll have defined the values yourself and thus they can be termed initial values. At subsequent iterations, internalField contains the calculated results. If you resume the calculation from the calculated results, I suppose you could term them initial-values for a restart.

BTW: startFrom latestTime is also the default that you should get if you've left this entry blank in the controlDict.

ulisses June 4, 2009 13:42

Quote:

Originally Posted by leonardo.morita (Post 217880)
Hi Ulisses,

I think it would be useful if you could send us a copy of your controlDict file.

Regards,

Leonardo

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.4.1 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

// FoamX Case Dictionary.

FoamFile
{
version 2.0;
format ascii;

root "/home/delio/OpenFOAM/delio-1.4.1/run";
case "icoValv05";
instance "system";
local "";

class dictionary;
object controlDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application icoFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 0.5;

deltaT 1e-08;

writeControl runTime;

writeInterval 0.001;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

graphFormat raw;

runTimeModifiable yes;

functions
(
);


// ************************************************** *********************** //

I've tried to continue from the simulation was stopped but I hadn't success.

Thanks for help.

leonardo.morita June 4, 2009 15:47

Hello,

Well...if this is the controlDict you used to restart your simulation, one important thing is missing...you should change "startFrom startTime" to "startFrom latestTime"...
In the case you sent us the wrong file, I suggest you to detail a little more about your system, solver etc, so we can understand it as well and it will be easier to find the reason of your problem.
One question: how do you know OF doesn't continue the iterations from the last time folder? What exactly you've checked? It's just a stupid question, but...

Quoting Rishi and adding one point to what Mark said, boundary conditions are allways written as a boundaryField in the time folders, from the first until the last time, and usually are fixed, i.e., this field is the same in all files (exceptions: mapped, cyclic, unstationnary BC).

Regards,

Leonardo

ulisses June 5, 2009 13:23

Quote:

Originally Posted by leonardo.morita (Post 218292)
Well...if this is the controlDict you used to restart your simulation, one important thing is missing...you should change "startFrom startTime" to "startFrom latestTime"...
In the case you sent us the wrong file, I suggest you to detail a little more about your system, solver etc, so we can understand it as well and it will be easier to find the reason of your problem.
One question: how do you know OF doesn't continue the iterations from the last time folder? What exactly you've checked? It's just a stupid question, but...

Hello Leonardo,

I quoted the ControlDict with the data that I've filled out in the beginning. When I tried to restart my simulation I puted "startFrom latestTime", but what happened was that when the simulation started again the last result directory (and this directory already contains data of pressure and velocity) was overwritten with the data from the inicial conditions.
I've used OF 1.4.1 and the the solver is the icoFoam.

Quote:

Originally Posted by leonardo.morita (Post 218292)
Quoting Rishi and adding one point to what Mark said, boundary conditions are allways written as a boundaryField in the time folders, from the first until the last time, and usually are fixed, i.e., this field is the same in all files (exceptions: mapped, cyclic, unstationnary BC).

Yes I understand that initial conditions are always written as a bondaryField in the time folders.
I'll gave you an example. At my case I have some time folders. Inside these folders there are three files and one more folder (except the first time folder (time=zero) that contains four files), and the first file is U, the second phi, the third is p and the folder is called uniform (this contains a file called time that contains informations about deltaT and deltaTo). In these files there are vector fields that were generated in that time folder. What it has happened with me is that when I restart simulation using the option "startFrom latestTime " the simulation starts in the lastest time folder but the old fields are erased and the initial conditions are written in the lastest time folder. Because of this I think that OF doesn't consider my latest data.

Thanks for helping.

leonardo.morita June 5, 2009 14:25

Ok. Could you attach your files here? (I think there're instructions somewhere in the forum about how to send files)
Or if you prefer, you could send me by e-mail...I'll try to run your case on monday.

Nice weekend!

wolle1982 June 10, 2009 06:18

leonardo is right,

the control dict must have

startFrom latestTime; in it, and no other "start"-lines. if you only are interested in the last result anyway and want to avoid an enormous increase of the folder number, use the purge-write function. purgeWrite 1; and writeInterval 1; for each timestep to be written out. In that case you will get each timestep to be written into a folder and the folder is replaced with the new one. to make sure that while writing out no error deletes youtr results, increase the purgeWrite to 2;

greets

leonardo.morita June 10, 2009 07:23

Actually, I think if we put startFrom latestTime, we can leave startTime X there, it won't be read anyway...


All times are GMT -4. The time now is 06:13.