Appendix: Running OpenFOAM Simulations

There are several claims in the above Chapters that appear to contradict conventional thinking promoted in the fluid flow literature. The peaking of the boundary layer velocity profile is one example. In the fluid flow literature, the velocity boundary layer is always discussed and depicted as smoothly asymptoting to a plateau. The author could find no contrary example anywhere in the literature. Yet, it is very easy to demonstrate that this is not the case by modifying a flow simulation tutorial available on the internet. To encourage readers who are not CFD simulation savvy, this Appendix is added to help the reader to verify some of the claims made in this book.

There are a wide variety of excellent commercial and free packages available for CFD experiments. One of those packages is OpenFOAM. OpenFOAM is a free, open-source CFD software package that was used by the author to do the laminar and turbulent boundary layer simulations discussed in the book. It offers an easy introduction to CFD without having to have extensive fluid flow computer software abilities. There are several versions available for different platforms. For those without a lot of computer background, blueCFD®-Core is a free open source OpenFoam project provided by FSD blueCAPE Lda for Windows users. It works like a regular Windows app and is a good beginner gateway to CFD. All of the OpenFoam versions include a large assortment of tutorials that guide the user through the different solvers and applications. Various YouTube videos can take you through the installation and beginner tutorials.

To demonstrate the peaking behavior of the turbulent boundary layer, we outline the steps to set up a Windows-based blueCFD installation and then run the unmodified and modified versions of the Turbulent flow over a NACA0012 airfoil (2D) tutorial. The unmodified tutorial uses a 897x257 NASA grid which can reproduce the lift and drag coefficients. However, the near-wall boundary layer data points are nonexistent for this case. As a remedy, I have modified the original tutorial to use the Family II 1793x513 NASA grid. This grid includes about 200-300 near-wall data points. A comparison of the results is very revealing. We start by reviewing the steps to load, run, and interrogate the modified version: David Weyburne’s Flow Files.

1) First, install the blueCFD OpenFOAM app. The YouTube video blueCFD OpenFOAM explains the process (note: choose the latest versions to install). Alternatively, you can go directly to the download site and download and install the latest version. (The internet sites listed herein are working as of 2021. If the links fail, try using Google to find alternatives).


2) To get started, consider running some of the tutorials such as those described in another YouTube video or in the User Guide (first time running blueCFD app, run as Administrator. Also create a “run” subdirectory in the Program Files/BlueCFD-Core-xxxx/ofuser-ofx directory. This is where all of the program directories for the different simulations should be located). Once you have run a few of the beginner tutorials and are comfortable with the process, you are hopefully ready to run the unmodified and the modified versions of the Turbulent flow over NACA0012 airfoil (2D) tutorial. The modified version can be downloaded from the author’s Google drive at David Weyburne’s Flow Files.


3) Copy the downloaded airFoil2D_1793_513_a0 directory to your run directory. Start the tutorial by running “simpleFoam” from the airFoil2D_1793_513_a0 directory (a0 is the alpha=0 version) in the BlueCFD terminal program. The modified version is much slower than the unmodified version taking a whole day to run on a standard laptop machine. The simulation is considered done once the velocities and pressure residuals drop below about 1e-6. This will take about 7200 iterations. If you want a version that has already been run, the author’s airfoil2D_1793_513_a0_allDone directory (David Weyburne’s Flow Files) contains a finished simulation (but it is 365 MB in size).

4) Once the run is complete, run the paraFoam command to launch paraView. Load the last time step and hit the Apply button. To take velocity profiles, we will use the button “slice” filter (the cube-with-a-plane-cut-through-the-inside icon). For the modified version, the NACA0012 leading edge is located at x,y,z = 0,0,0 and the trailing edge is at x,y,z = 1,0,0. Flow is in the x-direction with the y-direction normal to the flow. To take a cut along the x,y,z = 0.3,0,0 plane, hit the “slice” filter icon. In the Properties sidebar, change the Origin to 0.3,0,0 and the Normal to 1,0,0 and then hit Apply. Then go to “File”, “Save Data …”. I save the data as CSV format, 12 digit Precision, Point Field type.

5) The CSV data is stored in column format and can be accessed using spreadsheet software (Google Docs, MS Excel, etc.). The column data must be sorted before it can be plotted. I start off selecting the whole spreadsheet and sorting using the “Points:2” column (this is the z-axis), then I delete all the “Points:2” = 1.0 rows (the two z-column values are an artifact of OpenFOAM’s 2D simulations). Next resort the spreadsheet using the “Points:1” column. Normalize the “U:0” column (the u(x,y) data) by dividing through by u0. Now the data can be plotted as “Points:1” column (the y-direction data) versus the normalized “U:0” column. The result should look similar to Fig. 2.14.


The results will look similar to Fig. 2.14 but not identical. Fig. 2.14a was actually generated by a NACA0012 OpenFOAM simulation developed by Pablo Fernández described in his blog. This version explicitly including compressibility effects which is warranted given the Mach number. Comparison of the compressible and non-compressible results described above show that the compressible velocity profiles are noticeably sharer peaks than the non-compressible results. More information can be found on Pablo Fernández’s blog page. An already run simulation is available at David Weyburne’s Flow Files.


A.1 Comparison to OpenFOAM Tutorial results

At this point you should have verified the peaking behavior for exterior turbulent flow over a NACA0012 wing section. If one is so interested, there is more to be learned by comparing the unmodified tutorial to the just-finished modified version. To continue on:

1) Copy the “Program Files/BlueCFD-Core-xxxx/OpenFOAM-x/incompressible/simpleFoam/airfoil2D” to the run subdirectory. Edit the “U” file in the “/0” subdirectory using Notepad2 and change the velocity to the Alpha = 0 case (the line should read “internalField uniform (51.4815 0 0);” ). From the BlueCFD terminal, run “simpleFoam” and then “paraFoam”.

2) For the unmodified version, the NACA0012 leading edge is located at x,y,z = -17.5,0,0 and the trailing edge is at x,y,z = 17.5,0,0 (note that this is different than the version at the OpenFOAM tutorial discussion). Flow is in the x-direction with the y-direction normal to the flow. To take a cut along the x,y,z = -7,0,0 plane (equivalent to the 0.3 from above), hit the “slice” filter icon. In the Properties sidebar, change the Origin to -7,0,0 and the Normal to 1,0,0 and then hit Apply. Then go to “File”, “Save Data …”. I save the data as CSV format, 12-digit Precision, Point Field type.

3) Using the spreadsheet software, sort data as above. Plot the data and observe that there does not appear to be any boundary layer. The wall velocity at x,y,z = -7,3.68,0 is not even zero. The problem is that the “noSlip” wall boundary condition is not working properly. To fix the “noSlip” problem in the “U” file: Edit the “U” file and under the “internalField …” line add the line “plateField uniform (0 0 0);”. Under the “walls”, change “type noSlip;” to “type fixedValue;” and then under this line add the line “value $plateField;”. Run the “Allclean” command and then rerun “simpleFoam”. Run “paraFoam” and define and save another slice along the x,y,z = -7,0,0 plane. Sort and replot the data. Notice that the wall velocity at x,y,z = -7,3.68,0 is now zero.

What is extraordinary about the fixed airfoil2D data is that an examination of the results reveals that the boundary layer velocity profiles are nonexistent. The velocity at the airfoil surface is zero but it then jumps almost directly to the freestream values. Yet, the calculated lift coefficients, CL , drag coefficients, CD , and surface pressure coefficients Cp , compare very well to the excepted values. This points to the fact that one must be careful in interpreting experimental data.


To further encourage the readers to do their own simulations and verifications, a number of the other OpenFoam directories that were used to generate the results detailed in this book have also been made available for free download. Send your comments and improvements to David.Weyburne@gmail.com