Difference between revisions of "Sig Turbomachinery Utilities CGNS Converters"

From OpenFOAMWiki
(cgnsToFoam)
m (Downloading the CGNS converters and companion libraries)
 
(31 intermediate revisions by 4 users not shown)
Line 22: Line 22:
 
For more information on the structure of the Subversion repository for the openfoam-extend project on SourceForge.NET, see the following presentation from the 2nd OpenFOAM Workshop: [http://powerlab.fsb.hr/ped/kturbo/OpenFOAM/WorkshopZagrebJun2007/presentations/slides/slidesBeaudoinZagreb2007.pdf Open Subversion Repository Access For OpenFOAM]
 
For more information on the structure of the Subversion repository for the openfoam-extend project on SourceForge.NET, see the following presentation from the 2nd OpenFOAM Workshop: [http://powerlab.fsb.hr/ped/kturbo/OpenFOAM/WorkshopZagrebJun2007/presentations/slides/slidesBeaudoinZagreb2007.pdf Open Subversion Repository Access For OpenFOAM]
  
For browsing the openfoam-extend Subversion repository, follow this URL: [http://openfoam-extend.svn.sourceforge.net/viewvc/openfoam-extend/ http://openfoam-extend.svn.sourceforge.net/viewvc/openfoam-extend/]  
+
For browsing the openfoam-extend Subversion repository, follow this URL: [http://sourceforge.net/p/openfoam-extend/svn/HEAD/tree/ http://sourceforge.net/p/openfoam-extend/svn/HEAD/tree/]  
  
 
The CGNS converters are based on the following components:
 
The CGNS converters are based on the following components:
Line 34: Line 34:
 
== Downloading the CGNS converters and companion libraries ==
 
== Downloading the CGNS converters and companion libraries ==
 
The easiest way to retrieve the CGNS converters source code is to download the whole TurboMachinery section of the Breeder from the openfoam-extend Subversion repository.
 
The easiest way to retrieve the CGNS converters source code is to download the whole TurboMachinery section of the Breeder from the openfoam-extend Subversion repository.
 +
 +
*For OpenFOAM 2.0
 +
cd $WM_PROJECT_USER_DIR
 +
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_2.0/OSIG/TurboMachinery
 +
 +
*For OpenFOAM 1.6
 +
cd $WM_PROJECT_USER_DIR
 +
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.6/OSIG/TurboMachinery
  
 
*For OpenFOAM 1.5
 
*For OpenFOAM 1.5
 
  cd $WM_PROJECT_USER_DIR
 
  cd $WM_PROJECT_USER_DIR
  svn checkout https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/OSIG/TurboMachinery
+
  svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/OSIG/TurboMachinery
  
 
*For OpenFOAM 1.4.1
 
*For OpenFOAM 1.4.1
 
  cd $WM_PROJECT_USER_DIR
 
  cd $WM_PROJECT_USER_DIR
  svn checkout https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder/OSIG/TurboMachinery
+
  svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder/OSIG/TurboMachinery
  
  
Line 49: Line 57:
 
For example, for OpenFOAM 1.5:
 
For example, for OpenFOAM 1.5:
 
* The CGNS converters:
 
* The CGNS converters:
  svn checkout https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/OSIG/TurboMachinery/applications
+
  svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/OSIG/TurboMachinery/applications
  
 
* The companion libraries:
 
* The companion libraries:
  svn checkout https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/OSIG/TurboMachinery/src
+
  svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/OSIG/TurboMachinery/src
  
 
* The test cases:
 
* The test cases:
  svn checkout https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/OSIG/TurboMachinery/tutorials
+
  svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/OSIG/TurboMachinery/tutorials
  
  
NB: For the remaining of this document, we will assume that the whole TurboMachinery section of the Breeder_1.5 was download in the directory $WM_PROJECT_USER_DIR
+
NB: For the remaining of this document, we will assume that the whole TurboMachinery section of the Breeder_*.* was downloaded in the directory $WM_PROJECT_USER_DIR
  
 
== Compiling the companion libraries ==
 
== Compiling the companion libraries ==
Line 64: Line 72:
 
  ./Allclean
 
  ./Allclean
 
  ./Allwmake
 
  ./Allwmake
 +
 +
Note that these libraries are installed locally under their respective directory. They are not installed under $FOAM_USER_LIBBIN.
 +
 +
== Optional: compiling the CGNS Tools and Utilities ==
 +
The cgnstools are useful for viewing and editing CGNS files.
 +
 +
You first need to compile the CGNS Mid-Level library provided by cgnslib_2.5. This library is normally compiled when building the companion libraries for the CGNS converters.
 +
 +
You will also need to make sure the Tcl/Tk runtime and development libraries are available on your workstation.
 +
 +
The recipe for compiling the cgnstools is:
 +
 +
cd $WM_PROJECT_USER_DIR/TurboMachinery/src/cgnstools_2.5
 +
tar -zxvf ./cgnstools-2-5-2.tar.gz
 +
./Allwmake
 +
 +
Note that the cgnstools are installed locally under $WM_PROJECT_USER_DIR/TurboMachinery/src/cgnstools_2.5/platforms/$WM_OPTIONS/bin. They are not installed under $FOAM_USER_BIN.
 +
You will need to adjust your PATH accordingly, or modify the Allwmake script to suit your needs.
 +
 +
Here are two snapshots taken from the tool 'adfviewer' while viewing the CGNS file provided as $WM_PROJECT_USER_DIR/TurboMachinery/tutorials/cgnsConverters/test1/icem_mesh.cgns
 +
<gallery widths="100px" heights="100px" perrow="2">
 +
Image:Turbo_CgnsConverters_adfviewer.png|adfviewer
 +
Image:Turbo_CgnsConverters_adfviewer_CGNSplot.png|CGNSplot
 +
</gallery>
 +
<br clear="all" />
 +
 +
For more information about the cgnstools, please visit this site: http://www.grc.nasa.gov/WWW/cgns/cgnstools/index.html
  
 
== Compiling the CGNS converters ==
 
== Compiling the CGNS converters ==
 +
 
  cd $WM_PROJECT_USER_DIR/TurboMachinery/applications
 
  cd $WM_PROJECT_USER_DIR/TurboMachinery/applications
 
  ./Allclean
 
  ./Allclean
 
  ./Allwmake
 
  ./Allwmake
 +
 +
'''NB:'''
 +
The compilation of foamToCGNS requires the class pointVolInterpolation, which is available for OpenFoam-1.4.1-dev and OpenFOAM-1.5-dev, but not from the version distributed by OpenCFD.
 +
 +
In order to compile foamToCGNS under OpenFoam-1.4.1 and OpenFOAM-1.5 from OpenCFD, you need to make a small adjustment to the file '''cgnsToFoam/Make/options'''.
 +
 +
Here is the modification necessary for the file '''cgnsToFoam/Make/options''' under OpenFOAM-1.4.1:
 +
// We need to define some pre-processor definition
 +
// in order to adjust for various versions of OpenFOAM.
 +
// Please adjust accordingly to your own installation.
 +
//
 +
// For your information, pointVolInterpolation is not part
 +
// of OpenFOAM 1.4.1 from OpenCFD, but can be found in the openfoam-extend
 +
// distribution on SourceForge.net.
 +
// So you need to specify -DMISSING_POINTVOLINTERPOLATION -I./compatibility for
 +
// compiling with OpenFOAM 1.4.1 from OpenCFD.
 +
//
 +
// c++FLAGS+= -DOPENFOAM_VERSION=141 -DMISSING_POINTVOLINTERPOLATION -I./compatibility
 +
// c++FLAGS+= -DOPENFOAM_VERSION=141
 +
<font color=red>c++FLAGS+= -DOPENFOAM_VERSION=141 -DMISSING_POINTVOLINTERPOLATION -I./compatibility</font>
 +
 +
 +
Here is the modification necessary for the file '''cgnsToFoam/Make/options''' under OpenFOAM-1.5:
 +
// We need to define some pre-processor definition
 +
// in order to adjust for various versions of OpenFOAM.
 +
// Please adjust accordingly to your own installation.
 +
//
 +
// For your information, pointVolInterpolation is not part
 +
// of OpenFOAM 1.5
 +
// So you need to specify -DMISSING_POINTVOLINTERPOLATION -I./compatibility for
 +
// compiling with OpenFOAM 1.5
 +
//
 +
<font color=red>c++FLAGS+= -DOPENFOAM_VERSION=150 -DMISSING_POINTVOLINTERPOLATION -I./compatibility</font>
 +
// c++FLAGS+= -DOPENFOAM_VERSION=150
 +
 +
 +
== Building CGNS converters on Ubuntu 10.04 LTS ==
 +
 +
Add the PPAPPA repository from the CAE-TeamCAE-Team
 +
sudo add-apt-repository ppa:cae-team/ppa
 +
 +
and update sources list:
 +
sudo apt-get update
 +
 +
Install OpenFOAM®-ext 1.5 release:
 +
sudo apt-get install openfoam-dev-1.5 openfoam-dev-1.5-dev openfoam-dev-1.5-doc
 +
 +
Additionally install automake and libtool packages:
 +
sudo apt-get install automake libtool
 +
 +
Add alias command to ~/.bashrc to start-up OpenFOAM®-ext environment:
 +
alias startOF15dev="source /usr/lib/OpenFOAM-1.5-dev/etc/bashrc"
 +
 +
Use OpenFOAM®-ext version 1.5 in bash console:
 +
startOF15dev
 +
 +
Follow standard instructions to build CGNS converters
  
 
= Testing the CGNS converters =
 
= Testing the CGNS converters =
Line 76: Line 169:
  
 
== Test case: test1==
 
== Test case: test1==
A cgsnsToFoam test case
+
A simple cgsnsToFoam conversion test case
 +
 
 +
[[Image:Turbo_CgnsConverters_test1.png|thumb|left|Simple bump]]
 +
<br clear="all" />
  
 
== Test case: test2==
 
== Test case: test2==
Line 82: Line 178:
  
 
An example for converting periodic boundary conditions
 
An example for converting periodic boundary conditions
 +
 +
[[Image:Turbo_CgnsConverters_test2.png|thumb|left|Cycic BC]]
 +
<br clear="all" />
  
 
== Test case: test3==
 
== Test case: test3==
Reusing a foamToCGNS output as an inpput for a cgsnsToFoam test case.
+
Reusing a foamToCGNS output (from test2) as an input for a cgsnsToFoam test case.
  
 
An example for converting periodic boundary conditions
 
An example for converting periodic boundary conditions
Line 93: Line 192:
 
  % cgnsToFoam --help
 
  % cgnsToFoam --help
 
   
 
   
   Usage: cgnsToFoam <CGNS file> [-saveSolutions] [-cyclicRotX angle_nn_degree] [-cyclicRotY angle_in_degree] [-cyclicRotZ angle_in_degree]  
+
   Usage: cgnsToFoam <CGNS file> [-saveSolutions] [-cyclicRotX value] [-cyclicRotY value] [-cyclicRotZ value] [-mergeTolerance value] [-debug]  
                                [-mergeTolerance tolerance for matching identical nodes: fraction of smallest edge. Default value=0.1]
+
                                [-dryrun] [-case dir] [-cfxCompatibility] [-cyclicMatchFaceTolFactor value] [-matchCyclicBC bc1_name:bc2_name]  
                                [-zone zoneList] [-mapUnknown] [-debug] [-dryrun] [-case dir] [-cfxCompatibility]  
+
                                [-separatePatches] [-rho value] [-noMeshValidation] [-use2DElementsAsPatches]  [-help] [-doc] [-srcDoc]
                                [-cyclicMatchFaceTolFactor tolerance for matching cyclic faces: fraction of the smallest edge. Default value= 0.1]  
+
                                [-matchCyclicBC bc1:bc2] [-separatePatches] [-rho Volumic_density. Default value=1.0]  
+
                                [-novalidationMesh] [-use2DElementsAsPatches]  [-help] [-doc] [-srcDoc]
+
 
+
 
+
  
 
::{| cellpadding="8" cellspacing="0" border="3"
 
::{| cellpadding="8" cellspacing="0" border="3"
Line 114: Line 208:
 
|-
 
|-
 
| -cfxCompatibility
 
| -cfxCompatibility
|  
+
| Activate the support of specific syntax for ANSYS CFX CGNS field names<br>
 
|-
 
|-
 
| -cyclicMatchFaceTolFactor value
 
| -cyclicMatchFaceTolFactor value
| Tolerance factor for matching cyclic faces: fraction of the smallest edge. <br>Default value= 0.1  
+
| Tolerance factor for matching cyclic faces. Fraction of the smallest edge length. <br>Default value= 0.1  
 
|-
 
|-
 
| -cyclicRotX value  
 
| -cyclicRotX value  
|  
+
| Rotation angle for matching cyclic or periodic faces. Rotation about the X axis. <br>Value in degree.
 
|-
 
|-
 
| -cyclicRotY value  
 
| -cyclicRotY value  
|  
+
| Rotation angle for matching cyclic or periodic faces. Rotation about the Y axis. <br>Value in degree.
 
|-
 
|-
 
| -cyclicRotZ value  
 
| -cyclicRotZ value  
|  
+
| Rotation angle for matching cyclic or periodic faces. Rotation about the Z axis. <br>Value in degree.
 
|-
 
|-
 
| -debug
 
| -debug
|  
+
| Generate more verbose runtime information messages.
 
|-
 
|-
 
| -doc
 
| -doc
|  
+
| Not supported.
 
|-
 
|-
 
| -dryrun
 
| -dryrun
|  
+
| Process the CGNS file, but do not modify any files from the case.
 
|-
 
|-
 
| -help  
 
| -help  
|  
+
| Print usage.
|-
+
| -mapUnknown
+
|
+
 
|-
 
|-
 
| -matchCyclicBC bc1_name:bc2_name  
 
| -matchCyclicBC bc1_name:bc2_name  
|  
+
| Create a cyclic boundary condition using the patches named 'bc1_name' and 'bc2_name'
 
|-
 
|-
 
| -mergeTolerance value
 
| -mergeTolerance value
| Tolerance for matching identical nodes: fraction of smallest edge. <br>Default value=0.1
+
| Tolerance factor for merging duplicate nodes. Fraction of the mesh smallest edge. <br>Default value=0.1
 
|-
 
|-
| -novalidationMesh
+
| -noMeshValidation
|  
+
| Disable the converter internal mesh validation (checkMesh)
 +
|-
 +
| -rho value 
 +
| Value for the volumic density Rho.<br>: If present, the pressure field will be scaled by '1/value'.<br> Default value=1.0
 
|-
 
|-
 
| -saveSolutions
 
| -saveSolutions
|  
+
| Extract and convert the solutions stored in the CGNS file as OpenFOAM fields
|-
+
| -rho Volumic_density value 
+
| Default value=1.0
+
 
|-
 
|-
 
| -separatePatches  
 
| -separatePatches  
|  
+
| For multi-zones CGNS files: <br>: If option present: save each zone boundary conditions as a separate boundary condition. <br>: If option not present: merge all boundary conditions sharing the same name.
 
|-
 
|-
 
| -srcDoc
 
| -srcDoc
|  
+
| Not supported.
 
|-
 
|-
 
| -use2DElementsAsPatches   
 
| -use2DElementsAsPatches   
|  
+
| Lose all the boundary condition type information
|-
+
| -zone zoneList
+
|
+
 
|-
 
|-
 
|}
 
|}
 +
  
 
== foamToCGNS ==
 
== foamToCGNS ==
 
  % foamToCGNS -help
 
  % foamToCGNS -help
 
   
 
   
   Usage: foamToCGNS [-noZero] [-allowuserdefinedfields] [-exportcyclics] [-help] [-case dir] [-constant]  
+
   Usage: foamToCGNS [-noZero] [-allowuserdefinedfields] [-exportcyclics] [-case dir] [-constant]  
                     [-rho Volumic_density. Default value: 1.0] [-latestTime] [-time time]  [-help] [-doc] [-srcDoc]
+
                     [-rho value] [-latestTime] [-time time]  [-help] [-doc] [-srcDoc]
  
Description of the command-line options for fomToCGNS:  
+
::{| cellpadding="8" cellspacing="0" border="3"
[-noZero]
+
 
[-allowuserdefinedfields]
+
|colspan="2"|
[-exportcyclics]
+
'''Command-line options for foamToCGNS:'''
[-help]
+
|-
[-case dir]
+
| -allowuserdefinedfields
[-constant]
+
| Allow the conversion of non-supported OpenFOAM fields as CGNS user-defined fields
[-rho Volumic_density. Default value: 1.0]
+
|-
[-latestTime]
+
| -case dir
[-time time] 
+
| Case directory
[-help]
+
|-
  [-doc]
+
| -constant
[-srcDoc]
+
| Explicitly includes the constant directory in the time list
 +
|-
 +
| -doc
 +
| Not supported.
 +
|-
 +
| -exportcyclics
 +
| Export cyclic boundary conditions as periodic CGNS patch.<br>: If the option is not present the cyclic BC will be split into two separate CGNS patches.
 +
|-
 +
| -help
 +
| Print usage.
 +
|-
 +
| -latestTime
 +
| Restrict the conversion to the latest available time
 +
|-
 +
| -noZero
 +
| Explicitly excludes the 0 directory from the time list.
 +
|-
 +
| -rho value  
 +
| Value for the volumic density Rho.<br>: If present, the pressure field will be scaled by 'value'.<br> Default value=1.0
 +
|-
 +
| -srcDoc
 +
| Not supported.
 +
|-
 +
| -time time
 +
| Restrict the conversion to the data available for time 'time'
 +
|-
 +
|}
 +
 
 +
= Caveat =
 +
* A valid OpenFOAM case must first be created prior to using cgnsToFoam
  
 
= Use cases =
 
= Use cases =
 +
 +
Work in progress...

Latest revision as of 08:13, 1 June 2013

1 Introduction

The CFD General Notation System (CGNS) file converters cgnsToFoam and foamToCGNS allow for the conversion back and forth between OpenFOAM cases and files in CGNS format.

The converters support:

  • import and export of grid information
    • importing structured and unstructured grid from CGNS format file
    • exporting OpenFOAM grid format to unstructured grid CGNS format
  • import and export of boundary conditions information, including periodic or cyclic BCs
  • import and export of flow solutions


Using CGNS files, one can easily transfer CFD information like mesh and flow solutions between OpenFOAM and many commercial CFD applications (mesh generators, solvers, etc).

For more information on the CGNS file format, visit the following site: http://cgns.sourceforge.net/

2 Installing the CGNS converters

The CGNS file converters are available from the SourceForge.NET site http://openfoam-extend.wiki.sourceforge.net/ through a Subversion source code repository.

The converters source code currently resides in the Breeder section of the repository, under the TurboMachinery OpenFOAM Special Interest Group (OSIG) section.

For more information on the structure of the Subversion repository for the openfoam-extend project on SourceForge.NET, see the following presentation from the 2nd OpenFOAM Workshop: Open Subversion Repository Access For OpenFOAM

For browsing the openfoam-extend Subversion repository, follow this URL: http://sourceforge.net/p/openfoam-extend/svn/HEAD/tree/

The CGNS converters are based on the following components:

  • cgnslib_2.5  : CGNS Mid-Level library
  • cgnstools_2.5 : optional package from http://cgns.sourceforge.net/. Tools for viewing and editing CGNS files
  • libcgnsoo_3.0 : C++ wrapper for the CGNS Mid-Level library
  • cgnsToFoam  : CGNS file conversion to OpenFOAM
  • foamToCGNS  : OpenFOAM conversion to CGNS file


2.1 Downloading the CGNS converters and companion libraries

The easiest way to retrieve the CGNS converters source code is to download the whole TurboMachinery section of the Breeder from the openfoam-extend Subversion repository.

  • For OpenFOAM 2.0
cd $WM_PROJECT_USER_DIR
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_2.0/OSIG/TurboMachinery
  • For OpenFOAM 1.6
cd $WM_PROJECT_USER_DIR
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.6/OSIG/TurboMachinery
  • For OpenFOAM 1.5
cd $WM_PROJECT_USER_DIR
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/OSIG/TurboMachinery
  • For OpenFOAM 1.4.1
cd $WM_PROJECT_USER_DIR
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder/OSIG/TurboMachinery


It is also possible to download the converters, companion libraries and tutorial individually. Take note however that if the relative installation locations of the different converters components are modified, the files Make/options for cgnsToFoam and foamToCGNS will need to be adjusted accordingly.

For example, for OpenFOAM 1.5:

  • The CGNS converters:
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/OSIG/TurboMachinery/applications
  • The companion libraries:
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/OSIG/TurboMachinery/src
  • The test cases:
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/OSIG/TurboMachinery/tutorials


NB: For the remaining of this document, we will assume that the whole TurboMachinery section of the Breeder_*.* was downloaded in the directory $WM_PROJECT_USER_DIR

2.2 Compiling the companion libraries

cd $WM_PROJECT_USER_DIR/TurboMachinery/src
./Allclean
./Allwmake

Note that these libraries are installed locally under their respective directory. They are not installed under $FOAM_USER_LIBBIN.

2.3 Optional: compiling the CGNS Tools and Utilities

The cgnstools are useful for viewing and editing CGNS files.

You first need to compile the CGNS Mid-Level library provided by cgnslib_2.5. This library is normally compiled when building the companion libraries for the CGNS converters.

You will also need to make sure the Tcl/Tk runtime and development libraries are available on your workstation.

The recipe for compiling the cgnstools is:

cd $WM_PROJECT_USER_DIR/TurboMachinery/src/cgnstools_2.5
tar -zxvf ./cgnstools-2-5-2.tar.gz
./Allwmake

Note that the cgnstools are installed locally under $WM_PROJECT_USER_DIR/TurboMachinery/src/cgnstools_2.5/platforms/$WM_OPTIONS/bin. They are not installed under $FOAM_USER_BIN. You will need to adjust your PATH accordingly, or modify the Allwmake script to suit your needs.

Here are two snapshots taken from the tool 'adfviewer' while viewing the CGNS file provided as $WM_PROJECT_USER_DIR/TurboMachinery/tutorials/cgnsConverters/test1/icem_mesh.cgns


For more information about the cgnstools, please visit this site: http://www.grc.nasa.gov/WWW/cgns/cgnstools/index.html

2.4 Compiling the CGNS converters

cd $WM_PROJECT_USER_DIR/TurboMachinery/applications
./Allclean
./Allwmake

NB: The compilation of foamToCGNS requires the class pointVolInterpolation, which is available for OpenFoam-1.4.1-dev and OpenFOAM-1.5-dev, but not from the version distributed by OpenCFD.

In order to compile foamToCGNS under OpenFoam-1.4.1 and OpenFOAM-1.5 from OpenCFD, you need to make a small adjustment to the file cgnsToFoam/Make/options.

Here is the modification necessary for the file cgnsToFoam/Make/options under OpenFOAM-1.4.1:

// We need to define some pre-processor definition
// in order to adjust for various versions of OpenFOAM.
// Please adjust accordingly to your own installation.
//
// For your information, pointVolInterpolation is not part
// of OpenFOAM 1.4.1 from OpenCFD, but can be found in the openfoam-extend
// distribution on SourceForge.net.
// So you need to specify -DMISSING_POINTVOLINTERPOLATION -I./compatibility for
// compiling with OpenFOAM 1.4.1 from OpenCFD.
//
// c++FLAGS+= -DOPENFOAM_VERSION=141 -DMISSING_POINTVOLINTERPOLATION -I./compatibility
// c++FLAGS+= -DOPENFOAM_VERSION=141
c++FLAGS+= -DOPENFOAM_VERSION=141 -DMISSING_POINTVOLINTERPOLATION -I./compatibility


Here is the modification necessary for the file cgnsToFoam/Make/options under OpenFOAM-1.5:

// We need to define some pre-processor definition
// in order to adjust for various versions of OpenFOAM.
// Please adjust accordingly to your own installation.
//
// For your information, pointVolInterpolation is not part
// of OpenFOAM 1.5
// So you need to specify -DMISSING_POINTVOLINTERPOLATION -I./compatibility for
// compiling with OpenFOAM 1.5
//
c++FLAGS+= -DOPENFOAM_VERSION=150 -DMISSING_POINTVOLINTERPOLATION -I./compatibility
// c++FLAGS+= -DOPENFOAM_VERSION=150


2.5 Building CGNS converters on Ubuntu 10.04 LTS

Add the PPAPPA repository from the CAE-TeamCAE-Team

sudo add-apt-repository ppa:cae-team/ppa

and update sources list:

sudo apt-get update

Install OpenFOAM®-ext 1.5 release:

sudo apt-get install openfoam-dev-1.5 openfoam-dev-1.5-dev openfoam-dev-1.5-doc

Additionally install automake and libtool packages:

sudo apt-get install automake libtool

Add alias command to ~/.bashrc to start-up OpenFOAM®-ext environment:

alias startOF15dev="source /usr/lib/OpenFOAM-1.5-dev/etc/bashrc"

Use OpenFOAM®-ext version 1.5 in bash console:

startOF15dev

Follow standard instructions to build CGNS converters

3 Testing the CGNS converters

cd $WM_PROJECT_USER_DIR/TurboMachinery/tutorials/cgnsConverters
./Allclean
./Allrun

3.1 Test case: test1

A simple cgsnsToFoam conversion test case

Simple bump


3.2 Test case: test2

A foamToCGNS test case.

An example for converting periodic boundary conditions

Cycic BC


3.3 Test case: test3

Reusing a foamToCGNS output (from test2) as an input for a cgsnsToFoam test case.

An example for converting periodic boundary conditions

4 Basic documentation

4.1 cgnsToFoam

% cgnsToFoam --help

  Usage: cgnsToFoam <CGNS file> [-saveSolutions] [-cyclicRotX value] [-cyclicRotY value] [-cyclicRotZ value] [-mergeTolerance value] [-debug] 
                                [-dryrun] [-case dir] [-cfxCompatibility] [-cyclicMatchFaceTolFactor value] [-matchCyclicBC bc1_name:bc2_name] 
                                [-separatePatches] [-rho value] [-noMeshValidation] [-use2DElementsAsPatches]  [-help] [-doc] [-srcDoc]

Command-line options for cgnsToFoam:

<CGNS file> CGNS filename
-case dir Case directory
-cfxCompatibility Activate the support of specific syntax for ANSYS CFX CGNS field names
-cyclicMatchFaceTolFactor value Tolerance factor for matching cyclic faces. Fraction of the smallest edge length.
Default value= 0.1
-cyclicRotX value Rotation angle for matching cyclic or periodic faces. Rotation about the X axis.
Value in degree.
-cyclicRotY value Rotation angle for matching cyclic or periodic faces. Rotation about the Y axis.
Value in degree.
-cyclicRotZ value Rotation angle for matching cyclic or periodic faces. Rotation about the Z axis.
Value in degree.
-debug Generate more verbose runtime information messages.
-doc Not supported.
-dryrun Process the CGNS file, but do not modify any files from the case.
-help Print usage.
-matchCyclicBC bc1_name:bc2_name Create a cyclic boundary condition using the patches named 'bc1_name' and 'bc2_name'
-mergeTolerance value Tolerance factor for merging duplicate nodes. Fraction of the mesh smallest edge.
Default value=0.1
-noMeshValidation Disable the converter internal mesh validation (checkMesh)
-rho value Value for the volumic density Rho.
: If present, the pressure field will be scaled by '1/value'.
Default value=1.0
-saveSolutions Extract and convert the solutions stored in the CGNS file as OpenFOAM fields
-separatePatches For multi-zones CGNS files:
: If option present: save each zone boundary conditions as a separate boundary condition.
: If option not present: merge all boundary conditions sharing the same name.
-srcDoc Not supported.
-use2DElementsAsPatches Lose all the boundary condition type information


4.2 foamToCGNS

% foamToCGNS -help

  Usage: foamToCGNS [-noZero] [-allowuserdefinedfields] [-exportcyclics] [-case dir] [-constant] 
                    [-rho value] [-latestTime] [-time time]  [-help] [-doc] [-srcDoc]

Command-line options for foamToCGNS:

-allowuserdefinedfields Allow the conversion of non-supported OpenFOAM fields as CGNS user-defined fields
-case dir Case directory
-constant Explicitly includes the constant directory in the time list
-doc Not supported.
-exportcyclics Export cyclic boundary conditions as periodic CGNS patch.
: If the option is not present the cyclic BC will be split into two separate CGNS patches.
-help Print usage.
-latestTime Restrict the conversion to the latest available time
-noZero Explicitly excludes the 0 directory from the time list.
-rho value Value for the volumic density Rho.
: If present, the pressure field will be scaled by 'value'.
Default value=1.0
-srcDoc Not supported.
-time time Restrict the conversion to the data available for time 'time'

5 Caveat

  • A valid OpenFOAM case must first be created prior to using cgnsToFoam

6 Use cases

Work in progress...