OpenFOAM® v2006: New and improved post-processing

30/06/2020

Improved data conversion to Ensight format

The foamToEnsight utility has been extended to include flexible handling of cellZones and to incorporate more functionality similar to foamToVTK. The foamToEnsightParts utility (which was serial only) is now redundant and hence removed.

Now, foamToEnsight

  • can handle multiple cellZones
  • additional support for point fields (as per foamToVTK)
  • additional -nearCellValue option (as per foamToVTK)
  • as before, can run in serial or in parallel

The newest foamToEnsight options:

Options Output
default Individual parts for cellZones, unzoned cells (internalMesh) and patches
-cellZones NAME/LIST Specify single or multiple cellZones to write
-no-cellZones Suppress writing any cellZones
-excludePatches NAME/LIST Exclude single or multiple patches (name or regex) from writing
-index NUM Starting index for consecutive number of Ensight data/files.
-nearCellValue Use zero-gradient cell values on patches
-no-mesh Suppress writing the geometry
-no-overwrite Suppress removal of existing EnSight output directory
-no-point-data Suppress conversion of pointFields, disable -nodeValues

The full list of options can be found in the online manual and/or in the OpenFOAM API guide

The improved cellZones functionality can be tested on using tutorial case with cellZones. After running foamToEnsight, users can visualise the case as shown in the figure below, where the various cell zones are highlighted in different colors. In ParaView, cellZones can be extracted from the Ensight format via the filter Extract block.

[Picture]
Propeller case processed with Ensight (left) and ParaView (right)

Tutorial
$FOAM_TUTORIALS/incompressible/pimpleFoam/RAS/propeller

New momentum error function object

The new momentumError function object evaluates the error associated with the discretisation of the momentum equation solved in the top level solver, either based on settings in the controlDict or the command line via the postProcess option and utility.

Evaluations are performed per time step where the transient term is not included in the budget calculation. Therefore, the tool is only suitable for steady solvers.

The error is calculated using:

momentErr = divDevRhoReff() + fvc::div(phi, U) + fvc::grad(p)

where:

  • divDevRhoReff() is the turbulent momentum flux
  • fvc::div(phi, U) advection term
  • fvc::grad(p) pressure gradient

[Picture]

An example of the function object within the controlDict is:

momErr
{
    type            momentumError;
    executeControl  writeTime;
    writeControl    writeTime;
}

Source code
$FOAM_SRC/functionObjects/field/momentumError
Tutorial
$FOAM_TUTORIALS/incompressible/simpleFoam/airFoil2D

New reading of Abaqus surface files

This version adds reading of Abaqus surface element files.

Note that since Abaqus files and STARCD files may both use the file extension .inp for their input files, additional support was added to specify the input and output formats independent of the file extension. For example,

surfaceMeshConvert -read-format abaqus file.ext1 -write-format nastran file.ext2

Handling of surface extraction from solid elements and writing sampled surfaces in Abaqus format will be made available in future releases.

Source code
$FOAM_SRC/fileFormats/abaqus
$FOAM_SRC/src/surfMesh/surfaceFormats/abaqus

New interface height function object

This function object has been ported from the openfoam.org repository.

The interfaceHeight object reports the height of the interface above a set of user-specified locations. For each location, the vertical distance of the interface above both the location and the lowest boundary are written, complete with the point on the interface from which these heights are computed. It uses an integral approach, meaning that if multiple interfaces exist above or below a location an average value is reported.

The initial code has been extended to include an option to change the default direction from which the interface height is calculated. By default the height calculation is set to be aligned with the gravity vector, but the optional direction entry can be used to set a different direction.

interfaceHeight1
{
    type           interfaceHeight;
    libs           (fieldFunctionObjects);
    alpha          alpha.liquid;
    direction      (1 0 0);
    writeControl   timeStep;
    writeInterval  3;
    locations      ((0 0 0) (10 0 0) (20 0 0));
}

Source code
$FOAM_SRC/functionObjects/field/interfaceHeight
Tutorial
$FOAM_TUTORIALS/verificationAndValidation/interCondensatingEvaporatingFoam/stefanProblem
Attribution
The base of the interfaceHeight function object has been ported from OpenFOAM.org.
Extended code guide
interfaceHeight

New dynamic mode decomposition (DMD) function object

Dynamic Mode Decomposition (DMD) is a data-driven, i.e. independent of the underlying physics, dimensionality reduction method that can be used to reveal and quantify dominant spatiotemporal-coherent structures from a given flow (or dataset) in the form of modes, and associated mode parameters, e.g. mode frequency and decay rate, so that dynamic features of the given flow may become interpretable, tractable, or even reproducible without computing the complete set of governing equations. An elegant and useful introduction to DMD theory is given by Brunton (2018).

This release includes a new DMD variant as a function object called Streaming Total Dynamic Mode Decomposition (STDMD) based on an algorithm developed by Kiewat (2019), Hemati et al. (2017), and Hemati et al. (2014).

Among other DMD variants, STDMD is presumed to provide the general DMD method capabilities alongside economised and feasible memory and CPU usage, by allowing incremental updates and data compression on orthonormal bases.

Prominent characteristics:

  • Parallel including the classical Gram-Schmidt procedure, and direct tall-skinny QR decomposition (except the eigendecomposition solver)
  • Templated input for which {vol,surface}<Type>Field can be input where <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor, e.g.volScalarField.
  • Data compression by an orthonormal basis compression is possible.
  • Three mode sorting algorithms, and various filtering entries are available to reveal the dominant modes.

Potential (known) caveats:

  • This STDMD release is the beta release; therefore, small-to-medium changes in input/output interfaces and internal structures should be expected in the next versions.
  • DMD is an active research area at the time of writing; therefore, there would be cases whereat oddities might be encountered.
  • Restart is currently not supported since intermediate writing of STDMD matrices are not supported due to the prohibitive computational costs.
  • Operations on boundary fields, e.g. wallShearStress, are currently not supported.
  • Usage by postProcess utility is not available.

A set of plots showing cross-sections of mode fields from a two-dimensional steady-inflow cylinder

verification test suite can be seen below. In each sub-figure the corresponding order is used: Left-top = MATLAB (using serial data); Left-bottom = OpenFOAM (serial); Right-top = MATLAB (using parallel data); Right-bottom = OpenFOAM (parallel/8-procs).

[Picture]
Real and imaginary mode-0 and mode-1

[Picture]
Real and imaginary mode-2 and mode-3

The minimum working example of this function object can be seen below:

STDMD1
{
    type                STDMD;
    libs                (fieldFunctionObjects);
    field               <inpField>;
    stdmdInterval       5.5;
}

Source code
$FOAM_SRC/functionObjects/field/STDMD
Tutorial
$FOAM_TUTORIALS/incompressible/pimpleFoam/laminar/cylinder2D
Extended code guide
STDMD
Attribution
OpenCFD would like to thank Dr. Marco Kiewat (Technical University of Munich/AUDI) for the initial MATLAB implementation of the STDMD functionalities, the useful discussions, and his helpful suggestions.

New function object: ObukhovLength

The new ObukhovLength function object computes the Obukhov length field and associated friction velocity field.

When scaled by the ground-normal height, i.e. z, the Obukhov length becomes a dimensionless stability parameter, z/L, for atmospheric boundary layer modelling. It expresses the relative roles of buoyancy and shear in the production and dissipation of turbulent kinetic energy.

The minimum working example of this function object by using system/controlDict.functions can be seen below:

ObukhovLength1
{
    type            ObukhovLength;
    libs            (fieldFunctionObjects);
}

Source code
$FOAM_SRC/atmosphericModels/functionObjects/ObukhovLength
Tutorial
$FOAM_TUTORIALS/verificationAndValidation/atmosphericModels/atmForestStability
Extended code guide
ObukhovLength

New log(x) function object

The new log function object computes the natural logarithm of an input volScalarField.

f =  sln(max (f0,a)) + t
\relax \special {t4ht=

where: f  \relax \special {t4ht= Output volScalarField f0   \relax \special {t4ht= Input volScalarField ln  \relax \special {t4ht= Natural logarithm operator a  \relax \special {t4ht= Clip scalar s  \relax \special {t4ht= Scaling factor t  \relax \special {t4ht= Offset factor

The minimum working example of this function object can be seen below:

log1
{
    type            log;
    libs            (fieldFunctionObjects);
    field           <inpField>;
    clip            1e-3;
    checkDimensions false;
    scale           1.0;
    offset          0.0;
}

Source code
$FOAM_SRC/functionObjects/field/log
Tutorial
$FOAM_TUTORIALS/incompressible/pisoFoam/laminar/cavity
Extended code guide
log
Attribution
The base of the log function object has been ported from OpenFOAM.org

New pow(x) function object

The new pow function object computes the power of an input volScalarField.

f =  sfn0 + t
\relax \special {t4ht=

where:

  • f  \relax \special {t4ht= Output volScalarField
  • f0   \relax \special {t4ht= Input volScalarField
  • n  \relax \special {t4ht= Exponent
  • s  \relax \special {t4ht= Scaling factor
  • t  \relax \special {t4ht= Offset factor

The minimum working example of this function object can be seen below:

pow1
{
    type            log;
    libs            (fieldFunctionObjects);
    field           <inpField>;
    n               0.25;
    scale           1.0;
    offset          0.0;
}

Source code
$FOAM_SRC/functionObjects/field/pow/pow.H
Tutorial
$FOAM_TUTORIALS/incompressible/pisoFoam/laminar/cavity
Extended code guide
pow

Improved controls for sampled surfaces

The surface output formats have been extended to accept commonly used format and compression keywords. The exact meaning of these will depend upon the context. For VTK output, for example, this will choose between binary/ASCII formats, but compression will be silently ignored. For X3D output, the output remains ASCII, but the output file can be compressed.

This change also adds support for binary output of boundaryData, for improved file sizes with mapped fields.

The nastran and raw formats now support independent field scaling in a flexible dictionary format, as well as geometric scaling.

For example,

formatOptions
{
    raw
    {
        compression on;

        scale   1000;     // [m] -> [mm]
        fieldScale
        {
           "p.*"   0.01;  // [Pa] -> [mbar]
        }
    }
    
}

Source code
$FOAM_SRC/src/surfMesh/writers/nastran
$FOAM_SRC/src/surfMesh/writers/raw