Home » Verification of flow over a flat plate in OpenFOAM

Verification of flow over a flat plate in OpenFOAM

by thawtar

In this article, we will demonstrate how to carry out verification of simple problems in OpenFOAM.

Steady state laminar flow over a flat plate is one of the most taught classic fluid mechanics problems. One of the reasons for its popularity is we can learn the concept of boundary layers very deeply while very simply. And we can calculate the boundary layer thickness by using Blasius’s method for laminar boundary layer as :

Blasius boundary layer formula (Wikipedia)

In this formula, delta_99 is the distance from the wall at which the fluid velocity is 99% of the free stream velocity.

Blasius laminar boundary layer approach is also useful in learning CFD and verification. In this hands on tutorial, we are going to guide you through your OpenFOAM case setup to calculate this very interesting problem. 

We will use OpenFOAM’s classic “Cavity” tutorial as a base for our case. Although the solver used is icoFoam which is a transient laminar solver, we will run the simulation long enough to reach at the steady state solution, first.

So, we copy the cavity tutorial to our desired location. You can do this easily in your Ubuntu terminal as follows:

cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity $your_desired_location

Then we need to change the name of the case directory to flat_plate

mv cavity flat_plate && cd flat_plate

After that, we need to change boundary conditions to create the flow over a flat plate. So, we will need to change the patch names and patch types for the inlet and outlet boundaries. The imagination of the boundary conditions are as follows:

Boundary conditions for the simulation

Here, we use inlet velocity U=1m/s,  plate length L=1m and kinematic viscosity of fluid nu=1e-3 for simplicity. This will yield Reynolds number of 1000 for our flow.

First, we will create the mesh using cavity’s default settings. Run the command 

blockMesh

paraFoam -touch

Then, we can look at the mesh inside Paraview. Open the flat_plate.OpenFOAM in Paraview and choose OpenFOAM Reader. Then, inside Paraview, in the drop-down menu, choose Surface with Wdges. You can see the mesh, now.

Initial mesh created using Cavity tutorial

Since the length is 0.1 in x-direction, we will change it to 1m. Lets go to system/blockMeshDict to correct it! As the vertices coordinates are (x: 0~1, y:0~1, z:0~0.1) while the scale is 0.1, we will change the scale to 1.0. 

Changing scale to increase domain size
We can see that patch names and types are wrong. We need to fix it.

Also, inside the Mesh Regions, we do not have our desired inlet, outlet, top and bottom walls. So, we need to edit blockMeshDict file to create these patches. Inside the blockMeshDict, we can see that there are only movingWall and fixedWalls boundaries. We will change the name and types of these walls. 

The original blockMeshDict file
blockMeshDict file after modification to create inlet, outlet, top and bottom

Now we have divided the patches into our desired patches. We blockMesh again and we get our desired patches at proper length. 

0/U boundary conditions
0/p boundary conditions

After that, we change the 0/U and 0/p boundary conditions for inlet and outlet conditions. Since we assume inlet velocity as 1 m/s in the positive x-direction, we define uniform (1 0 0) for 0/U while we assign zeroGradient for 0/p. For the outlet, the pressure is uniform 0 while velocity is calculated from solver, thus assigning zeroGradient.

Then we will change the fluid properties such that the kinematic viscosity nu=0.001. We need to edit constant/transportProperties file and change nu to 0.001 as below.

We need to change kinematic viscosity to 0.001

Finally, we can run our solver since we do not need to care much about other things like fvSchemes and fvSolution files. We run the solver by typing 

icoFoam > log | tail -f log. The simulation will run very fast.

How to run solver while taking log
Solver finished very naturally without any problems
The domain is too short. We need to fix it.

In Paraview, we can see our velocity field and the boundary layer.

As a result, the velocity profile was not good too

We can see the velocity profile is not fully developed yet. So, the results may not be as reliable as we want. Now, we can improve the mesh by increasing length in x direction and refining the mesh in y direction. So, we will go to system/blockMeshDict file and increase x coordinates to 5 and we will use stretching layers in y direction near the wall. The new blockMeshDict would look like this:

Changing blockMeshDict to increase x direction length

Now we will validate the result against that by Blasius. The above is measured at x=2m. Since U=1 and nu=1e-3, Re = 2000. The new result would look like below.

New mesh is much better with flow being fully developed

Then from Blasius formula, delta_99 = 0.223m. From the above result, we can see that the velocity is around 0.99m/s at y=0.22m. Our simulation results have very good agreement with the theoretical solution by Blasius! 

Much better velocity profile

Summary

We carried out CFD simulations for laminar flow over a flat plate using OpenFOAM’s icoFoam solver. We used “Cavity” tutorial and modified it to create our desired proper boundary conditions. The results show good agreements with Blasius boundary layer formula. Increasing domain length in flow direction and using stretching mesh lead to much better results than original results.

We need to always remember that CFD is not just Colorful Fluid Dynamics. Understanding the flow phenomena and carrying out proper verification and validation steps make your result reliable and useful. 

You can download the case files here.

Other useful and interesting blog posts here

Our newsletter here

🌟 Elevate Your Cloud Experience with CloudHPC 🌟
CloudHPC

Related Posts

2 comments

JOHN September 23, 2024 - 10:43 pm

This is one of the best explanations I’ve come across. Thanks!

Reply
thawtar September 24, 2024 - 12:22 am

Thank you. Please stay tuned for more information.

Reply

Leave a Comment

🌟 Elevate Your Cloud Experience with CloudHPC 🌟

Step into a world of limitless possibilities with CloudHPC. Our state-of-the-art cloud computing platform offers unparalleled performance and scalability for your projects.

🚀 Supercharge Your Workflows: Harness the power of high-performance computing to accelerate your simulations, modeling, and data analysis tasks. 💡 Seamless Integration: Integrate seamlessly with popular tools and frameworks, ensuring a smooth transition for your projects.

🔒 Robust Security: Rest easy knowing your data is protected by industry-leading security measures, keeping your work safe and secure.

Explore the future of computing with CloudHPC. Sign up today and elevate your cloud experience to new heights!