OpenFOAM® v1806: New and improved post-processing

OpenFOAM® v1806: New and improved post-processing

29/06/2018

New In-situ processing with ParaView Catalyst

The new function object adaptor for ParaView Catalyst marks a significant addition in post-processing and visualisation capabilities for OpenFOAM.

Catalyst adds in-situ and live visualisation capabilities to arbitrary OpenFOAM simulations. Rather than post-processing at the end of a simulation, it is now possible to harness the capabilities of ParaView and generate visualisation results simultaneous to the simulation. The scripts for the visualisation pipelines can be created interactively using the ParaView GUI.

There can be several benefits of using the Catalyst in-situ visualisation. In general, it is more efficient to avoid writing intermediate results solely for the sake of visualisation. It is faster and uses less disk space to generate the desired visualisation images directly. This becomes extremely important for large meshes and when a high temporal resolution is required for the visualisation.

The example animation below shows an overset case where the images have been created at a high temporal frequency during the calculation, and the view configured to produce the composite image for all mesh regions:

The live visualisation option can also be useful to examine the current simulation fields without writing to disk. Since the live visualisation is incorporated into the OpenFOAM time loop, it can be used to pause the simulation and set breakpoints. These features make it invaluable during the development of new solvers or physics, to gain insights of the behaviour of the simulation and models.

The Catalyst function object is run-time selectable and supports in-situ conversion of the following types:

  • finite volume meshes and fields. Single or multi-region.
  • finite area meshes and fields. Single region.
  • lagrangian (clouds). Single or multiple clouds.

The Catalyst function object is a community module that has been developed by OpenCFD in collaboration with Simone Bna and with the kind support of Andy Bauer.

Installation support with spack is current approaching completion and will be available within a few weeks.

Build requirements
  • OpenFOAM-v1806 or newer.
  • ParaView 5.4 or newer, compiled with python support.

ParaView 5.5 or newer is recommended for its more advanced script generation support. If building from source, the additional patches applied by the ThirdParty makeParaView script are also recommended for better support of the OpenFOAM -case option.

Source code
$WM_PROJECT_DIR/modules/catalyst
Examples
$WM_PROJECT_DIR/modules/catalyst/tutorials/finiteArea/sphereSurfactantFoam/sphereTransport
$WM_PROJECT_DIR/modules/catalyst/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater
$WM_PROJECT_DIR/modules/catalyst/tutorials/incompressible/icoFoam/cavity
$WM_PROJECT_DIR/modules/catalyst/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek
$FOAM_TUTORIALS/incompressible/overPimpleDyMFoam/twoSimpleRotors/system/catalyst

Writing residual fields

The residuals function object now enables users to create linear solver residual fields, which are stored on the mesh database and can be optionally written to disk according to the chosen write controls. The following animation shows the evolution of the p_rgh field and its initial residual for the BernardCells tutorial case.

Source code
$FOAM_SRC/functionObjects/utilities/residuals
Examples
$FOAM_TUTORIALS/heatTransfer/buoyantBoussinesqPimpleFoam/BernardCells/system/residuals
$FOAM_TUTORIALS/incompressible/pisoFoam/LES/motorBike/motorBike/system/stabilizationSchemes

Updated writing of VTK format data

Updated vtkWrite function object

Now disabled in -postProcess mode to avoid accidental overwrite of run-time conversions.

The new default is to write the without additional polyhedral decomposition, since this produces compacter files and VTK manages this in most instances. The optional dictionary decompose flag can be used to reinstate the old behaviour.

Source code
$FOAM_SRC/functionObjects/utilities/vtkWrite
Examples
$FOAM_TUTORIALS/incompressible/simpleFoam/windAroundBuildings

New vtkCloud function object

This new function object writes Lagrangian data in the VTK polyData format with the extension .vtp during a simulation. In parallel, all data are written from the master.

The result is a .vtp per cloud and time-step containing positions and all of the selected fields.

The time information is stored redundantly. Each data file contains this information in the first XML comment within the file. For example,

<!-- cloud=limestoneCloud1 time=0.005 index=200 -->

Additionally, a .vtp.series time series file is created for each cloud. This file contains a listing of file names and their associated times in a human readable format that can also be loaded directly as a sequence with ParaView 5.5 or later.

Source code
$FOAM_SRC/functionObjects/lagrangian/vtkCloud
Examples
$FOAM_TUTORIALS/lagrangian/coalChemistryFoam/simplifiedSiwek

Updated writing of Ensight format data

EnSight format for sampled surfaces

The sampled surface geometry is now written in the same directories as the sampled fields. This allows a more flexible response to changes in the underlying sampled surface geometry.

The surface output writers are now triggered when a change in the surface geometry occurs. This fixes a previous bug where the collated EnSight surface format would not follow changes the iso-surfaces.

Updated ensightWrite function object

Now disabled in -postProcess mode to avoid accidental overwrite of run-time conversions.

The ensight mesh geometry is now stored in the same location as the fields, so there is no initial distinction in the output between moving and non-moving simulations. Only when the ensight case file is written will a distinction be seen.

For moving cases, the geometry varies with time and a combination of a time-set and a data mask are used to locate the files.

GEOMETRY
model:  1   data/********/geometry

For non-moving cases, the geometry is time-invariant and is referenced directly.

GEOMETRY
model:  data/00000000/geometry

The ensight case file is now flushed every time the function object write is called. This ensures that the case file always contains the current values and allows immediate loading of the case file and processing of the data during the calculation.

The ensightWrite function object now supports the nodeValues option for consistency with the foamToEnsight utility.

Source code
$FOAM_SRC/functionObjects/utilities/ensightWrite
Examples
$FOAM_TUTORIALS/incompressible/simpleFoam/windAroundBuildings
$FOAM_TUTORIALS/incompressible/pimpleFoam/RAS/wingMotion/wingMotion2D˙pimpleFoam
$FOAM_TUTORIALS/incompressible/simpleFoam/motorBike

Improved sampling options

Surface sampleScheme

The surface sampling routines can specify an alternative sampling scheme for obtaining the face values instead of just using the cell value.

{
    type    surfaces;
    libs    ("libsampling.so");
    ...
    sampleScheme  cellPoint;
    interpolationScheme cellPoint;
}
This can be useful for cases when the sampling face is close to a cell boundary and when there are large gradients in the sampled field.

Source code
$FOAM_SRC/sampling/sampledSurface/sampledSurfaces
$FOAM_SRC/src/sampling/surfMeshSample/surfMeshSamplers

New cellCentre sampledSet

Samples on cell centres, can optionally be limited based on a bounding box. This can be used, for example, to extract volume fields into a CSV or other format for use with external programs.

Source code
$FOAM_SRC/sampling/sampledSet/cellCentre
Examples
$FOAM_SRC/compressible/rhoSimpleFoam/squareBend

Bounded sampling planes

The new bounds entry for sampling planes enables users to restrict the extent of the plane, as shown below:

plane1
{
    type        plane;
    source      cells;

    planeType   pointAndNormal;

    pointAndNormalDict
    {
        normal      (-1 0 0);
        point       (-0.04 0 0);
    }

    bounds      (-1 -1 -1) (0 0 1);
}

Distance surface sampling

Users can now define non-closed signed distance surfaces. This allows their use as flexible alternative to a sampled plane with bounding box restrictions, or to sample on arbitrary surface, e.g. a hemisphere in an outflow.

Source code
$FOAM_SRC/sampling/sampledSurface/distanceSurface
$FOAM_SRC/sampling/surfMeshSample/distanceSurface/surfMeshSampleDistanceSurface
Examples
$FOAM_SRC/compressible/rhoSimpleFoam/squareBend

Derived sampled fields

Now support the specification of a rhoRef when calculating rhoU or pTotal as a derived sampled surface field for incompressible cases.

Source code
$FOAM_SRC/sampling/surfMeshSample/surfMeshSamplers
Examples
$FOAM_SRC/incompressible/rhoSimpleFoam/squareBend

New uniformity index

Added a new flow uniformity operation to the surfaceFieldValue function object, available in regular, weighted and absolute weighted versions.

Note: When the mass-flow is taken for the weight field, an intermediate sampling into surfFields is likely to be required.

Source code
$FOAM_SRC/functionObjects/field/fieldValues/surfaceFieldValue
Example case
$FOAM_TUTORIALS/compressible/rhoSimpleFoam/squareBend
$FOAM_TUTORIALS/incompressible/simpleFoam/squareBend