Hello everyone.
Welcome back to the CFD using Openfoam beginner to Intermediate course.
This is our class four and we will see overview on incompressible solvers, compressible solvers and
some of the multiphase solvers which are available in Openfoam.
Then we will do a hands on tutorial on case study on lid driven cavity, same as what we did in the
class previous class, but it will be much refined and we will actually see how the simulation goes.
Instead of a bad mesh, we will have a very good mesh.
So incompressible solvers.
Incompressible solvers in Openfoam are used to simulate fluid flows where the fluid density remains
constant.
So not just in Openfoam whenever you are trying to do any analytical calculations, or in most of the
commercial solvers, the incompressibility is assumed.
In most of the cases, unless you are working with very high speed sonic, uh, or external aerodynamics
thing.
Otherwise, mostly it is incompressible.
The solvers are ideal for simulating flows at very low Mach number, where compressible effects can
be neglected.
So mostly less than, uh, Mach one, mostly subsonic.
The incompressible solver is available in Openfoam or Ecco form.
So as we already saw, Ecco form is a transient solver for incompressible laminar flow of Newtonian
fluids.
The application can be used for time dependent simulation, that is, transient simulation involving
very simple fluid flow.
Laminar case and it is useful in simulating transient flow in a pipe or a channel.
So it can be very easily set up and we can get good results.
The next most widely used solver is simple form.
It is known among almost everyone using Openfoam, so it is the most common one.
It is a steady state solver for incompressible.
It can also work for turbulent flows.
Both laminar and turbulence can be simulated here and it has a variety of turbulence models.
The application will be suitable for steady state problems in various engineering applications, mostly
in cases of airflow over an airfoil or water flow.
Flow in a hydraulic structure where the same flow will get to steady state after some time.
So that is where we can generally use, uh.
It is always steady.
That's why we are using simple algorithm inside.
And we have a simple form.
So this is combination of piezo algorithm and uh simple algorithm.
So that is how the name pimple came.
It is not available in any other commercial solvers.
So the description is this is a transient solver for incompressible.
It can handle both laminar and turbulent.
It is very similar to simple form.
But this can also uh work on time dependent simulation that is transient simulations.
So unlike simple form this can work on transient simulation.
So it is like flow around a cylinder or moving airfoil where the mesh moves.
Uh, dynamic Dynamic meshing is also possible, and where there is vortex shedding.
In those cases we can use simple form.
This is also widely used as equally as simple form.
So the implement implementation steps are going to remain the same.
Either you use block mesh alone or along with snappy mesh.
We are generating the mesh.
Then we will be setting up the zero directory for boundary conditions.
Then we will be setting up the transport properties turbulence properties.
Then we will configure whatever we want to do in the system directory under control dict.
And we will initiate the uh simulation.
If it is ICO form, just type ICO form and it will get initiated.
If it is simple form then simple form.
So you get the point.
We have to use the name of the solver to initiate it.
So introduction to compressible solvers in Openfoam.
Uh handle fluid flows where density changes are very significant.
These solvers are essential for high speed flows, shock waves, and other compressible phenomena.
So the most important solver is rho central foam.
So it is a density based compressible flow solver.
So whatever we saw in incompressible or pressure based solvers now uh rho central foam is a density
based solver.
so it is suitable for high speed aerodynamic and shock wave kind of simulation.
And one of the examples is if you want to simulate a supersonic flow over a ridge or through a nozzle,
then you can use row central foam.
And there is one very popular, uh, compressible solver called sonic foam.
So as the name says, it works for sonic flows, uh, a transient solver and uh, for transonic, supersonic,
subsonic, anything you can use.
But it assumes that the gas or the fluid is compressible.
That is the only thing.
So if it is compressible, mostly it is gas.
It can't be a liquid.
And applications is useful for simulating time dependent compressible flows, which is transient and
simulating a shock tube or expansion of a gas in a nozzle.
These are the kind of things sonic foam is good at doing.
Then we have rho pimple foam.
As it says, Rho is for density based and the pimple is for transient.
So it is a transient solver for turbulent flows of compressible fluids.
Unlike, uh, pure simple foam, this can also handle compressible fluids.
It is applicable to a wide range of, uh, compressible fluid problems, including high speed train
or an aircraft wing.
Okay.
And implementation step is going to remained the same.
But we also have to define the pressure and velocity differently.
Since it is density based.
We will be defining thermophysical properties because it has to account for the compressible nature.
So we will be defining thermophysical properties uh, which will handle the compressibility.
Otherwise, it is going to remain the same on most of the levels.
Like, uh, do the mesh set up the boundary condition, initial condition, then run the simulation.
Okay, so for multiphase, the multiphase solvers in Openfoam are used to simulate, uh, fluid flows
involving more than one fluid.
So whatever we have done till now is like one phase or, uh, one fluid.
Right.
So if we are working with two fluids, let's say water mixing with oil, and we want to see how fast
the oil will, uh, rise over the water.
So if you want to do such kind of multiphase things, then, uh, you can use openfoam multiphase solvers.
These always are crucial for application in mostly chemical engineering, environmental engineering,
and also fluid structure interactions, where we will be having like a flap of an airfoil and we want
to see what it happens.
If you want to work on fluid structure interaction, then you can use multiphase solvers.
Uh, then the key multiphase solvers or inter form, this is the most widely used one.
So it uses volume of fluid method.
Uh you can recall it from your CFD theoretical course if you took multiphase, uh, subjects.
So it will use volume of fluid, which is highly complicated, but you can set it up easily using Openfoam.
It is ideal for simulating interface between two fluids and simulating the break of waves or dam breaks.
It is popularly known as the flow in a mixing tank.
If you have a very big tank with oil, and if you are pouring water into it and how it will react,
if you want to see how the bubbles are formed.
So those things can be done in the multiphase solver using interphone.
We have multiphase interphone.
So this is also the same as interphone.
But again it has some uh, tweaks to the solver and how it is getting solved.
So there is slight difference.
If you want to know more you can check the documentations.
Okay, because it is beyond the mathematics of the course.
Okay.
Uh, implementation steps will be mesh generation and we will be setting up the boundary condition initial
condition phase fraction.
Here it is an additional setting we have to set uh which area has what fluid initially.
So we have to set that.
And we will also be defining the thermophysical properties for each of the fluid, each of the phase.
And we will do the control dict setup as usual and we will run the simulation.
So now we are going to do a lid driven cavity case.
So lid driven cavity flow is a classic benchmark problem in fluid mechanics.
It involves a square cavity filled with fluid.
Like how I explained already there is a big cavity.
All our walls.
There is a lid on top.
We are trying to move the lid towards the right side at a constant speed.
Now it is going to create a recirculation region.
So this is used as a benchmark problem to see whether all the algorithm works in your, uh, solver
is because it is having, uh, complex flow phenomena like boundary layer separation, vortex shedding.
And there is also recirculation zones, mostly vortex shedding is not happening here because if you
are working with alias then you might get small small vortex, but in most cases you are not going to
get vortex shedding.
In this it is mostly recirculation zones and we are going to check that.
So it is a valuable test case for validating computational fluid dynamics codes.
So the objective of this case study is that to understand the fundamentals of incompressible flow simulation
using Openfoam, they are going to implement appropriate boundary condition for the lid driven cavity
case.
And we are going to analyze the flow characteristics such as velocity profile, pressure distribution
and vorticity patterns.
We are going to validate the simulation against established benchmarks or experimental data.
But this is a homework for you.
Like validating the case.
I will tell you how to do the setup in Openfoam, and it's up to you to validate it and see how accurate
it is.
So the case setup is going to consider these steps.
First we will prepare a geometry.
It will be a square cavity.
We have already seen how to generate this block mesh for this case.
And in the flow regime we are going to do an incompressible flow with low to moderate Reynolds number.
How we are going to set the Reynolds number is based on how fast we are moving the lid.
Okay.
And the boundary condition lid will have constant velocity boundary condition, which is no slip.
And waltz is also going to contain no slip.
So when I say lid is having no slip, I mean at the surface of the lid just next to the lid, it is
going to have zero velocity, but as there is a shear, it is going to move with a constant velocity
with respect to the rest of the fluid particles in with respect to the lead.
The fluid particle just next to the lead is at zero position zero velocity, but with respect to rest
of the fluids it is moving at a constant velocity.
So that is the basic understanding here on setting up the boundary condition.
So the simulation parameters are we are going to use block mesh to develop the structured mesh.
Then this is a transient simulation.
We are going to use Icofom.
And the turbulence model is obviously laminar because it is icofom okay.
If you want to look at what is the boundary condition, I have displayed it here.
You can look at it.
As you can see, the first is uh, velocity.
You can recognize it by the dimensions.
So the velocity of the moving wall is one meters per second towards x axis.
For the pressure it is uh zero gradient and zero gradient.
And for uh kinematic viscosity it is 0.01 and the S.I. unit only.
And the application is I go from the start from a start time.
So which is zero.
And we are going to end at 0.05.
And the delta t here is 0.005.
Unless unlike what we did in the previous thing like 0.005 here it is much smaller.
So after we set the boundary conditions then we are just going to analyze the velocity profile, pressure
distribution, vorticity patterns and validation.
So this validation is on you.
This is like a homework.
You have to do it.
Uh we will be seeing how to post-process for velocity profile, pressure distribution and vorticity
patterns using Paraview.
Validation is up to you.
So we will now run the simulation actually.
Okay.
This is the case of cavity case.
Okay.
And we have zero constant para performance system.
So I will open it.
Okay.
So under zero we have velocity and pressure.
So these are exactly same as what you saw in the presentation like these things.
So I am not going to go over every one of them.
Uh I'll show you transport properties.
The new is 0.01.
And in the system the block mesh is same.
And the control dict, it is slightly going to be different, like it is starting from zero ending a
0.05.
That is same.
But the delta t is 0.0005.
And right interval is two for every two time steps.
Or uh yeah, time steps.
It is going to write one case file, which means 0.001.
For every 0.001, there is going to be one case one.
So now we can run it.
To run it, all we have to do is do block, mesh and icofom.
It is going to take only that much time.
Now we can run it or no visualize it using Paraview.
We got all the time steps.
I'll go to paraview.
Click on apply.
Now you can see we have the pressure profile.
I'll choose Velocity Profile.
Now we are in the 0.001 time step to play.
I can click on this and you can see how it is growing.
So you get how it has converged right.
Okay.
To.
This is the velocity profile.
We got the pressure profile also.
But how to plot streamlines to understand what is it we have to plot streamlines.
Right.
So to do that first we will do a slice.
So to click on the slice and choose Z normal we will have this plane I usually remove show plane and
click on apply.
So on this slice you can choose velocity.
We have the velocity profile.
And you see this right.
So it is a stream tracer.
If you click on that it will plot from the minimum to maximum.
Click on apply.
And usually it is in pressure.
So you can choose velocity.
You can uh reduce the number of points.
Now it is thousand.
You can keep it around 500 or even less.
I'll keep like 100.
Now you can see how the velocity is in circulation region.
That is one thing, but if you want to do the uh vectors also you can work with the glyphs.
But that's not going to be very useful in this case.
So I will keep it with streamlines.
You want to hide this line.
Just click on this and it will be done.
You want to save this as animation?
Click on File Save Animation and give some name.
Let's say lid driven cavity such as mp4.
Click on okay and you can choose the frame rate.
Let's say I want to do ten frames which will be 0.1 second will be the one frame.
Click on okay.
Don't worry about this error.
It always appears we have the file.
So we have for the stream lines.
Now if you do want to do just for the paraview, hide this, hide this.
And again can't save animation.
Now I'll do lid driven cavity velocity okay.
Let's click on okay and click okay.
Now we got the velocity.
Now this will be much slower because I chose one frame per second.
Yeah.
So so you can actually play with this.
And that is all about this tutorial.
Okay.
And the next week's homework task is go to this link.
It will be available in resources.
This is a tutorial I made for a mesh preparation using block mesh for backward facing step.
So this will be used in our next class.
So make sure you understand everything from this tutorial.
Pause the video whenever you need.
Do it hands on, do it parallelly and understand everything.
If you have any questions, feel free to contact me.
Thank you for watching this video.
See you in the next class.