In today’s article, I am going to explore with you how to solve the simple cavity flow example with Openfoam!
This tutorial will describe how to pre-process, run and post-process a case involving isothermal, incompressible flow in a two-dimensional square domain.
Openfoam Lid-Driven Cavity Flow Tutorial
This is how the boundary conditions of the cavity are defined. All the boundaries of the square are walls. The top wall moves in the x-direction at a speed of 1 m/s while the other 3 are stationary.

This example is fully detailed in open foam user guide here, so feel free to check it as well for the detailed process in text format.
If you like this kind of articles and if this is useful for you, please let me know in the comments!
I read every comment I get and I try to answer the questions as best as I can also ;-)
Happy New Year 2021 and Stay Safe!

Cyprien “Here comes the first Openfoam Tutorial!” Rusu
Hello Cyprien,
Youtube is replete with OpenFOAM tutorials. If possible, please see all that is there on internet and make tutorials for cases never discussed before. A suggestion would be to make tutorials on Fluid Structure Interaction using OpenFOAM and Code Aster or perhaps using foam extend version at https://openfoamwiki.net/index.php/Installation/Linux/foam-extend-4.1
which can handle Multi Degree of Freedom as well as FSI. If you like to have ideas, please have a look at http://www.tfd.chalmers.se/~hani/kurser/OS_CFD/
This site has projects and perhaps you can make video tutorials of the more difficult projects that are discussed there to get a better rating on youtube. Profile initialization, computational acoustics, programming in OpenFOAM or perhaps computational solid mechanics / finite element analysis using OpenFOAM or dealII might be a good idea.
Calculating the Courant number in OpenFOAM and visualize it in Paraview
Multiphase simulations mesh with cfMesh
Refining final mesh in only certain regions and only in certain directions
Adding streamlines during runtime
Plotting of averaged values on boundaries
Plotting of results at probe locations during run-time in transient simulations
Residual plotting in steady-state simulations
How to manipulate your inlet velocity fields (and any other field at a boundary)
How to calculate the Mach number in OpenFOAM and visualize it in Paraview
How to not skip zero time in Paraview
Initializing non-uniform fields
Defining additional boundaries
mesh with snappyHexMesh (some tutorials are not available but you can see where these tutorials are lacking)
Overset meshing with OpenFOAM
Plotting of averaged values on boundaries
If a simulation has run but one has forgotten to write the time steps, how to extract the time directories using bash commands without re-running the simulation
Regards,
Imad
Thanks for those ideas and links Imad! I will look into it.
I am doing simple videos first because there are still a lot of users who can benefit from it.
I don’t really care about the views on Youtube, I do that purely to teach engineering skills
(If I did care, I would probably have to switch to a gaming channel or doing slime videos like someone suggested in the youtube comments ;-) )
Hello, Cyprien!
First of all, happy New Year! I was looking with the great interest your Tutorial 2 (Lid-driven Cavity flow). I noticed you’re using Paraview ver 5.6.0, while my recent Ubuntu installation of OpenFoam8 on Ubuntu 16.04 LTS installed Paraview 5.4.0. Is there any big difference between these two versions and if any, how can I obtain th newer version of the Paraview? What concerns FSI, I would be also very much interested for these tutorials, especially those which are dealing with vibro-acoustic problems in compressible fluids (or aero-acoustics). Many thanks and regards!
Hi Neno,
Thanks for your message!
I don’t think there is much difference in the newest Paraview version for the average user… but if you are interested to know what changed, there are details here: https://blog.kitware.com/paraview-5-6-0-release-notes/
To install the newest preview version, you just have to uninstall the current version you have and install the last version from the Paraview website.
What kind of applications do you want to solve in vitro-acoustics?
FSI is generally a very complex to tackle (especially with open-source), but I know some specialised software that might be of some help depending of what you want to solve.
Hello, Cyprien!
Thank You for the grate explaining.
I have a question please:
I am solving the cavity tutorial with icoHeatFoam (the energy equation is added to icoFoam). I need to get the wallheaflux. when typing the command:
icoHeatFoam -postProcess -func wallHeatFlux
I got this error:
………………………………………………………………………………….
–> FOAM FATAL ERROR: (openfoam-2012)
Unable to find compressible turbulence model in the database
…………………………………………………………………………………
So, as I understand, it is not possible to get the wallHeatFlux while using a incompressible solver.
Then what to do?
I searched every where for a good answer but no help. Your help will be appreciated.