PyFoam.Execution.FoamThread module

Thread wrappers for OpenFOAM

class PyFoam.Execution.FoamThread.FoamThread(cmdline, runner)[source]

Bases: threading.Thread

Thread running an OpenFOAM command

The output of the command can be accessed in a thread-safe manner, line by line

Designed to be used by the BasicRunner-class

check()[source]
Returns:False if there is no more output of the command
cpuSystemTime()[source]
Returns:number of seconds CPU-Time used in system mode
cpuTime()[source]
Returns:number of seconds CPU-Time used
cpuUserTime()[source]
Returns:number of seconds CPU-Time used in user mode
getLine()[source]

gets the last line from the output

getReturnCode()[source]
interrupt()[source]

A keyboard-interrupt is reported

read()[source]

read another line from the output

run()[source]

start the command

setState(state)[source]

sets the state of the thread (is there any more output)

stopTimer()[source]
usedMemory()[source]
Returns:maximum resident set size in MegaByte
wallTime()[source]
Returns:the wall-clock-time needed by the process
PyFoam.Execution.FoamThread.checkForStopFile(thrd)[source]

Checks for the file ‘stop’ in the directory of the FoamRun. If it exists it is removed and the run is stopped gracefully

If a file ‘write’ is found then the next timestep is written

File ‘stopWrite’ stops the run at the next write

‘kill’ stops without writing

PyFoam.Execution.FoamThread.getLinuxMem(thrd)[source]

Reads the Memory usage of a thread on a linux-System

Parameters:thrd – the thread object in question