WEBVTT

00:00.200 --> 00:01.010
Hello everyone.

00:01.010 --> 00:04.730
Welcome back to the CFD using Openfoam beginner to intermediate course.

00:04.730 --> 00:06.830
So this is our class nine.

00:07.670 --> 00:12.560
Uh, in this class we'll be seeing automation with Aldrin file and all clean file.

00:13.520 --> 00:16.520
So automation with Aldrin file works like this.

00:16.730 --> 00:23.360
If you have the set of commands like running block mesh decomposing and then running it in parallel,

00:23.360 --> 00:26.360
those commands has to be entered manually in terminal as of now.

00:26.360 --> 00:31.070
But if you want to make it automated then you can use the old file to do this.

00:31.220 --> 00:34.820
The purpose is streamlined execution of Openfoam simulations.

00:34.850 --> 00:39.950
Benefit is it automates the entire simulation workflow by reducing the manual steps.

00:40.160 --> 00:43.280
After initiating the alternate file, you don't have to do anything.

00:43.280 --> 00:45.140
It just finishes the entire simulation.

00:45.140 --> 00:48.560
And then you can interact with the computer just to post-process.

00:49.460 --> 00:55.180
So to create an alternate file, generally the components are like mesh generation, initial condition

00:55.180 --> 01:00.490
setup, solver execution, and call for post-processing like force plotting and all.

01:00.550 --> 01:01.960
Not the paraview thing.

01:01.960 --> 01:07.030
So the structure would be it is a shell script that sequentially runs necessary commands.

01:07.030 --> 01:10.450
So that is all that uh, and all run file is.

01:11.170 --> 01:13.900
So we are we have an example here.

01:13.900 --> 01:17.200
So you can open all file in any text editor.

01:17.200 --> 01:18.100
And you can see it.

01:18.100 --> 01:24.190
And the command to initiate alternate file through WSL is bash uh space dot slash Aldrin.

01:24.400 --> 01:28.750
But if you're on ubuntu it is just dot slash Aldrin.

01:29.140 --> 01:31.960
So you can see that it has a header.

01:31.960 --> 01:37.390
It says uh dollar w rm project directory bin slash tool slash run function.

01:37.390 --> 01:38.410
So that is essential.

01:38.410 --> 01:39.340
That is like header.

01:40.450 --> 01:45.810
If you want to clean old case files then the command would look something like run application.

01:45.810 --> 01:50.250
Run application is the shell script command to call the application kind.

01:50.250 --> 01:52.980
So it is rm minus RF.

01:52.980 --> 01:56.190
It delete deletes the polymesh under constant.

01:56.280 --> 02:05.520
So it points to the uh program that it has to delete any file that starts with 0 to 9 any number.

02:05.520 --> 02:07.300
So that is one method.

02:07.420 --> 02:10.960
And to generate mesh we will be running the application block mesh.

02:10.960 --> 02:16.540
If you want to set up the initial condition by decomposing then it is decomposed power.

02:16.690 --> 02:19.150
And the hyphen force is generally not used.

02:19.150 --> 02:20.320
But it is a.

02:21.400 --> 02:24.130
It is just an example from an alternate file.

02:24.280 --> 02:26.890
So you don't have to worry about the force.

02:26.890 --> 02:29.290
You can stick to whatever we have learned in this course.

02:30.010 --> 02:35.550
Then when you want to run solver in parallel, you use the command run parallel and simple form space

02:35.550 --> 02:39.450
hyphen parallel so you don't have to write MPI, run and be a parallel.

02:39.480 --> 02:43.170
All these things are not needed so it will do it for you.

02:43.170 --> 02:49.410
Just have to mention the number of processors somewhere and for run application we can uh do reconstruct

02:49.410 --> 02:52.650
part also and post process function like forces.

02:52.650 --> 02:56.870
So we can do all of these and benefits of order and file.

02:56.870 --> 03:00.800
It ensures that all steps are executed correctly in the right format.

03:00.800 --> 03:06.770
When we are working with terminal, we are bound to make mistakes sometimes in the working directory

03:06.770 --> 03:13.070
or while typing the commands, and we might be wondering what caused the issue so these things might

03:13.070 --> 03:13.700
happen.

03:13.700 --> 03:17.840
To prevent those things, we can use order and file the efficiency.

03:17.840 --> 03:23.210
It saves time by automating repetitive, repetitive tasks like you are running block as you're waiting

03:23.210 --> 03:25.400
for some time, or initiating the solver.

03:25.430 --> 03:28.850
Let's say pimple form, and you are waiting for some minutes or hours.

03:28.850 --> 03:33.950
And then again, when it is just done, you have to come to computer and do the reconstruction.

03:35.060 --> 03:40.670
So instead of that, what if you just initiate and get back and you can file or find all the case files

03:40.670 --> 03:42.530
that you just need all reconstructed.

03:42.530 --> 03:47.740
It removes all the process of file and if you just need the output, it can be done with an alternate

03:47.740 --> 03:47.920
file.

03:47.920 --> 03:49.990
You can run your own alternate file.

03:49.990 --> 03:55.570
Also just the commands which you want and documentation is like it acts as a record of the simulation

03:55.570 --> 03:56.020
procedure.

03:56.020 --> 04:02.890
If you are sending a openfoam case to someone, and if they have no idea on what are the essential steps

04:02.890 --> 04:05.680
to run the case, then they have to contact you.

04:05.680 --> 04:10.090
But instead of that, if you provide the alternate file, they can open the alternate file and either

04:10.090 --> 04:14.950
know what are the commands that are needed, or they can just initiate the alternate file and they can

04:14.950 --> 04:16.480
get all the data that is needed.

04:16.480 --> 04:18.880
And all they have to do is just post-process.

04:19.240 --> 04:22.630
They don't even have to know how the case was set up or how to run it.

04:23.620 --> 04:30.070
So automation with all clean file is like it cleans up files from previous simulation to prepare for

04:30.070 --> 04:30.730
a new run.

04:30.760 --> 04:38.180
So it just sits back the entire case to its original version so you can run from scratch.

04:38.180 --> 04:42.080
And it also ensures a fresh start for simulation by removing old data.

04:42.500 --> 04:45.230
So that is the benefit of using all clean files.

04:46.430 --> 04:52.580
So to create an alternate file we are just going to, uh, remove mesh files and deletion.

04:52.700 --> 04:56.180
Uh, we are going to delete the time directories and the clearing log files.

04:56.180 --> 04:56.540
Sorry.

04:56.540 --> 04:58.680
It has to say automation with all clean files.

04:58.710 --> 05:05.040
This slide is about all clean, and it is also a shell script that removes specified specified files

05:05.040 --> 05:05.850
and directories.

05:07.170 --> 05:10.410
So this is an example of all clean files.

05:10.440 --> 05:11.580
Sorry, it's not all done.

05:11.580 --> 05:12.630
It's all clean.

05:13.800 --> 05:16.290
So it removes the constant polymesh folder.

05:16.290 --> 05:16.530
Again.

05:16.530 --> 05:19.350
It removes all the time steps from 0 to 9.

05:19.350 --> 05:24.570
And it also removes the post-processing folder where we had the force coefficient, and it also removes

05:24.570 --> 05:26.910
any log files when you are running all run file.

05:26.910 --> 05:32.160
Since you will not be getting anything on the terminal, it would be stored as a log file.

05:32.160 --> 05:34.500
So that's what documenting also means.

05:34.500 --> 05:43.050
So to initiate this you can use bash space, dot slash or all clean when you are on a windows machine.

05:43.620 --> 05:47.300
But when you are on an ubuntu machine just dot slash all clean is fine.

05:48.560 --> 05:52.970
So we will be seeing some examples from the tutorials folder now.

05:53.660 --> 06:02.480
Okay, when I was talking about uh tutorials folder I was saying that it can be copied and run even

06:02.480 --> 06:05.420
without knowing what that simulation actually means.

06:05.660 --> 06:08.870
So I will open the tutorial folder here.

06:10.190 --> 06:18.290
So just going to go to the run directory and open the explorer here.

06:19.880 --> 06:22.640
So we have a copy of tutorials here.

06:22.880 --> 06:26.330
So let's take incompressible okay.

06:26.720 --> 06:33.800
In incompressible let's take simple form and let's see airfoil 2D.

06:34.010 --> 06:36.830
And let's see what it has in the old run file.

06:40.910 --> 06:43.940
See it has a different set of commands.

06:43.940 --> 06:46.160
It says restore zero directory.

06:46.160 --> 06:50.330
If you try to run this command in your command prompt it won't run.

06:50.330 --> 06:52.040
But through shell scripts it will.

06:52.370 --> 06:58.460
You see this is the header and setting we are setting parallel to true because we have a if else condition

06:58.460 --> 06:58.970
here.

07:01.480 --> 07:02.020
Okay.

07:02.020 --> 07:03.880
It is restoring the zero directory.

07:03.880 --> 07:07.540
It means it is copying the zero dot original file and putting it in zero.

07:07.540 --> 07:10.660
So that is what zero restore zero directory means.

07:10.780 --> 07:19.300
Then we are doing zero hyphen d constant polymesh and uh slash slash copy rf constant slash polymesh

07:19.300 --> 07:21.730
dot original two constant slash polymesh.

07:21.730 --> 07:23.050
So what this does.

07:23.170 --> 07:27.430
We have polymesh original because we don't want to mess with the original polymesh file.

07:28.180 --> 07:34.870
So this command essentially copies the polymerized or original and pastes it in the new name Polymesh.

07:34.870 --> 07:36.850
So that is what this command means.

07:37.300 --> 07:37.570
Okay.

07:38.380 --> 07:43.000
And we are entering the if else condition we have set the parallel to true.

07:43.000 --> 07:46.900
So when parallel is true then we will be running decompose power.

07:47.650 --> 07:50.670
Then run parallel would be get application.

07:50.670 --> 07:53.910
It would be in a dollar for a reference.

07:53.910 --> 07:58.560
So it would get the application from control dict and it will run that command here.

07:58.560 --> 08:00.240
So it would be running in parallel.

08:00.240 --> 08:07.470
And we have run application reconstruct part to reconstruct whatever is decomposed if it is parallel.

08:07.470 --> 08:12.840
But when the parallel is set to false then it would just get the application and run it.

08:12.840 --> 08:15.060
So it is just basic if else condition.

08:16.050 --> 08:18.810
Now we will see all clean file.

08:20.670 --> 08:23.550
So it just says clean case zero.

08:23.550 --> 08:26.010
It is going to clean all the time steps.

08:26.310 --> 08:30.510
It is same as form less times but in a shell script way.

08:30.510 --> 08:33.600
And we have our rm minus rf constants slash polymesh.

08:33.600 --> 08:38.580
So it is going to delete the polymesh which we just duplicated from polymesh dot origin.

08:40.020 --> 08:46.710
Okay, for tutorial purpose I am going to copy this and put it in this week's folder.

08:47.220 --> 08:48.900
When you get it it would be empty.

08:51.150 --> 08:53.790
Okay, now we have this airfoil.

08:55.560 --> 09:02.550
Okay, now what I'm going to do is I'm not going to do any sort of like block mesh or run anything because

09:02.550 --> 09:03.800
it already has polymers.

09:03.800 --> 09:12.170
So I'm just going to initiate the all run file and you can see that it is running everything one by

09:12.170 --> 09:12.590
one.

09:13.880 --> 09:16.790
First it restored zero dot original to zero.

09:16.820 --> 09:22.070
Yes it happened and then it did decompose part as it happened.

09:22.070 --> 09:25.940
And it is running simple form keys on eight processes.

09:26.090 --> 09:28.790
But you're not getting anything here at all, right?

09:28.790 --> 09:33.980
Because when you are running simple form, it would keep on saying updating the time steps because it

09:33.980 --> 09:37.790
is getting stored in logged or simple form.

09:38.600 --> 09:45.080
So you can open it and always see what was happening with the case.

09:45.470 --> 09:50.120
And you can even post-process this if you are very good at dictionary in Python.

09:50.570 --> 09:53.650
Okay, So this simulation is done.

09:53.650 --> 09:55.510
It is also reconstructing now.

09:55.510 --> 10:01.360
And if you want to monitor reconstruct part, yes you can open it in VSCode or any text editor.

10:01.570 --> 10:08.320
And you can get live updates like all you have to do is maybe change application or refresh the file.

10:09.160 --> 10:14.260
When you change application and come back here, it will just work like change the tab or something.

10:15.100 --> 10:16.630
So mostly that works.

10:17.380 --> 10:17.770
Okay.

10:17.770 --> 10:19.060
So it is reconstructing.

10:19.060 --> 10:20.770
That is all that is important.

10:21.370 --> 10:21.670
Okay.

10:21.670 --> 10:24.250
Now let's just wait for this to end.

10:24.880 --> 10:27.460
It's probably going to end at 500.

10:27.910 --> 10:29.230
Now it is at 300.

10:30.790 --> 10:33.550
Or maybe you can also learn to interrupt.

10:33.730 --> 10:37.510
Just hit Ctrl C and it would be interrupted right there.

10:37.810 --> 10:38.050
Okay.

10:38.050 --> 10:43.500
Because anyways we are going to clean this case we are not interested in running it completely or post-processing

10:43.500 --> 10:43.740
it.

10:43.890 --> 10:47.220
So we will also, uh, run the all clean.

10:47.220 --> 10:49.590
Now you have these many files right.

10:49.590 --> 10:54.240
So you can do bash dot slash all clean.

10:54.390 --> 10:58.230
And you can see that it is deleting all the time steps first.

11:00.630 --> 11:04.530
And then the decomposed processes it deleted all the log file.

11:04.530 --> 11:06.510
It it deleted the zero copy.

11:06.540 --> 11:08.280
It also deleted polymesh.

11:08.280 --> 11:11.970
So now it is just as new as what we copied.

11:12.630 --> 11:15.510
Okay, now you knew all these steps.

11:15.510 --> 11:19.590
In this case, you knew what will happen in the airfoil case.

11:19.590 --> 11:24.600
But let's say something like piece of form in alias.

11:24.600 --> 11:24.900
Okay.

11:24.900 --> 11:30.360
We are not going to see about alias, but you really don't have an idea about alias, right?

11:31.170 --> 11:37.860
But if you want to run this case, okay, then you can open this alternate file and see what are the

11:37.860 --> 11:39.180
commands necessary.

11:39.720 --> 11:44.190
Obviously, when someone gives you this case file, you wouldn't know these are the steps, right?

11:44.550 --> 11:48.870
But we don't really care whether it is there or not.

11:48.870 --> 11:53.670
Like see, we have a command called renumber mesh potential form.

11:54.200 --> 11:59.780
We don't know any of these, but if we still want to get the result out of this, all you have to do

11:59.780 --> 12:00.740
is copy.

12:01.610 --> 12:05.150
Put it wherever you want this to be, run.

12:06.110 --> 12:13.730
Then go to your terminal, enter that folder, then initiate all run file.

12:14.240 --> 12:19.670
That is all that is needed to do this.

12:24.380 --> 12:26.810
See, it is now running Snappy Smash also.

12:28.850 --> 12:31.130
Okay, anyways, I'm just going to interrupt.

12:37.370 --> 12:38.600
I'll interrupt here.

12:39.080 --> 12:39.770
Okay.

12:40.190 --> 12:44.380
Uh, but it is running other commands, so you have to interrupt everything when you are interrupting.

12:45.850 --> 12:47.680
It is just running all the commands.

12:49.000 --> 12:50.170
Okay, I'll clear it.

12:50.770 --> 12:51.100
Okay.

12:51.100 --> 12:52.930
Now we have all of these files.

12:52.960 --> 12:54.280
I'll open all clean.

12:54.280 --> 12:56.020
It is going to be very simple.

12:56.440 --> 12:58.090
You see it cleans K zero.

12:58.090 --> 12:59.800
It deletes the tri surface.

12:59.800 --> 13:02.740
And it also deletes all the decomposed par dict.

13:02.860 --> 13:07.630
Uh, I mean, we have made some changes to decompose par and it is changing it.

13:08.470 --> 13:10.930
We really don't want to understand it as of now.

13:11.200 --> 13:17.020
All we want to know is how to run, all run and all clean files.

13:17.890 --> 13:19.570
Now, see, it is deleting everything.

13:20.050 --> 13:21.610
Now the case is just as new.

13:22.600 --> 13:26.560
So I hope you understood about all run and all clean files.

13:26.560 --> 13:32.920
So if any case you find in tutorial and you want to run it, you can always do it just using ultra clean

13:32.920 --> 13:33.280
files.

13:33.400 --> 13:39.610
And you can also see the commands and try to execute them one by one in terminal and find out what what

13:39.610 --> 13:40.840
each command does.

13:40.990 --> 13:43.000
Or check out the documentation that works too.

13:44.620 --> 13:49.150
Okay, now your, uh, project one would start from here.

13:49.150 --> 13:53.590
So it is flow around a prism with coefficient of drag and clip loss.

13:53.860 --> 13:59.010
So you have to do a flow analysis around a square prism using Openfoam.

13:59.250 --> 14:04.350
So the objective is to analyze the flow characteristics around a square prism and compute the drag coefficient

14:04.350 --> 14:06.180
and lift coefficient using openfoam.

14:06.990 --> 14:12.720
This project will involve mesh generation, setting a boundary condition, running simulation and post-processing

14:12.720 --> 14:15.750
results to obtain and analyze CL plots.

14:16.350 --> 14:19.080
So the duration you can take for this is.

14:19.080 --> 14:25.140
You can take three days for case setup and simulation, two days for plotting and report preparation,

14:25.140 --> 14:27.420
and one day for discussing the report.

14:27.420 --> 14:30.240
If you really want to discuss with me, you can mail to me.

14:31.470 --> 14:33.180
So you can mail us.

14:33.180 --> 14:39.210
And we would get back to you if we have any, uh, comments on that.

14:39.420 --> 14:39.780
Okay.

14:39.780 --> 14:41.730
The project description is like this.

14:42.690 --> 14:48.720
The project involves simulating the flow around a square prism, uh, placed in a uniform flow.

14:48.720 --> 14:50.880
So the students will have to use openfoam.

14:50.880 --> 14:56.400
I mean, you have to use Openfoam to generate the computational mesh using block mesh only, or you

14:56.400 --> 14:57.900
can do it in snappy hex mesh.

14:58.710 --> 15:02.190
You can't import mesh from Ansys or anything like that.

15:02.190 --> 15:09.770
You have to use only Openfoam and you have to set up the boundary condition using the appropriate problem.

15:09.770 --> 15:15.710
Like if you are using transient or turbulent, then you can have higher Reynolds number.

15:15.710 --> 15:20.060
But if you are trying to make a steady state laminar case, then you have to keep it very low.

15:20.060 --> 15:25.340
So set up the boundary conditions appropriately and run the simulation using a suitable solver for that

15:25.340 --> 15:25.940
problem.

15:26.750 --> 15:28.970
So you can decide whatever you want to do.

15:29.210 --> 15:35.600
Then you have to extract and analyze the force coefficient CL either using Excel or foam monitor.

15:35.630 --> 15:37.490
Then you can take screenshots from there.

15:37.520 --> 15:42.410
Then you can plot the KD and CL values over time or against other relevant parameters.

15:42.410 --> 15:44.000
If you are doing with Excel.

15:44.480 --> 15:45.050
Then you can.

15:45.080 --> 15:49.460
You have to interpret the results and discuss the flow characteristics observed around the prism.

15:49.550 --> 15:54.230
So this comes with the knowledge of CFD and it is not constrained to knowledge of Openfoam.

15:55.220 --> 16:01.690
So you have to interpret and discuss what that result or value from the simulation actually means.

16:02.230 --> 16:05.560
So the description would be as like this.

16:05.560 --> 16:07.330
Prepare a geometry 2D or 3D.

16:07.330 --> 16:08.890
It's up to you of a square prism.

16:09.730 --> 16:12.460
Then mesh it using block mesh or snap x mesh.

16:12.460 --> 16:16.120
Then ensure the mesh is refined around the prism to capture the boundary layer.

16:16.120 --> 16:17.350
If it is, snap a hex mesh.

16:17.350 --> 16:20.890
You can also use uh, add layers.

16:20.890 --> 16:24.850
Then you have to specify the proper boundary condition setup.

16:25.060 --> 16:33.610
Then choose the solver properly and it is highly recommended to use K-omega SST turbulence model and

16:33.610 --> 16:35.260
set the maximum SEO as one.

16:35.650 --> 16:40.660
Include the necessary function objects to calculate force coefficient postprocess using Paraview.

16:40.750 --> 16:42.310
Study the streamlines.

16:42.310 --> 16:45.070
Plot the CL graph uh.

16:45.070 --> 16:48.420
You can use either for Monitor monitor or Excel.

16:48.750 --> 16:51.930
Then you have to make a detailed report.

16:51.930 --> 16:56.700
Either you you can keep it, uh, for your own reference, or you can mail us.

16:56.700 --> 16:58.890
And we will get back to you with the comments.

16:59.880 --> 17:03.180
So you can work on this question.

17:03.180 --> 17:07.500
You can take the PDF for the question or details, and you can do this.

17:07.740 --> 17:10.770
If you have any questions, please feel free to contact me.

17:10.800 --> 17:12.000
See you in the next class.

17:12.000 --> 17:12.630
Thank you.
