Introduction to OpenFOAM

Ole Lindberg
Section of Coastal, Maritime and Structural Engineering Department of Mechanical Engineering Technical University of Denmark

November 18, 2009

Ole Lindberg

Introduction to OpenFOAM

opencfd. A open source CFD toolbox written in C++ for the Linux operation system. It is produced by OpenCFD Ltd.About OpenFOAM OpenFOAM: Open Field Operation and Manipulation. Licensed under the GNU General Public Ole Lindberg Introduction to OpenFOAM .co. freely available and open source. Homepage: http://www.

High licence fees on other commercial CFD packages like CFX or Fluent. The quality of the C++ code is very high. It comes with a fairly good documentation. The industry is very interested in OpenFOAM. It is the best open source CFD program available. OpenFOAM has an easy to use high level object-orientated programming interface. OpenFOAM has almost all standard finite volume methods implemented.Why OpenFOAM? OpenFOAM is open source. Ole Lindberg Introduction to OpenFOAM .

Some of the numerical methods in OpenFOAM are: Time integration: Backward Euler: Crank-Nicholson: Euler steadyState Steady state solver: CrankNicholson Gradient. Laplacian and interpolation schemes: Second order central difference: linear Fourth order central difference: cubic First order upwind: upwind First/second order upwind: linearUpwind Ole Lindberg Introduction to OpenFOAM .Numerical methods in OpenFOAM OpenFOAM is a Finite Volume CFD program using both structured and unstructured meshes. divergence.

Gauss-Seidel): smoothSolver Geometric and algebraic multigrid: Turbulence models: k-ε: kEpsilon k-ω: kOmegaSST LES GAMG Ole Lindberg Introduction to OpenFOAM . PBiCG Basic iterative method (e.g.Numerical methods in OpenFOAM Linear solvers: Preconditioned (bi-)conjugate gradient: PCG.

outletInlet.Boundary conditions in OpenFOAM The boundary conditions are setup for each of the flow variables (U. etc). cyclic Primitive types: fixedValue. p. Derived types: calculated inletOulet. fixedGradient. Some of the boundary types are: Base types: patch. mixed. symmetry. wall. empty. movingWallVelocity. slip Ole Lindberg Introduction to OpenFOAM .

Precompiled solvers OpenFOAM comes with many of precompiled solvers ready for use. Transient solver for incompressible and laminar flow. Solves a transport equation for a passive scalar. Transient solver for sonic flow of a compressible gas. The most important of these are: laplacianFoam potentialFoam scalarTransportFoam icoFoam simpleFoam pisoFoam sonicFoam interFoam dnsFoam electrostaticFoam Solves a simple Laplace equation. Potential flow solver. for thermal diffusion. Steady-state solver for incompressible and turbulent flow. Transient solver for incompressible and turbulent flow. using the VOF method. Direct numerical simulation of isotropic turbulence. Ole Lindberg Introduction to OpenFOAM . Solver for electrostatics. Two phase incompressible flow.g. e.

Block structured mesh and unstructured mesh in combination. Curved internal and external boundaries. Large and complex grids can be made with a GUI in e. Unstructured mesh.g. External mesh generation is also possible with the tools: ansysToFoam. Good for small grids. Block structured mesh.. ANSYS ICEM (proprietary) or Gmsh (open source). cfxToFoam. Ole Lindberg Introduction to OpenFOAM .Mesh generation in OpenFOAM OpenFOAM comes with a mesh generation tool: blockMesh Block structured meshes. gmshToFoam and more . The mesh is setup in a script (no GUI)..

uk/openfoam/download.6. e. Download the packages: OpenFOAM-1.gtgz and save the files in the directory structure as described on the download page. Unpack the files.Installation of OpenFOAM The latest official version of OpenFOAM is available on: http://www.opencfd.gtgz OpenFOAM-1.linuxGcc.gtgz ThirdParty.General.g.gtgz Read the file $HOME/OpenFOAM/OpenFOAM-1.: tar xzf OpenFOAM-1.General.gtgz ThirdParty.html Both 32bit or 64bit versions are available. Ole Lindberg Introduction to OpenFOAM and follow the instructions.6.linuxGccDPOpt.6.

ParaView uses Qt (a C++ GUI library).org/. see http://www.Installation of ParaView OpenFOAM uses ParaView as flow visualisation tool. Ole Lindberg Introduction to OpenFOAM . Install Qt from the repository of your Linux distribution.paraview.

/0/U (and p./constant/polyMesh/blockMeshDict Setup the initial and boundary conditions in: . epsilon etc. Set physical parameters in: . k./system/fvSchemes Setup linear solvers in: ./system/controlDict Setup temporal schemes and spatial finite volume schemes in: . end time and Courant number in: .6/run/MySimulation Go to your new case directory: cd $HOME/OpenFOAM/$USER-1.6/run/MySimulation Copy one of the tutorials into your case: cp -r $HOME/OpenFOAM/$USER-1.6/run/incompressible/icoFoam/cavity/* ./system/fvSolution Ole Lindberg Introduction to OpenFOAM .Setup a new OpenFOAM simulation Start a new OpenFOAM case: mkdir $HOME/OpenFOAM/$USER-1./constant/transportProperties Setup the mesh in: .) Set the start time.

e.pdf look at the tutorials: $HOME/OpenFOAM/OpenFOAM-1.6/run/MySimulation Run the mesh generation: blockMesh Run the simulation: icoFoam Do some post-processing.Basic working cycle Go to your case directory: cd $HOME/OpenFOAM/$ or search the OpenFOAM forum: http://www. calculation of vorticity: vorticity View the solution using paraView: paraFoam In trouble? Read the manual: $HOME/OpenFOAM/ Ole Lindberg Introduction to OpenFOAM .6/doc/Guides-a4/UserGuide.

geo -o constant/gmshMesh/mesh.geo from file sharing on Campusnet and $HOME/OpenFOAM/$USER-1.geuz. and start calculating.g.msh Setup the your OpenFOAM flow http://www.sourceforge.geuz. e. boundary conditions.pdf Go to your OpenFOAM case folder: cd $HOME/OpenFOAM/$ Convert the gmsh mesh to OpenFOAM format: gmshToFoam constant/gmshMesh/ For introductions to Gmsh see: http://www. Ole Lindberg Introduction to OpenFOAM .6/MySimulation/constant/gmshMesh/ gmsh -3 constant/gmshMesh/mesh.Mesh generation with Gmsh Install Gmsh from the repository of your Linux distribution or download it here http://www.6/run/MySimulation Download the Gmsh file place it in the folder: Run Gmsh: mesh.geuz.

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.