WEBVTT

00:00.320 --> 00:01.220
Hello everyone.

00:01.220 --> 00:04.940
Welcome back to the CFD using Openfoam beginner to intermediate course.

00:04.940 --> 00:10.100
This is the class two and in this class we will be seeing some geometry and mesh generation using a

00:10.100 --> 00:11.390
tool called block mesh.

00:11.390 --> 00:14.390
Then setting up boundary and initial conditions.

00:14.390 --> 00:19.100
And then we will also see how to use solvers and run the simulation in Openfoam.

00:19.100 --> 00:24.890
After doing that, we will be using Paraview as the post-processing tool and we will be seeing the results

00:25.370 --> 00:26.000
first.

00:26.000 --> 00:26.960
What is block mesh?

00:26.960 --> 00:31.470
Block mesh is a mesh generation tool which comes with the installation of Openfoam.

00:31.800 --> 00:37.560
It uses a dictionary file to call block mesh dict to define simple geometries and create structured

00:37.560 --> 00:38.070
meshes.

00:38.760 --> 00:44.220
The role of block machine openfoam is that it is used to create initial computational meshes.

00:44.220 --> 00:51.060
It can be highly structured, suitable for simple geometries like square, rectangle, channel or cube,

00:51.060 --> 00:54.320
cuboid or a flow over a cylinder or a wedge.

00:54.350 --> 00:57.020
These kind of things can be easily done using block mesh.

00:57.500 --> 00:58.100
Even.

00:58.100 --> 01:02.030
It can handle complicated mesh like structured mesh around an airfoil.

01:02.030 --> 01:08.960
But for that, we have other tools which might be very efficient in terms of time than block mesh.

01:09.050 --> 01:15.770
So the effort versus, uh, accuracy comes better in other software for a complex mesh.

01:15.770 --> 01:19.200
But block mesh is very efficient for a simple mesh.

01:20.010 --> 01:24.270
So the main key sections of block mesh dict is like vertices will be there.

01:24.270 --> 01:29.010
We have to define the vertices on a 3D space which we are going to use.

01:29.010 --> 01:36.630
Then using those vertices we will be defining boxes or a hexahedral box, meaning it will have six faces,

01:36.630 --> 01:38.010
more like a cube or a cuboid.

01:38.220 --> 01:42.580
Then we will be defining edges if we want specialized curves.

01:42.580 --> 01:49.300
So if there is a two point and we can join the two lines two points using a line.

01:49.300 --> 01:55.900
But if we want to join it using an arc, we can introduce a third point and define that point as a path.

01:55.900 --> 01:59.110
So that can be done using the edge feature.

01:59.860 --> 02:01.360
And then comes the boundary.

02:01.360 --> 02:08.940
So this boundary will define the type of patch, whether it is an inlet or outlet, or empty patch or

02:08.940 --> 02:11.010
wall patch, or if it is symmetric.

02:11.010 --> 02:12.990
We can do those things in the boundary.

02:12.990 --> 02:20.970
But let's say we have two blocks and two blocks share one common face, but we don't want it to be like

02:20.970 --> 02:21.360
a wall.

02:21.360 --> 02:27.690
What we do, we just merge the patch so that those two blocks behave like a single block.

02:27.690 --> 02:32.020
So that is where the mesh merge patch pairs come into play.

02:32.110 --> 02:37.390
So we will be seeing all these practically when seeing the blog mesh dict file as an example.

02:38.200 --> 02:43.030
For the first thing, we will be creating simple geometries like a 2D square cavity.

02:43.720 --> 02:49.450
We will be defining eight vertices, and we will use those eight vertices to create a single block.

02:49.450 --> 02:51.520
And we will be defining boundary condition.

02:51.520 --> 02:54.710
And we will see how the meshes in the next example will be.

02:54.710 --> 03:01.640
We will be doing a 3D rectangular channel where we will be setting boundary condition like inlet, outlet

03:01.640 --> 03:05.030
and wall, same eight vertices, and we'll be creating a block.

03:05.240 --> 03:08.570
So we will first see this and then proceed further.

03:08.660 --> 03:12.560
Now I have my terminal open.

03:12.560 --> 03:15.500
I'm already in the folder for class two.

03:16.190 --> 03:20.580
And we have the first case which is square cavity mesh.

03:20.580 --> 03:22.980
So I will go inside that.

03:25.440 --> 03:25.920
Okay.

03:25.920 --> 03:33.120
Inside this we can see that we have constant uh para dot form and system.

03:33.120 --> 03:34.290
We do not have zero.

03:34.290 --> 03:38.160
So zero is supposed to contain the boundary condition or boundary files.

03:38.160 --> 03:45.080
But we are not having that file here, that folder here because we are not interested in in running

03:45.080 --> 03:49.460
the case, we are just interested in doing the mesh using block mesh data.

03:49.520 --> 03:53.630
So block mesh dict exists inside system folders.

03:53.630 --> 03:54.830
Let me show you.

03:55.010 --> 03:57.590
So this is the case which we are going to use.

03:57.590 --> 04:01.370
And under system folder we will be having the block mesh dict.

04:01.370 --> 04:03.590
We will view what is there inside.

04:04.490 --> 04:05.030
Okay.

04:05.030 --> 04:07.830
Now we have eight vertices as you can see.

04:07.830 --> 04:10.380
So each one corresponds to x, y and z.

04:10.470 --> 04:12.840
But before that we have something called scale.

04:12.840 --> 04:14.160
So what is this scale.

04:14.160 --> 04:21.150
Usually everything in openfoam is an Si unit, meaning whatever vertices we define it is in metres.

04:21.150 --> 04:27.000
So if it is like zero comma, zero comma zero, it is a point, and the next point is one comma zero

04:27.000 --> 04:27.600
comma zero.

04:27.600 --> 04:33.560
It means that this is one metre away from zero comma zero comma zero in x axis.

04:33.560 --> 04:36.620
But if we don't want to work with meters, what do we do?

04:36.650 --> 04:39.620
We just define it as 0.001.

04:39.620 --> 04:45.800
If we want to work with millimeters just 0.01 if we want to work with centimeters.

04:45.800 --> 04:51.680
But if you want to work on a kilometer scale, then you can obviously choose 1000.

04:51.680 --> 04:58.980
If you are doing something like an entire aeroplane with a large amount of, uh, mesh, then you can

04:58.980 --> 05:04.500
choose kilometer scale if you want, but usually scale one, which is meters is fine.

05:04.680 --> 05:06.870
Now let's see what are these vertices.

05:06.870 --> 05:13.590
To explain that, I will just open paint, uh, so that I can explain you physically.

05:13.590 --> 05:15.840
So this is 000.

05:15.840 --> 05:18.990
So let's assume we have a coordinate system.

05:20.590 --> 05:22.390
And let's say this is x.

05:22.690 --> 05:25.300
This is y and this is Z.

05:25.570 --> 05:26.140
Okay.

05:26.140 --> 05:29.290
Now we will be doing one by one.

05:29.290 --> 05:32.680
This is like a an array okay.

05:32.680 --> 05:35.080
Uh openfoam is written in C plus plus.

05:35.080 --> 05:38.260
So everything starts from zero.

05:38.260 --> 05:42.100
So this element in the array starts from zero.

05:42.100 --> 05:46.850
So let's keep it like this is the zeroth point okay.

05:46.970 --> 05:52.490
And we have one comma zero comma zero which is like one meter displaced in the direction of x.

05:52.490 --> 05:54.770
So this will be our point one.

05:55.520 --> 06:00.230
And then we have one comma one comma zero which would be around here.

06:00.230 --> 06:01.760
And this is our point two.

06:02.120 --> 06:06.560
And then we have zero comma one comma zero which will be around here.

06:07.370 --> 06:09.830
So this will be our point three.

06:09.890 --> 06:17.000
Now these four points can form a face a simple 2D face.

06:17.000 --> 06:24.050
Well Openfoam can't really work with 2D structures, but with these four points we can only make a 2D

06:24.050 --> 06:24.470
face.

06:24.500 --> 06:33.830
Now we have got a face, but if you see the other four, the values in the x and y are same, like if

06:33.830 --> 06:40.010
it is zero, one, two, three, then four, five, six, seven have the a corresponding like zero and

06:40.010 --> 06:43.400
four have the same x and y, but the z is different.

06:43.490 --> 06:47.750
And if you see two and five, the x and y is same.

06:47.750 --> 06:49.430
But the z is changing.

06:49.430 --> 06:56.800
What it essentially means is that we are just displacing this entire face or copying the entire face

06:56.800 --> 07:00.010
and putting it at some distance in the Z direction.

07:00.010 --> 07:03.130
Let's say this will be our fourth point.

07:03.820 --> 07:06.880
This will be our fifth point corresponding to one.

07:07.300 --> 07:12.340
This will be our sixth point, and this will be our seventh point.

07:12.340 --> 07:17.620
So what this essentially does is that we have got another face.

07:23.020 --> 07:23.530
Yeah.

07:23.560 --> 07:29.470
Now we have two faces, but it is not yet connected in the Z direction, so we don't have a block.

07:29.470 --> 07:29.830
Right.

07:29.830 --> 07:32.320
So that's where this section comes in.

07:32.320 --> 07:38.560
We are defining it in the name hex because it is a hexahedral block.

07:38.560 --> 07:40.270
And then we are giving the numbers.

07:40.270 --> 07:43.960
So these numbers are the index of these vertices.

07:44.070 --> 07:52.590
So if you had noticed something when I was writing this, I was doing it in counterclockwise because

07:52.590 --> 07:55.050
zero one, two three is in counter-clockwise.

07:55.050 --> 07:57.600
Then 4567 is also counterclockwise.

07:57.630 --> 08:01.080
This is a notion that we have to follow in openfoam.

08:01.080 --> 08:07.320
And also when we are finished doing those the first four points, the next point has to correspond with

08:07.320 --> 08:08.130
the zeroth point.

08:08.140 --> 08:09.610
So that is how it works.

08:09.610 --> 08:11.770
Only then it can make the association.

08:12.010 --> 08:12.490
Okay.

08:12.490 --> 08:20.050
Now we have created the two faces and we are defining 01230123.

08:20.050 --> 08:22.990
And we have 456764567.

08:22.990 --> 08:25.750
So we are defining it as a single block.

08:25.750 --> 08:31.900
Now this will connect these points and make it as a block.

08:33.320 --> 08:33.920
Okay.

08:35.120 --> 08:35.570
Okay.

08:35.570 --> 08:40.940
The next command which we are seeing here is three points or three values.

08:40.940 --> 08:44.030
This is x, this is y and this is z.

08:44.090 --> 08:51.200
So what it means is that we are subdividing the x direction face in the value of 20.

08:51.200 --> 08:53.630
And we are subdividing y by 20.

08:53.630 --> 08:57.100
And we are just keeping one cell in z Z direction.

08:57.100 --> 09:06.100
So after subdivision, the X direction will be getting subdivided 20 times and it will be carried over

09:06.100 --> 09:09.550
throughout the mesh, not just one phase, it will be carried over throughout the mesh.

09:10.240 --> 09:15.160
We will also see this visually and y is also done simple grading.

09:15.160 --> 09:17.740
We will not look at that right now.

09:17.740 --> 09:20.960
Let's uh, assume that it is one, one one as of now.

09:20.960 --> 09:23.450
Most commonly, we will be using one, one one only.

09:23.450 --> 09:29.000
So we will just see up to here, run the block mesh and we will see.

09:29.000 --> 09:34.730
So what I am going to do is I will comment this entire boundary.

09:34.730 --> 09:37.730
We will pretend that this doesn't exist.

09:37.730 --> 09:41.690
Like I have commented this meaning it doesn't exist in the code.

09:41.690 --> 09:43.430
So we are just going to run this.

09:43.430 --> 09:50.970
I will go here and whenever you are running anything in Openfoam, make sure you are in the right working

09:50.970 --> 09:51.510
directory.

09:51.510 --> 09:57.570
So what is working directory mean when you are in a location like in this case I am at one square cavity

09:57.570 --> 10:03.210
mesh and if I type ls I have to see the constant system folders.

10:03.210 --> 10:07.110
Only then we are in the right, uh, location.

10:07.110 --> 10:11.930
Let's say I am inside system because this is where block mesh resides.

10:11.930 --> 10:12.140
Right?

10:12.140 --> 10:14.180
But I should not be doing this.

10:14.180 --> 10:17.900
If I go into system and do block mesh, it will throw an error.

10:17.900 --> 10:19.340
It is not going to work.

10:19.340 --> 10:21.440
So I will go back one directory.

10:22.250 --> 10:23.450
Now I will type ls.

10:23.480 --> 10:25.790
Now we can see constant and system.

10:25.790 --> 10:30.890
So this is the location where we have to execute all our open form commands.

10:30.890 --> 10:34.290
We have to remember this throughout the usage of open form.

10:34.530 --> 10:39.930
Now the command to execute block mesh is just block mesh.

10:40.050 --> 10:41.940
Notice that M is capital.

10:42.390 --> 10:43.500
I will hit enter.

10:44.340 --> 10:53.430
Now you can see that we have 400 cells because we have 20 by 20 and we have many faces.

10:53.430 --> 10:57.300
And the bounding box is like 000 which is the minimum value.

10:57.310 --> 11:02.080
and this is the maximum value of the cube, which is one one, minus one 0.1.

11:02.080 --> 11:05.230
And we have only default faces as all patch.

11:05.230 --> 11:08.680
So we will visualize it to visualize.

11:08.680 --> 11:14.860
As I have explained in the previous class, we will do touch space dot form to create a paraview file.

11:14.860 --> 11:16.780
Then we can go in here.

11:16.810 --> 11:18.160
Double click this.

11:22.320 --> 11:23.730
Wait for it to load.

11:23.730 --> 11:24.810
Click apply.

11:24.810 --> 11:26.460
Then we will have a block.

11:26.670 --> 11:27.690
You see it is a block.

11:27.690 --> 11:29.160
But how do we view the mesh?

11:29.670 --> 11:31.080
We will go here.

11:31.380 --> 11:33.210
Click on surface with edges.

11:33.210 --> 11:35.910
Now you can see the blocks okay.

11:36.690 --> 11:41.490
Uh, if you scroll down on the left panel you can see something called Data Access Grid.

11:41.490 --> 11:42.330
I will turn on.

11:42.330 --> 11:45.510
You can see the x axis ranges from 0 to 1.

11:45.520 --> 11:52.120
Y is also ranging from 0 to 1, and z direction is from 0 to 0.1.

11:52.120 --> 11:54.760
Exactly what we wanted to do.

11:54.790 --> 11:59.650
So if I click this button, it will snap to the z axis normal plane.

11:59.830 --> 12:01.180
Okay now we have this.

12:01.180 --> 12:04.870
So we will see what the 20 by 20 actually did.

12:04.900 --> 12:05.320
Okay.

12:05.320 --> 12:09.980
Now let's say I have only one one in x and y direction.

12:10.700 --> 12:14.420
Uh, now after changing, I will hit control S to save the file.

12:14.480 --> 12:19.400
I will run block mesh again so it will get updated.

12:19.490 --> 12:26.930
I will go to paraview and make sure that you are selected para dot form and click on refresh.

12:26.930 --> 12:29.120
Try to move something like in para view.

12:29.150 --> 12:31.670
Your left mouse will be used to rotate it.

12:31.700 --> 12:36.810
Right mouse button can be used to scale up and scale down.

12:36.840 --> 12:39.060
Middle mouse can be used to move things.

12:39.240 --> 12:44.190
Mouse is highly recommended whenever you are working with any geometry, so get a mouse.

12:44.970 --> 12:48.450
Okay, now I am zooming by scrolling the mouse wheel.

12:48.780 --> 12:55.140
Okay, now you can see even though I am in surface with edges, we are seeing only one cell in this

12:55.320 --> 12:59.330
because we have not divided into anything.

12:59.360 --> 13:04.130
Now let's say I am just dividing this by five five.

13:05.810 --> 13:08.900
I will save the file run block mesh command.

13:09.170 --> 13:10.340
Go to paraview.

13:10.340 --> 13:11.120
Refresh it.

13:11.120 --> 13:15.770
Now you can see we have five on the x axis and five on the y axis.

13:15.770 --> 13:22.220
Now I just want to go back to 20 by 20 let's say okay I will save it.

13:22.630 --> 13:27.190
and run the block mesh refresh.

13:27.190 --> 13:29.110
And you can see we have 20 by 20.

13:29.110 --> 13:35.260
But since I gave one as the value in z direction, we have only one cell in the z direction.

13:35.260 --> 13:39.850
It is because we are trying to make a 2D uh square cavity case.

13:39.850 --> 13:42.400
So we are keeping is it as one.

13:42.400 --> 13:47.710
So because in openfoam there is nothing as pure 2D, Everything has to be 2D.

13:47.710 --> 13:53.800
But what we will do is we will set the front plane and back plane as empty patch, so it will behave

13:53.800 --> 13:54.790
like a 2D case.

13:55.390 --> 13:56.980
Okay, now we have the mesh.

13:57.070 --> 14:00.850
How to define the boundary names like everything is a default patch here.

14:00.850 --> 14:01.930
How do I know?

14:02.140 --> 14:08.590
On the left panel if you see if you click here, I will deselect internal mesh and select on the default

14:08.590 --> 14:09.730
faces click apply.

14:10.540 --> 14:12.570
You see everything is default phase.

14:12.570 --> 14:15.930
Now this is where we will be getting the name of the patches.

14:15.930 --> 14:19.800
Now I will go back to internal mesh as of now okay.

14:20.340 --> 14:27.660
In the block mesh dict file I have typed this so let's see what each of them says.

14:27.660 --> 14:31.260
I will just comment out moving wall.

14:31.260 --> 14:31.980
Save it.

14:32.070 --> 14:33.810
I will go back to the paint.

14:33.900 --> 14:36.820
Now you see, I have given a name.

14:36.820 --> 14:38.950
Moving wall and the curly braces.

14:38.950 --> 14:41.830
Within that I have typed type as wall.

14:42.040 --> 14:44.230
So this is going to behave like a wall.

14:44.500 --> 14:46.270
And this name can be anything.

14:46.600 --> 14:49.750
I just chose moving wall um, in this case.

14:49.750 --> 14:52.510
But it can be anything like a top wall or something.

14:53.560 --> 14:57.640
Then the type is wall and I have to define the faces.

14:57.640 --> 15:01.010
You can see we have four numbers here three, seven, six and two.

15:01.040 --> 15:06.950
So what it is it is three, seven, six and two which is the top face here.

15:07.010 --> 15:13.400
So you can notice that this is also an anticlockwise direction 3762.

15:13.430 --> 15:15.020
We always have to follow this.

15:15.020 --> 15:19.130
Otherwise it will say the face is outward.

15:19.130 --> 15:20.300
It is facing outwards.

15:20.300 --> 15:23.680
So what we are trying to follow is right hand thumb rule.

15:25.450 --> 15:34.120
Assume that this is a hand okay, so whenever you are curling your fingers, the outward normal should

15:34.120 --> 15:35.230
be facing outside.

15:35.230 --> 15:37.240
Your thumb has to face outside.

15:37.300 --> 15:39.400
So we are curling it that side.

15:39.400 --> 15:42.010
So it is facing outside.

15:42.010 --> 15:42.730
You can try it.

15:42.730 --> 15:44.800
It is right hand thumb rule okay.

15:44.800 --> 15:46.660
Now I will save this file.

15:47.780 --> 15:48.890
I'll go here.

15:48.890 --> 15:49.880
Run block mesh.

15:49.880 --> 15:52.880
Now you can see that we have one more patch called moving wall.

15:52.970 --> 15:57.080
Apart from default face I'll go to Paraview refresh.

15:57.230 --> 15:59.210
You can see this just popped up.

15:59.210 --> 16:00.830
We have a moving wall now.

16:00.830 --> 16:02.120
I will select that.

16:02.120 --> 16:05.240
Deselect everything and you can see this is the moving wall.

16:05.960 --> 16:06.560
Very nice.

16:06.560 --> 16:10.310
We just created or given a name to a wall or a patch.

16:10.980 --> 16:17.310
Okay, now similarly I will remove comment for fixed walls.

16:17.910 --> 16:19.650
Fixed walls are also walls.

16:19.890 --> 16:23.010
As you can see I have defined three phases here.

16:23.010 --> 16:28.410
One is 0473 which is 0473, which is this phase.

16:28.410 --> 16:32.130
If you see from that side then that is still anticlockwise.

16:33.090 --> 16:37.390
Then we have two six, five one and then 51540.

16:37.390 --> 16:40.540
So we have defined all these faces as fixed walls.

16:40.720 --> 16:43.630
I will save the file run block mesh.

16:43.750 --> 16:46.630
Now you can see we also got fixed walls.

16:46.630 --> 16:49.690
Now I'll go here refresh.

16:49.960 --> 16:51.760
I will select the fixed walls alone.

16:51.760 --> 16:54.130
Deselect everything you can see.

16:54.130 --> 16:55.240
This is the fixed wall.

16:55.270 --> 16:56.620
Okay, this is annoying.

16:56.620 --> 16:58.630
I will remove the date axis grid.

16:58.840 --> 16:59.560
Okay.

16:59.560 --> 17:00.900
we have the fixed servers.

17:00.930 --> 17:04.770
Now I will select both fixed walls and default faces.

17:06.750 --> 17:08.400
We are seeing everything.

17:09.030 --> 17:12.000
I will select fixed walls and moving wall.

17:12.600 --> 17:14.100
Yeah, these are the walls.

17:14.130 --> 17:16.350
Now we are missing front and back.

17:16.350 --> 17:16.830
Right.

17:16.830 --> 17:20.700
So you can see that only those two are left in the default patch.

17:20.700 --> 17:23.010
Only these two are left without name.

17:24.340 --> 17:30.850
So what we are going to do is we will select those two faces and put it into front and back, and we

17:30.850 --> 17:32.110
are defining it as empty.

17:32.140 --> 17:35.740
Whenever you are working with 2D, the front and back has to be empty.

17:35.740 --> 17:38.110
Only then this will behave like a 2D case.

17:38.260 --> 17:42.130
And here also I have put two face values.

17:42.250 --> 17:48.650
I will save the file run block mesh just like you expected And refresh.

17:48.650 --> 17:51.260
Now you can see we don't have anything in default phases.

17:51.260 --> 17:52.400
We are seeing nothing.

17:52.520 --> 17:54.380
I will remove default phases.

17:54.380 --> 17:54.920
Check.

17:54.920 --> 17:55.670
Fixed walls.

17:55.670 --> 18:00.740
We have fixed walls, we have moving walls and we have front and back.

18:01.160 --> 18:03.590
Yes, we have created the entire mesh.

18:03.590 --> 18:06.830
Now if you want to refine it, it's very simple.

18:06.830 --> 18:10.430
Just go here and maybe put 50 by 50.

18:11.510 --> 18:12.640
Save the file.

18:12.640 --> 18:14.170
Run block mesh.

18:15.070 --> 18:16.210
Give refresh.

18:16.570 --> 18:16.960
Yeah.

18:16.960 --> 18:18.220
You have a finer mesh.

18:18.220 --> 18:21.940
So this is all that you have to do to create a 2D mesh.

18:21.940 --> 18:29.890
If it is a simple square like this can be done if you want to do something like a flow, uh, on a flat

18:29.890 --> 18:33.280
plate, then you can do these things, but you need an inlet and outlet.

18:33.280 --> 18:38.270
You just have to change this as inlet and this as outlet, which we will be seeing in the next case.

18:38.330 --> 18:41.180
So I hope you understood what we did here.

18:41.390 --> 18:43.550
Now we will see about simple grading.

18:43.580 --> 18:47.180
So simple grading is like a gradient for the mesh.

18:47.420 --> 18:53.510
Uh, let's say this is one now in the x direction I will change it to 0.1 and you will see how the effect

18:53.510 --> 18:54.260
changes.

18:55.460 --> 18:57.290
Sorry I didn't run the block mesh.

19:00.870 --> 19:03.420
You see, everything is biased towards the right.

19:03.420 --> 19:04.860
Still, the count is same.

19:04.860 --> 19:11.640
It is 50 by 50, but it is a gradient towards one surface.

19:11.640 --> 19:18.570
It is because we have given it as 0.1, which means this is 0.1 times finer than whatever is here.

19:18.570 --> 19:21.900
So it will do that simple uniform grading.

19:21.900 --> 19:25.310
So this will be efficient when you are doing some inflation layer.

19:25.310 --> 19:31.520
Or if you want to, uh, create some boundary layer thickness then this could be useful.

19:32.060 --> 19:34.670
And if I do -0.1.

19:36.920 --> 19:40.970
Then I will get it towards this side okay.

19:40.970 --> 19:53.140
And this can be done for y direction also I'll do Do 0.1 run block mesh and refresh.

19:53.230 --> 19:54.640
Yeah, we have got it.

19:54.640 --> 20:02.290
So to reset everything, all you have to do is put the values to default one, one one, save the file,

20:02.290 --> 20:05.980
run block, mesh and refresh.

20:06.130 --> 20:07.090
That's it.

20:07.090 --> 20:09.820
So we have got the entire mesh.

20:09.820 --> 20:10.870
This is nice.

20:11.050 --> 20:13.330
Okay we are done with this.

20:13.360 --> 20:18.520
Now we will see what we have in the second tutorial, which is rectangular channel.

20:21.130 --> 20:22.090
Um, okay.

20:22.090 --> 20:29.080
In the system folder we have block mesh dict and I have defined eight vertices.

20:29.080 --> 20:33.640
You can pause the video and ponder how these vertices make a block.

20:34.270 --> 20:38.570
Again I have made this, but now you can see there is a slight difference.

20:38.570 --> 20:44.420
We are working with 3D so we don't have front and back and walls is defined as wall, but the inlet

20:44.420 --> 20:50.390
and outlet is defined as patch because in patches we can give values like inlet and outlet.

20:50.390 --> 20:52.040
That is what this makes.

20:52.850 --> 20:54.860
For inlet I have chose the left face.

20:54.860 --> 20:58.970
For outlet it is the right face and everything else is a wall.

20:58.970 --> 21:00.830
This is a 3D case in x direction.

21:00.830 --> 21:05.110
I chose 100 y ten and is it also ten?

21:05.110 --> 21:11.890
No grading okay, and I have chose the scale as 0.1 and I'll save this file.

21:12.730 --> 21:18.100
I'll go to this location which is the second folder rectangular channel mesh.

21:19.570 --> 21:19.900
Okay.

21:19.900 --> 21:21.910
Now I am in the right directory.

21:21.910 --> 21:26.090
I know because I am seeing constant and system and I do list which is list.

21:26.240 --> 21:26.570
Okay.

21:26.570 --> 21:29.060
List is list will listing all the folder.

21:29.090 --> 21:32.180
Now I can type block mesh.

21:32.570 --> 21:33.230
Okay.

21:33.440 --> 21:38.780
And, uh, I have already created the preview file, so I'll double click and open it.

21:40.820 --> 21:41.450
Gonna apply.

21:42.200 --> 21:45.680
So this is the geometry I'll go to surface with edges.

21:46.100 --> 21:47.810
You can see the entire geometry.

21:48.170 --> 21:51.150
Now I can click on inlet.

21:51.540 --> 21:52.890
This is the inlet.

21:53.850 --> 21:55.440
This is the outlet.

21:56.490 --> 21:59.430
And these are the walls.

21:59.430 --> 22:00.930
So you get the point.

22:00.930 --> 22:02.760
How block mesh works.

22:02.760 --> 22:06.540
And once we have the inlet and outlet we can set up a case.

22:06.570 --> 22:10.320
But you might be wondering where are these files getting saved.

22:10.470 --> 22:10.980
Right.

22:10.980 --> 22:13.590
So we will see where it is getting saved.

22:13.590 --> 22:14.990
It is under constant folder.

22:14.990 --> 22:21.170
Generally constant folder has other files also like properties of the fluid or material.

22:21.170 --> 22:26.090
But I have deleted these files because we are just interested in mesh.

22:26.210 --> 22:28.490
Under this we have a folder called poly mesh.

22:28.490 --> 22:30.800
This is where all the mesh information is stored.

22:30.950 --> 22:37.820
Regardless of what mesh you are using, be it block mesh or snappy hex mesh, or if you are importing

22:37.820 --> 22:46.050
mesh from Ansys or Fluent or Mesh or whatever it is, once it is in open form understandable format,

22:46.050 --> 22:47.580
it will be under poly mesh.

22:48.390 --> 22:50.400
Here you will be able to see five files.

22:50.460 --> 22:55.890
These are points which make the mesh and these are the owner which is like a patch.

22:55.890 --> 22:57.390
And the relation.

22:57.510 --> 22:58.380
These are neighbors.

22:58.380 --> 22:58.800
Other.

22:58.800 --> 23:01.320
Another relation and faces.

23:01.320 --> 23:05.920
If you are interested in seeing what is there inside, it is just pure numbers.

23:05.920 --> 23:08.110
Okay, same with this.

23:09.370 --> 23:19.090
You see everything is just number and for owner again it is just numbers, points also obviously numbers.

23:19.090 --> 23:20.860
But we are not interested in those.

23:20.860 --> 23:22.480
We are just interested in boundary.

23:22.690 --> 23:25.120
Okay I will go inside the boundary file.

23:25.120 --> 23:27.060
And now you can see it makes sense.

23:27.060 --> 23:27.660
Right.

23:27.690 --> 23:29.670
We have three patches.

23:29.670 --> 23:33.150
One is inlet, the other is outlet and the other is wall.

23:33.180 --> 23:34.890
So suppose you made the mesh.

23:34.890 --> 23:38.010
Now you don't want to generate block mesh from scratch again.

23:38.610 --> 23:45.360
Because sometimes when the mesh count is too high like a million, then it can take a bit of time to

23:45.360 --> 23:46.050
generate the mesh.

23:46.050 --> 23:47.730
It won't happen quickly.

23:47.850 --> 23:52.600
In that case, you don't want to change just the patch names and run the block mesh again.

23:53.590 --> 23:57.610
All you can do is you can go here and change whatever you want.

23:57.640 --> 24:01.000
Let's say, uh, I don't want this as outlet.

24:01.000 --> 24:04.390
I just want this as, uh, outflow.

24:04.390 --> 24:04.780
Okay?

24:04.780 --> 24:05.950
I'm just changing the name.

24:05.950 --> 24:07.240
Then I can do it.

24:07.240 --> 24:12.610
I'll save the file and it will be appearing there also.

24:14.870 --> 24:16.490
You see, we have outflow.

24:18.140 --> 24:19.820
So this is the outflow.

24:20.150 --> 24:24.440
Uh Paraview has some trouble when we are removing names.

24:24.440 --> 24:27.200
As you can see, this outlet actually doesn't have anything.

24:27.200 --> 24:29.720
Once you open and close, it will be fine.

24:29.750 --> 24:33.230
Now we have the outflow and that is the outlet now.

24:33.230 --> 24:35.480
So that is how you can change the name.

24:35.480 --> 24:37.940
Now I will change this back to outlet.

24:38.710 --> 24:41.590
Save the file and refresh.

24:42.010 --> 24:43.900
See now nothing is there in outflow.

24:43.900 --> 24:45.460
We have it in outlet.

24:45.970 --> 24:48.220
That is what this boundary can do.

24:48.220 --> 24:53.260
Also you can change the patch type like if you don't want this outlet as a patch.

24:53.260 --> 24:56.890
If you want it as um, empty.

24:57.130 --> 25:03.380
Let's say it's not usually how physics works, but let's say that you want to change some patch to empty.

25:03.410 --> 25:07.070
Then you can just change this to empty and it will go to empty.

25:07.880 --> 25:08.390
Okay.

25:08.390 --> 25:11.480
And now we also see something called group walls.

25:11.510 --> 25:16.550
So if we have multiple walls, let's say walls one, walls two, walls three and multiple groups of

25:16.550 --> 25:20.570
walls, then we are just selecting group walls and click on apply.

25:20.570 --> 25:22.400
And we will be seeing all the walls.

25:22.400 --> 25:25.610
So this is also one nice feature in Paraview.

25:26.150 --> 25:29.520
Okay we are done with the second tutorial also.

25:30.810 --> 25:34.590
Now the third is we are going to see curves.

25:34.590 --> 25:36.150
Okay, it's a bend pipe.

25:36.420 --> 25:39.060
I'll jump back to the PPT.

25:40.080 --> 25:41.400
Now introduction to arcs.

25:41.400 --> 25:42.630
So what are arcs?

25:42.630 --> 25:49.170
When I was explaining edges, I mentioned that we can not just join two points through a line, we can

25:49.170 --> 25:51.940
join it through a curve by defining a third point.

25:51.940 --> 25:54.340
That is what the ARX function does.

25:54.640 --> 25:59.290
So we will be doing that ARX in this okay.

25:59.290 --> 26:06.580
So in any rectangular channel you can create a circular outflow or opening.

26:06.580 --> 26:07.870
So that could be done.

26:07.870 --> 26:11.800
Or you can create an entirely circular pipe that is also possible.

26:11.800 --> 26:14.470
So this is the syntax the edges.

26:14.470 --> 26:18.270
You can see we have arc v1 v2 p x p y p z.

26:18.330 --> 26:19.890
So what is v1 v2.

26:20.010 --> 26:26.610
When we were defining the block mesh we have these points four seven, three, two, six, one and so

26:26.610 --> 26:26.850
on.

26:26.850 --> 26:31.140
If I want to create a create an arc between 4 and 5.

26:31.320 --> 26:35.010
So I just have to give these two as the v1 and v2.

26:35.910 --> 26:38.310
Here v one and v two will be four and five.

26:38.340 --> 26:40.180
Now what is p x p y p z.

26:40.180 --> 26:41.560
This is the third point.

26:41.560 --> 26:46.060
So how we usually do is the center of this point.

26:46.180 --> 26:48.370
This will act as the p y p z.

26:49.210 --> 26:52.840
So you can basically choose the third point and it will work.

26:52.840 --> 26:56.530
So how do you actually know what is the third point's coordinate.

26:56.860 --> 27:04.580
Uh, it comes by simple calculation on uh like a geometry.

27:04.580 --> 27:04.880
Right?

27:04.880 --> 27:11.090
We have we know the center of something, and, uh, we know the angle at which this is subtended.

27:11.090 --> 27:17.750
If you want to say you want to create a point here, then you know what is the angle from the normal,

27:17.750 --> 27:24.410
then you can just calculate it, calculate the x and y based on the sine theta and cos theta.

27:25.040 --> 27:28.750
This is just, uh, normal geometrical calculation.

27:28.750 --> 27:31.120
You can do that and select the points.

27:31.150 --> 27:31.690
Okay.

27:32.020 --> 27:37.030
This will be the syntax and we can create an arc.

27:37.030 --> 27:43.900
Now we will see how it is done through a tutorial I'll go to the third bend pipe.

27:43.900 --> 27:50.380
As you can see uh we have the block mesh here okay.

27:51.190 --> 27:56.480
So now let's say that we don't have these two arcs.

27:56.690 --> 27:57.020
Okay.

27:57.020 --> 28:02.240
I have commented it out and I'll go to the location.

28:05.060 --> 28:07.670
I will run sorry.

28:08.780 --> 28:09.890
Block mesh.

28:09.920 --> 28:10.580
Okay.

28:10.790 --> 28:12.440
I will load the mesh.

28:16.410 --> 28:16.680
See?

28:16.680 --> 28:18.240
Now we have a pure rectangle.

28:18.510 --> 28:19.740
Nothing fancy.

28:20.970 --> 28:22.770
We can see surface with edges.

28:22.800 --> 28:26.970
Yeah, we have an inlet.

28:27.510 --> 28:33.060
We have an outlet and we have walls.

28:33.090 --> 28:34.710
Okay, we have everything.

28:36.000 --> 28:36.480
Okay.

28:36.480 --> 28:40.170
Now let's say I want to join two points and create an arc.

28:40.190 --> 28:41.450
So how do I do it?

28:41.480 --> 28:44.570
We will just create one arc and see how it works.

28:44.600 --> 28:46.550
Usually it looks messy.

28:46.580 --> 28:50.600
Arcs are not very efficient in openfoam.

28:50.600 --> 28:53.960
Maybe sometimes it is efficient, sometimes it is not.

28:55.250 --> 29:01.100
Okay, I have just given refresh and you can see it has created an arc here.

29:01.130 --> 29:05.370
Okay, so it just created an arc because we defined it.

29:05.370 --> 29:07.170
It is between 1 and 2.

29:07.170 --> 29:12.900
And I have just created uh, defined a third point and it is creating mesh.

29:13.020 --> 29:13.560
Okay.

29:13.800 --> 29:15.330
So this is how it works.

29:15.330 --> 29:24.120
Now if I want to do it for this phase also, then I will uncomment this save the file, run block mesh

29:24.750 --> 29:26.910
and refresh it again.

29:26.910 --> 29:31.060
You can see now if you really want to see the coordinates matching.

29:32.560 --> 29:33.070
Okay.

29:33.070 --> 29:38.080
Now if you see this point it is zero point in x axis.

29:38.080 --> 29:40.600
It is one.

29:40.870 --> 29:42.910
You can see that it is 0 to 1.

29:42.910 --> 29:49.990
So in x axis it is one and y axis it is 0.5 z axis it is around 1.5.

29:50.620 --> 29:52.960
See that is what we have defined it here.

29:52.960 --> 29:55.880
So it is 10.5 and 1.5.

29:55.910 --> 30:01.490
Now let's say I just want to push it to one this year, not 1.5.

30:01.880 --> 30:02.570
It changed it.

30:03.110 --> 30:07.430
Uh and running the block it is throwing an error because it's not matching well.

30:07.430 --> 30:08.990
So there is it.

30:09.110 --> 30:10.790
This is not fully functional.

30:10.790 --> 30:14.210
So we might have to be very cautious while doing this.

30:15.350 --> 30:15.890
Okay.

30:15.890 --> 30:18.850
So I just defined it and it works fine.

30:18.850 --> 30:20.290
So I will just stick on to it.

30:20.290 --> 30:24.010
But if you want to play with the values, you can definitely do.

30:24.010 --> 30:30.760
And I also have a tutorial on YouTube, uh, in the channel code dynamics where I have done flow over

30:30.760 --> 30:33.190
a cylinder mesh just using block mesh.

30:33.190 --> 30:42.170
So there I have clearly explained on how to calculate the third point, the point where it will create

30:42.170 --> 30:42.680
a curve.

30:42.710 --> 30:46.730
Using Python, the basic mathematical formula, we can evaluate that.

30:46.730 --> 30:50.570
So you can check that video if possible I will drop that in the resources.

30:50.840 --> 30:51.170
Okay.

30:52.460 --> 30:57.440
If I start explaining that this will become a very very long video like 1.5 hours video.

30:58.220 --> 30:58.580
Okay.

30:58.580 --> 30:59.960
Now we have the mesh.

30:59.960 --> 31:03.170
So this is how we are creating Arcs.

31:03.500 --> 31:04.100
Okay.

31:04.760 --> 31:06.810
Now we will go to the next topic.

31:07.140 --> 31:10.440
So we saw all of these how to do run a block mesh.

31:10.440 --> 31:14.670
It is through the command block mesh and usually it is stored in the poly mesh folder.

31:15.060 --> 31:15.570
Okay.

31:15.570 --> 31:20.520
In CFD whenever we are working we will be defining the boundary conditions.

31:20.520 --> 31:27.090
Let's say the inlet velocity at zeroth time step is one meters per second or 0.1m/s.

31:27.180 --> 31:29.840
So this is what is called as boundary condition.

31:29.840 --> 31:32.660
And it will be applied for all the phases.

31:32.660 --> 31:36.470
Let's say in wall it is a no slip condition which means velocity is zero.

31:36.710 --> 31:38.840
It is a fixed value at the outlet.

31:38.840 --> 31:42.800
The pressure will be zero and for velocity it will be zero gradient.

31:42.800 --> 31:44.690
So what is zero gradient?

31:44.690 --> 31:47.450
We have to understand the types of boundary condition.

31:47.450 --> 31:55.020
When you take the regular theoretical CFD course we you would have come across something called the

31:55.020 --> 31:59.010
Dirichlet boundary condition and the von Neumann boundary condition.

31:59.010 --> 32:05.790
So what it actually means is that, uh, the Dirichlet condition, the values are fixed, it doesn't

32:05.790 --> 32:10.770
change or it is not a gradient kind of thing, it is just a fixed value.

32:10.770 --> 32:12.120
It is a specific value.

32:12.120 --> 32:18.280
But if you take Neumann condition, it is a zero gradient or some gradient.

32:18.280 --> 32:23.170
It is a flow which is defined in terms of gradients.

32:23.170 --> 32:23.500
Okay.

32:23.500 --> 32:28.660
So if you want to get into the math you can check the lectures which will talk about it.

32:28.660 --> 32:31.870
But we are just focusing on how to implement those in Openfoam.

32:32.470 --> 32:33.850
So we will see that.

32:33.850 --> 32:36.100
And there is also something called symmetric.

32:36.100 --> 32:41.200
Let's say there is flow over a cylinder, but you don't want to simulate the entire cylinder because

32:41.200 --> 32:42.840
it will be computationally expensive.

32:43.080 --> 32:47.190
If it is laminar, it is going to be symmetric about the center axis, right?

32:47.190 --> 32:49.260
We don't have to do it completely.

32:49.260 --> 32:54.360
So in that case you can do symmetric boundary condition and only simulate flow over half cylinder.

32:54.360 --> 32:57.390
And it all directly applies to the other half.

32:57.390 --> 33:00.150
Also you can do the mirroring and post-processing.

33:00.150 --> 33:02.580
So that is where symmetry boundary condition comes.

33:02.580 --> 33:06.400
And cyclic and periodic boundary conditions are something like.

33:06.400 --> 33:13.240
The outflow can be connected back to the inlet, and whatever values is getting out of the outflow will

33:13.240 --> 33:14.680
be connected back to the inlet.

33:14.680 --> 33:16.750
So it is like repeating geometries.

33:16.750 --> 33:19.000
That's why it is called periodic boundary condition.

33:19.000 --> 33:24.130
And obviously wall will have no slip or slip condition depending on the physics you are working with

33:24.550 --> 33:28.630
and setting the boundary conditions will always happen in the zero folder.

33:28.630 --> 33:32.840
So just like how we had constant and system, we have another folder called zero.

33:33.170 --> 33:39.140
We will be seeing from now on because for the previous videos we did not want the boundary condition

33:39.140 --> 33:40.250
to be confusing.

33:40.970 --> 33:42.680
So we I did not add it.

33:42.680 --> 33:44.960
Now we will be seeing the zero file also.

33:45.590 --> 33:52.820
So each file will have or the each time step in the zeroth condition zeroth folder is just zeroth time

33:52.820 --> 33:53.300
step.

33:54.080 --> 33:59.930
It will have velocity, pressure, uh, temperature pressure minus the hydrostatic forces.

34:00.320 --> 34:06.530
Uh, and there are other turbulence models like k epsilon, nu T omega and so on.

34:06.530 --> 34:10.190
So these files contain the boundary condition for the entire case.

34:10.190 --> 34:14.930
But usually it is mandatory to only to have velocity and pressure.

34:14.930 --> 34:17.570
Depending on physics we will have other mandatory files.

34:18.110 --> 34:18.500
Okay.

34:18.500 --> 34:21.920
Now now for the very simpler case, we will have only velocity and pressure.

34:21.950 --> 34:22.790
No turbulence.

34:22.790 --> 34:23.870
It will be a laminar case.

34:24.740 --> 34:30.860
So this condition will be defined under a section called boundary field which looks something like this.

34:30.860 --> 34:33.500
For an example we have the velocity file.

34:33.500 --> 34:36.950
And under velocity file we will have the function called boundary field.

34:36.950 --> 34:40.040
It is having three conditions like inlet, outlet and wall.

34:40.040 --> 34:42.680
This is what we had in the mesh also.

34:42.690 --> 34:47.790
So this inlet is having type fixed value and the value is one meter per second.

34:47.790 --> 34:51.240
Since it is a unit, this is one meter per second.

34:51.600 --> 34:56.940
And in the x direction in the outlet is zero gradient, which means the solver will calculate the values

34:56.940 --> 34:57.510
for you.

34:57.510 --> 35:02.850
Initially it is just zero in gradients it is a Neumann type boundary condition.

35:02.850 --> 35:06.240
Then the solver will calculate what should be the outlet based on the inlet.

35:06.240 --> 35:15.710
The walls is no slip, so Openfoam offers you this guy a nice keyword no slip to, uh, type that the

35:15.710 --> 35:16.760
velocity will be zero.

35:16.760 --> 35:22.460
But if you don't want to use that, you can't do type fixed value and check the value to uniform 000.

35:22.460 --> 35:25.220
So that is also meaning essentially the same.

35:25.220 --> 35:32.280
And if you take the pressure for the same case, the inlet will be zero gradient because velocity and

35:32.280 --> 35:33.510
pressure are coupled.

35:33.510 --> 35:36.330
It's related, so we should not over define it.

35:36.330 --> 35:38.310
So we will set the inlet as zero gradient.

35:38.310 --> 35:44.370
Because we already defined the inlet as value and the outlet, we will set a specific value for pressure

35:44.370 --> 35:48.930
because we ask the solver to calculate the outflow for velocity.

35:49.500 --> 35:52.560
So we have to give some condition which will be given to the pressure.

35:52.560 --> 35:54.480
And walls will also be zero gradient.

35:54.480 --> 35:57.970
So the solver will calculate the pressure on walls.

35:58.930 --> 35:59.530
Okay.

35:59.530 --> 36:02.980
So we will see, uh, how these things work.

36:02.980 --> 36:07.990
Okay I'll go to the next folder which is a lid driven cavity case.

36:08.110 --> 36:14.320
We have zero constant and system under system we have the block mesh file.

36:14.320 --> 36:17.860
We will just run the mesh and we will see how it looks.

36:25.820 --> 36:26.900
It is throwing an error.

36:26.900 --> 36:29.240
Let's see what happened in the block mesh.

36:34.280 --> 36:36.770
Okay, I have some keywords here.

36:36.770 --> 36:38.180
I should remove it.

36:38.180 --> 36:39.680
I will save the file.

36:41.270 --> 36:43.190
Yes, it is running fine now.

36:43.400 --> 36:46.060
So that was a typo mistake.

36:47.260 --> 36:48.700
Now we can see the mesh.

36:50.470 --> 36:52.360
So this is the mesh we have.

36:54.010 --> 36:57.730
This will be fixed walls.

36:58.720 --> 37:01.150
And this is a moving wall.

37:01.150 --> 37:04.810
Front and back will be empty because, uh, it is a 2D case.

37:04.810 --> 37:10.010
If you just want to see all the empty patches, you can select this and you can see all the empty patches.

37:10.010 --> 37:11.720
So front and back is empty.

37:11.720 --> 37:18.020
Now, what we are trying to do is we are trying to simulate a case, a 2D case where the upper wall

37:18.020 --> 37:22.340
is moving towards the right and other walls are fixed.

37:22.430 --> 37:28.340
So it is going to create a recirculation region inside this domain.

37:28.670 --> 37:30.560
And that is what we are trying to observe.

37:30.560 --> 37:32.700
Okay Okay.

37:32.700 --> 37:34.560
Now we will see.

37:35.040 --> 37:37.170
Uh, it it has created the poly mesh.

37:37.170 --> 37:39.930
Now we will get introduced to the zero files.

37:39.930 --> 37:43.260
Now we have u and p which means velocity and pressure.

37:43.530 --> 37:45.570
I will open the velocity file.

37:45.930 --> 37:49.710
You can see the dimensions are zero one minus one 000.

37:49.710 --> 37:51.960
And don't worry about these errors.

37:51.960 --> 37:54.480
If you are uh ID shows it.

37:54.630 --> 37:57.200
It doesn't matter as long as the syntax is fine.

37:59.060 --> 38:03.860
Uh, we have the moving wall, which is moving at one meter per second in X direction.

38:03.950 --> 38:08.630
We have fixed walls, which is obviously no slip print and back is empty.

38:08.810 --> 38:09.080
Okay.

38:09.080 --> 38:14.150
So this is like a syntax this names has to mandatorily match with these.

38:14.150 --> 38:21.120
Only then it will get uh applied if you make even slight mistake like putting small w W instead of capital

38:21.120 --> 38:22.830
W, it's going to be a problem.

38:23.610 --> 38:25.500
Then we will see the pressure file.

38:26.460 --> 38:29.850
So in pressure for walls we have defined zero gradient.

38:29.850 --> 38:32.070
And front and back is always empty.

38:32.100 --> 38:33.900
So we have given empty.

38:33.930 --> 38:35.490
You can calculate the dimension.

38:35.490 --> 38:37.800
This is m l t.

38:37.800 --> 38:40.740
And the other values also go on like temperature and all.

38:40.740 --> 38:42.810
But we are not interested in that as of now.

38:43.260 --> 38:47.920
Just do m l t and you can know what the dimension of this file is.

38:48.580 --> 38:49.030
Okay.

38:50.110 --> 38:50.440
Okay.

38:50.440 --> 39:00.580
Now we have done the initial conditions, but now we also have to set the turbulence model.

39:00.580 --> 39:00.940
Right.

39:00.940 --> 39:05.710
So for this cavity case we are using something called ICO form.

39:05.740 --> 39:14.480
So ICO form is a solver in Openfoam, which is transient in nature and it is incompressible, but it

39:14.480 --> 39:15.920
cannot handle turbulence.

39:15.920 --> 39:17.030
It is purely laminar.

39:17.030 --> 39:19.760
It can work only in laminar regions.

39:19.760 --> 39:20.150
Okay.

39:20.150 --> 39:23.810
So for that we have a file called transport properties.

39:23.810 --> 39:31.790
Always transport properties will define the values of the kinematic viscosity of the fluid which is

39:31.790 --> 39:32.090
used.

39:32.090 --> 39:33.640
So to change the fluid.

39:33.670 --> 39:40.180
We don't have the facility to choose a fluid by name, unlike commercial software like Ansys.

39:40.210 --> 39:45.670
Instead, what we will do is we will define the kinematic viscosity of the fluid and it will calculate

39:45.670 --> 39:46.990
whatever is necessary.

39:47.170 --> 39:53.230
And since Ecco foam doesn't work with turbulence, we don't have a file here called turbulence properties.

39:53.230 --> 40:00.050
Otherwise we will be having turbulence properties also in Ecco form Without said it is always laminar

40:00.050 --> 40:01.970
so we are not going to set any turbulence.

40:02.450 --> 40:05.750
You can find the polymesh which has all the mesh details.

40:06.620 --> 40:11.960
Okay, now we are not interested in learning these three things just yet.

40:11.960 --> 40:18.500
We will be seeing uh, it quickly, but for now we will see what we are going to do with this Iko form

40:18.500 --> 40:18.770
case.

40:18.770 --> 40:21.300
We are trying to do something called lid driven cavity.

40:21.390 --> 40:27.840
We are going to, uh, move a lid on top and we will be seeing what is the recirculation region inside.

40:28.260 --> 40:28.650
Okay.

40:28.650 --> 40:29.850
Now we will run it.

40:29.850 --> 40:33.390
So we will be using eco foam solver as I said.

40:34.200 --> 40:36.210
Now I will go into control duct.

40:36.660 --> 40:41.610
And this is the file which controls all the running parameters simulation parameters.

40:41.610 --> 40:45.450
So the application is eco foam which is the solver is eco foam.

40:45.450 --> 40:45.470
icofom.

40:45.770 --> 40:49.040
And the simulation has to start from start time.

40:49.040 --> 40:51.710
So in this case the start time is zero.

40:51.710 --> 40:52.970
So it will start from zero.

40:52.970 --> 40:59.600
Suppose if we run till some time let's say 0.5 seconds and we want to continue from there, then we

40:59.600 --> 41:02.210
can use this command latest time.

41:02.210 --> 41:05.630
But in this case the latest time happens to be zero.

41:05.630 --> 41:09.020
So this can be latest time need not be start time.

41:09.120 --> 41:11.430
Then we are setting the start time as zero.

41:11.430 --> 41:14.250
So if we are using start time then this will be essential.

41:14.250 --> 41:16.170
Otherwise you can leave it then stop.

41:16.170 --> 41:18.480
It will be end time and we will define the end time.

41:18.480 --> 41:20.910
In this case I have chosen 0.5 seconds.

41:20.910 --> 41:25.560
Let it be the delta T, which is the, uh time step.

41:25.740 --> 41:28.200
We will be using 0.005.

41:28.200 --> 41:32.010
So I have checked the stability criteria and came up with this time step.

41:32.010 --> 41:39.040
In most cases you have to check it and there is also adaptive time stepping in openfoam, which we will

41:39.040 --> 41:46.690
learn later to set up certain cases where we can do adaptive time stepping based on the current number

41:46.990 --> 41:48.070
or kfl number.

41:48.070 --> 41:50.290
If you know by that name, okay.

41:50.290 --> 41:56.350
And right interval is 20, which means for every 20 time steps a file will be written, the time step

41:56.350 --> 41:57.550
file will be written.

41:58.770 --> 42:02.070
and, uh, perjury will remove older files.

42:02.070 --> 42:07.230
Let's say if I give purge right five, then it will keep only latest five times.

42:07.350 --> 42:13.620
This will be useful in case of steady state scenarios, but now it is not useful if all the details

42:13.620 --> 42:16.920
are going through your head, don't worry, you will catch up.

42:16.920 --> 42:18.360
It is just the first tutorial.

42:18.360 --> 42:23.200
Okay, so you don't have to worry about these things as of now Pretty much all the time.

42:23.200 --> 42:25.030
We'll let it be default.

42:25.360 --> 42:26.020
Okay.

42:26.020 --> 42:33.250
And the FPV schemes and FPV solution contain all the details related to what numerical method you will

42:33.250 --> 42:35.830
be using to solve each of the equation.

42:35.830 --> 42:38.770
So we are not going to go into that.

42:38.770 --> 42:42.700
It will be an advanced course, so we are just leaving it as default.

42:42.700 --> 42:44.230
We are using a Piso solver.

42:44.230 --> 42:47.360
So Piso is an algorithm which is what the ICO form uses.

42:48.170 --> 42:49.820
So we will stick with that.

42:49.820 --> 42:51.650
And I'll go here.

42:51.980 --> 42:53.210
So we have the mesh.

42:53.210 --> 42:56.120
We set up the boundary conditions and initial condition.

42:56.150 --> 43:00.980
Now I will initiate echo form by the command I echo form.

43:02.000 --> 43:02.900
I'll hit enter.

43:02.900 --> 43:04.790
Now the simulation is over.

43:04.790 --> 43:09.080
So you you could see that we have 0.10.2.

43:09.170 --> 43:11.040
So on till 0.5.

43:11.910 --> 43:15.390
I will open the paraview from scratch again.

43:15.420 --> 43:18.720
Usually refresh doesn't work in this kind of things.

43:19.380 --> 43:20.580
I'll apply you.

43:20.580 --> 43:22.620
The colors might be different for you.

43:22.620 --> 43:26.100
If you want to change the color, you can scroll down on the left panel.

43:26.730 --> 43:28.260
You can click on the color map.

43:28.260 --> 43:29.100
It will get.

43:29.520 --> 43:37.520
This might be your color map as of now, but I like to keep this pressure in this color map.

43:37.520 --> 43:41.930
If you want to set this as your default, you can set it and click this button.

43:42.800 --> 43:43.280
Okay?

43:43.280 --> 43:47.390
If you want to choose any other color maps, you are free to do so.

43:47.390 --> 43:50.600
I personally prefer this for, uh, pressure.

43:50.600 --> 43:53.180
So this is the pressure at 0.1 seconds.

43:53.180 --> 43:57.650
Now, if I play, this doesn't pretty much change for till 0.5.

43:57.680 --> 44:03.420
It is being constant, so if I want to view velocity I will go here choose velocity.

44:03.870 --> 44:09.270
And uh, as you can see the velocity changes something like this.

44:09.390 --> 44:09.780
Okay.

44:09.780 --> 44:16.980
So we are not seeing pretty much any change in here, even though the time step is from 0.1 to 0.5.

44:17.010 --> 44:21.060
It is because we have a very coarse mesh.

44:21.060 --> 44:21.630
Let's see.

44:21.630 --> 44:23.080
It's a very very coarse.

44:23.080 --> 44:27.490
And also we are not trying to do a lid driven cavity case.

44:27.490 --> 44:30.250
As such we are just learning the boundary condition.

44:30.250 --> 44:36.190
So this is fine because essentially we might need smaller time steps with a finer grid.

44:36.820 --> 44:42.100
But for now you understood the point on how to set up the boundary condition, the u and p file.

44:42.340 --> 44:47.250
So I will close this, uh, and we have one last tutorial.

44:47.250 --> 44:48.000
Pipe flow.

44:48.300 --> 44:54.510
So the pipe flow, we will be setting the initial fixed value for velocity pressure.

44:54.510 --> 44:58.230
And we will also do, uh, no slip for the walls.

44:58.350 --> 45:03.360
And then we will set up the initial velocity and pressure for boundary conditions.

45:03.360 --> 45:04.950
Then let's see okay.

45:04.950 --> 45:15.340
Now for uh pipe flow we already have a block mesh dict which comes along with this, but this is pretty

45:15.340 --> 45:16.060
crazy, right?

45:16.060 --> 45:17.590
This is advanced thing.

45:17.890 --> 45:23.020
We will see how to create a pipe mesh very simply using snappy mesh.

45:23.020 --> 45:27.100
Without all these values, it will be very simple.

45:27.130 --> 45:32.530
Uh, we will be seeing in forthcoming weeks, but for now, we will be just using, uh, existing block

45:32.530 --> 45:32.740
mesh.

45:32.920 --> 45:38.060
I took this from the tutorials folder, so we will just create block mesh using this.

45:38.060 --> 45:40.700
Now I'll clear this.

45:42.530 --> 45:45.320
Now we will go to the last case which is pipe flow.

45:45.920 --> 45:49.550
I'm in the right directory now I will do block mesh.

45:49.550 --> 45:54.140
The mesh is generated I will view it in paraview.

45:57.980 --> 46:01.000
So we have a pipe case.

46:01.450 --> 46:01.780
Okay.

46:01.780 --> 46:05.800
So this is more like a symmetry blend case.

46:05.800 --> 46:07.660
Like this is your symmetry plane.

46:08.290 --> 46:08.650
Okay.

46:08.650 --> 46:13.570
So we are not interested in understanding what this case physically means.

46:13.570 --> 46:16.450
We are just interested in setting up the boundary conditions.

46:17.140 --> 46:18.580
That's what this tutorial is about.

46:18.580 --> 46:25.730
As you can see we have inlet front back walls, lower wall and wall, startup outlet, upper wall and

46:25.730 --> 46:26.990
so many things here.

46:27.290 --> 46:35.540
So if you go to the zero file in the U file you can see the boundary condition for everything.

46:35.540 --> 46:37.640
Now you might be wondering what is this.

46:37.640 --> 46:44.270
So this is just C plus plus way of telling that this condition applies to both lower wall startup and

46:44.270 --> 46:45.230
upper wall startup.

46:45.350 --> 46:51.630
Same for this okay, so we are doing an inlet of 0.01 the x direction.

46:51.630 --> 46:56.430
This internal field is like the internal scalar field which will be set.

46:56.610 --> 46:59.730
And uh this is only minus eight.

46:59.730 --> 47:01.350
We did not want to set it to zero.

47:01.350 --> 47:03.240
So it is in a pretty low value.

47:03.270 --> 47:04.980
This is the velocity file.

47:04.980 --> 47:07.980
You can pause the video and ponder on what is actually set.

47:07.980 --> 47:11.940
Okay the Dirichlet and Neumann condition then.

47:11.940 --> 47:11.960
Then.

47:11.960 --> 47:16.100
Similarly for pressure we have this.

47:16.190 --> 47:22.010
So you can see that this is set to symmetry plane because they want a symmetry over this plane.

47:22.070 --> 47:23.720
So that's why it is set to symmetry.

47:23.720 --> 47:26.660
Again you can pause and ponder.

47:26.660 --> 47:29.270
You can change values and try on your own.

47:29.270 --> 47:32.510
So this is what we are essentially doing in boundary file.

47:32.510 --> 47:38.520
All I wanted to say is we have to set boundary condition for all the files, unless, unlike commercial

47:38.520 --> 47:44.670
software where you will set only for inlet and it will automatically choose what will be there for pressure

47:44.670 --> 47:46.140
and for the inlet.

47:46.140 --> 47:49.260
So it's not like that in Openfoam you have to define everything.

47:49.380 --> 47:55.770
Okay, we have only U and P and we will see what type of solver we are using.

47:55.770 --> 47:59.280
Again, it's uh incompressible solver.

47:59.280 --> 48:00.460
It's called simple form.

48:00.700 --> 48:05.110
So simple means Semi-implicit method for pressure linked equations.

48:05.110 --> 48:08.650
You would have come across this in your, uh, theoretical CFD course.

48:08.770 --> 48:10.900
So that is what we are going to use.

48:11.050 --> 48:12.160
Simple algorithm.

48:12.700 --> 48:16.570
It is a steady state solver and it is incompressible.

48:16.570 --> 48:22.570
So we will be running this case and we will be running till 200th time step.

48:23.320 --> 48:23.560
Okay.

48:23.560 --> 48:26.780
The start time is zero and the end time is 2000.

48:26.810 --> 48:28.130
We will run this.

48:28.130 --> 48:30.770
I will go here and type simple form.

48:30.770 --> 48:32.450
Notice that F is capital.

48:32.630 --> 48:33.770
I'll hit enter.

48:33.770 --> 48:41.060
It will take a bit of time before it is converged and we will wait for it to converge.

48:41.060 --> 48:42.320
Then I'll get back to you.

48:43.820 --> 48:45.710
Okay, now the simulation is over.

48:45.710 --> 48:49.030
But why did not it go to 2000?

48:49.060 --> 48:49.600
Right.

48:49.600 --> 48:54.130
We set the end time as 2000, but it did not because the solution converged.

48:54.130 --> 48:58.360
Before 2000, it converged at one for two two iterations itself.

48:58.360 --> 49:05.140
So the convergence criteria and everything is set in the FP scheme and FP solution, not in F scheme.

49:05.350 --> 49:13.010
In FP solutions you can see the residual control and uh, how many iterations it has to run for each

49:13.010 --> 49:13.460
thing.

49:13.460 --> 49:15.110
And what is the characters?

49:15.110 --> 49:18.770
That is the number of iterations and what type of solver you want to use?

49:18.770 --> 49:19.970
What is the tolerance for that?

49:19.970 --> 49:21.710
Everything can be set here.

49:22.430 --> 49:26.570
Uh, so that is how it is choosing the convergence criteria.

49:27.020 --> 49:28.280
And it has converged.

49:28.280 --> 49:33.140
Now if you go here you can see only five files, right.

49:33.140 --> 49:37.530
If you go to the control date, you can see that the right right interval is 100.

49:37.530 --> 49:42.720
So we should have been getting files for every 100 iteration.

49:42.720 --> 49:48.720
But we did not because the purge rate is five, which means it will keep only the latest five files.

49:48.720 --> 49:54.150
But for steady state all we care is just one for double two, because that is the solution where it

49:54.150 --> 49:55.050
got converged.

49:55.050 --> 49:57.930
So we are not interested in other files.

49:57.930 --> 49:59.940
We can safely delete those if you want.

50:00.750 --> 50:02.630
Now I will just open paraview.

50:04.610 --> 50:05.630
Click on apply.

50:05.660 --> 50:09.500
You see we have the pressure and we have the velocity.

50:09.500 --> 50:12.110
But this is at 1100.

50:12.140 --> 50:13.790
We have to go to the last time step.

50:13.790 --> 50:19.490
Either you can select it manually or click on this button and it will take you to the last time step.

50:19.910 --> 50:22.670
As you can see this simulation converged.

50:22.700 --> 50:24.830
This is the pressure or sorry velocity.

50:25.200 --> 50:26.700
And this is your pressure.

50:26.790 --> 50:31.020
Always make sure to visualize the cell data so that it will be smooth if you do.

50:31.620 --> 50:33.150
Uh, sorry.

50:33.150 --> 50:34.590
Point data always point data.

50:34.590 --> 50:37.590
If you choose the cell data it will be squared like this.

50:38.700 --> 50:40.860
So always choose point data.

50:42.420 --> 50:42.840
Okay.

50:42.840 --> 50:47.430
So we now know how to do simple form and how to set up the boundary condition.

50:47.430 --> 50:54.520
But as I was saying we also have to define turbulence properties because simple form can handle turbulence.

50:54.520 --> 50:58.120
So what I did here is I just set the simulation type to laminar.

50:58.420 --> 51:02.530
If we are working with any turbulence model, then we will be defining it here.

51:02.530 --> 51:07.810
Like if it is rans, we will be defining what is the Rans model.

51:08.320 --> 51:10.930
If it is less, we will be defining that as well.

51:10.930 --> 51:14.820
But we'll be seeing that in the upcoming weeks for now.

51:15.060 --> 51:21.660
Uh, we have just run a laminar case for, uh, two solvers, ACO form and simple form, and we have

51:21.660 --> 51:23.730
set the boundary condition generated mesh.

51:23.880 --> 51:28.140
I think that is pretty good for this week.

51:28.500 --> 51:29.130
Okay.

51:29.250 --> 51:32.040
And now we also know how control dict works.

51:33.120 --> 51:33.660
Okay.

51:34.170 --> 51:40.420
So ACO form as I said it is an incompressible laminar flow for Newtonian fluids.

51:40.570 --> 51:42.490
It can't handle turbulence.

51:42.910 --> 51:49.030
It solves unsteady Navier-Stokes equation, which is also the transient one or also known as uh.

51:51.040 --> 51:51.520
Yeah.

51:51.520 --> 51:52.810
Unsteady or transient.

51:52.810 --> 51:53.440
That's it.

51:53.440 --> 52:00.250
And for the case setup, all we need is velocity pressure and transport properties.

52:00.490 --> 52:06.320
And, uh, we will be giving the kinematic viscosity in the transport properties file.

52:06.320 --> 52:09.440
Then for running Iko form, the list of commands is.

52:09.440 --> 52:12.710
First we have to do block mesh and then I go home.

52:13.520 --> 52:17.360
And simple form is a steady state solver for incompressible fluids.

52:17.360 --> 52:21.350
It can handle turbulence and it is for uh laminar flows.

52:21.350 --> 52:27.420
Also, it can work both for laminar and turbulence and it solves the steady state Navier-Stokes equation

52:27.420 --> 52:32.010
using this simple algorithm, which is Semi-implicit method for pressure linked equations.

52:32.010 --> 52:36.990
If you want to know the math of it, you can check the documentation or any standard textbook like Versteeg

52:36.990 --> 52:37.680
Malalasekera.

52:39.150 --> 52:46.020
And for simple form the k setup, we need the velocity pressure if it is a laminar case.

52:46.020 --> 52:50.390
Otherwise we will also have the turbulence files which we are not carrying as of now.

52:50.390 --> 52:54.650
And we have to define the transport properties where we will be defining the fluid properties.

52:55.400 --> 53:02.120
And also, as I said, we have the turbulence properties where we have given laminar okay.

53:02.120 --> 53:03.500
For mesh generation.

53:03.500 --> 53:08.510
The command which we used is block mesh to generate the computational domain.

53:08.510 --> 53:15.510
And we set the initial and boundary condition using the zero folder and the files under zero folder

53:15.510 --> 53:18.240
for physical properties like kinematic viscosity.

53:18.270 --> 53:23.160
We use the transport properties and for turbulence we use turbulence properties file.

53:23.160 --> 53:29.190
For control parameters we use control dict if we scheme and if we solution under the system folder.

53:29.190 --> 53:35.100
And for running the simulation we will be using the respective solver and we post-processed with Paraview.

53:36.030 --> 53:36.360
Okay.

53:36.360 --> 53:39.670
So these are just some introduction to Paraview.

53:39.700 --> 53:43.090
This is exactly what I said in the tutorials.

53:43.090 --> 53:47.230
If you want to go through the PPT then you can, uh, ponder over it.

53:47.440 --> 53:54.160
Okay, so if you have any doubts, you can, uh, contact me or there is a big community, as I always

53:54.160 --> 53:58.000
say, there is a huge community online for CFD using Openfoam.

53:58.300 --> 54:03.930
Someone has already faced the issue that you are facing right now, so most probably you will get any

54:03.930 --> 54:04.590
solution.

54:04.680 --> 54:10.860
So by searching yourself online, you will be coming across other problems which other people faced.

54:10.860 --> 54:17.550
So by uh, looking at those problems, if you face it later in the future, you will be able to resolve

54:17.550 --> 54:18.480
it without looking up.

54:18.480 --> 54:19.920
So that's the advantage.

54:19.920 --> 54:24.060
Instead of directly asking someone what the solution could be.

54:24.300 --> 54:26.220
So thank you for watching this video.

54:26.220 --> 54:27.540
See you in the next class.
