# Mathematics, Numerics, Derivations and OpenFOAM®

## The Free Edition for the OpenFOAM® Community

The well-known book by Holzmann CFD. This version of the book, fourth edition of February 2017, will be free. More than 35.000 reads/downloads on the former Holzmann CFD website and ResearchGate. The book enjoys world-wide acceptance and was written and released from the years 2014 to 2018. This free edition will not be updated and maintained.

- Description
- REVIEWS

Dedicated to the OpenFOAM® community and to all colleagues and people who support my work on Holzmann CFD. The ambition to write the book was based on my personal love for the open-source thought. Thus, my objective is to give any interested CFD lover an introduction to computational fluid dynamics while showing interesting equations and some relations which are not given — or at least I did not realize them — in most of the famous books and papers in that particular area. In addition, the book should prepare you for the tasks that you may work on during your personal career, hopefully with OpenFOAM®. DOI: 10.13140/RG.2.2.27193.36960

## Abstract

This book gives an introduction to the underlying mathematics used in the field of computational fluid dynamics. After presenting the mathematics aspects, all conservation equations are derived using a finite volume element, dV. It is precisely described how the mass and momentum equation can be obtained. Subsequently, all kinds of the energy equations are discussed and presented namely the kinetic energy, internal energy, total energy, and the enthalpy equation. Based on the nature of the equations, the general governing equation is introduced afterward and it is shown how this equation can be used to derive other ones.

The subsequent chapters discuss the definition of the shear-rate tensor τ for Newtonian fluids and is followed by a discussion that shows the analogy between the Cauchy stress tensor σ, the shear-rate tensor τ, and the pressure p. All equations are summed up with a one page summary at the end.

Based on the fact that engineering applications are mostly turbulent, the Reynolds-Averaging methods are presented and explained. Subsequently the incompressible equations are derived and finally, the closure problem is discussed in detail. Here, the Reynolds-Stress equation — which is entirely derived in the appendix — and the analogy to the Cauchy stress tensor is shown. To close the subject of turbulent flows, the eddy-viscosity theory is introduced and the equation for the turbulent kinetic energy k and dissipation epsilon are deducted. The topic ends with a brief description of the derivation for the compressible Navier-Stokes-Equations equations and its difficulties and validity.

The last chapters of the book are related to the detailed explanation of the implementation of the shear-rate tensor calculation in OpenFOAM ®. During the investigation into the C++ code, the mathematical equations are given and a few words about the numerical stabilization are said.

Finally, a more general discussion of the different pressure-momentum coupling algorithms is presented. Subsequently, the PIMPLE-algorithm is explained while considering an OpenFOAM® case.

The last chapter is related to OpenFOAM® beginners which are seeking tutorials and some other useful information and websites.

### Changes from Release 5.x (04.04.2018) to Release 7.x (10.2019)

- In Progress

### Changes from edition 4 (24.09.2017) to Release 5.x (04.04.2018)

- Updated the c++ code to the OpenFOAM-5.x Foundation version (not yet done)
- Version number of the book correlates to the Foundation version (not yet)
- Correction of nOuterCorrectors set-up on page 115. I mentioned to set this quantity to zero to get the PISO loop but it is one
- On page 116 the code tells one that the turbOnFinalIter is set to true but I mentioned that it is set to false in the text

Thanks to Hossein Heydari for the report - Summary of equations. The enthalpy equation was wrong
- Added other equations to the summary

Thanks to Dr. Lars Korn for the hints - First term in equation 2.61 corrected (density was missing)

Thanks to Chris Harding for the hint - Corrected typos and sentences
- Improved English
- Book format changed
- Bookmarks for PDF corrected

### Changes from edition 4 (20.09.2017) to edition 4 (24.09.2017)

- Sign mistake in appendix page 155
*Shear-Rate Term a)* - Sign mistake in appendix page 159 equation 14.32
*f)* - Derivative wrong in equation 14.42, 14.43 and 14.44 (second term on the LHS)
- Minor grammar mistakes

Thanks to Vishwesh Ravi Shrimali for reporting the mistakes

### Changes from edition 4 (17.09.2017) to edition 4 (20.09.2017)

- Equation 9.97, 9.98, 9.99 9.100, 9.101 average symbol missing on some quantities
- Equation 9.107 and 9.108 had a wrong derivation
- Equation 9.110 had a wrong diffusion term
- Equation 14.18 and 14.19 denominator was wrong

Thanks to Vishwesh Ravi Shrimali for reporting the mistakes

### Changes from edition 4 (03.09.2017) to edition 4 (17.09.2017)

- Essential error in integral form of the momentum equation 2.28 and 8.8: The pressure term is a surface integral
- Typos correction on page 23 and 49

Thanks to Florian Kunstmann for the hints - Missing absolute bar in page 50 (summary in the total energy equation
- Equation 5.26, the term on the left hand side was wrong (the shear-rate term)
- Equation 9.39, 9.41, 9.46, 9.47 and 9.48 were wrong (pressure term with wrong sign)
- Equation 9.7 missing d
*t*term on the LHS - Equation 9.51 and 9.52 represents one equation (not two)
- Equation 9.64 (new number 9.63), missing identity on the RHS (underbrace)
- Equation 9.73 (new number 9.72), missing trace operator in second line
- Equation 9.83 (new number 9.82), pressure typo (star sign has to be applied)

Thanks to Vishwesh Ravi Shrimali for the hints (highly appreciated) - Equation 9.78, 9.79, 9.80 (new number 9.77, 9.78 and 9.79), missing bar on pressure

**Note:** Based on merging 9.51 and 9.52 all following equations are reduced by the number of one.

### Changes from edition 4 (29.07.2017) to edition 4 (03.09.2017)

- Corrected equation 2.95 (density inside the squares)

Thanks to Vishwesh Ravi Shrimali for the hint

### Changes from edition 4 (24.07.2017) to edition 4 (29.07.2017)

- Page 69, section 9.1the sentence including "... figure 7.1" was corrected (number of the figure was wrong)
- Page 70, equation 9.3 corrected
- Page 86, equation 9.64 corrected

Thanks to Vigneshwaran Sankar for the hints - Page 115, PISO is done with nOuterCorrectors equal one (previous ... equal zero)

Thanks to Arnav Ajmani for the hint - New chapter about the relaxation techniques in OpenFOAM® (field and matrix) to get more information about the information loose and the Final flag

### Changes from edition 4 (21.02.2017) to edition 4 (24.07.2017)

- Changed the word viscose to viscous (thanks to my colleague Christian Rodrigues)

### Changes from edition 4 (29.01.2017) to edition 4 (21.02.2017)

- Changes only related to chapter 7
- Improved English
- Added dependency to equation 7.4, 7.5, 7.6, 7.7 and 7.8
- Corrected equation 7.16, 7.17 and 7.18

### Changes from edition 4 (26.11.2016) to edition 4 (29.01.2017)

- Some typos
*residualControls*changed to*residualControl*in the chapter of PIMPLE- Added chapter about the bulk viscosity
- Big changes in chapter 4 and 5 according to the bulk viscosity
- Some sentence correction in chapter 10
- Corrected equation 10.12
- Added chapter 12 - OpenFOAM® tutorials

### Changes from version 4 (October 19.10.2016) to edition 4 (26.11.2016)

- Corrected a lot of typos
- Renewed the introduction of the mass conservation equation
- Renewed the introduction of the momentum conservation equation
- Corrected the summary page (equations were wrong)
- Corrected equation 2.46
- Added new chapter about "OpenFOAM® tutorials"
- Updated and changed a lot of sentences for a better understanding in the whole documentation
- Added literature
- Added "how to cite"
- Renewed the abstract
- Book read (for me) to print

### Changes from version 4 (October 04.10.2016) to Revision 4 (October 19.10.2016)

- Added subsection for the usage of the SIMPLEC algorithm
- Added SIMPLEC to SIMPLE
- Added SIMPLEC to PIMPLE

### Changes from version 4 (September) to Revision 4 (October)

- Implemented English correction in chapter 1 (thanks to Vignesh T.G.)
- Corrected Gauss summation convention (thanks to Jaap Versteegh)
- Added non-symmetric tensor definition
- Extended equation (1.13) to clear some doubts
- Included hyperref to the document
- Re-format the code listings
- New literature style
- Added a new chapter (23 pages) about the usage of the PIMPLE algorithm (community wish)
- Some typo correction

### Changes from version 3 to Revision 4 (September)

- Corrected figure 2.2
- Corrected two terms (plus sign of pressure to minus sign)
- Increased readability drastically
- Moved Reynolds-Stress equation derivation to the appendix
- Summary of equation is now a own chapter
- Changed format to B5 (for book)
- Generated a book cover
- Added one literature
- All formula's are included in the text flow (they end with a point or comma)
- A lot of equations are new formated

Changes from version 2.1 to 3.0

- Extended ~ 35 pages for turbulence modeling

- Correct some mistakes (in general)
- Include the handling of the time derivative as differences first
- English improvements
- Extend and reorganized the mathematic chapter
- Reorganized the chapters
- Reorganize the shear-rate tensor derivation in OpenFOAM®

- Turbulence modeling
- Introduce to Reynolds-Averaging methods (time-average, ensemble, ...)
- Time-Averaging operations on linear, nonlinear terms and constants
- Derivation of incompressible Reynolds time-averaged mass conservation
- Derivation of compressible Reynolds time-averaged mass conservation (to show why we get more troubles here)
- Introduce the turbulent Reynolds stress tensor
- Derivation of incompressible Reynolds time-averaged momentum equation
- Introducing the closure problem
- Comparison of Reynolds stress tensor and Cauchy stress tensor (especially to show the modified pressure we use in OpenFOAM®)
- Introducing to the Boussinesq eddy viscosity approximation
- Introducing the eddy viscosity approximation
- Derivation of the incompressible Reynolds-Stress equation to derive the turbulent kinetic energy equation
- Derivation of the incompressible kinetic energy equation of the turbulence
- Relation between length scale and dissipation
- Derivation of the incompressible dissipation rate equation (not shown in detail)

- Introducing the Favre averaging concept
- Demonstrate the concept using the compressible mass conservation equation

### Changes from version 2.0 to 2.1

- English improvements and corrections corrected (thanks to Sergei for the nice corrections)
- Gauss theorem introduced in the mathematic section
- Equation (1.6) corrected
- After equation (1.7), the vector notation (brackets) was wrong
- Equation (1.14) results not in a vector, it results in a scalar
- Equation (1.15) dyadic sign added
- Equation (1.16) dyadic sign added
- Equation (2.4) corrected again
- The sentence after (2.9) was changed to be more clear
- Section 2.1.1, remarks and addition information to gauss theorem etc.
- Equation (2.13) - (2.16) corrected; velocity vector was not bold
- Literature added for the non-common continuity equation
- Equation (2.30), (2.31) and (2.32) dyadic sign added
- Equation (2.77) other re-arrangement, to be more clear what we do
- Equation (2.78) conversation -> conversion
- Equation (2.85) 4th term on the RHS is a surface integral (changed integral sign)
- Added a description why we use the small bullet in the integrals instead of the big bullet (because both represent the inner product of two vectors)