Open Source CFD Solver - OpenFOAM 1. INTRODUCTION 2 ...

70 downloads 248 Views 860KB Size Report
The OpenFOAM® (Open Field Operation and Manipulation) Computational Fluid .... Step 4, To hands on the tutorials, you need to copy tutorial files to your own ...
Open Source CFD Solver - OpenFOAM Wang Junhong (HPC, Computer Centre)

1. INTRODUCTION The OpenFOAM® (Open Field Operation and Manipulation) Computational Fluid Dynamics (CFD) Toolbox is a free, open source CFD software package produced by OpenCFD Ltd (http://www.openfoam.com). It offers users the complete freedom to customise and extend its existing functionality, either by themselves or through support from OpenCFD. Established in 2004, OpenFOAM is adopted by many users from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics and electromagnetics. OpenFOAM leads the open source CFD software market and has a large, active user base across the engineering, science and the public sectors, consisting of over 80 solver and 170 utility applications. It is applicable to solve any complex fluid flows involving chemical reactions, turbulence and heat transfer.

2. FEATURES OF OpenFOAM OpenFOAM is a generic open source CFD solver that supports unstructured meshes of cells of any shape and can be integrated with many third part visualisation software tools for postprocessing. The solver can be run in parallel mode using multiple processors on a multiprocessor computer or on many computers across a network. The solver is written in C++ language.

2.1.

Solver Capabilities



Compressible and Incompressible flows



Multiphase flows , such as bubble flow, cavitation, VOF, Euler and mixing.



Combustion and Chemical Reaction flows



Buoyancy-driven flows, with consideration of buoyant force for both compressible and incompressible flows



Conjugate heat transfer, including radiation



Particle methods (DEM, DSMC, MD)



Other (Solid dynamics, electromagnetics) 1

2.2.

Mesh Generation and Conversion

OpenFOAM supports unstructured meshes of cells of any shape. Cells in OpenFOAM can have any number of faces and faces can have any number of edges. OpenFOAM provides a few meshing tools according to the complexity of the geometry. 

blockMesh for Simple Geometries

The blockMesh is used to generate multi-block hexahedra mesh for simple geometries from a text configuration file. The OpenFOAM distribution contains numerous example configuration files for blockMesh to generate meshes for flows around simple geometries, e.g. a cylinder, a wedge, etc. 

snappyHexMesh for Complex Geometries

For complex geometries, snappyHexMesh meshes surfaces from CAD, but also allows the user to define simple geometric entities such as boxes, spheres, planes, etc. The snappyHexMesh utility can run in parallel, generating meshes of hundreds of millions of cells, given a sufficient number of CPUs and memory. 

extrudeMesh and polyDualMesh

The extrudeMesh and polyDualMesh are two special meshing tools. The extrudeMesh generates a mesh by extruding cells from a patch of an existing mesh, or from a surface mesh. It can perform a range of extrusions to produce linear, wedge or spherical meshes. The polyDualMesh creates the dual of a polyMesh and can be used to generate a “honeycomb” polyhedral mesh from a tetrahedral mesh. 

Mesh Conversion

In addition to the provided meshing tools, OpenFOAM accepts meshes generated by any of the major mesh generators and CAD systems. For example, you can use the mesh created by ANSYS, CFX, Fluent/Gambit, Plot3D, etc, using the specific mesh converters as listed in the table below.

Table 1 Mesh Converters ansysToFoam cfx4ToFoam fluent3DMeshToFoam gambitToFoam plot3dToFoam writeMeshObj

Mesh Converters provided by OpenFOAM Details Converts an ANSYS input mesh file, exported from I-DEAS, to OPENFOAM® format Converts a CFX 4 mesh to OPENFOAM® format Converts a Fluent mesh to OPENFOAM® format Converts a GAMBIT mesh to OPENFOAM® format Plot3d mesh (ascii/formatted format) converter For mesh debugging: writes mesh as three separate OBJ files which can be viewed with e.g. javaview 2

2.3.

Post-Processing Visualisation using ParaView

The open source visualisation application ParaView is integrated and used as the postprocessing tool to visualise results for OpenFOAM simulations. ParaView uses the Visualisation Toolkit (VTK) as its data processing and rendering engine, and can therefore read any data in VTK format. OpenFOAM includes the foamToVTK utility to convert data from its native format to VTK format, which means that any VTK-based graphics tools can be used to post-process OPENFOAM® cases.

The screen capture below shows the graphics user interface of ParaView. Further details about ParaView can be found at http://www.paraview.org.

Besides ParaView, you can export results for OpenFOAM simulations to other third-party

post-processing software such as EnSight, Tecplot, and even Fluent. The data converters for post-processing with other third party post-processing tools are listed below in Table 2. Table 2

Mesh Coventers provided by OpenFOAM

Data Converters

Details

foamDataToFluent foamToEnsight foamToTecplot360

Translates OPENFOAM® data to Fluent format Translates OPENFOAM® data to EnSight format Tecplot binary file format writer Write out the OPENFOAM® mesh in Version 3.0 FieldviewUNS format (binary) Reader module for Fieldview 9 to read OPENFOAM® mesh and data

foamToFieldview9 fieldview9Reader

3

3. ACCESS OpenFOAM ON HPC CLUSTERS OpenFOAM version 2.0.x, the latest version released in June 2011, is installed on HPC clusters Atlas5 and Atlas6. You can follow the following steps to run the software. Step 1, Logon to HPC Portal Run Jobs/Apps Step 2, Click on “atlas5-c01 cluster (xterm)” or “atlas6-c01 cluster (xterm)” Step 3, Set the OpenFOAM environment by entering the following command at the xterm command line prompt. You can enter command “blockMesh” to verify Atlas6-c01> . /app1/common/OpenFoam/Atlas6/OpenFOAM/OpenFOAM-2.0.x/etc/bashrc

Step 4, To hands on the tutorials, you need to copy tutorial files to your own working space. The tutorial files are available at: Atlas6-c01> ls -l /app1/common/OpenFoam/Atlas6/OpenFOAM/OpenFOAM-2.0.x/tutorials/

For example, to practice the first tutorial “Lid-driven cavity flow” on the tutorial documentation (http://www.openfoam.com/docs/user/cavity.php#x5-40002.1), you can copy the whole tutorial folder “cavity” as below: Atlas6-c01> cp -r /app1/common/OpenFoam/Atlas6/OpenFOAM/OpenFOAM2.0.x/tutorials/incompressible/icoFoam/cavity .

4

You can continue to try out the tutorial following the tutorial instruction guide.

4.

Useful Links

The following URLs are very helpful for learning and using OpenFOAM. Feel free to contact me at [email protected] should you wish to explore the software or encounter any difficulties in accessing the software. OpenFOAM webpage:

http://www.openfoam.org

OpenFOAM Docs and Tutorials:

http://www.openfoam.com/docs/user/

OpenFOAM Online Forum:

http://www.cfd-online.com/Forums/openfoam/

ParaView webpage:

http://www.paraview.org/

5