Contrib Parallelized Native OpenFOAM Reader for ParaView

From OpenFOAMWiki
Revision as of 00:58, 28 April 2008 by 7islands (Talk | contribs)

The OpenFOAM reader included in ParaView3 (tips for enabling the reader is documented here) lacks a number of essential features to be practially used, so I re-coded the reader from ground up and posted to the Message Board. This page is meant as the documentation for the reader.

1 Features

The reader

  • supports the ParaView 3.3 CVS development version (as of Mar. 24, 2008) and the 3.2.1 released version.
  • is tested under Linux x86, x86_64, VS2003.net/2008 on Windows and Mac OS X Leopard (10.5).
  • has improved performance and compatibility over the reader included in the ParaView sources.
  • supports all combinations of vol/point/lagrangian (of class Cloud)-Scalar/Vector/SphericalTensor/SymmTensor/Tensor fields (See Notes below to use the lagrangian feature).
  • supports compressed(gzipped)/uncompressed-ascii/double precision binary data formats. Single precision binary format is not supported.
  • has a builtin cell data to point data filter (not as accurate as the volPoint interpolator in paraFoam but supposed to be better than the one in ParaView, see Notes below)
  • has a neat user interface. Patch and array selection lists are now offered.

2 Installation

1. Get the ParaView3 source.

  • For 3.3-CVS:
cvs -d :pserver:anoncvs@www.paraview.org:/cvsroot/ParaView3 login
    (respond with empty password)
cvs -d :pserver:anoncvs@www.paraview.org:/cvsroot/ParaView3 co ParaView3
  • For 3.2.1:
tar -zxf paraview-3.2.1.tar.gz
ln -s ParaView3.2.1 ParaView3
(a symbolic link is required for the reader package to be correctly unpacked)

2. Untar the package at the parent directory of ParaView3 source tree (the directory where you issued the above cvs commands). This will overwrite the reader code included in the source tree.

tar jxf vtkOpenFOAMReader-YYYYMMDD.tar.bz2

3. Patch the XML code at the parent dirctory.

patch -b -p0 < readers.xml.diff
  • For 3.2.1: add the following piece into ParaView3.2.1/Qt/Components/Resources/XML/ParaViewReaders.xml.
<Reader name="OpenFOAMReader"
          extensions="foam"
          file_description="OpenFOAM Files">
</Reader>

4. Build ParaView3 as usual. It is highly recommended to turn on compiler optimization (by setting CMAKE_BUILD_TYPE to Release) since the reader is dead slow without optimization. If you get a bit better performance than paraFoam the optimization is working adequately.

3 Notes

  • To load an OpenFOAM case, you either have to
    • create an empty stub file <caseName>.foam right under the case directory, where <caseName> is an arbitrary string other than the strings that starts with "controlDict," or
    • create a symbolic link from controlDict to controlDict.foam and open controlDict.foam.
  • The builtin cell-to-point filter works like a Cell Data to Point Data filter in ParaView in that it just takes the average of cell values connected to a point. The difference is that the builtin filter takes boundary patch values into account. The filter is not as accurate as the volPoint interpolator in paraFoam, which further does inverse distance weighting of cell values.
  • The cell-to-point filter is computationally demanding so you can turn it off by deselecting "Create cell-to-point filtered data" on the reader panel.
  • Several compile-time performance-related configuration options are now provided at the beginning of vtkOpenFOAMReader.cxx. With defaults the reader
    • omits CRC checks for gzipped files (except on Windows)
    • counts line numbers where the FoamFile parser is reading (if turned off, the line number will always be shown as 0 when the reader issues a parser error in return for a bit of additional performance)
    • uses its own string to floating point conversion routine, which is fast but may be a bit inaccurate than the system strtod().
  • To separate Eulerians and Lagrangians, extract Node 0 for Eulerians and Dataset 1 right under Root with Filter->Extract Block (ParaView 3.3) or group 0 for Eulerians and group 1 for Lagrangians with Extract Group (ParaView 3.2.1).
  • To create a slice with volField data you have to extract internal mesh (dataset 0) or turn off reading patches in the reader panel.
  • The reader lists time instances according to descriptions in controlDict when (adjustTimeStep, writeControl) == (yes, adjustableRunTime) or (no, timeStep) (i. e. writing interval is supposed to be constant in simulated time), or otherwise, lists all valid time directories. This is a different behavior from paraFoam which always lists all valid time directories in a case directory.
  • The reader lists array names according to the "object" entry in FoamFile header, whereas paraFoam lists according to the file name of the object. So you need a valid FoamFile header for every object.
  • The Accumulate Patches checkbox in the reader panel is meant to be used for topo change cases to append patches that don't exist in the initial timestep into the selection list over an animation run. To update the patch selection list after the run, deselect controlDict.foam in Pipeline Browser once and re-select it.
  • Handling of boundary conditions is quite poor as of now; if a boundary patch doesn't have a value entry the corresponding patch-internal field value is used (i. e. equivalent to zeroGradient b. c.)
  • Mesh which consists of polyMesh/points, polyMesh/faces and polyMesh/cells (old mesh format) is not supported.
  • It looks like Filter->Surface Flow doesn't work because of an incompatibility between what the reader offers as output dataset and what the filter requires as input, i.e. the Surface Flow filter doesn't seem to support composite dataset types, one of which is the type of dataset the reader outputs. Other possibly incompatible filters with the same reason are Append Attributes and Append Datasets (I still haven't confirmed though). Unfortunately no quick workaround come to me.
  • For binary-formatted Lagrangian positions files the reader only supports the ones created by OF version 1.4 or later.
  • The FoamFile parser is still under development so if you find a bug posting a minimal test case will be highly appreciated.

4 Downloads

Download from the native reader thread on the Message Board.

You can also download prebuilt binaries with the reader included here (currently only available for Windows).

5 History

7islands 02:58, 28 April 2008 (CEST) (Takuya OSHIMA): update for the 20080324 version.

7islands 09:18, 29 Dec 2007 (CET): some addenda.

7islands 04:36, 16 Dec 2007 (CET) (Takuya OSHIMA): Created this page.