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

From OpenFOAMWiki
m (added ParaView 3.5-CVS as one of the supported versions)
m (Usage: parallelized reader: added link to ParaView wiki)
Line 97: Line 97:
  
 
* There is a user convenience script "pvFoam" which works just like paraFoam.
 
* There is a user convenience script "pvFoam" which works just like paraFoam.
 +
 +
* For general instructions on configuring ParaView in server/client mode, have a look at the Server Setup section of [http://www.paraview.org/Wiki/ParaView ParaView Wiki].
  
 
=Notes=
 
=Notes=

Revision as of 04:10, 26 September 2008

1 Short description

This is a development snapshot of OpenFOAM native reader for ParaView 3.3/3.5-CVS (vtkOpenFOAMReader) and its experimental parallelization extension for decomposePar-ed cases (vtkPOpenFOAMReader).

I repeart, this a development snapshot. This is not made to be as robust as the past serial versions have been.

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

3 Licenses

The serial part of the package is licensed under the ParaView License (a BSD license), while the parallel part and the additional UIs comes with GPL, as a compromise of complicated licensing issues coming from the fact that I am using an open source edition of Qt. I am willing to hear better solutions if any (except "buy a commercial edition of Qt").

4 Installation

For now the installation configuration of the readers is a bit irregular: the installation of serial reader will be done by overwriting the existing reader in the ParaView source tree, while the parallelized reader and the additional reader UIs 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. Note that in order to install the parallelized reader, the serial reader must have been installed.

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-CVS: 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.
  • Obviously, you need to build ParaView with parallelization support (PARAVIEW_USE_MPI=ON).

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 for the ParaView build (otherwise the plugin will not load).

4. Run make.
make
5. Copy the following produced libraries to your plugin directory.
libOpenFOAMPanel.*
libPOpenFOAMPanel.*
libPOpenFOAMReaderGUIPlugin.*
libPOpenFOAMReaderSMPlugin.*
where * is the extension given to shared libraries on your platform(so, dylib or dll).

5 Usage

5.1 Usage: serial reader

  • 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 "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: parallelized reader

  • [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 stub file extension assigned to the reader is ".pfoam". Create a stub file like in the case of serial reader and open it.
  • 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.
  • The reader can also read a reconstructed case (a serial case) by setting the combo box at top-left of the reader panel to "Reconstructed case."
  • There is a user convenience script "pvFoam" which works just like paraFoam.
  • 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. At times you may see a bizarre message "had to make up a value for selection" when the selection lists of the reader panel are refreshed. The issue has been filed as a ParaView bug #7583. (Update: fixed in cvs versions newer than 20080905)

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

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

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

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

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

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

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

12. 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.).

13. Single precision binary format is not supported.

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

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

7. The reader does not output processor boundary patches. 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.

8 Downloads

Development snapshot:

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

Past serial versions:

9 Feedback

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

10 History

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.