CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

save the last timestep

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By mabinty

Reply
 
LinkBack Thread Tools Display Modes
Old   April 27, 2011, 18:44
Default save the last timestep
  #1
pit
New Member
 
Join Date: Mar 2010
Posts: 25
Rep Power: 7
pit is on a distinguished road
Hi, I have only a short question. Is it possible to save the timestep before foam shut down? I have a long calculation with adjustable timestep and long write intervals. The 'purgeWrite' option doesen't work well for me. Thanks and best regards
pit is offline   Reply With Quote

Old   April 27, 2011, 19:06
Default
  #2
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 727
Rep Power: 18
mturcios777 will become famous soon enough
When does your simulation end? If you know how long you are going to run it, then you just need to match your interval in such a way you get an integer number of steps. Otherwise you need to add

Code:
runTime.writeNow()
to the solver, just before the
Code:
return 0;
statment ending the simulation.
mturcios777 is offline   Reply With Quote

Old   April 28, 2011, 23:19
Default
  #3
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 7
tonyuprm is on a distinguished road
In your system/controlDict you can use:

stopAt writeNow;

This will stop and write your fields. Hope this helps.
tonyuprm is offline   Reply With Quote

Old   November 28, 2011, 10:24
Default
  #4
Senior Member
 
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 186
Rep Power: 8
mabinty is on a distinguished road
dear all!

i have to stop my simulation and write the current time step after a pre-specified ClockTime -> clockTimeLimit. For this task I used the runTime.writeAndEnd() function in the main while-loop of the solver:

Code:
while (runTime.run())
{
        .
        .
        .

        runTime.write();

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;

    if(runTime.elapsedClockTime() >= clockTimeLimit)
    {
            Info<< "  Time limit reached." << nl
                  << "  Stop simulation and write current time step."
                  << nl << endl;

        runTime.writeAndEnd();
    }
}
The code works in serial but causes problem in parallel: at the moment the runTime.writeAndEnd() is executed the solver hangs and does nothing, no output in the log-file.

Does somebody have an idea what is going wrong here?

Thanks in advance!

Cheers,
Aram
mabinty is offline   Reply With Quote

Old   November 28, 2011, 14:18
Default
  #5
Senior Member
 
Aram Amouzandeh
Join Date: Mar 2009
Location: Vienna, Vienna, Austria
Posts: 186
Rep Power: 8
mabinty is on a distinguished road
hi!

i changed the code and now it seems to work in parallel:

Code:
    scalar clockTime = runTime.elapsedClockTime();
    reduce(clockTime, sumOp<scalar>());

    if(clockTime/Pstream::nProcs() >= clockTimeLimit)
    {
            Info<< "  CPU time limit " << clockTimeLimit << " s reached." << nl
                 << "  Stop simulation and write current time step."
                 << nl << endl;

            runTime.writeAndEnd();
    }
cheers,
aram
mm.abdollahzadeh likes this.
mabinty is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restart 2-way FSI with different timestep? Lance CFX 11 April 17, 2013 00:37
Adequate timestep selection for multidomain problem gerardosrez CFX 6 November 28, 2010 18:50
Use of Timestep in obtaining solution. hagupta CFX 7 February 28, 2006 14:14
Timestep selection Jindra Kosprdova CFX 9 April 28, 2005 06:41
timestep in transinet simulations caty CFX 1 April 18, 2005 19:54


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