OpenFOAM
Encyclopedia
OpenFOAM is a C++
toolbox for the development of customized numerical solvers
, and pre-/post-processing utilities for the solution of continuum mechanics
problems, including computational fluid dynamics
(CFD). The code is released as free and open source software under the GNU General Public License
. It is maintained by The OpenFOAM Foundation, which is sponsored by Silicon Graphics
, the owner of the trademark to the name OpenFOAM.
. This led to the choice of C++
as programming language, due to its highest modularity and object oriented features. The predecessor, FOAM, was sold by UK company Nabla Ltd. before being released as open source in 2004. On 15th August 2011, OpenCFD announced its acquisition by Silicon Graphics Inc.
(SGi).
OpenFOAM was one of the first major scientific packages written in C++. It has also been the first major general-purpose CFD package to use polyhedral cells.
s that closely resembles the equations being solved. For example the equation
is represented by the code
This syntax, achieved through the use of object oriented programming and operator overloading
, enables users to create custom solvers with relative ease. However, code customization becomes more challenging with increasing depth into the OpenFOAM library, owing to a lack of documentation, and heavy use of template metaprogramming
.
Structure of OpenFOAM
OpenFOAM is constituted by a large base library, which offers the core capabilities of the code:
The capabilities provided by the library are then used to develop applications. Applications are written using the high-level syntax introduced by OpenFOAM, which aims at reproducing the conventional mathematical notation. Two categories of applications exist:
Each application provides specific capabilities: for example the application called blockMesh is used to generate meshes from an input file provided by the user, while another application called icoFoam solves the Navier-Stokes equations for an incompressible laminar flow.
Finally, a set of third-party packages are used to provide parallel functionality (i.e.OpenMPI) and graphical post-processing (ParaView
).
Capabilities
OpenFOAM solvers include:
In addition to the standard solvers, OpenFOAM's syntax lends itself to the easy creation of custom solvers.
OpenFOAM utilities are subdivided into:
License
OpenFOAM is free and open source software, released under the GNU General Public License
version 3.
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
toolbox for the development of customized numerical solvers
Numerical analysis
Numerical analysis is the study of algorithms that use numerical approximation for the problems of mathematical analysis ....
, and pre-/post-processing utilities for the solution of continuum mechanics
Continuum mechanics
Continuum mechanics is a branch of mechanics that deals with the analysis of the kinematics and the mechanical behavior of materials modelled as a continuous mass rather than as discrete particles...
problems, including computational fluid dynamics
Computational fluid dynamics
Computational fluid dynamics, usually abbreviated as CFD, is a branch of fluid mechanics that uses numerical methods and algorithms to solve and analyze problems that involve fluid flows. Computers are used to perform the calculations required to simulate the interaction of liquids and gases with...
(CFD). The code is released as free and open source software under the GNU General Public License
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
. It is maintained by The OpenFOAM Foundation, which is sponsored by Silicon Graphics
Silicon Graphics
Silicon Graphics, Inc. was a manufacturer of high-performance computing solutions, including computer hardware and software, founded in 1981 by Jim Clark...
, the owner of the trademark to the name OpenFOAM.
History
The original development of OpenFOAM started in the late 1980s at Imperial College, London, to develop a more powerful and flexible general simulation platform than the de-facto standard at the time, FORTRANFortran
Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...
. This led to the choice of C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
as programming language, due to its highest modularity and object oriented features. The predecessor, FOAM, was sold by UK company Nabla Ltd. before being released as open source in 2004. On 15th August 2011, OpenCFD announced its acquisition by Silicon Graphics Inc.
Silicon Graphics
Silicon Graphics, Inc. was a manufacturer of high-performance computing solutions, including computer hardware and software, founded in 1981 by Jim Clark...
(SGi).
OpenFOAM was one of the first major scientific packages written in C++. It has also been the first major general-purpose CFD package to use polyhedral cells.
Syntax
One distinguishing feature of OpenFOAM is its syntax for tensor operations and partial differential equationPartial differential equation
In mathematics, partial differential equations are a type of differential equation, i.e., a relation involving an unknown function of several independent variables and their partial derivatives with respect to those variables...
s that closely resembles the equations being solved. For example the equation
is represented by the code
This syntax, achieved through the use of object oriented programming and operator overloading
Operator overloading
In object oriented computer programming, operator overloading—less commonly known as operator ad-hoc polymorphism—is a specific case of polymorphism, where different operators have different implementations depending on their arguments...
, enables users to create custom solvers with relative ease. However, code customization becomes more challenging with increasing depth into the OpenFOAM library, owing to a lack of documentation, and heavy use of template metaprogramming
Template metaprogramming
Template metaprogramming is a metaprogramming technique in which templates are used by a compiler to generate temporary source code, which is merged by the compiler with the rest of the source code and then compiled. The output of these templates include compile-time constants, data structures, and...
.
Structure of OpenFOAM
OpenFOAM is constituted by a large base library, which offers the core capabilities of the code:
- Tensor and field operations
- Discretization of partial differential equations using a human-readable syntax
- Solution of linear systems
- Solution of ordinary differential equations
- Automatic parallelization of high-level operations
- Dynamic mesh
- General physical models
- Rheological models
- Thermodynamic models and database
- Turbulence models
- Chemical reaction and kinetics models
- Lagrangian particle tracking methods
- Radiative heat transfer models
- Multi-reference frame and single-reference frame methodologies
The capabilities provided by the library are then used to develop applications. Applications are written using the high-level syntax introduced by OpenFOAM, which aims at reproducing the conventional mathematical notation. Two categories of applications exist:
- Solvers: they perform the actual calculation to solve a specific continuum mechanics problem
- Utilities: they are used to prepare the mesh, set-up the simulation case, process the results, and to perform operations other than solving the problem under examination
Each application provides specific capabilities: for example the application called blockMesh is used to generate meshes from an input file provided by the user, while another application called icoFoam solves the Navier-Stokes equations for an incompressible laminar flow.
Finally, a set of third-party packages are used to provide parallel functionality (i.e.OpenMPI) and graphical post-processing (ParaView
ParaView
ParaView is an open source, freely available program for parallel, interactive, scientific visualization. It has a client–server architecture to facilitate remote visualization of datasets, and generates level of detail models to maintain interactive framerates for large datasets. It is an...
).
Capabilities
OpenFOAM solvers include:
- Basic CFD solvers
- Incompressible flow with RANS and LES capabilities
- Compressible flow solvers with RANS and LES capabilities
- Buoyancy-driven flow solvers
- DNS and LES
- Multiphase flow solvers
- Particle-tracking solvers
- Solvers for combustion problems
- Solvers for conjugate heat transfer
- Molecular dynamics solvers
- Direct Simulation Monte Carlo solvers
- Electromagnetics solvers
- Solid dynamics solvers
In addition to the standard solvers, OpenFOAM's syntax lends itself to the easy creation of custom solvers.
OpenFOAM utilities are subdivided into:
- Mesh utilities
- Mesh generation: they generate computational grids starting either from an input file (blockMesh), or from a generic geometry specified as STL file, which is meshed automatically with hex-dominant grids (snappyHexMesh)
- Mesh conversion: they convert grids generated using other tools to the OpenFOAM format
- Mesh manipulation: they perform specific operations on the mesh such as localized refinement, definition of regions, and others
- Parallel processing utilities: they provide tools to decompose, reconstruct and re-distribute the computational case to perform parallel calculations
- Pre-processing utilities: tools to prepare the simulation cases
- Post-processing utilities: tools to process the results of simulation cases, including a plugin to interface OpenFOAM and ParaViewParaViewParaView is an open source, freely available program for parallel, interactive, scientific visualization. It has a client–server architecture to facilitate remote visualization of datasets, and generates level of detail models to maintain interactive framerates for large datasets. It is an...
. - Surface utilities
- Thermophysical utilities
License
OpenFOAM is free and open source software, released under the GNU General Public License
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....
version 3.
Advantages
- Friendly syntax for partial differential equations
- Unstructured polyhedral grid capabilities
- Automatic parallelization of applications written using OpenFOAM high-level syntax
- Wide range of applications and models ready to use
- Commercial support and training provided by the developers
- No license costs
Disadvantages
- Absence of an integrated graphical user interfaceGraphical user interfaceIn computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
(stand-alone proprietary options are available) - The Programmer's guide does not provide sufficient details, making the learning curve steeper
- The lack of maintained documentation makes it difficult for the new users
Publicly available
- blueCFD is a cross-compiledCross compilerA cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is run. Cross compiler tools are used to generate executables for embedded system or multiple platforms. It is used to compile for a platform upon which it is not feasible to...
version of OpenFOAM that runs on Windows operating systems. The package also includes additional tools and functionality useful for OpenFOAM. It is produced by blueCAPE - FreeFOAM is geared towards freeing OpenFOAM from its system dependence, making it more portable and user-friendly for installation. The project closely tracks the official releases from OpenCFD and does not include additional functionality. CMakeCMakeCMake is a cross-platform, open-source system for managing the build process of software using a compiler-independent method. It is designed to support directory hierarchies and applications that depend on multiple libraries, and for use in conjunction with native build environments such as Make,...
is used as a build system. - OpenFOAM-extend is maintained by Wikki Ltd. This fork has a large repository of community-generated contributions, much of which can be installed into Official OpenFOAM with minimal effort. It is developed in parallel to the Official OpenFOAM, incorporating its latest versions, although these are released one or two years later.
Not publicly available
- CastNet is a proprietary modelling and simulation environment produced by DHCAE Tools. The application includes a graphical user interfaceGraphical user interfaceIn computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
front-end for OpenFOAM. - ICON FOAMpro CFD is maintained by ICON Process & Consulting Ltd. It is developed mostly around automotive applications through collaboration with the Volkswagen Group, and Ford Motor Co . This fork includes community-generated content as well as ICON-specific developments.
- Symmscape is a company that produces a family of software packages that use OpenFOAM. They include graphical user interfaceGraphical user interfaceIn computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
s for OpenFOAM case setup, solution, and post processing.
Proprietary software
- ANSYS CFX
- ANSYS Fluent
- PumplinxPumplinxPumpLinx is a 3-D Computational Fluid Dynamics software developed for the analysis of fluid pumps, motors, compressors, valves, propellers, hydraulic systems and other fluid devices with rotating or sliding components....
- STAR-CCM+
- KIVA (software)KIVA (software)KIVA is a family of Fortran-based Computational Fluid Dynamics software developed by Los Alamos National Laboratory . The software predicts complex fuel and air flows as well as ignition, combustion, and pollutant-formation processes in engines...
- PowerFlow
- FOAMpro
Official Resources
Community resources
- OpenFOAM Forum at CFD Online
- OpenFOAM wiki
- FOAM CFD web site, by one of the original developers of the code, who is not associated with OpenCFD.
- A Blog about OpenFOAM in Chinese