Open-Source CFD Software Packages: Good Enough and Free

There are many advantages to using open-source solvers, such as OpenFOAM, so what's the catch?

A review of the OpenFOAM open-source computational fluid dynamics (CFD) packages.

Example of foamMonitor interactive OpenFOAM simulation residuals plot. Image courtesy of Resolved Analytics.


There are many advantages to using open-source software. In addition to being free to use and distribute, open-source software provides users the license to modify source code as-needed. In some cases, online user communities exist that support user learning and code development. Open-source computational fluid dynamics (CFD) solvers are no different. OpenFOAM is by far the most widely used and has gained considerable credibility in recent years through verification and validation studies performed by a growing user base, so OpenFOAM (OF) will be the focus of this review.

Free? Check. Accurate? Check. Customizable? Check. Applicable to numerous types of fluids problems? Check. So, what’s the catch?

OpenFOAM Background

OpenFOAM, originally simply “FOAM,” is a package of finite-volume based numerical algorithms originally developed by the CFD research group at London’s Imperial College in the late 1980s. FOAM stands for Field Operations and Manipulation. OpenFOAM was then made open-source when Henry Weller and colleagues founded OpenCFD Ltd. which was then acquired by Silicon Graphics International (SGI) and later ESI.  Meanwhile, the OpenFOAM copyright was transferred to the OpenFOAM Foundation Ltd. Both of these organizations provide OpenFOAM related software packages and tutorial downloads. The code base is the same for both. The software release cycles are a bit different, as is the “numbering” of the software versions.

Linux and Windows Versions

OF is natively a Linux-based program, meaning you will need to use a Linux based operating system such as Ubuntu, Fedora or Redhat Linux Enterprise, or you will need to run OF through a virtual machine within Windows. It goes without saying that some knowledge or background in Linux will come in handy when using OF. Microsoft recently implemented the ability to run a Linux Bash Shell as an application within Windows 10 and OpenCFD has also released a Windows “containerized” version of OpenFOAM.

Workflow and Physics Capabilities

OpenFOAM is capable of quite a lot right out of the box. It can solve for transient or steady-state flows, turbulent or laminar flows, Newtonian or non-Newtonian fluids, multi-phase flows (Lagrangian particles and Eulerian/VOF), reacting flows and passive scalars, to name a few. In general, each built-in solver is tailored for a specific type of problem, so you will need to know a priori what type of physics are present in your application and what type of finite-volume based numerical algorithm is best suited for solving said physics. A brief list of some of the more common solvers and their associated physics is shown below.

simpleFoam  Steady-state, incompressible, turbulent flow
rhoSimpleFoam  Steady-state, compressible, turbulent flow
scalarTransportFoam  Passive scalar, transport
porousSimpleFoam  Steady-state, incompressible, turbulent flow with porosity
interFoam  VOF of two immiscible liquids

All this can be a bit daunting, but each directory can be treated as an organizational bucket and each “dictionary” file within the bucket is not overly complex. In general, you will only need to modify fluid properties and inlet/outlet boundary conditions for each case, once you have typical solver settings configured to your liking. This will be handy for users who repetitively solve the same types of problems where entire case/project directory structures can be re-used again and again without changing anything except for the mesh.

Meshing

The lack of an easy-to-use and highly functioning built-in meshing utility is currently a stumbling block for all open-source CFD programs, including OF. The process is time consuming, and no utility is included that can implement meshes on internal flow problems where geometries are created in a typical 3D solid modeling environment. OF does, however, include several converter utilities that will convert meshes from other software packages into the required mesh file structure. This, for us, has been the easiest and fastest way to get a high-quality mesh into OF, though we did experience some unexplained solver stability issues after using the built-in converters. More options are discussed in the OpenCFD documentation.

Solving and Post-Processing

Once you have a meshed geometry and the physics models and solver settings are ready to go, one navigates to the case directory and types the solver keyword, such as simpleFoam into the command line terminal. That’s it. Your case should be running. One particular strength of OF is that it allows for “decomposing” your problem and running in parallel on multiple processors, or even across multiple CPU nodes on a network. Though setting this up is laborious, the simulation time on large problems can be greatly reduced. New versions of OF have added a routine called foamMonitor that allows for conservation equation residuals to be plotted interactively by typing a second command into the terminal after the job is launched.

OpenFOAM comes packaged with an open-source post-processing software called ParaView. ParaView capabilities include most standard scientific visualizations such as contour plots, vector plots, streamlines, and line plots. Data extraction along lines and points can be implemented. Easy switching between time-step results allows for animation creation. An example of a ParaView-produced streamlines based on the Ahmed Body reference problem is shown below.

OpenFOAM Ahmed Body Problem Simulation Result: Velocity Contour Plane and Streamlines Visualized in ParaView. Image courtesy of Resolved Analytics.

OpenFOAM Ahmed Body Problem Simulation Result: Velocity Contour Plane and Streamlines Visualized in ParaView. Image courtesy of Resolved Analytics.

OpenFOAM CFD Conclusions

OpenFOAM is a great tool for computational fluid dynamics with tons of capabilities and multiple solvers. It is a product that has been developed and refined by CFD experts over the last two decades and is increasingly accepted in academia and industry. OF has many advantages typical of open-source software such as broad user base, tutorials and example problems online and the ability to customize the code base to your liking. Plus, it costs nothing! But there are some drawbacks, which may be holding it back from becoming more mainstream.

The biggest deal-breaker for some is the extra time required to set up and analyze model results. This is mainly due to the disconnected workflow and the lack of a high-performance built-in meshing utility and need for an additional post-processing software package. Beginners may experience a steep learning curve due to the advanced user expertise required in determining what important physics to solve and how to best match those physics with numerical algorithms. Some users may also be held back by the need for a Linux-based operating system or some version of OF for Windows that may or may not have all of the native OF capabilities/utilities (such as plotting interactive residuals, for example).

For a more detailed review of OpenFOAM, including basic interface and workflow, physics modeling capabilities, CAD cleanup and meshing, simulating, and post-processing, read the original article on Resolved Analytics' blog.

If you are a CFD software user, consider participating in Resolved Analytics' CFD User Survey.

For More Info

Stewart Bible and Caleb Triece are co-founders and managing partners of Resolved Analytics.

Share This Article

Subscribe to our FREE magazine, FREE email newsletters or both!

Join over 90,000 engineering professionals who get fresh engineering news as soon as it is published.


#22164