This isn’t actually a list of “101 Things to read when starting with OpenFOAM”, but we found the title name catchy. OpenFOAM is an Open Source software for Computational Fluid Dynamics (CFD) implemented using the C++ programming language. Looking at this definition, it is easy to see what needs to be learned in order to use and/or extend OpenFOAM effectively.
To understand how OpenFOAM works, you need to get familiar with browsing its large source code base (Open Source) and to understand the source code, an understanding of the C++ programming language as well as Object Oriented Design is a must. To accurately and reliably use at least some of the available solvers, both CFD knowledge (numerical methods implemented, various other algorithms, etc.) and experience (running a lot of simulations with different schemes, geometries, boundary conditions) are required.
OpenFOAM related literature
- The Users Guide, that comes along with OpenFOAM.
- The Programmers Guide, that also comes along with OpenFOAM. It can be regarded as more of an extended Users Guide, so don’t feel intimidated, if you are not a proficient C++ programmer (yet).
- The OpenFOAM PhD course of Håkan Nilsson from Chalmers contains a variety of different information on various topics of OpenFOAM.
- “The OpenFOAM Technology Primer”, by T. Maric, J. Höpken and K. Mooney
- “Getting started withOpenFOAM 1.4:” by Delphine Leroux
- “A tensorial approach to computational continuum mechanics using object-oriented techniques” by H.G. Weller, G. Tabor, H. Jasak and C. Fureby
- PhD thesis of Hrvoje Jasak
- PhD thesis of Henrik Rusche
- PhD thesis of Onno Ubbink
- “OpenFOAM for Computational Fluid Dynamics” by G. Chen, Q. Xiong, P. J. Morris, E. G. Paterson, A. Sergeev, and Y.-C. Wang
- “Running OpenFOAM Tutorials” by Tommaso Luchini
- The “snappy Wiki”, a wiki dedicated to snappyHexMesh
There is a great list of C++ books on Stack Overflow. A choice of a beginner C++ book is difficult to suggest in general. Each reader is different and expects different things. Still, since the amount of knowledge to be obtained in order to effectively and accurately work with OpenFOAM is huge, we find that a solid beginner C++ book might have the following properties:
- the examples should be as small as possible,
- language constructs are not enough – c++ idioms supported by them should also be covered if possible.
There are some large books that cover C++ at the beginner level and the number of pages is simply due to the large examples used to describe a language construct. For example, having huge classes with fat interfaces and a lot of output messages is not necessary to describe multiple inheritance. To save time, at the beginner level, to get started with OpenFOAM as soon as possible, you can either find a short intro book or a short tutorial. Don’t worry, there is plenty to read on the intermediate / expert level.
- József Nagy’s Youtube Channel – Great Starter videos
Software Design literature
Learning the C++ language, and even its idioms and tutorials that show how to use it effectively is one thing. Programming clean, re-usable and modular libraries and solvers and understanding how OpenFOAM works, are all topics of Software Development.
OpenFOAM uses Object Oriented Design (OOD) patterns. Things like run-time type selection and Object Registry are not magic C++ constructs developed specially for CFD, they are well known Design Patterns.
Same goes for Generic Programming. Generic programming is used in OpenFOAM for type lifting of boundary conditions, interpolation schemes, discrete differential operators, mesh objects, almost everything. Trait based type promotion is used to determine the rank of the tensor resulting from a differential or algebraic operation.
These books we found helpful for learning about clean coding and design patterns:
- Code Complete, by Steve McConnell
- Clean Code, by Robert C. Martin
- Growing Object-Oriented Software, Guided by Tests, by Steve Freeman and Nat Pryce,
- Design Patterns. Elements of Reusable Object-Oriented Software, by von Erich Gamma, Richard Helm, Ralph E. Johnson and John Vlissides,
- Head First Design Patterns, by Eric Freeman, Elisabeth Robson, Bert Bates und Kathy Sierra,
- UML Distilled: A Brief Guide to the Standard Object Modeling Language (3rd Edition) by Martin Fowler
There are more useful books on this topic, but if you read even some of the books listed above, you will be able to recognize over and over the same repeating patterns occuring in different parts of OpenFOAM, making the understanding of how the entire software is built, hopefully, much easier.
BASH shell programming literature
There is a lot of information on BASH freely available online, but this book is really good since it distills the most important information in an organized way:
- Pro Bash Programming by Chris F.A. Johnson
There is already a great list of CFD books on the CFD Online website. We recommend to read the following:
- An Introduction to Computational Fluid Dynamics: The Finite Volume Method, by H. Versteeg and W. Malalasekera
- Computational Methods for Fluid Dynamics, by Joel H. Ferziger and Milovan Peric
- Computational Fluid Dynamics: The Basics with Applications, by John David Anderson
- Computational fluid mechanics and heat transfer, by Dale A. Anderson; Richard H. Pletcher and John C. Tannehill
- Turbulence Modeling for CFD, by David C. Wilcox
- Turbulent Flows, by Stephen B. Pope