OpenFOAM version 4.0 is the latest major version of OpenFOAM, released on 28th June 2016.  It was produced by a small community of individuals who contribute their work to the OpenFOAM Foundation under the OpenFOAM Contributor Agreement, enabling the Foundation to enforce the free, open source General Public Licence (GPL), to preserve the software freedoms granted by the GPL.

CFD Direct was by far the largest contributor to OpenFOAM 4.0, through the combined efforts of Henry Weller (creator and co-founder) and  Chris Greenshields (co-founder).  We contributed the vast majority of new functionality including post-processing, numerous boundary conditions, physical models and developments in multiphase, reacting flows.  Additionally, we contributed across all other aspects of software engineering that make OpenFOAM a mature, modern environment for production CFD, research CFD and CFD programming.  This article provides the inside view of that work on the software engineering behind OpenFOAM 4.0, contributed largely during a 3 month period from April-July, 2016.

OpenFOAM Design

Software design involves the process of dividing a problem into smaller components, with well-defined, understandable interfaces between the components.  In OpenFOAM 4.0, we designed and implemented new libraries, including rigidBodyDynamics, for dynamics of n-degrees of freedom (n-DoF) articulated bodies in parallel, and rigidBodyMeshMotion, for mesh-motion of multiple articulated rigid-bodies with joints, restraints and external forces.

OpenFOAM Redesign

Perhaps more importantly, we redesigned and reimplemented libraries where interfaces needed extending to meet future requirements and where interfaces were badly designed.  Major components that were redesigned and rewritten included function objects, vector algebra and matrices.  OpenFOAM 4.0 shows yet again that CFD Direct is capable, willing and committed to contribute essential redesign and reimplementation to future-proof the code against unmanageable levels of maintenance and facilitate contribution from the community.  In this respect, we are unique.

OpenFOAM Development and Maintenance

OpenFOAM 4.0 benefits from better consistency, robustness and performance due to a commitment to code maintenance that has seen a reduction in outstanding issues (“bugs”) by 70% since 2014.  For version 4.0, we have relocated the issue tracking system to a dedicated website at http://bugs.openfoam.org.  We continue to manage the code base through public development repositories of OpenFOAM, adding the OpenFOAM 4.x patch repository.  We created a dedicated website, http://cpp.openfoam.org, for the C++ Source Guide for both v4.0 and v3.0, to communicate OpenFOAM’s design to those programming CFD.  In order to standardise and accelerate code development, we also added source code scripts with templates e.g. foamNewBC, foamNewApp, and foamNewFunctionObject.

OpenFOAM Download

For OpenFOAM 4.0, we redesigned and implemented the OpenFOAM Foundation website (http://openfoam.org), transferring 100+ existing pages, e.g. from the OpenFOAM Release History and OpenFOAM Download Archive, maintaining URL redirects, etc.  The new, modern website gives users more immediate access to the information they need to deploy OpenFOAM and locate resources quickly.  Version 4.0 was packaged for the recent 16.04 LTS version of Ubuntu, which encourages higher levels of package authentication than before.   We therefore moved OpenFOAM downloads to a dedicated signed, authenticated repository at http://dl.openfoam.org and took this opportunity to index the download files, allowing users to browse through all OpenFOAM packs released since 2010.

OpenFOAM Cloud Computing

Version 4.0 has also been released for the cloud through CFD Direct From the Cloud™ v4.0: a 100% open source,  cloud computing platform that includes OpenFOAM 4.0 and supporting software, e.g. ParaView, Scotch, OpenMPI, etc., running on Ubuntu 16.04LTS.  It is supplied for Amazon Web Services (AWS) as a product on AWS Marketplace, with the software pre-configured as an Amazon Machine Image (AMI).  Anyone wishing to use the software simply needs to setup and configure as a AWS user, then launch an instance of the AMI on Amazon Elastic Compute Cloud (EC2).

OpenFOAM Documentation

CFD Direct contributes new features and tools to make OpenFOAM easier to use as part of the continuous development of its OpenFOAM Training courses.  For version 4.0, the redesign of function objects resulted in a new Post-Processing Command Line Interface (CLI) that simplifies post-processing considerably and improves functionality and maintainability.  This new functionality has been documented in a new section 6.2 of the OpenFOAM User Guide which we contributed along with major rewrites and updates to  2 Tutorials, 3 Applications, 4.4 Numerical Schemes, 4.5 Solution Control4.6 Case Management, 5 Mesh Generation and Conversion and 6 Post-processing.  We also created an archive of the OpenFOAM User Guide for v3.

OpenFOAM Training

Improved usability in OpenFOAM 4.0 increases CFD productivity.  We estimate that users can set up a CFD problem in OpenFOAM 4.0 in less than half the time it takes in OpenFOAM from 2 years ago, i.e. version 2.x.x.  Improving usability of OpenFOAM means we can spend much more time on the process of designing CFD solutions, starting with a prototype case that is then enhanced in small, digestible steps with periods of reflection to reinforce new concepts.  We believe most users can benefit greatly from the Essential CFD and Applied CFD courses, including users who attended training prior to version 3 of OpenFOAM.  For those programming OpenFOAM, we strongly recommend the Programming CFD course.  Please see the OpenFOAM Training Schedule for details of forthcoming courses.

OpenFOAM Videos

We have recently created a YouTube Channel at http://cfd.tips to provide short instructional videos on various aspects of OpenFOAM 4.0.  We expect this will provide an effective, new way to inform users of some of the latest tools in OpenFOAM.   We released the first video on monitoring residuals and  plan to add to our library of videos over the coming months, covering all aspects of CFD: geometry and meshing; fluid dynamics and modelling; numerics; data analysis (post-processing); and computers and programming.

Beyond OpenFOAM 4.0

Immediately after the release of OpenFOAM 4.0, we returned to the development version of OpenFOAM (OpenFOAM-dev), committing new developments, bug fixes, tools and features every day.  We collaborated with other developers in the community to integrate Tabulation of Dynamic Adaptive Chemistry (TDAC) in OpenFOAM-dev, giving 10x speed up on simple cases.  We also provided changes to wmake, to improve and simplify code compilation — another development to make OpenFOAM easier to use.  We hope that work will encourage more people will join the community using OpenFOAM-dev, test the code, report, discuss and fix issues, and help make the next release of OpenFOAM even more reliable, functional and efficient — and easier to use.

Inside OpenFOAM 4.0