WEBVTT

00:00.110 --> 00:00.800
Hello everyone.

00:00.800 --> 00:04.250
Welcome back to the CFD using Openfoam Beginner to Intermediate course.

00:04.340 --> 00:10.430
In this class we will be seeing the types of boundary conditions, practical implementation, examples

00:10.430 --> 00:16.460
of those boundary condition turbulence modeling, introduction and setting up and running some Rans

00:16.460 --> 00:17.240
simulation.

00:18.020 --> 00:20.120
So what are the types of boundary condition?

00:20.120 --> 00:22.070
As we already saw we have two.

00:22.070 --> 00:25.790
One is Dirichlet boundary condition and the other is Neumann boundary condition.

00:25.790 --> 00:29.720
To do a Dirichlet condition we will be defining a fixed value.

00:30.530 --> 00:34.040
So it specifies a fixed value for a variable at the boundary.

00:34.040 --> 00:36.860
The example is like inlet velocity in a pipe.

00:36.860 --> 00:42.050
The application will be used when the exact value of the variable is known at the boundary.

00:42.050 --> 00:44.990
The open form keyword to do this is fixed value.

00:44.990 --> 00:47.690
Notice that the v is capital because it's the second word.

00:48.590 --> 00:49.850
I took a velocity file.

00:49.850 --> 00:50.720
For example.

00:51.350 --> 00:54.750
In this we will be specifying the inlet as a velocity.

00:54.750 --> 00:57.420
So here I have done inlet as a function.

00:57.420 --> 01:00.000
This will be defining in the u file.

01:00.000 --> 01:01.800
So the type will be fixed value.

01:01.860 --> 01:07.440
The value will be uniform 100 which means it is one meters per second in x direction.

01:07.440 --> 01:13.440
If you want it in the negative x direction, you can just mention it minus one and it will be, uh,

01:13.440 --> 01:20.360
directed in the opposite direction if you see Neumann boundary condition, it is a fixed gradient.

01:20.360 --> 01:24.740
So it specifies a fixed gradient or rate of change for a variable at the boundary.

01:25.100 --> 01:29.330
The example is heat flux at the surface of the wall or a heated wall.

01:29.360 --> 01:30.470
The application is.

01:30.470 --> 01:33.770
It is used when the derivative of the variable is known at the boundary.

01:33.890 --> 01:36.950
So the open form keyword is zero gradient.

01:37.040 --> 01:41.860
It is not constrained to using zero gradient, but it is the most commonly used.

01:42.490 --> 01:48.160
You can also define other types of gradients with specific values if you want, so that is also possible.

01:48.160 --> 01:53.200
Here I have say taken the same velocity file, but here we will be defining the outlet.

01:53.200 --> 01:59.440
So this outlet is set to type zero gradient because we do not know what is the value at the outlet because

01:59.440 --> 02:01.000
we define at the inlet.

02:01.000 --> 02:02.620
So we won't give at the outlet.

02:02.620 --> 02:04.300
The solver will calculate it for us.

02:05.100 --> 02:08.220
Instead, we will be defining maybe zero pressure at the outlet.

02:08.640 --> 02:10.770
Then we have symmetric boundary condition.

02:10.770 --> 02:14.100
It assumes no flux across the boundary.

02:14.190 --> 02:19.080
The center line of a symmetric flow problem is one such example.

02:19.080 --> 02:24.090
The application is used to reduce computational effort by exploiting the symmetry in the problem.

02:24.090 --> 02:32.300
The openfoam keyword is using just symmetry plane, so it is mostly useful in cases like a nozzle instead

02:32.300 --> 02:33.500
of doing entire 3D.

02:33.500 --> 02:36.590
Even if you take a 2D section, you are still going to see the flow.

02:36.590 --> 02:41.780
But even in a 2D, you don't have to simulate both the top half and the bottom half.

02:42.410 --> 02:47.510
Just simulating the top half is enough because it is going to be symmetric along the center axis.

02:47.510 --> 02:52.160
So you can define the center axis face as symmetry plane and it would still work.

02:52.730 --> 02:56.530
Then we have the periodic boundary condition, which is also known as cyclic.

02:56.620 --> 03:02.920
It assumes the solution repeats itself in a periodic manner, which means the flow in a periodic array

03:02.920 --> 03:10.570
of obstacles can be modeled in such a way that the outlet of the pipe or outlet of the flow domain can

03:10.570 --> 03:12.610
be given as the input back.

03:12.610 --> 03:18.390
So when we are getting a value at the outlet, we can give it as the inlet as well.

03:18.390 --> 03:20.430
So that is what the cyclic says.

03:21.150 --> 03:25.590
So the application is it is used in simulations of a repetitive structures or flow.

03:25.590 --> 03:30.600
And if you have only a small section of pipe, but if you want to consider it as an infinite length,

03:30.600 --> 03:35.640
then you can do the outlet are given to the inlet thing.

03:35.640 --> 03:40.320
So it is mostly periodic or cyclic, and it can be considered as an infinite pipe.

03:41.600 --> 03:46.400
The openfoam keyword is just cyclic, so we have two things.

03:46.400 --> 03:48.470
So one is periodic one and periodic two.

03:48.470 --> 03:51.740
So if you see both has the type cyclic.

03:51.740 --> 03:55.520
But the neighborhood patch corresponds to the opposite of the one.

03:55.520 --> 04:00.380
If you see the periodic one we have neighbor patches periodic two and periodic two has the neighbor

04:00.380 --> 04:01.490
patches periodic one.

04:01.520 --> 04:05.300
This is how we are defining the coupling of both those patches.

04:05.320 --> 04:12.370
and it will be coupled so that one of the output value is given to the input of other value.

04:13.150 --> 04:16.540
The practical implementation example is what we are going to see now.

04:17.290 --> 04:19.840
We have a backward facing step of a 2D.

04:19.840 --> 04:24.940
So if you haven't watched the meshing tutorial already, please check out this YouTube link of my YouTube

04:24.940 --> 04:29.320
channel where I have step by step explained how to prepare the mesh for this.

04:29.490 --> 04:32.010
We will set up both laminar and turbulent case.

04:32.010 --> 04:36.930
For this problem we will use incompressible state solver which is simple form.

04:37.500 --> 04:40.200
So now we will see how to do the laminar case.

04:41.220 --> 04:43.590
This is the geometry which we are using.

04:43.590 --> 04:46.770
It has inlet outlet fixed walls and front and back.

04:46.800 --> 04:50.790
If you see the front end back is set to empty because we are treating it as 2D case.

04:51.450 --> 04:52.830
Then we have the velocity.

04:53.600 --> 04:54.320
The velocity.

04:54.320 --> 05:00.350
We have used Dirichlet boundary condition, where we are defining the uniform velocity as 1D minus three,

05:00.350 --> 05:02.810
which is ten power minus three in the x direction.

05:02.840 --> 05:04.250
Of course, meters per second.

05:04.490 --> 05:06.110
And the outlet is zero gradient.

05:06.110 --> 05:10.610
If you see correspondingly for the pressure, we are not defining the inlet because we already defined

05:10.610 --> 05:11.660
it in the velocity.

05:12.320 --> 05:15.050
So we are defining it as zero gradient in the inlet.

05:15.050 --> 05:17.920
And for the outlet we are setting zero pressure.

05:17.920 --> 05:19.990
So it is also in a unit.

05:19.990 --> 05:23.650
So we will be defining fixed value and the value is uniform zero.

05:23.650 --> 05:26.470
And for fixed walls for velocity it is no slip.

05:26.470 --> 05:29.410
It is just nice way of saying that the fixed value is zero.

05:29.410 --> 05:34.330
Notice that the s is capital and for pressure we are saying zero gradient.

05:34.330 --> 05:38.980
So zero gradient is the way to tell the solver that you have to calculate it for me, and I do not know

05:38.980 --> 05:43.320
it already on front and back is obviously empty because we are doing a 2D case.

05:43.710 --> 05:48.360
If you see the transport properties, we are using a Newtonian model with the kinematic viscosity of

05:48.360 --> 05:55.440
1.56 into ten power minus five, and the simulation type is laminar for this tutorial and in the control

05:55.440 --> 06:01.770
dict, the application is simple form start time is zero and we will be stopping at 2000.

06:01.770 --> 06:03.690
That's the maximum number of iterations.

06:04.350 --> 06:09.470
But if the solution converges faster, we will not go till 2000.

06:09.470 --> 06:11.120
That's how steady state cases work.

06:11.360 --> 06:15.290
So these are the results which we are expecting out of the tutorial.

06:15.290 --> 06:18.290
So now I will jump to the terminal.

06:18.710 --> 06:23.660
Okay so this is the case where we will be working on.

06:23.660 --> 06:28.190
So I will open that location by doing the command explorer dot x space dot.

06:28.190 --> 06:31.090
So this is exactly the case which I showed you.

06:31.090 --> 06:32.800
All the case files belong to this.

06:33.040 --> 06:35.200
Now we are going to run the block mesh.

06:36.790 --> 06:38.380
So I ran the block mesh.

06:38.530 --> 06:41.260
And then the next command is simple form.

06:43.120 --> 06:46.750
Now I will let the simulation run and let it converge.

06:47.680 --> 06:49.030
And we will wait for it.

06:54.660 --> 06:58.380
Okay, now the simulation has converged at 483 iterations.

06:58.410 --> 07:04.620
As you can see, since it converged, it did not bother to go till, uh, 2000 iterations.

07:04.650 --> 07:06.690
Now we can visualize the results.

07:06.810 --> 07:08.490
I'll open the paraview file.

07:11.340 --> 07:12.510
I'll click on apply.

07:13.110 --> 07:15.000
Okay, now we have got the pressure.

07:15.000 --> 07:19.780
But since we are interested only in the last time step where it converged, we will press this and go

07:19.780 --> 07:22.360
to the last time step which is 483.

07:23.260 --> 07:29.950
I'll press on this to set the value to the, uh, range, which is visible here, and we can visualize

07:29.950 --> 07:30.790
the pressure.

07:31.120 --> 07:36.010
As you can see, uh, we are getting a good, steady state over here.

07:36.850 --> 07:37.300
Okay.

07:37.300 --> 07:43.620
Now, the most important, uh, result, which we are seeing in our backward facing step is the reattachment

07:43.620 --> 07:46.380
length and the recirculation region.

07:46.380 --> 07:51.180
So we will see how to visualize the recirculation region by plotting streamlines.

07:51.180 --> 07:54.750
So I will press on this which will plot the streamlines.

07:54.750 --> 07:55.920
Click on apply.

07:55.920 --> 07:58.170
Initially it will show only the pressure colors.

07:58.170 --> 08:01.410
You can change it to velocity colors.

08:01.410 --> 08:03.810
Now if you want to hide the line you can press on this.

08:03.810 --> 08:04.710
It will hide the line.

08:04.710 --> 08:09.530
You can see that there is a recirculation region under Reattachment point for this.

08:09.530 --> 08:14.390
But this tutorial is not about calculating the calculating the reattachment point, so I am not going

08:14.390 --> 08:15.320
to touch upon that.

08:15.650 --> 08:23.300
If you think like this are too many number of stream lines, then you can probably reduce it like this

08:23.300 --> 08:24.710
is a good number.

08:24.710 --> 08:27.440
We are able to see distinct lines here.

08:27.560 --> 08:30.280
So this is how we will be plotting stream lines.

08:30.730 --> 08:37.300
And uh, if you just want to see how it looks without the stream lines, then you can go here, hide

08:37.300 --> 08:37.600
this.

08:37.600 --> 08:38.800
And this is your result.

08:39.010 --> 08:41.140
So that's it about the laminar case.

08:41.140 --> 08:43.330
Now we will see the turbulent case.

08:44.080 --> 08:45.400
So what is turbulence.

08:45.550 --> 08:50.260
The characteristics of a turbulent flow are irregularity diffusivity and high Reynolds number.

08:50.260 --> 08:55.410
The importance of turbulence in engineering is that it is an important aspect to consider, as it plays

08:55.410 --> 09:00.540
a crucial role in fields like fluid mechanical system, aeronautical engineering, and environmental

09:00.540 --> 09:01.080
engineering.

09:01.110 --> 09:03.270
Also weather and HVAC.

09:04.440 --> 09:07.890
The turbulence model overview is mostly these.

09:07.920 --> 09:11.370
We are mostly interested in only three types of turbulence modeling.

09:11.370 --> 09:16.020
One is direct numerical simulation, where we will be solving the entire Navier-Stokes equation without

09:16.020 --> 09:16.800
any modeling.

09:17.780 --> 09:21.830
It is computationally expensive and not feasible for higher Reynolds number.

09:21.830 --> 09:27.560
Then we have large eddy simulations which will resolve large scale turbulence structures while modeling

09:27.560 --> 09:32.480
smaller scales, and it is suitable for unsteady flows with moderate computational cost.

09:32.480 --> 09:38.150
Then we have Reynolds averaged Navier-Stokes, popularly known as Rans, or in Openfoam terms, it's

09:38.150 --> 09:44.750
RA ra as it solves the time averaged equation of motion with turbulence effects modeled widely used

09:44.750 --> 09:47.540
due to its balance between accuracy and computational cost.

09:47.540 --> 09:50.690
So this is the introduction to turbulence modeling.

09:50.990 --> 09:53.180
We will be using Rans throughout this course.

09:53.180 --> 09:57.890
In trance there are mostly three main uh models.

09:57.890 --> 10:04.640
One is known as k epsilon where it is a two equation model where it is, uh modeled based on turbulence

10:04.640 --> 10:08.220
kinetic energy, which is k, and the dissipation rate epsilon.

10:08.610 --> 10:10.920
It is suitable for general purpose applications.

10:10.920 --> 10:15.900
Then we have the most popular one, which is the k omega SST model.

10:16.500 --> 10:21.630
It is also a two equation model based on turbulence, kinetic energy and specific dissipation rate,

10:21.630 --> 10:22.650
which is omega.

10:22.800 --> 10:28.740
Commonly used in external aerodynamics and turbomachinery where the walls need to be modeled so SST

10:28.740 --> 10:31.110
is shear stress transport model.

10:31.560 --> 10:34.410
So we will be modeling shear stress better in this.

10:34.410 --> 10:40.140
Then we have the Spalart-allmaras model, which is a one equation model designed specifically for aerospace

10:40.140 --> 10:43.770
application to predict boundary layer behavior and aerodynamic performance.

10:43.950 --> 10:48.180
It is mostly used in external aerodynamics for airfoil wings and aircraft.

10:48.420 --> 10:53.010
So now we will be seeing backward facing step 2D turbulent case tutorial.

10:55.420 --> 10:57.280
So I'll go here.

10:57.610 --> 11:00.760
I will, uh, enter the second tutorial.

11:02.170 --> 11:03.040
I'll clear this.

11:03.550 --> 11:04.000
Okay.

11:04.000 --> 11:06.850
Now we are going to see the boundary files again.

11:06.850 --> 11:08.800
The boundary is going to remain in the same.

11:08.800 --> 11:09.970
The mesh is the same.

11:10.210 --> 11:15.070
And for velocity we have given 0.05m/s.

11:15.070 --> 11:17.440
It's quite high from what we used already.

11:17.440 --> 11:23.350
Then we have the K, which is, uh, turbulent kinetic energy for inlet.

11:23.380 --> 11:25.360
We are giving a fixed value and value.

11:25.360 --> 11:32.260
We are giving a reference value which is uniform 1.09 into ten power minus three.

11:32.260 --> 11:34.450
It is a 0.061 percentage.

11:34.450 --> 11:41.440
If you want to know how to calculate k omega and epsilon, there is a beautiful documentation from Openfoam.

11:41.440 --> 11:42.590
You can check that out.

11:43.070 --> 11:47.330
So they have given all the standard formula to calculate it, which you will be using as the initial

11:47.330 --> 11:48.080
condition.

11:48.290 --> 11:54.500
And for fixed walls we are using k q r wall function and again the value is referenced to internal field.

11:54.650 --> 11:56.690
Front and back is again empty.

11:56.990 --> 12:06.080
Then for new T we are giving the inlet as zero outlet, also as zero fixed walls as new two blended

12:06.080 --> 12:07.780
wall function, which is a function.

12:07.960 --> 12:13.570
And if you want to know more about these functions, you really have to check the documentation because

12:13.570 --> 12:14.710
there are a lot of function.

12:14.710 --> 12:18.250
We can't just explain all the function in the videos.

12:18.910 --> 12:22.960
So uh, we have the front and back HMD.

12:22.960 --> 12:26.980
So new T is just turbulent kinematic viscosity.

12:27.280 --> 12:31.860
Then uh, the next thing is we are having the omega here.

12:31.860 --> 12:34.710
So sorry the PPT has went backside.

12:34.710 --> 12:40.080
So it is omega and we have given it a pretty big value.

12:40.080 --> 12:46.440
So there is a reason since we want it to converge to a right value, we are giving it a very big value

12:46.440 --> 12:50.220
and it will correct it to the correct value.

12:50.220 --> 12:55.100
So we are trying to give a very big value and asking the solver to correct it for us.

12:56.090 --> 12:59.720
And uh, if you notice in new T we are giving it calculated.

12:59.720 --> 13:00.800
So that is also same.

13:00.800 --> 13:05.750
We are setting it as zero, a very low value and asking the solver to calculate it for us.

13:05.750 --> 13:07.340
So that's what happening.

13:08.210 --> 13:11.000
And in the control dict it is going to remind the same.

13:11.000 --> 13:15.410
And this is what we are uh expecting out of the simulation.

13:15.590 --> 13:16.010
Okay.

13:16.010 --> 13:18.020
Now I will run block mesh.

13:18.670 --> 13:19.540
It is done.

13:19.540 --> 13:20.860
Now I will run simple form.

13:23.350 --> 13:26.320
Let's wait for the simulation to end.

13:26.680 --> 13:31.240
Now the simulation has converged at 1378 iterations.

13:31.270 --> 13:33.550
Now we can visualize it using Paraview.

13:38.680 --> 13:40.570
Okay, we have got the pressure.

13:41.200 --> 13:44.790
And we have also got the velocity.

13:46.440 --> 13:50.730
Now, if you want to plot the streamlines, of course you can do it here.

13:51.540 --> 13:53.310
I'll change it to 250.

13:53.400 --> 13:54.450
Click on apply.

13:57.120 --> 14:01.470
Now you see we have got many recirculation regions.

14:01.470 --> 14:05.430
So this is what turbulence does to the flow domain.

14:06.320 --> 14:07.010
Okay.

14:07.040 --> 14:09.680
Now we have done the simulation.

14:10.130 --> 14:13.910
If you have any questions please feel free to contact me.

14:14.480 --> 14:21.230
And if you want to check the boundary conditions or types of boundary for each of the turbulence values

14:21.230 --> 14:26.060
like k, epsilon and omega, you can check the documentation and set it up.

14:26.060 --> 14:31.580
There are many tutorial cases which you can refer to and try it on your own.
