CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Stop Openfoam simulation (https://www.cfd-online.com/Forums/openfoam-solving/69692-stop-openfoam-simulation.html)

deji October 31, 2009 18:28

Stop Openfoam simulation
 
evening everyone. does anyone know the command to stop an openfoam simulation/

alberto October 31, 2009 19:44

Quote:

Originally Posted by deji (Post 234738)
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,

pauls October 31, 2009 19:45

Quote:

evening everyone. does anyone know the command to stop an openfoam simulation/
foamPullPowerPlug works in openfoam1.6-dev
http://www.cfd-online.com/Forums/ima...apse_thead.gif

olesen November 1, 2009 09:47

Quote:

Originally Posted by deji (Post 234738)
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

QuangDang August 8, 2011 05:56

Quote:

Originally Posted by olesen (Post 234767)
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).
--------------------------------------------------------------------------

uli July 13, 2012 19:06

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 July 14, 2012 01:20

Code:

runTimeModifiable yes;
in the controldict file solved my problem.

niaz July 15, 2012 07:54

just push ctrl+z
Quote:

Originally Posted by deji (Post 234738)
evening everyone. does anyone know the command to stop an openfoam simulation/


wyldckat July 15, 2012 10:08

Greetings to all!

Quote:

Originally Posted by niaz (Post 371503)
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

Meltedbrain September 18, 2012 11:58

Hello, what if i want to stop a process without losing saved data and then restart it from where i stopped it?

wyldckat September 18, 2012 14:44

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

Meltedbrain September 19, 2012 03:47

Thank you sir,
so maybe i should set starfFrom:latestTime, right?

pattim August 25, 2020 11:33

Quote:

Originally Posted by Meltedbrain (Post 382487)
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.


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