v2212: New and improved post-processing

New EnSight mesh reader


Importing EnSight Gold meshes in both ascii and binary format is now supported, where files have the '.geo' extension. The importer accepts all cell shapes supported by the foamToEnsight converter. Supported keywords include:

  • extents
  • node id 'given', 'ignore', 'assign'
  • node_ids
  • element id 'given', 'ignore', 'assign'
  • element_ids
  • part
  • coordinates
  • tetra4
  • pyramid5
  • penta6
  • hexa8
  • nfaced
  • tria3
  • quad4
  • nsided

However, the following are not supported:

  • 2D (finite-area) meshes
  • block structured meshes
  • quadratic elements, e.g. twenty node hexahedron
  • faceZones
  • baffles

The importer reads all parts, combines all cells (tetra3, hexa8 etc.) and determines the outside faces. All points are merged using a geometric test (see below) and the importer uses all faces (tria3 etc.) to patch any outside faces. Patch names are assigned the original part names with any illegal word symbol replaced by underscores ('_'). Any remaining outside faces are added to a defaultFaces patch of type empty.


  • mergeTol: optional merge tolerance to obtain the correspondence between points of different parts. Default is 1e-10 of the bounding box of all points. Specifying 0 disables any point merging (and hence patching).
  • scale: optional scaling for the coordinates. Default is no scaling. Scaling is useful to convert units, e.g. from [mm] to [m].
  • keepHandedness: by default the mesh reader will flip (non-polyhedral) cells with negative volume. It will display warning messages of the form 'zero or negative pyramid volume'. This flag will disable this check and use the normal vertex numbering.

Source code

Improved EnSight output


More consistent handling of file and variable names

  • To avoid illegal and poorly readable names, e.g. the output field name PaSR<psiReactionThermo>:Qdot is now sanitised as PaSR_psiReactionThermo_Qdot.

Atomic file operations are now used when writing EnSight output.

  • Output is now committed to disk as a single operation after all writing is completed. In the case of failure, this avoids incomplete or partial files, but in the general case it also avoids issues when loading EnSight output while it is still being generated by the simulation.

Improved parallel performance

  • The EnSight writing routines have been reworked to improve their performance with larger processor counts, e.g. 1000+ ranks. Since the changes are largely related to the sparsity, the improvement will be less pronounced for lower processor counts. The following graph shows a performance comparison for a 60M cell case operating on 4096 cores and writing 130 fields:

Improved ensightWrite, vtkWrite function objects


The ensightWrite and vtkWrite function objects now support excluding fields and patches. This allows blocking out patches, e.g. outer walls, inlet/outlet etc. that are not particularly interesting to visualise, and  aligns the functionality more with the foamToEnsight and foamToVTK standalone applications.

Improved surface writers


New options

  • The boundaryData writer output can now include the face area-normals, which helps support additional post-processing of the extracted data.
  • All sampled surfaces now also support arbitrary Cartesian coordinate transformations, e.g.
        scale 1000;  // m -> mm
            // origin  (0 0 0);
            rotationCentre  (1 0 0);
            rotation axisAngle;
            axis    (0 0 1);
            angle   -45;

As the example illustrates, it is also possible to specify a rotationCentre to rotate the surfaces in-place. This additional transform enables mapping of simulation data to component sub-assemblies, which are typically described in a different coordinate system location. The rotationCentre behaves like the transformPoints and surfaceTransformPoints '-centre' option in that it removes the specified amount from the point locations, applies the rotation and finally adds the specified amount back to the newly rotated point locations.

Improved parallel performance

The inter-process communication for merged fields now uses an MPI scheduled communication, but is user-selectable. The surface merge information is reused for field merging, which avoids an additional MPI call to gather sizes each time. These changes will not be noticeable unless surface sampling is performed very frequently, e.g. every iteration, and with large core counts.

Improved noise utility


Text files generated by the noise utility have been updated from the earlier 'graph' format to a more descriptive text format that includes additional case information, e.g. the surface area-averaged value headers:

# f [Hz] vs P(f) [Pa]                                                            
# Lower frequency: 2.50000000e+01                                                
# Upper frequency: 5.00000000e+01                                                
# Window model  : Hanning                                                        
# Window number : 7                                                              
# Window samples: 128                                                            
# Window overlap %: 5.00000000e+01                                               
# dBRef         : 2.00000000e-05                                                 
# Area average  : true                                                           
# Area sum      : 8.99999982e-02                                                 
# Number of faces: 400                                                           
# f                 P(f)


Merge request

New turbulence resolution quality estimation


Grid independence studies and grid adaptation for implicit LES/DES are nontrivial and intractable due to the inherent coupling between spatial resolution and subgrid-scale modelling.

To enable assessment of the mesh requirements for LES/DES calculations, the new resolutionIndex function object provides a single-mesh resolution index, offering the following submodels:

  • Pope (2000)'s index using turbulent kinetic energy variables,
  • Celik et al. (2005) and Celik et al. (2009)'s index using
    • effective Kolmogorov length scale, and
    • effective viscosity.

A minimal example is shown below:

    // Mandatory entries
    type            resolutionIndex;
    libs            (fieldFunctionObjects);
    model           <word>;

    // Conditional entries

        // Option-1: when model == PopeIndex

        // Option-2: when model == CelikNuIndex

        // Option-3: when model == CelikEtaIndex

    // Inherited entries

The illustration below shows a Smagorinsky-based large-eddy simulation and the resolution-index fields for coarse and fine resolutions:

Source code


  • Pope, S. B. (2000). Turbulent flows. Cambridge, UK: Cambridge Univ. Press
  • Celik, I. B., Cehreli Z. N., Yavuz I. (2005). Index of resolution quality for large eddy simulations. Journal of Fluids Engineering. 127:949–958.
  • Celik, I., Klein, M., & Janicka, J. (2009). Assessment measures for engineering LES applications. Journal of fluids engineering, 131(3)


OpenCFD would like to acknowledge and thank Prof. Ismail Celik for his contributions, elaborate suggestions and help, and critical recommendations.

Merge request

Improved histogram generation


The histogram function object has been refactored and extended to include two new submodels:

  • equalBinWidth: groups data into bins of equal widths (previous behaviour)
  • unequalBinWidth: groups data into bins of unequal widths.

The earlier output based on files per time-step has been replaced by a single file.

    type                    histogram;

    // Option-1
    model                   equalBinWidth;

    // Option-2
    model                   unequalBinWidth;


Source code


Merge request

Improved heat transfer coefficient function object


The heatTransferCoeff function objects has been refactored and a new submodel, faceZoneReferenceTemperature, introduced. This submodel evaluates the heat transfer coefficient using the area-average temperature of a specified face zone as the reference temperature. A minimal example usage follows:

    // Inherited entries

    // Mandatory entries
    htcModel            faceZoneReferenceTemperature;
    referenceFaceZone   <word>;

    // Optional entries
    referenceRegion     <word>;

Source code

Merge request

Improved fvOption output


The following fvOptions now support writing to file:

  • velocityDampingConstraint
  • limitTemperature
  • limitVelocity

Writing is controlled by the new writeToFile option as shown below:

    type                    limitVelocity;

    // writeFile entries
    writeToFile             true;

Examples showing the structure of the output files generated for each of the options are shown below.



# UMax          : 10
# Time              nDamped_[count]     nDamped_[%]



# Tmin          : 280
# Tmax          : 310
# Time              nDampedCellsMin_[count] nDampedCellsMin_[%] nDampedCellsMax_[count] nDampedCellsMax_[%]



# UMax          : 10
# Time             nDampedCells_[count]    nDampedCells_[%]    nDampedFaces_[count]    nDampedFaces_[%]

Source code

Merge request

Improved turbulenceFields function object


The turbulenceFields function object provides access to fields created and/or used by turbulence models, including:

  • k: turbulent kinetic energy

  • epsilon: turbulent kinetic energy dissipation rate

  • omega: specific dissipation rate

  • nuTilda: modified turbulent viscosity (Spalart-Allmaras turbulence model)

  • mut, nut: turbulent viscosity (dynamic, kinematic)

  • muEff, nuEff: effective turbulent viscosity (dynamic, kinematic)

  • alphat: turbulence thermal diffusivity

  • alphaEff: effective turbulence thermal diffusivity

  • R: Reynolds stress tensor

  • DevRhoReff, DevReff: Deviatoric part of the effective Reynolds stress (compressible, incompressible)

  • L: integral-length/Mixing-length sale

  • I: turbulence intensity

  • LESRegion: DES model LES region indicator field

  • fd: DES model shielding function

where the LESregion and fd options have been added to the latest release. An example use from the vortexShed case is shown below

    type            turbulenceFields;
    libs            (fieldFunctionObjects);
    writeControl    writeTime;
    fields          (fd LESRegion);


Source code