CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Can we restart the simulation from a different time in OpenFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree17Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 15, 2010, 23:57
Default Can we restart the simulation from a different time in OpenFoam
  #1
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Dear Foamers,

I was running a simulation till a particular time period, but found that the steady state was not reached. I would like to know, whether I have to rerun my simulations again from the beginning or is it possible to start the simulations from the point where I stopped as the starting value. I was trying to implement this by changing the starting value in controlDict file, but couldnt be of any use. I would appreciate if you guys can throw your suggestions.

Thanks

Vishal
kon11 likes this.
nandiganavishal is offline   Reply With Quote

Old   September 16, 2010, 00:39
Default
  #2
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24
santiagomarquezd will become famous soon enough
Yes, it is possible use latestTime in stead of startTime in system/controDict. This info is available in User's Guide.

Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Research Scientist
Research Center for Computational Methods (CIMEC) - CONICET/UNL
Tel: 54-342-4511594 Int. 7032
Colectora Ruta Nac. 168 / Paraje El Pozo
(3000) Santa Fe - Argentina.
http://www.cimec.org.ar
santiagomarquezd is offline   Reply With Quote

Old   September 16, 2010, 01:44
Default
  #3
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Dear Santiago,

Thanks for the reply. I did change it in my control dict, but still get the same error.

My controlDict initial few lines

application eofFoam;

startFrom latestTime;

latestTime 3e6;

stopAt endTime;

endTime 6e6;

deltaT 200;

writeControl timeStep;

writeInterval 10000;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;


Error message:

Create time

Create mesh for time = 3e+06

Reading field C1 (A)



compound has already been transfered from token
on line 39689 the empty compound of type List<scalar>#0 Foam::error:rintStack(Foam::Ostream&) in "/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::token::transferCompoundToken() in "/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#3 Foam::Istream& Foam:perator>><double>(Foam::Istream&, Foam::List<double>&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#4 Foam::Field<double>::Field(Foam::word const&, Foam::dictionary const&, int) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#5 Foam::zeroIonFluxFvPatchScalarField::zeroIonFluxFv PatchScalarField(Foam::fvPatch const&, Foam:imensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#6 Foam::fvPatchField<double>::adddictionaryConstruct orToTable<Foam::zeroIonFluxFvPatchScalarField>::Ne w(Foam::fvPatch const&, Foam:imensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#7 Foam::fvPatchField<double>::New(Foam::fvPatch const&, Foam:imensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#8 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricB oundaryField(Foam::fvBoundaryMesh const&, Foam:imensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#9 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#10 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#11 main in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#12 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#13 Foam::regIOobject::readIfModified() in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"


From function token::transferCompoundToken()
in file lnInclude/token.C at line 96.

FOAM aborting

Aborted

Kindly let me know where I am making an error.

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   September 16, 2010, 03:31
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by nandiganavishal View Post
Dear Santiago,

Thanks for the reply. I did change it in my control dict, but still get the same error.

My controlDict initial few lines

startFrom latestTime;
latestTime 3e6;
stopAt endTime;
endTime 6e6;

...
Kindly let me know where I am making an error.
With the entry
Code:
 
startFrom latestTime;
the latest time step available on the disk will be used.
Note that this is also the default if the keyword "startFrom" is missing.
With this option, you'd simply remove any later results, this will do what you want.

The entry
Code:
 
latestTime 3e6;
has no meaning and will be ignored.

Note, you could also use another alterative combination. For example,
Code:
 
startFrom startTime; 
startTime 1000;
to specify that the calculation should start (or restart) from iteration 1000. However, I generally find it easier to remove the old results via the command-line and use the default startFrom latestTime.

Beyond that I'm not sure what other problem you are encountering.
olesen is offline   Reply With Quote

Old   September 18, 2010, 18:07
Default
  #5
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Dear Santiago

I did try your suggestion again but still get the same error. I would check with the tutorial codes and see if the cavity foam wrks or not. Further, I would like to know if I use probes function to calculate variation a variable with time, is it possible to start dumping the values from a particular start and stop time rather than from time t =0.

Kindly throw some light on this. I was searchin this in openFOAM tutorials and other forums but couldn't get any concrete answer.

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   September 20, 2010, 10:30
Default
  #6
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 16
Linse is on a distinguished road
I do not know if it is connected to your error message, but:
I did some restarts of different cases. If I restarted from the alst timestep, sometimes some data was missing. Usually everything went fine as soon as I used the last BUT ONE timestep as restarting step.

Perhaps it works if you try to restart from 2.99e6 or another value you still have stored inside the simulation folder?
Linse is offline   Reply With Quote

Old   September 20, 2010, 12:31
Default
  #7
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Thanks for the reply Linse, I would try that and would let you know!!
nandiganavishal is offline   Reply With Quote

Old   October 10, 2010, 16:11
Default
  #8
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Dear Foamers,

I did try again to start the simulation from the latest time but still end up with the same error. I was able to run the cavity foam example and it was working fine for that case.

Here is a part of my controldict file

application eofFoam;

startFrom latestTime;

latestTime 100;

stopAt endTime;

endTime 200;

deltaT 100;

writeControl runTime;

writeInterval 100;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

I notice that simulation is starting from 100 (initial time) and not from 200 (as deltaT is 100 and latest time is 100).

Here is the error message

Create time

Create mesh for time = 100

Reading field C1 (A)



compound has already been transfered from token
on line 39689 the empty compound of type List<scalar>#0 Foam::error:rintStack(Foam::Ostream&) in "/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::token::transferCompoundToken() in "/home/vishal/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#3 Foam::Istream& Foam:perator>><double>(Foam::Istream&, Foam::List<double>&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#4 Foam::Field<double>::Field(Foam::word const&, Foam::dictionary const&, int) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#5 Foam::zeroIonFluxFvPatchScalarField::zeroIonFluxFv PatchScalarField(Foam::fvPatch const&, Foam:imensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#6 Foam::fvPatchField<double>::adddictionaryConstruct orToTable<Foam::zeroIonFluxFvPatchScalarField>::Ne w(Foam::fvPatch const&, Foam:imensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#7 Foam::fvPatchField<double>::New(Foam::fvPatch const&, Foam:imensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#8 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricB oundaryField(Foam::fvBoundaryMesh const&, Foam:imensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#9 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#10 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#11 main in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"
#12 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#13 Foam::regIOobject::readIfModified() in "/home/vishal/OpenFOAM/vishal-1.5/applications/bin/linuxGccDPOpt/eofFoam"


From function token::transferCompoundToken()
in file lnInclude/token.C at line 96.

FOAM aborting

Kindly can anyone provide some help.

Thanks

Regards

Vishal Nandigana
nandiganavishal is offline   Reply With Quote

Old   March 7, 2011, 17:34
Default
  #9
Member
 
Join Date: Sep 2010
Posts: 36
Rep Power: 16
anfho is on a distinguished road
Hi,
notheless this thread is almost six months old, I wanted to add and clarify that if you are using OF1.7.x, it is not necessary to specify the latestTime per sae. If OF1.7.x is restarted and

startFrom latestTime;

is specified it will always start from the last solution written in the case folder (either at time 0 or at time latestTime).

My controlDict looks like this and is able to restart at any time:

Code:
 
application     fireFoam;
startFrom       latestTime;
startTime       0.0;
stopAt           endTime;
endTime        10.0;
deltaT           0.001;
Regards, Andreas
uckmhnds and amber25 like this.

Last edited by anfho; March 7, 2011 at 18:50.
anfho is offline   Reply With Quote

Old   March 7, 2011, 17:57
Default
  #10
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Thanks Andreas. I was able to solve that issue..

Regards
Vishal
nandiganavishal is offline   Reply With Quote

Old   March 9, 2011, 13:37
Default
  #11
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Quote:
Originally Posted by nandiganavishal View Post
Thanks Andreas. I was able to solve that issue..
It might help other people if you add a post providing details how you solved your problem.
HappyS5 likes this.
akidess is offline   Reply With Quote

Old   March 9, 2011, 14:49
Default
  #12
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Is there an easy way to revert back to an old time during runtime (ie. while the solver is running)?

This way if my solver is becoming unstable due to a time step that is too large, I can go back to the last successful time and pick a smaller time step.
benk is offline   Reply With Quote

Old   March 9, 2011, 16:43
Default
  #13
Member
 
Join Date: Sep 2010
Posts: 36
Rep Power: 16
anfho is on a distinguished road
Quote:
It might help other people if you add a post providing details how you solved your problem.
@Anton: I think I did that above.

Quote:
Is there an easy way to revert back to an old time during runtime (ie. while the solver is running)?
@Ben: You would have to stop the solver iteration loop and then delete the unstable solutions in your directory and start with a different time step/ different settings from the time where you have a stable solution. This is definetely not possible while the solver is running.

Regards, Andreas

Last edited by anfho; March 9, 2011 at 20:51.
anfho is offline   Reply With Quote

Old   March 9, 2011, 17:31
Default
  #14
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Quote:
Originally Posted by anfho View Post
@Anton: I think I did that above.

@Ben: You would have to stop the solver iteration loop and then delete the unstable solutions in your directory and start with a different time step/ different settings from the time step where you have a stable solution. This is definetely not possible while the solver is running.

Regards, Andreas
The way I read Vishal's answer was that he solved the entire problem (he already had 'latestTime' included in his post from October 10). If that was not what he meant, you are right there was nothing to add.

Ben, I do believe that should be possible with some programming work. You have to access the Time object, then you can use either runTime.setTime() to set a specific time or runTime-- to go back one time step. Now, you'll have to make sure that old data is available, by calling setTime for a time you know you wrote data or storing the old time data like done in a SIMPLE style solver. Let me know if it works!

Doxygen for Time: http://foam.sourceforge.net/docs/cpp...14f547f414.php
akidess is offline   Reply With Quote

Old   March 9, 2011, 18:18
Default
  #15
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Dear Foamers,

I did change the controlDict file from the latesttime step i had in my simulation for example

application coupleFoam;

startFrom startTime;

startTime 18e6;

stopAt endTime;

endTime 25e6;

deltaT 100;

writeControl runTime;

writeInterval 1e6;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;


The problem I was facing was that in the 18e6 folder some variables had non uniform values in the boundary condition that was not deducted by openfoam so I changed those non uniform values to uniform 0 (as once the iteration starts these values will be computed again)

Hope this helps

Regards

Vishal
uckmhnds likes this.
nandiganavishal is offline   Reply With Quote

Old   March 10, 2011, 12:22
Default
  #16
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Quote:
Originally Posted by akidess View Post
Ben, I do believe that should be possible with some programming work. You have to access the Time object, then you can use either runTime.setTime() to set a specific time or runTime-- to go back one time step. Now, you'll have to make sure that old data is available, by calling setTime for a time you know you wrote data or storing the old time data like done in a SIMPLE style solver. Let me know if it works!

Doxygen for Time: http://foam.sourceforge.net/docs/cpp...14f547f414.php
I have something that kindof works:

Code:
if (trouble_flag == 1) {

// this will go back to the last good timestep
runTime.setTime( runTime.times()[runTime.times().size()-1].value(), runTime.times()[runTime.times().size()-1].value() );

// Now I have to read the values of the last good timestep...what's the best way to do this?
fieldName(IOobject("fieldName",runTime.timeName(),mesh,IOobject::MUST_READ,IOobject::AUTO_WRITE),mesh);
...
...
//read in all fields
...
...
//set a new dt
runTime.setDeltaT(someDeltaT);
//continue simulation
}
I think this works, but I have to manually read in the time directory fields, maybe I shouldn't be complaining about this but it just seems like a lot of unnecessary work.

I think having a feature like this could be very useful to OpenFOAM, I believe most commercial solvers can do this.
mm.abdollahzadeh likes this.
benk is offline   Reply With Quote

Old   March 14, 2011, 09:31
Default
  #17
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
akidess will become famous soon enough
Can you check if this works?

Code:
if (troubleflag == 1)
    {
        // this will go back to the last good timestep
        instant oldtime = runTime.times()[runTime.times().size()];
        runTime.setTime( oldtime.value(), runTime.findClosestTimeIndex(runTime.times(), oldtime.value() ) );

        //set a new dt
        runTime.setDeltaT(runTime.deltaT().value() / 2.0);

        //runTime++ after include of setDeltaT should call objectRegistry::readModifiedObjects(), which in turn should update fields
    };
PS. Didn't you already solve this problem in a different way last year? -> http://www.cfd-online.com/Forums/ope...tml#post262131
mm.abdollahzadeh likes this.
akidess is offline   Reply With Quote

Old   July 22, 2014, 23:25
Default I restart the solution but this error appears
  #18
New Member
 
Hassan Adel
Join Date: Oct 2013
Location: Egypt
Posts: 18
Rep Power: 13
hassan1201 is on a distinguished road
Create time

Create dynamic mesh for time = 0.116

Selecting dynamicFvMesh dynamicMotionSolverFvMesh


--> FOAM FATAL IO ERROR:
patch 6 not empty type. Patch type = patch





file: /home/hassan/foam/foam-extend-3.1/tutorials/solidMechanics/icoFsiElasticNonLinULSolidFoam/HronTurekFsi/fluid/0.116/meshPhi::boundaryField::frontAndBackPlanes from line 41776 to line 41776.

From function emptyFvsPatchField<Type>::emptyFvsPatchField
(
const fvPatch& p,
const Field<Type>& field,
const dictionary& dict
)

in file fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.C at line 100.

FOAM exiting
__________________
H.Elsheshtawy
hassan1201 is offline   Reply With Quote

Old   June 2, 2015, 15:11
Default
  #19
New Member
 
Josh Elliott
Join Date: Feb 2011
Posts: 1
Rep Power: 0
jelliott121 is on a distinguished road
Is it possible to start from "t minus 1 timeStep"? With the server I am working with there is a possibility of being forced to shut down my process before completing the latestTime iteration. If that occurs, I want to be able to reboot and the solver should pick up from the last complete time step instead of the latest time step. purgeWrite set to 2, so the last complete iteration is left in the project directory. Any ideas how to start from this timeStep?
jelliott121 is offline   Reply With Quote

Old   November 30, 2015, 05:03
Default How to restart simulation in Ansys Fluent?
  #20
New Member
 
parham
Join Date: Oct 2015
Posts: 24
Rep Power: 11
mk091088 is on a distinguished road
Hi all,
I have the same question but in Ansys Fluent. My simulation had run for 3 days, unfortunately it was stopped for obscure reason, thus I have to re-run it again from the last time step. Any help would be appreciated.
mk091088 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 16:33
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 07:25
(chtMultiRegionFoam) reducing gravity increase the simulation time ! openfoam1 OpenFOAM 7 March 10, 2010 10:41
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 10:15
influence of time step in insationary simulation Sascha Behrens FLUENT 0 December 1, 2005 10:08


All times are GMT -4. The time now is 15:50.