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

save the last timestep

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

Like Tree2Likes
  • 2 Post By mabinty

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 27, 2011, 19:44
Default save the last timestep
  #1
pit
New Member
 
Join Date: Mar 2010
Posts: 25
Rep Power: 16
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, 20:06
Default
  #2
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
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 29, 2011, 00:19
Default
  #3
Member
 
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 15
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: 190
Rep Power: 17
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: 190
Rep Power: 17
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
mabinty is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restart 2-way FSI with different timestep? Lance CFX 10 April 17, 2013 01: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 07:41
timestep in transinet simulations caty CFX 1 April 18, 2005 20:54


All times are GMT -4. The time now is 14:54.