Close

6th March 2013

OpenFOAM 2.2.0: Run-time Control

Case Override of Global controlDict Settings

For any given case it is now possible to override certain entries in the global controlDict file within the etc directory of the OpenFOAM installation. For example, for a particular case, the user can monitor some messages for specific functionality by overriding debug switches by adding entries to the case controlDict file, e.g.

DebugSwitches
{
    coupled          1;
}

Optimisation switches can be overridden such as fileModificationChecking, commsType, floatTransfer, nProcsSimpleSum, writeNowSignal and stopAtWriteNowSignal. For example, the user could set up a case to terminate with writing at a signal of 2, — equivalent to hitting CTRL-C — as follows

OptimisationSwitches
{
    stopAtWriteNowSignal    2;
}

Dimensioned constants can all be overridden including an entire unit set, so an individual case could be set up to run in USCS units by adding the following entry to a case controlDict file:

DimensionedConstants
{
    unitSet           USCS;
}

Symbolic Dimensions

In OpenFOAM, fields (e.g. pressure) and properties (e.g. viscosity) have dimensional units associated with them. When mathematical operations are executed in the code, dimensioned are checked. For example, the dimensions of quantities on the left and right hand side of an addition operation are the compared for consistency.

Dimensions have historically been specified through an array of exponents of mass, length, time, temperature, quantity, current and luminosity. In this latest release of OpenFOAM, the user can optionally describe dimensions symbolically, so that they represent dimensions in a familiar unit system. Any number of symbolic dimensions can be defined, with a basic set declared in the global controlDict file, e.g.

DimensionSets
{
    unitSet             SI; // USCS

    SICoeffs
    {
        // Basic units
        kg  kg  [ 1 0 0 0 0 0 0 ] 1.0;
        m   m   [ 0 1 0 0 0 0 0 ] 1.0;
        ...

        // Derived units
        Hz  Hz  [ s^-1 ] 1.0;
        N   N   [ kg m s^-2 ] 1.0;
        ...

        writeUnits (kg m s K mol A Cd);

If the user wishes to write dimensions in this symbolic form, they need to include a writeUnits statement in their controlDict file (see above), either globally through the /etc directory or in a local case file, as described in the previous section. The writeUnits statement needs to contain any consistent set of units.

More Secondary Write Controls

In the latest version, the set of secondary write controls has been extended.

These optional controls allow writing of results in addition to the standard writeControl and writeInterval settings. In this release, a setting has been added to purge the data written by the secondary write controls. The secondaryPurgeWrite keyword specifies a limit on the number of results directories saved by the secondary set of controls, without affecting the results from the primary write controls. A user can ensure that there are always data to restart simulations by having a secondary write of data every hour of run-time, e.g.

secondaryWriteControl    cpuTime;
secondaryWriteInterval   3600;
secondaryPurgeWrite      1;

Example

  • Global controlDict file –
    $WM_PROJECT_DIR/etc/controlDict