6.4 Third-Party post-processing

OpenFOAM includes the following applications for converting data to formats for post-processing with several third-party tools. For EnSight, it additionally includes a reader module, described in the next section.

foamDataToFluent
Translates OpenFOAM data to Fluent format.
foamToEnsight
Translates OpenFOAM data to EnSight format.
foamToEnsightParts
Translates OpenFOAM data to Ensight format. An Ensight part is created for each cellZone and patch.
foamToGMV
Translates foam output to GMV readable files.
foamToTetDualMesh
Converts polyMesh results to tetDualMesh.
foamToVTK
Legacy VTK file format writer.
smapToFoam
Translates a STAR-CD SMAP data file into OpenFOAM field format.

6.4.1 Post-processing with Ensight

OpenFOAM offers the capability for post-processing OpenFOAM cases with EnSight, with a choice of 2 options:

  • converting the OpenFOAM data to EnSight format with the foamToEnsight utility;
  • reading the OpenFOAM data directly into EnSight using the ensight74FoamExec module.

6.4.1.1 Converting data to Ensight format

The foamToEnsight utility converts data from OpenFOAM to EnSight file format. For a given case, foamToEnsight is executed like any normal application. foamToEnsight creates a directory named Ensight in the case directory, deleting any existing Ensight directory in the process. The converter reads the data in all time directories and writes into a case file and a set of data files. The case file is named EnSight_Case and contains details of the data file names. Each data file has a name of the form EnSight_nn.ext, where nn is an incremental counter starting from 1 for the first time directory, 2 for the second and so on and ext is a file extension of the name of the field that the data refers to, as described in the case file, e.g.T for temperature, mesh for the mesh. Once converted, the data can be read into EnSight by the normal means:

  1. from the EnSight GUI, the user should select Data (Reader) from the File menu;
  2. the appropriate EnSight_Case file should be highlighted in the Files box;
  3. the Format selector should be set to Case, the EnSight default setting;
  4. the user should click (Set) Case and Okay.

6.4.1.2 The ensightFoamReader reader module

EnSight provides the capability of using a user-defined module to read data from a format other than the standard EnSight format. OpenFOAM includes its own reader module ensightFoamReader that is compiled into a library named libuserd-foam. It is this library that EnSight needs to use which means that it must be able to locate it on the filing system as described in the following section.

In order to run the EnSight reader, it is necessary to set some environment variables correctly. The settings are made in the bashrc (or cshrc) file in the $WM_PROJECT_DIR/etc/apps/ensightFoam directory. The environment variables associated with EnSight are prefixed by $CEI_ or $ENSIGHT7_ and listed in Table 6.1. With a standard user setup, only $CEI_HOME may need to be set manually, to the path of the EnSight installation.


Environment variable

Description and options



$CEI_HOME

Path where EnSight is installed, eg /usr/local/ensight, added to the system path by default

$CEI_ARCH

Machine architecture, from a choice of names corresponding to the machine directory names in $CEI_HOME/ensight74/machines; default settings include linux_2.4 and sgi_6.5_n32

$ENSIGHT7_READER

Path that EnSight searches for the user defined libuserd-foam reader library, set by default to $FOAM_LIBBIN

$ENSIGHT7_INPUT

Set by default to dummy




Table 6.1: Environment variable settings for EnSight.

The principal difficulty in using the EnSight reader lies in the fact that EnSight expects that a case to be defined by the contents of a particular file, rather than a directory as it is in OpenFOAM. Therefore in following the instructions for the using the reader below, the user should pay particular attention to the details of case selection, since EnSight does not permit selection of a directory name.

  1. from the EnSight GUI, the user should select Data (Reader) from the File menu;
  2. The user should now be able to select the OpenFOAM from the Format menu; if not, there is a problem with the configuration described above.
  3. The user should find their case directory from the File Selection window, highlight one of top 2 entries in the Directories box ending in /. or /.. and click (Set) Geometry.
  4. The path field should now contain an entry for the case. The (Set) Geometry text box should contain a ‘/’.
  5. The user may now click Okay and EnSight will begin reading the data.
  6. When the data is read, a new Data Part Loader window will appear, asking which part(s) are to be read. The user should select Load all.
  7. When the mesh is displayed in the EnSight window the user should close the Data Part Loader window, since some features of EnSight will not work with this window open.
OpenFOAM v7 User Guide - 6.4 Third-Party post-processing
CFD Direct