CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   How to stop bproperlyb a job (

openfoam_user October 9, 2008 08:42

Dear users, 1. How can I st
Dear users,

1. How can I stop 'properly' a multi-processors job that is running in background ? and maybe also save the results of the last iterations ?

2. Is it possible to plot the residuals while the job is running ?

Thanks for helping me,


gschaider October 9, 2008 15:21

Have a look at section 4.3 of
Have a look at section 4.3 of the 1.5 UserGuide:

Replace in the controlDict the current stopAt-Value with writeNow. Save and wait. But be sure not to mistype because then your run might stop without writing anything


openfoam_user October 10, 2008 02:38

Thanks Bernhard for your help
Thanks Bernhard for your help !

floooo October 10, 2008 08:59

During calculation you can mak
During calculation you can make :


You can see the first output
and 20min later you can update it :

in paraFoam => update content

in order to kill a job I use
ps to get the PID
kill ...

Then if you want to start from the last output, you have to modify your controlDict and change the start time.

olesen October 10, 2008 09:47

For solvers that I use often,
For solvers that I use often, I've added the following bits of code.

At the top bit of the main(), before the time loop starts:

// define ABORT file for stopping the job
fileName abortName(args.rootPath()/args.globalCaseName()/"ABORT");
if (file(abortName))
Info<< "removing old ABORT file" << endl;

2. In the bottom part of the time loop:


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

if (file(abortName))
Info<< "reacting to user ABORT" << endl;

3. Finally outside of the time loop:

// cleanup ABORT file
if (file(abortName))

This makes the solver react to the existence of the file 'ABORT' and works well with serial or parallel calculations.

It could make a nice functionObject, but to be convenient there'd need to be some way of defining site or user global functionObjects. Eg, via the existing etc/controlDict mechanism, or with a ~OpenFOAM/... directory expansion.
I'd certainly want to avoid adding the functionObject to every single system/controlDict!

openfoam_user October 10, 2008 10:33

Mark, I am a new user of Op

I am a new user of OpenFoam !!!

into which file (controlDict) have you written these bits of code ?


gschaider October 10, 2008 14:44

Hi Stephane! Have a look at
Hi Stephane!

Have a look at the chapter 4 of the user-guide. It is a most interesting read. Especially if you have to ask for the controlDict (which is THE most important file in any OF-case). Trust me.


olesen October 13, 2008 02:36

The bits of code have been add
The bits of code have been added directly into the solver itself (eg, simpleFoam, rhoSimpleFoam, rhoPorousSimpleFoam, etc.)

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