Difference between revisions of "Contrib Parallelized Native OpenFOAM Reader for ParaView"

From OpenFOAMWiki
(The check-in to ParaView CVS was reverted due to too many errors by older compilers.)
m (Feedback)
Line 184: Line 184:
  
 
=Feedback=
 
=Feedback=
 +
* A use case on a supercomputing cluster: [http://www.csc.fi/csc/kurssit/arkisto/ofud09 "Parallelized OpenFOAM reader for Paraview - An example"] by CSC Finland
 +
 
If you found bugs or have comments, post to [http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?tpc=1&post=17466 the native reader thread].
 
If you found bugs or have comments, post to [http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?tpc=1&post=17466 the native reader thread].
  

Revision as of 10:24, 12 February 2009

1 Short description

This is an OpenFOAM native reader for ParaView 3.3/3.4/3.5 and VTK (vtkOpenFOAMReader) and its parallelization extension for decomposePar-ed cases (vtkPOpenFOAMReader).

2 Features

2.1 Features: main features

  • Fast. For a rough performance indication, the serial reader loads an ascii-gzipped mesh with 3.5 million hexahedral cells in 9 seconds on my 3.0 GHz Mac Pro.
  • Memory efficient. The readers typically requires less memory than PV3FoamReader. The above mentioned case crashes a 32-bit version of ParaView due to out of memory if loaded by PV3FoamReader, while the reader does not.
  • Portable. The reader works under Linux, Mac OS X and Windows without any porting works.
  • Supports parallel decomposed cases and multi-region cases.

2.2 Features: new features/changes from the last release (20080728)

  • Removed the Accumulate Patches option. Zero-sized patches are now always preserved in the selection list.
  • Fixed cell normal directions (they all have been inverted!).
  • Experimental parallelized reader plugin for decomposed cases (vtk"P"OpenFOAMReader).
  • Support for standard multi-region cases where mesh for each region is separeted into separate subdirectory. This means chtMultiRegionFoam is not supported.
  • Dropped ParaView 3.2.x support.
  • Support for old mesh format (points/faces/cells).
  • Addition of several extra mesh consistency checks.
  • The license of the reader is now compatible with ParaView License v1.2, except for the GPLed materials under the GPL subdirectory.
  • Fixed compressed lagrangian positions not being detected.
  • Now warns about the existence of different time directories with the same time value and removes the duplicates (e.g. "0" and "0.000").
  • Added a Refresh button to refresh case information (timesteps etc.).
  • Added a feature to attach the case path as field data to the output. This can be accesible from a downstream programmable filter as follows.
input = self.GetInputDataObject(0, 0)
casePath = input.GetFieldData().GetArray("CasePath").GetPointer(0)
NB: In client/server mode, the case path is not added to the output of pvserver processes whose IDs are equal or larger than the number of available processor subdirectories, since it is the behavior specified in The ParaView Guide.
  • Added labelField support for lagrangians.
  • Added feature to change case without starting over.

3 Licenses

The serial part of the package is licensed under the ParaView License (a BSD license, "the code may be used in commercial products without condition" in Kitware's words). On the other hand the parallel part and the additional UI are licensed under GPL in order to avoid complicated licensing issues coming from the fact that I am using an open source edition of Qt. I am willing to hear suggestions (except "buy a commercial edition of Qt").

4 Installation

For now the installation configuration of the reader is a bit irregular: the installation of the serial part will be done by overwriting the existing reader in the ParaView source tree, while the parallel part and the additional UI will be built as plugins.

First install the serial reader as noted by BSD/ReleaseNotes, then proceed to install the parallel reader following GPL/ReleaseNotes.

[IMPORTANT] You must install both of the serial and parallel reader even if you only need the serial reader.

4.1 Installation: serial reader

1. Only required for ThirdParty ParaView3.3-cvs: Setup your OF environment.
. ~/OpenFOAM/OpenFOAM-1.5/etc/bashrc
2. Untar the package at the parent directory of ParaView3 source tree.
tar zxf <packageName>-<releaseDate>.tar.gz
3. Run the preInstall script.
<packageDirectory>/BSD/preInstall.sh

4. Build ParaView3.

  • For general ParaView 3.3/3.4: Build ParaView3 as usual. You would want to turn on compiler optimization (set CMAKE_BUILD_TYPE to Release). Without it the reader is dead slow. For a rough performance indication, the reader loads an ascii-gzipped mesh with 3.5 million hexahedral cells in 9 seconds on my 3.0 GHz Mac Pro.
  • For ThirdParty ParaView3.3-cvs: If you have built your own binary of ParaView,
    buildParaView3.3-cvs 1             # should finish in a minute or two! 
    
 If you have not,
buildParaView3.3-cvs               # wait for a while until it finishes 
 

4.2 Installation: parallelized reader

The package can be installed with the usual installation procedure of ParaView plugins. For details you would want to refer to Section 19.2 of The ParaView Guide. In brief, it goes as follows.

0. [IMPORTANT]

  • Installation of vtkOpenFOAMReader (the serial version of the reader) is required before installation of the parallel reader.
  • In order for parallelization to work you need to build ParaView with parallelization support (PARAVIEW_USE_MPI=ON). However if you just like to read decomposed cases in serial the parallelization support is not mandatory.

1. Create a build directory.

2. Run ccmake from within the build directory. Set ParaView_DIR to your ParaView build directory (not the source directory) at the command line.
cd <buildDirectory>
ccmake <packageDirectory>/GPL -DParaView_DIR=<path to your paraview build>

3. Configure the build. Note that CMAKE_BUILD_TYPE must be same as the one used for the ParaView build (otherwise the plugin will not load).

4. Run make.
make
5. Copy the following produced libraries to your plugin directory.
[lib]POpenFOAMPanel.*
[lib]POpenFOAMReaderSMPlugin.*
where * is the extension given to shared libraries on your platform(so, dylib or dll).

5 Usage

5.1 Usage: general

  • 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 strings that starts with "controlDict," and open <caseName>.foam or
    • create a symbolic link from controlDict to controlDict.foam and open controlDict.foam.
  • There is a user convenience script "pvFoam" which works just like paraFoam.
  • There is a "Refresh" button on the top right of the reader panel which triggers the reader to refresh the case information, including timesteps, when clicked. This is supposed to be useful when watching a running simulation.

5.2 Usage: parallel-specific

  • [IMPORTANT] The POpenFOAMReaderSM plugin must be loaded as a remote plugin before loading a parallel case when ParaView is run in client/server mode. Otherwise ParaView will crash.
  • The Case Type selection combo box determines whether a reconstructed case or a decomposed case will be loaded. The parallelization works only for decomposed cases in client/server mode. If you try to load a reconstructed case in server/client mode, it will be loaded into pvserver process 0 (then you can apply Merge Blocks -> D3 to distribute the data).
  • You can use the reader either in client/server mode or in builtin server mode. In the latter case the reader works as a serial reader that can read all decomposePar-ed processor subdirectories at once.
  • For general instructions on configuring ParaView in server/client mode, have a look at the Server Setup section of ParaView Wiki.

6 Notes

6.1 Notes: general

1. $-expansion only works for complete syntactic units. e. g.
fieldValue       uniform 0;
internalField    $fieldValue;
is supposed to work, while
fieldValue       0;
internalField    uniform $fieldValue;
and
uniformity       uniform;
internalField    $uniformity 0;
are not.

2. ~OpenFOAM expands only to $HOME/.OpenFOAM where $HOME is the user's home directory.

3. The #remove directive is not supported.

4. 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 still not as accurate as the volPoint interpolator in paraFoam, which further does inverse distance weighting of cell values.

5. 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.

6. With the default the reader omits CRC checks for gzipped files (except on Windows). If you feel it is too adventurous set VTK_FOAMFILE_OMIT_CRCCHECK to 0 at the beginning of vtkOpenFOAMReader.cxx.

7. To create a slice with volField data you have to extract internal mesh or turn off reading patches in the reader panel.

8. When the List timesteps according to controlDict checkbox is turned on 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.

9. The reader lists field 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.

10. Reading cellZones for polyhedral mesh with the Read Zones feature may cause ParaView to thrash.

11. Handling of boundary conditions is quite incomplete as of now; if a boundary patch doesn't have a value nor a uniformValue entry the corresponding patch-internal field value is used (i. e. equivalent to zeroGradient b. c.).

12. Single precision binary format is not supported.

13. The reader fails to load mesh that has negative labels in owner. This will be fixed in the next release.

14. The reader fails to restore mesh/array selection status from state file. This will be fixed in the next release.

6.2 Notes: parallel-specific

1. The number of decomposed mesh regions and the number of pvserver processes do not have to be identical, with a known exception of the following note 4.

2. The reader does nothing about adding ghost cells. So you have to see processor boundaries when your geometry is represented in Wireframe or Surface. If you want to remove internal processor boundaries from the output of Extract Surface, you can run Merge Blocks -> D3 -> Extract Surface.

3. When the reader is run in serial, you can use the Clean to Grid filter to remove internal processor boundaries.

4. To run Stream Tracer when in parallel, a pvserver process should be assigned for each decomposed mesh region (since the tracer handles inter-server process boundaries -- but not processor boundaries -- properly). For example if your case was decomposed into four processor regions, you should run four pvserver processes. On the other hand when in serial you can use Clean to Grid as noted in 3. Otherwise the streamlines will stop at appended processor boundaries.

5. Processor subdirectories are detected by the server process 0 and distributed to other processes in an interleaved way. For example, if you have processor0 - processor4 subdirectories while having 3 pvservers running, process 0 owns processor0 and processor3 subdirectories, process 1 owns processor1 and processor4, and process 2 owns processor2. The reader does not support distributed cases yet.

6. Timesteps are taken from the first processor subdirectory (typically processor0) by server process 0 and broadcasted to other processes.

7. The reader does not output processor boundary patches when reading a decomposed case. To do so you have to read each processor subdirectory as a separate case.

7 Miscellaneous

  • The parallel extension part is quite a straightforward implementation of what are written in the Section 21.3 of The ParaView Guide.
  • In my testing I get typically 2.3x - 2.5x speedups in mesh loading time by 4 process parallel execution. However everything is not so rosy especially in that I often get slower rendering times by parallel executions. As no one but me being quite new to parallel visualization, I'm interested in your findings. You are welcomed to post them to the forum.
  • The reader was once checked in as a part of ParaView but reverted due to too many errors by older compilers. The author is trying hard to resolve the isssue.

8 Downloads

Release:

Subversion repository:

  • Note that the code in the repository is almost always untested, may be broken or may not even compile. Also please keep in mind that the URL may change in the near future.
svn co https://of-interfaces.svn.sourceforge.net/svnroot/of-interfaces/trunk/vtkPOpenFOAMReader

Technical documentation:

Past versions:

9 Feedback

If you found bugs or have comments, post to the native reader thread.

10 History

7islands 06:13, 5 October 2008 (CEST) (Takuya OSHIMA): Released 20081005. Notable changes from the 20080831 snapshot are

  • Unified application interfaces of the serial/parallel readers. Both can be accessed by opening a .foam file. Subsequently, readers.xml no longer have to be patched -- which makes tracking the CVS head of ParaView easier.
  • Fixed several bugs, notably deadlocks.
  • Added lagrangian labelField support, casePath addition to output.
  • Added feature to change case without reinstanciating another reader.

7islands 06:57, 31 August 2008 (CEST) (Takuya OSHIMA): moved to Contrib section. Initial upload of the parallelized version.

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.