PyFoam.Execution.BasicRunner module

Run a OpenFOAM command

class PyFoam.Execution.BasicRunner.BasicRunner(argv=None, silent=False, logname=None, compressLog=False, lam=None, server=False, restart=False, noLog=False, logTail=None, remark=None, jobId=None, parameters=None, writeState=True, echoCommandLine=None)[source]

Bases: object

Base class for the running of commands

When the command is run the output is copied to a LogFile and (optionally) standard-out

The argument list assumes for the first three elements the OpenFOAM-convention:

<cmd> <dir> <case>

The directory name for outputs is therefor created from <dir> and <case>

Provides some handle-methods that are to be overloaded for additional functionality

addEndTrigger(f)[source]
Parameters:f – A function that is to be executed at the end of the simulation
appendTailLine(line)[source]

Append lines to the tail of the log

getSolutionDirectory(archive=None)[source]
Returns:The directory of the case
Return type:PyFoam.RunDictionary.SolutionDirectory
Parameters:archive – Name of the directory for archiving results
lineHandle(line)[source]

called every time a new line is read

logName()[source]

Get the name of the logfiles

runOK()[source]

checks whether the run was successful

start()[source]

starts the command and stays with it till the end

startHandle()[source]

to be called before the program is started

stopAtNextWrite()[source]

Tells the runner to stop at the next write

stopGracefully()[source]

Tells the runner to stop at the next convenient time

stopHandle()[source]

called after the program has stopped

stopWithoutWrite()[source]

Tells the runner to stop without writing

writeLastSeen()[source]
writeNowTime(force=False)[source]
writeResults()[source]

Writes the next possible time-step

writeStartTime()[source]

Write the real time the run was started at

writeTailLog()[source]

Write the last lines to the log

writeTheState(state, always=True)[source]

Write the current state the run is in

writeToStateFile(fName, message)[source]

Write a message to a state file

class PyFoam.Execution.BasicRunner.BasicRunnerCheck[source]

Bases: object

A small class that does primitve checking for BasicRunner Duplicates other efforts, but ….

controlDictRead(line)[source]

Was the controlDict reread?

floatRegExp = '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?'
getCreateTime(line)[source]

Does this line contain mesh time information?

getTime(line)[source]

Does this line contain time information?

PyFoam.Execution.BasicRunner.calcLogname(logname, argv)[source]
PyFoam.Execution.BasicRunner.findRestartFiles(logfile, sol)[source]
PyFoam.Execution.BasicRunner.restoreControlDict(ctrl, runner)[source]

Timed function to avoid time-stamp-problems