MSc/PhD course in CFD with OpenSource software, 7.5hec , 2015

Table of Contents

Basic information

Prerequisites and preparations


Schedule and Contents

Student reports/tutorials

Project suggestions


Useful links

More information

Master Thesis propositions


Basic information

The course homepage is . If you intend to make a link to something at the homepage, please add the year to the address, such as OS_CFD_2015. If you are not attending the course, but find the homepage useful, please write me a couple of words (to that help me argue that this way of working is acknowledged.

The course is open to master students at Chalmers, and PhD students enrolled anywhere.

Other interested should consider the industrial alternatives (OpenSource CFD for Industry – Basic Usage, and OpenSource CFD for Industry – High-level development, through Chalmers Professional Education - CPE), or contact me to be put in a mail list that is used for information regarding courses and conferences related to OpenSource CFD.

Some notes for master students at Chalmers: You will take this course under course code TME050, which means that you will be graded U/3/4/5. It also means that you can not use that course code for any other course, or if you have already used that course code you can not take this course. Talk to the student administration to make sure that you can take the course and that you can count it in your programme. Please see the formal syllabus of TME050.

If you are interested in taking the course you should contact me at so that I can maintain an e-mail list that will be used for further information until the course starts. Getting closer to the start of the course I will ask for a verification (registration) that you will take the course for sure.

Prerequisites and preparations

·         Time: You should make sure that you have time to take the course. It is very intense the first weeks, with two full hands-on lecturing days per occasion, and assignments for the next occasion. You are expected to dedicate at least 25h per week to the course the first three course weeks. After that you have a certain number of weeks to do a complete project, and then you should review the work by another student. You should spend at least 175h in total: 52h lectures, and about 20h for assignments, 95h for the project, and 8h for the peer-review. Don’t underestimate the work required!

·         Fluid Dynamics and CFD: You should have a background in Fluid Dynamics, and ideally some CFD experience and/or a course in CFD.

·         Project: You should be able to identify a suitable project that fulfils the requirements of this course, and that you are able to complete in the available time. It is beneficial if it is related to a project you are anyway doing, or planning to do (PhD project/Master project etc.), since it will be more useful to you and you will put more effort into it. We will of course discuss the project before you start doing it.

·         Linux: The course requires you to have a basic knowledge in Linux. In order to be able to follow the lectures, you should make sure that you understand and can use the basic Linux commands presented at the link below. You need to have that knowledge in order to follow already the first lecture.

·         Software: It is HIGHLY recommended that you make sure that you can run Linux and OpenFOAM from your own laptop. See instructions at the link below. We should have access to a computer lab with OpenFOAM installed, during the lectures and presentations, and you can try to find a seat there whenever it is not booked (or work from your FoDat computer if you have access to that, or remotely on one of our servers). On the other hand, you will gain more knowledge and freedom if you learn to install Linux and OpenFOAM yourself. We will not go through the installation procedures during the course, so you must do it before arriving.


Basic Linux commands

Install Ubuntu 14.04 LTS, OpenFOAM-2.4.x, foam-extend-3.1 etc. on your own laptop


Miscellaneous tips and tricks (advanced raw information, mainly for myself)


The course gives an introduction to the use of OpenSource software for CFD applications. It has a strong focus on how to efficiently use the Linux operating system and different softwares that are useful for CFD (to the largest extent OpenFOAM, see the short description below), rather than having a focus on teaching the basics of CFD or fluid dynamics. A major project work in OpenFOAM forms a large part of the course. The project may be defined according to the student's special interests. The result of the project should be a detailed tutorial for a specific application or library of OpenFOAM (Docendo discimus – Latin: “by teaching, we learn”). The tutorials will be peer-reviewed by the students, and the tutorials thus form a part of the course. The tutorials will be made available, as a contribution to the OpenFOAM community. To pass the course the student must do the project and peer-review a tutorial from another project. There will also be some compulsory minor tasks.

The students will learn on the following subjects:

Other software that may be of interest, but are not covered: salome, freecad, blender, engrid, gmsh, cubit, visit, Dakota, Enosh

OpenFOAM (Open Field Operation and Manipulation, is developed and distributed by OpenCFD Ltd at ESI Group and distributed by the OpenFOAM Foundation. OpenFOAM is an object oriented C++ toolbox for solving various systems of partial differential equations using the finite volume method on arbitrary control volume shapes and configurations. It includes preprocessing (grid generator, converters, manipulators, case setup), postprocessing (using OpenSource Paraview), and many specialized CFD solvers are implemented. The features in OpenFOAM are comparable to what is available in the major commercial CFD codes. Some of the more specialized features that are included in OpenFOAM are: sliding grid, moving meshes, two-phase flow (Langrange, VOF, Euler-Euler) and fluid-structure interaction. The strength of OpenFOAM is however the object-oriented approach to generating specialized solvers, utilities and libraries, using a flexible set of C++ modules. OpenFOAM runs in parallel using automatic/manual domain decomposition, and the parallelism is integrated at a low level so that solvers can generally be developed without the need for any parallel-specific coding. Due to the distribution as an OpenSource code it is possible to gain control over the exact implementations of different features, which is essential in research work. It also makes development and tailoring of the code for the specific application possible. In addition to the source code, OpenFOAM gives access to an international community of OpenFOAM researchers through the discussion board at the OpenFOAM home page. Community contributions are available through the OpenFOAM-Extend project at SourceForge (also at

This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks. Following the trademark policy.

Schedule and Contents

§  Syllabus

§  Access to computers and OpenFOAM

§  OpenFOAM applications and case set-up

§  ParaFoam tutorial

§  Find solver and utility tutorials in the source code, and learn how to use them

§  Some utility and functionObject tutorials

§  A quick look at pyFoam (set-up-file)

§  A quick look at the source code of applications

§  Start to work on assignment, with supervision (see below)

§  Compulsory assignment to be handed in by September 13
Submit your (correct) answers through PingPong:

§  Source code and binary file directory organization

§  High-level programming in OpenFOAM

§  Implement three applications
The rodFoam case

§  Basics of C++, and how it is used in OpenFOAM

§  Object orientation in C++ and OpenFOAM

§  A look inside icoFoam

§  Implement a turbulence model
Code for kOmegaSSTF
Optional: Link to Pirooz’ licentiate thesis, and a description of turbulence models in OpenFOAM
Optional: Link to Martin’s master thesis, and a description of DES models in OpenFOAM

§  Implement a boundary condition
Optional: Sparse instructions for implementing a rampedFixedValue BC

§  Implement a functionObject

§  Debugging (completed at third occasion)

§  Start to work on assignment, with supervision (see below)

§  Compulsory assignment to be handed in by September 28
Submit your (correct) answers through PingPong:

§  Klas Jareteg – Coupled solvers etc. Files

§  Isabelle Choquet – The thermoPhysical library files case

§  Hrvoje Jasak – Discretization best practice, immersed boundary

§  Top-ten problems with assignment 1

§  Introduction to assignment 3 – project work

§  Compulsory project work to be handed in through Ping-Pong before the presentation days!
Hand in intermediate draft, including project description, October 26, through PingPong!!!

§  Example of project description

§  LaTeX report template (originated from Per Carlsson, 2008.
Compile the tex file with latex or pdflatex. NOTE: output directly to pdf!)
Try using

§  Report example, with front page, learning outcomes, and questions.

§  Example of accompanying questions and answers

§  LaTeX/Beamer slide template tar-file
Note that it is not required to use LaTeX/Beamer, but it is a nice experience.
The template should at least work in the Chalmers system.

§  Questions regarding the material covered so far.

Update your project files according to peer-reviews and write a response to the reviewers (deadline: NN/NN, Example of a good response to a peer-review)

The final, updated files will be distributed at the course homepage. If you do not want your names to appear, don’t put it in your report. If you don’t want your name to be listed as reviewer, tell the author not to include it.

Student reports/tutorials

Here the final, peer-reviewed, student reports/tutorials are listed.

Disclaimer: This is a student project work, done as part of a course where OpenFOAM and some other OpenSource software are introduced to the students. Any reader should be aware that it might not be free of errors. Still, it might be useful for someone who would like learn some details similar to the ones presented in the report and in the accompanying files. The material has gone through a review process. The role of the reviewer is to go through the tutorial and make sure that it works, that it is possible to follow, and to some extent correct the writing. The reviewer has no responsibility for the contents.

Project suggestions

Project suggestions may be listed here (or see the previous courses), but you are encouraged to work in your own PhD/Master project, with a twist to make it appropriate in the current course. For inspiration, also see if there are master thesis suggestions below, where a part can be done as the project in this course. People visiting this web page may send suggestions to me at

·         Modeling of chemical batch reactor (mixer). Look at suitability, pros and cons for alternative techniques available in OpenFOAM for modelling the rotating impeller and static baffles in the reactor: Simple MRF modeling, use of AIM (mesh motion) in transient simulation, or immersed boundary methods. Relates to medical applications at SP Technical Research Institute of Sweden, where contact person (Ola Widlund) can provide additional information.

·         Design an automated validation test-loop. Start with a couple of ERCOFTAC cases ( Have a look at how the test-loop of FOAM-extend-3.1 is currently set up using CDash.

·         Make a thorough description how wall functions are implemented in OpenFOAM, and implement the wall function described in Popovac and Hanjalic, Compound Wall Treatment for RANS Computation of Complex Turbulent Flows and Heat Transfer, Flow, Turbulence and Combustion (2007) 78:177-202

·         Evaluate the immersed boundary technique of FOAM-extend-3.2 to simulate water turbines. MRF simulations should be straight-forward. Rotating runner should introduce an additional level of complexity. Rotating runner and varying guide vane angle should add yet an additional level of difficulty. Use axialTurbine or Francis-99 (,

·         Evaluate the use of the 6DOF library (e.g. in FOAM-extend-3.1/2) for water turbine runners. Introduce rotor-dynamics equations for the shaft and generator. Use axialTurbine or Francis-99 (,

·         Evaluate the use of cFmesh and/or swiftBlock for the Francis-99 turbine, in terms of meshing and analysis of the mesh quality for accurate simulations. (,

·         Evaluate the use of the block-coupled MRF solver in FOAM-extend-3.2 for water turbine simulations. Use axialTurbine or Francis-99 (,

·         Make an in-depth description of how fvOptions in OpenFOAM-2.4.x is used, how it is implemented, and how it can be expanded.

·         Make an updated tutorial on heat transfer in OpenFOAM-2.4.x. A couple of projects were done before, but things have happened since then.

·         Project suggestions by J.Miguel Nobrega See his info here. If you find any of those suggestions of interest, please discuss both with Mr. Nobrega and me, and we will make sure that it fulfils all requirements. Mr. Nobrega will support the project(s) with additional supervision.

o   Modelling the injection molding filling stage (a cavity initially with air that should be filled with a polymer melt – solvers interFoam or interDymfoam would work – air should be allowed to exit the cavity);

o   Modelling the extrudate swell in profile extrusion (it is something that happens to the extrudate after leaving the flow channel – solvers interTrackFoam, preferably, or interFoam would work);

o   Modelling the cooling stage in profile extrusion (It’s mainly heat exchange between two domains – the fixed metal (calibrator) and the moving profile (polymer) – and a contact resistance at the interface, solvers chtMuktiRegionSimpleFoam would work);

o   Implementation of partial slip boundary condition (there are several laws available that relate the tangent shear stress with slip velocity);

o   Implementation of linear extrapolation stress tensor boundary condition (for viscoelastic solvers);

Project 1 and 2 require modelling the flow of thermoplastic polymers, thus a non-isothermal solver that is able to cope with a Generalized Newtonian constitutive equation (e.g. Bird Carreau) must be used/programmed).

·         Verification and validation – extension of the testHarness. Automatize V&V for existing tutorials, or new cases. See

·         Automate the process of setting up, running, post-processing, and analyzing the results of the Francis-99 turbine case (, A case with existing results can be used. Focus can be on one of the parts of the process, and not necessarily on all parts. Running the simulation should be avoided since it is very time consuming and can not be done as a quick tutorial.

·         A good test case for turbulent rotating flow is fully developed flow in a rotating pipe. It is a 3D flow which only varies in the radial direction. Experimental data is available at and . It is used for validation of EARSM in . The case can be simulated both in a rotating reference frame, with rotating mesh (DyM), and in stationary coordinates with a rotating wall. All methods should give the same results. EARSM should model this kind of flow well. Stefan Wallin has a quite good description of how to implement EARSM in EVM-codes by adding an extra anisotropy term, in paper 6 of his PhD thesis: EARSM should be a rather robust and economical model compared to full RSM.
A preliminary implementation of EARSM exists.

·         Improve the functionality for projecting blockMesh patches to stl surfaces, based on the work by Kalle Nogenmyr. It is currently (2013-12-17) using an external multigrid solver, amgpp, which is very slow except for very small cases. Further, it gives an FPE, so the OpenFOAM FPE check must be disabled. An alternative would be to use the OpenFOAM GAMG solver instead. Files are located here:, and descriptions are located here: I think that Kalle would be happy to supervise a bit. Requires a skilled student.

·         Continue the work on coupled solvers, by Klas Jareteg 2012, having Klas as contact person. Requires a skilled student.


There is no requirement to buy any book. You have to find the information you need to solve your project and the tasks.

The C++ part of the course is based on “C++ Direkt”, by Jan Skansholm, Studentlitteratur, which is in Swedish. There is also a book in English by the same author, titled “C++ from the beginning”. Any introductory C++ book should be fine. Anyone who is doing CFD is recommended to have “An Introduction to Computational Fluid Dynamics: The Finite Volume Method by Versteeg and Malalasekera. Another useful book is “Computational Methods for Fluid Dynamics” by J.H. Ferziger and M. Peric. Some useful references:

1.      C++ how to Program by Paul and Harvey Deitel, Current version is 9 but older versions will also work fine.

2.      Object Oriented Programming in C++ by Robert Lafore , 4th Edition

3.      C++ from the Beginning by Jan Skansholm (should be a very good book for a complete basic programming newbie.)

4.      Free on-line book on C-programming in Linux (I haven't checked it)

5.      C++ tutorial

6.      Free on-line text book in CFD (I haven't checked it)              Accompanying exercise book

7.      Iterative methods for sparse linear systems

8.      Lecture slides, Rotating machinery

Useful links

1.      The CoCoons project (community-driven documentation of OpenFOAM)

2.      OpenFOAM Workshops (mirror)

3.      Documents related to OpenFOAM, collected by Professor Hrvoje Jasak.

4.      Great collection of know-how for OpenFOAM

5.      Some small mesh generation tools

6.      Mesher for complex terrains

7.      Another similar course 2012 2013

8.      Git reference


10.  An open code for blade geometry generation:

More information

See the homepages of the course given 2007, 2008, 2009, 2010, 2011, 2012, 2013 and 2014 for more information. The course for 2015 will develop from the one given in 2014. You can also contact me at

Master Thesis propositions

·         Official web-page of the department

·         Streamline curvature effects in turbulence modeling of hydropower applications

·         Master thesis for an international workshop in hydro power


For those of you travelling to Chalmers, here are some suggested hotels:
SGS Veckobostäder - This is a student-apartment-like alternative (~10min walking)

Quality Hotel Panorama – This is located closest to Chalmers (~5min walking). Ask for special price since you are visiting Chalmers.

Jonsereds Herrgård Apply for free accomodation during 1-3 months, for scientists and PhD students.


List of hotels close to Chalmers (ask for special price, for those in 1-3, since you are visiting Chalmers):

1.Normal standard:
City Hotel
Hotel Royal
Hotel Vasa AB
Hotel Flora AB
2. High standard:
Quality Hotel Panorama
Hotel Opalen
Hotell Liseberg Heden
Hotel Novotel
Grand Hotel Opera AB
Hotel Riverton AB
3. Very high standard:
Hotel Avalon
Elite Plaza Hotel
Cheap alternatives:
Youth Hostel Stigbergsliden
Hotel Nice B&B
5. Other:
Info from go:teborg&company
More hotels


Flag Counter