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

From OpenFOAMWiki
(Initial contents for the parallelized version (tentative))
Line 1: Line 1:
The OpenFOAM reader included in ParaView3 (tips for enabling the reader is documented [[Tip_Build_A_Paraview3_Plugin|here]]) lacks a number of essential features to be practially used, so I re-coded the reader from ground up and posted to [http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?tpc=1&post=17466#POST17466 the Message Board]. This page is meant as the documentation for the reader.
+
=Short description=
 +
 
 +
This is a development snapshot of OpenFOAM native reader for ParaView 3.3-CVS and its experimental parallelization extension for decomposePar-ed cases.
 +
 
 +
I repeart, this a development snapshot. This is not made to be as robust as the past serial versions have been.
  
 
=Features=
 
=Features=
  
The reader
+
* 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.
* 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).
+
* 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.
  
* has improved performance and compatibility over the reader included in the ParaView sources.
+
* Portable. The readers works under Linux, Mac OS X and Windows without any porting works.
  
* supports all combinations of vol/point/lagrangian (of class Cloud)-Scalar/Vector/SphericalTensor/SymmTensor/Tensor fields (See Notes below to use the lagrangian feature).
+
* Too many to write now, more to come later
  
* supports compressed(gzipped)/uncompressed-ascii/double precision binary data formats. Single precision binary format is not supported.
+
=Installation=
  
* 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)
+
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.
  
* has a neat user interface. Patch and array selection lists are now offered.
+
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.
  
* supports some (but not all) of the extended file format introduced in OF 1.5.
+
==Installation: serial reader==
  
=Installation=
+
1. Only required for ThirdParty ParaView3.3-cvs: Setup your OF environment.<bash>. ~/OpenFOAM/OpenFOAM-1.5/etc/bashrc</bash>
  
1. Get the ParaView3 source.
+
2. Untar the package at the parent directory of ParaView3 source tree.<bash>tar zxf <packageName>-<releaseDate>.tar.gz</bash>
*For 3.3-CVS:
+
<bash>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</bash>
+
*For 3.2.1:
+
<bash>tar -zxf paraview-3.2.1.tar.gz
+
ln -s ParaView3.2.1 ParaView3</bash> (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
+
3. Run the preInstall script.<bash><packageDirectory>/BSD/preInstall.sh</bash>
(the directory where you issued the above cvs commands). This will
+
overwrite the reader code included in the source tree.
+
<bash>tar jxf vtkOpenFOAMReader-YYYYMMDD.tar.bz2</bash>
+
3. Patch the XML code at the parent dirctory.
+
<bash>patch -b -p0 < readers.xml.diff</bash>
+
*For 3.2.1: add the following piece into ParaView3.2.1/Qt/Components/Resources/XML/ParaViewReaders.xml.
+
<xml><Reader name="OpenFOAMReader"
+
          extensions="foam"
+
          file_description="OpenFOAM Files">
+
</Reader></xml>
+
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.
+
  
=Notes=
+
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.
  
* To load an OpenFOAM case, you either have to
+
* For ThirdParty ParaView3.3-cvs:
** 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
+
** If you have built your own binary of ParaView,<bash>buildParaView3.3-cvs 1            # should finish in a minute or two!</bash>
** create a symbolic link from controlDict to controlDict.foam and open controlDict.foam.
+
** If you have not,<bash>buildParaView3.3-cvs              # wait for a while until it finishes</bash>
  
* 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.
+
==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.
  
* 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.
+
0. <b>[IMPORTANT]</b>
 +
* 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).
  
* Several compile-time performance-related configuration options are now provided at the beginning of vtkOpenFOAMReader.cxx. With defaults the reader
+
1. Create a build directory.
** 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).
+
2. Run ccmake from within the build directory. Set ParaView_DIR to your ParaView build directory (not the source directory) at the command line.<bash>cd <buildDirectory>
 +
ccmake <packageDirectory>/GPL -DParaView_DIR=<path to your paraview build></bash>
  
* To create a slice with volField data you have to extract internal mesh (dataset 0) or turn off reading patches in the reader panel.
+
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).
  
* 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.
+
4. Run make.<bash>make</bash>
  
* 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.
+
5. Copy the following produced libraries to your plugin directory.<bash>libOpenFOAMPanel.*
 +
libPOpenFOAMPanel.*
 +
libPOpenFOAMReaderGUIPlugin.*
 +
libPOpenFOAMReaderSMPlugin.*</bash>where * is the extension given to shared libraries on your platform(so, dylib or dll).
  
* 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.
+
=Usage=
 +
==Serial reader==
  
* 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.)
+
*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.
  
* Mesh which consists of polyMesh/points, polyMesh/faces and polyMesh/cells (old mesh format) is not supported.
+
==Parallelized reader==
  
*On 3.3-CVS Filters->Append Attributes and Filters->Append Datasets can be run after running Filter->Merge Blocks over the reader output. Filters->Surface Flow runs as is since it is now compatible with the reader output. However the calculated value of Surface Flow should be taken only as a rough indication. Using calcMassFlow ([[Contrib_calcMassFlow|here]] or [http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?tpc=1&post=20736#POST20736 here]) is recommended for accuracy. The technique does not work for 3.2.1 because there is no Merge Blocks filter.
+
* <b>[IMPORTANT]</b> 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.
  
* For binary-formatted Lagrangian positions files the reader only supports the ones created by OF version 1.4 or later.
+
* The stub file extension assigned to the reader is ".pfoam". Create a stub file like in the case of serial reader and open it.
  
* The FoamFile parser is still under development so if you find a bug posting a minimal test case will be highly appreciated.
+
* 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 a decomposePar-ed case directly.
 +
 
 +
=Notes=
 +
 
 +
* See the ReleaseNotes in the package for now. [To be added later]
  
 
=Downloads=
 
=Downloads=
Download from [http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?tpc=1&post=17466#POST17466 the native reader thread] on the Message Board.
 
  
You can also download prebuilt binaries with the reader included [http://oshima.eng.niigata-u.ac.jp/OpenFOAM/ParaView/ here] (currently only available for Windows).
+
Development snapshot:
 +
*[[Media:vtkPOpenFOAMReader-20080831.tar.gz|vtkPOpenFOAMReader-20080831.tar.gz]]
 +
 
 +
 
 +
Past serial versions:
 +
* Download from [http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?tpc=1&post=17466#POST17466 the native reader thread] on the Message Board.
  
 
=History=
 
=History=
 +
[[User:7islands|7islands]] 06:57, 31 August 2008 (CEST) (Takuya OSHIMA): moved to Contrib section. Initial upload of the parallelized version.
 +
 
[[User:7islands|7islands]] 02:58, 28 April 2008 (CEST) (Takuya OSHIMA): update for the 20080324 version.
 
[[User:7islands|7islands]] 02:58, 28 April 2008 (CEST) (Takuya OSHIMA): update for the 20080324 version.
  

Revision as of 04:57, 31 August 2008

1 Short description

This is a development snapshot of OpenFOAM native reader for ParaView 3.3-CVS and its experimental parallelization extension for decomposePar-ed cases.

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

2 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.
  • Too many to write now, more to come later

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

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

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

4 Usage

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

4.2 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 a decomposePar-ed case directly.

5 Notes

  • See the ReleaseNotes in the package for now. [To be added later]

6 Downloads

Development snapshot:


Past serial versions:

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