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

Stop Openfoam simulation

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

Like Tree5Likes
  • 1 Post By alberto
  • 1 Post By olesen
  • 3 Post By wyldckat

Reply
 
LinkBack Thread Tools Display Modes
Old   October 31, 2009, 19:28
Default Stop Openfoam simulation
  #1
Senior Member
 
n/a
Join Date: Sep 2009
Posts: 198
Rep Power: 7
deji is on a distinguished road
evening everyone. does anyone know the command to stop an openfoam simulation/
deji is offline   Reply With Quote

Old   October 31, 2009, 20:44
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by deji View Post
evening everyone. does anyone know the command to stop an openfoam simulation/
Simply kill the process, or, if you want something more elegant set

stopAt writeNow; // It stops the simulation after writing data for the current time step

or

stopAt noWriteNow; // It stops the simulation without writing data for the current time step

in the controlDict dictionary and save it.

Best,
mahditorabiasr likes this.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   October 31, 2009, 20:45
Default
  #3
New Member
 
Paul Schiefer
Join Date: Sep 2009
Posts: 25
Rep Power: 7
pauls is on a distinguished road
Quote:
evening everyone. does anyone know the command to stop an openfoam simulation/
foamPullPowerPlug works in openfoam1.6-dev
pauls is offline   Reply With Quote

Old   November 1, 2009, 10:47
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 777
Rep Power: 18
olesen will become famous soon enough
Quote:
Originally Posted by deji View Post
evening everyone. does anyone know the command to stop an openfoam simulation/
In time-loop of my solvers I look for the existence of an "ABORT" file. If it exists, the runtime does 'runTime.writeAndEnd();'

From the command-line, a simple "touch ABORT" suffices without needing to edit any files.

For general reference (in case anyone else wants to add it to their solvers):

Before the time-loop begins:
Code:
// define ABORT file for stopping the job
fileName abortName(args.rootPath()/args.globalCaseName()/"ABORT");
if (isFile(abortName))
{
    Info<< "removing old ABORT file" << endl;
    rm(abortName);
}
Within the time-loop itself (near the bottom):
Code:
if (isFile(abortName))
{
    Info<< "reacting to user ABORT" << endl;
    runTime.writeAndEnd();
}
After the time-loop:
Code:
// cleanup ABORT file
if (isFile(abortName))
{
    rm(abortName);
}
It should really be rewritten to act as a functionObject, but I've never gotten around to it.

/mark
mm.abdollahzadeh likes this.
olesen is offline   Reply With Quote

Old   August 8, 2011, 05:56
Default
  #5
New Member
 
Quang
Join Date: Jul 2010
Posts: 11
Rep Power: 7
QuangDang is on a distinguished road
Quote:
Originally Posted by olesen View Post
In time-loop of my solvers I look for the existence of an "ABORT" file. If it exists, the runtime does 'runTime.writeAndEnd();'

From the command-line, a simple "touch ABORT" suffices without needing to edit any files.

For general reference (in case anyone else wants to add it to their solvers):

Before the time-loop begins:
Code:
// define ABORT file for stopping the job
fileName abortName(args.rootPath()/args.globalCaseName()/"ABORT");
if (isFile(abortName))
{
    Info<< "removing old ABORT file" << endl;
    rm(abortName);
}
Within the time-loop itself (near the bottom):
Code:
if (isFile(abortName))
{
    Info<< "reacting to user ABORT" << endl;
    runTime.writeAndEnd();
}
After the time-loop:
Code:
// cleanup ABORT file
if (isFile(abortName))
{
    rm(abortName);
}
It should really be rewritten to act as a functionObject, but I've never gotten around to it.

/mark
Really, I run parallel and after simulation stop (I do like you), it makes errors. Can you help me?

This is my code

if( errors <= 0.001 )
{
Info<< "reached convergence"<< endl;
runTime.writeAndEnd();
Info<< "latestTime = " << runTime.timeName() << endl;
}

This is error

--------------------------------------------------------------------------
mpirun noticed that process rank 0 with PID 27921 on node dfmserver exited on signal 11 (Segmentation fault).
--------------------------------------------------------------------------
QuangDang is offline   Reply With Quote

Old   July 13, 2012, 19:06
Default
  #6
uli
New Member
 
Join Date: Jun 2012
Posts: 25
Rep Power: 5
uli is on a distinguished road
What could be the reason for OF not stopping when I put "writeNow" in the controldict file?


Code:
application     pimpleFoam;

startFrom       startTime;

startTime       0;

stopAt          writeNow;

endTime         100;

deltaT          0.002059;

writeControl    timeStep;

writeInterval   1000;
Thanks for any suggestions.
uli is offline   Reply With Quote

Old   July 14, 2012, 01:20
Default
  #7
uli
New Member
 
Join Date: Jun 2012
Posts: 25
Rep Power: 5
uli is on a distinguished road
Code:
runTimeModifiable yes;
in the controldict file solved my problem.
uli is offline   Reply With Quote

Old   July 15, 2012, 07:54
Default
  #8
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 118
Rep Power: 8
niaz is on a distinguished road
just push ctrl+z
Quote:
Originally Posted by deji View Post
evening everyone. does anyone know the command to stop an openfoam simulation/
niaz is offline   Reply With Quote

Old   July 15, 2012, 10:08
Default
  #9
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!

Quote:
Originally Posted by niaz View Post
just push ctrl+z
Uhm... that only suspends the execution. Running:
Code:
fg
#or
bg
The first one will unfreeze to the foreground and the second one unfreezes to the background.

For more, search online for:
Code:
linux job control
Oh, and it's Ctrl+C that breaks/terminates an application currently running on a terminal.

Last but not least, nowadays the official OpenFOAM version has a helper script named foamEndJob. For more:
Code:
foamEndJob -help
Best regards,
Bruno
zandi, romant and Haier like this.
wyldckat is offline   Reply With Quote

Old   September 18, 2012, 11:58
Default
  #10
New Member
 
Manfredi
Join Date: Aug 2012
Posts: 5
Rep Power: 4
Meltedbrain is on a distinguished road
Hello, what if i want to stop a process without losing saved data and then restart it from where i stopped it?
Meltedbrain is offline   Reply With Quote

Old   September 18, 2012, 14:44
Default
  #11
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings Meltedbrain,

Like I wrote on the previous post, the command foamEndJob can assist you with stopping it.

As for restarting... you can see on the user guide, section 4.3 Time and data input/output control:
Quote:
startFrom -> Controls the start time of the simulation.
Have fun!
Bruno
wyldckat is offline   Reply With Quote

Old   September 19, 2012, 03:47
Default
  #12
New Member
 
Manfredi
Join Date: Aug 2012
Posts: 5
Rep Power: 4
Meltedbrain is on a distinguished road
Thank you sir,
so maybe i should set starfFrom:latestTime, right?
Meltedbrain 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
Solidification simulation with OpenFOAM James OpenFOAM 5 June 26, 2012 02:33
OpenFOAM - Validation of Results Ahmed OpenFOAM Running, Solving & CFD 9 June 22, 2011 18:59
diesel Engine simulation in OpenFOAM karam OpenFOAM Running, Solving & CFD 1 March 1, 2011 10:46
Is OpenFOAM appropriate for a river simulation jasonneuswanger OpenFOAM Running, Solving & CFD 7 December 14, 2010 02:26
OpenFOAM Training Courses in Germany hjasak OpenFOAM Announcements from Other Sources 0 July 23, 2009 19:34


All times are GMT -4. The time now is 02:58.