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

Stop Openfoam simulation

Register Blogs Community New Posts Updated Threads Search

Like Tree23Likes
  • 1 Post By deji
  • 11 Post By alberto
  • 2 Post By olesen
  • 8 Post By wyldckat
  • 1 Post By pattim

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 31, 2009, 19:28
Default Stop Openfoam simulation
  #1
Senior Member
 
n/a
Join Date: Sep 2009
Posts: 199
Rep Power: 17
deji is on a distinguished road
evening everyone. does anyone know the command to stop an openfoam simulation/
kon11 likes this.
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,912
Rep Power: 36
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,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
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: 17
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: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
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
olesen is offline   Reply With Quote

Old   August 8, 2011, 06:56
Default
  #5
New Member
 
Quang
Join Date: Jul 2010
Posts: 11
Rep Power: 16
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, 20:06
Default
  #6
uli
New Member
 
Join Date: Jun 2012
Posts: 25
Rep Power: 14
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, 02:20
Default
  #7
uli
New Member
 
Join Date: Jun 2012
Posts: 25
Rep Power: 14
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, 08:54
Default
  #8
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 17
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, 11:08
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, Haier and 5 others like this.
__________________
wyldckat is offline   Reply With Quote

Old   September 18, 2012, 12:58
Default
  #10
New Member
 
Manfredi
Join Date: Aug 2012
Posts: 5
Rep Power: 14
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, 15:44
Default
  #11
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, 04:47
Default
  #12
New Member
 
Manfredi
Join Date: Aug 2012
Posts: 5
Rep Power: 14
Meltedbrain is on a distinguished road
Thank you sir,
so maybe i should set starfFrom:latestTime, right?
Meltedbrain is offline   Reply With Quote

Old   August 25, 2020, 12:33
Default
  #13
Member
 
Patti Michelle Sheaffer
Join Date: Sep 2018
Posts: 55
Rep Power: 8
pattim is on a distinguished road
Quote:
Originally Posted by Meltedbrain View Post
Thank you sir,
so maybe i should set starfFrom:latestTime, right?
That's what I read - did you try it?

OF rereads the controlDict after every cycle of the solver, I believe, so dynamic changes can be made there.
Trailokya likes this.
pattim 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
Solidification simulation with OpenFOAM James OpenFOAM 6 September 8, 2024 11:13
Is OpenFOAM appropriate for a river simulation jasonneuswanger OpenFOAM Running, Solving & CFD 8 December 18, 2020 05:25
OpenFOAM - Validation of Results Ahmed OpenFOAM Running, Solving & CFD 10 May 13, 2018 19:28
diesel Engine simulation in OpenFOAM karam OpenFOAM Running, Solving & CFD 1 March 1, 2011 10:46
OpenFOAM Training Courses in Germany hjasak OpenFOAM Announcements from Other Sources 0 July 23, 2009 20:34


All times are GMT -4. The time now is 17:11.