Hello everyone!
In this video we are going to see how to install Openfoam version 20 406 using WSL.
So WSL is Windows Subsystem Linux, where you can get almost all the access of Linux system within your
windows machine.
So that is what we are going to see.
We are going to start from the installation of WSL and get till the installation of Openfoam 20 406,
and also I have an additional tip on how to set up the Openfoam so that it does not consume a lot of
space in your hard disk or SSD.
So usually WSL has this problem where even after you delete certain files inside the WSL architecture,
it will not show as free space in your hard disk.
So we will see one method which will rectify that problem.
So to install Openfoam you can visit this website openfoam.
Comm.
There are two versions I will suggest using this one.
So once you go to Openfoam comm you go to downloads here, press on Linux.
Then this will open up this window.
So here you can press Debian plus Ubuntu and it will open a new window.
And these are the commands that we have to run in a terminal which is the Linux terminal.
To install Openfoam.
So for that we need a shell right.
So we will see how to install that.
First you can open your command prompt in a regular fashion.
Then you can choose any drive that you want.
If you want to use your C drive only, you can just type all the commands which I am typing directly.
But now let us say that I want to use my D drive.
Then I will put D colon, press enter and it will take me there.
So it's up to you on which drive you want to do it.
I have multiple drives and I don't want to put it in C, so I am putting it in D.
If you want to continue with C, you can do it in.
The command is okay let me zoom it up slightly.
So space hyphen D sorry.
Hyphen hyphen Install space.
Hyphen D space.
Ubuntu.
Hyphen 24.04.
So version 24.04 is the latest version, so I am installing that.
If it asks for any permission, you can give it and it will take a bit of time to install the WHL.
So let us wait till it is over.
Okay, now the installation is happening.
I will give it the access now after it has downloaded it is installing now.
Let's wait till it installs.
Okay, now the installation has been done and it is saying the requested operation is successful, but
the changes will not be effective until the system is rebooted.
So generally we will have to reboot, but for some system it might or might not work without a reboot.
So let us see whether it is working without a reboot.
If it is not working, then we will reboot.
So to check whether it is it's working or not.
Just hit your search button.
Then search for, uh, ubuntu.
Yeah.
So it is showing ubuntu 24.04.
Just press enter.
Okay.
You can see that it is giving me an error.
This may take a few minutes and the register distribution failed at all.
So for me it did not work without a reboot.
So I am going to proceed and reboot.
So once the reboot is done then I will show you what is the procedure.
So now I will reboot.
Okay, now my system has been rebooted.
So what I am going to do is this search for ubuntu.
This might open automatically or might not open automatically.
So let it take some time.
Then once the installation is over it will ask for username and password.
Then we will do the setup because this is like a separate machine inside your windows machine.
So we have to give the username and password.
Okay.
Now it is asking for a username, so I am just entering a username.
Press enter, then it will ask for a password.
But you have to be very careful while typing the password because when you type.
Usually when we type password anywhere, either it will show what we are typing or it will show at least
a star or some symbol, right?
But here now it will not show anything.
So you have to type it very carefully and it will ask for a confirmation also.
So now I am going to type enter and it will ask to retype the password.
So type it again carefully and make sure that you are not giving any space special character while typing
your username or password.
So it should not have any special character or it should not have any spaces in between.
So once you do that, this window will appear and this is your cell machine.
So how will you know whether you are in a cell or in a command prompt?
So when you are in a cell, you will see that your username but your device name will appear here.
But if you are on your command prompt, then this will all be white, right?
And it will just say C users HP.
The laptop name, all that will come here.
So here you will be getting this green color and then it will be followed by blue color.
So all that will be there.
That is how you know that you are in your WSF.
So let me close this and open a new ubuntu terminal.
Now we can start installing our Openfoam.
So the first method is like just copy this.
Go to your terminal either right click right mouse button or just press Ctrl V.
So mostly right button will work.
Right button.
Press enter.
Now it is asking for a password right.
So you have to type it very carefully.
You have to remember the password all the time.
You should not forget it.
Otherwise you have to uninstall and reinstall it again.
It's going to be a big problem.
So always remember the password.
Now it is saying the repository is set up.
You can now install packages.
So first we have to update get updates the updates for the packages.
So copy this right click press enter.
It will search for any updates available.
This might take a bit of time.
So once that is done we are ready to install.
So you just copy this entirely.
Go here right click use your left arrow button to change this to 20 406 instead of 2312.
Then press enter.
Then it will ask for a confirmation.
Right now it is asking yes or no and it will consume one, two, four, six MB of additional space.
So I will type y.
Hit enter.
Doesn't matter whether it is small y or capital y, you don't have to worry about that.
So once you press type Y, press enter.
Just wait for openfoam to get installed.
So once the installation is done, I will get back to you.
Okay, now the installation of Openfoam is also done.
But if you see that it is giving us some instructions to do so, now let us do that.
Okay.
To do that just type explorer dot x space dot press enter okay.
Then this window will open.
Here you can see that you have a file called dash dot bash RC.
Now if this file is not there this location is not there.
Then in the terminal you just type CD once.
Then you type the explorer dot txt and it will be fine.
Okay so now you can open this dot bashrc file either in VSCode or in notepad.
So or if you have any other text editor anything is fine.
So once you open that go go to the last line.
Okay.
Just create one more line after the file.
This should be the last line.
Okay.
Now here you have to type this command that is shown here.
Okay Just going to type it out.
You can also copy paste, but I generally like to type it so don't miss.
The dot starts with dot space slash user slash lib slash open form slash open form 20 406 slash ATC
slash bash RC.
So once you type that without any mistakes.
I hope I did not make any mistakes.
Save the file.
Close this.
Close this also.
Then open a new ubuntu.
Okay now you have to type the set of commands that I am telling you.
So mkdir space hyphen p dollar form underscore run.
So notice that form underscore run is capital.
Press enter.
Okay.
Now what we are going to do is we are going to create a location where you can use your open form so
you don't follow any other YouTube tutorial.
They will be using the location where WSL is installed that will cause problems.
So I will tell you this and you follow this all the time.
So go to your drive.
Any drive C or D or E, wherever you have space.
Then create a new folder called Openfoam.
Here you can create another new folder called version 20 406.
Press enter.
I am just doing this because if you want to create any other versions later, then you can have it nicely
there.
Okay, now what we are going to do is going to open the same explorer dot txt space dot.
In this location open the bashrc.
Go to the last line and just type out this command a l I s Equal to open a colon CD space.
Then you have to type slash m and t slash.
Then you just go to this location.
If you are in C drive then you have to type small C.
If you are in D drive with small D for me it's small D slash then this location.
Okay so it's open form slash V2406.
Then close the single quotes.
Now here we have to give this a name.
So I am going to call this off 20 406.
Okay.
There is no space between this and this and all.
So just save this.
Close this bash RC open the sorry.
Close the ubuntu.
Open a new one.
Okay.
So whenever you want to run any open form simulation just type this.
It will take you to this location.
Okay.
This is inside windows.
That is what this m nt m nt means.
So now let's test it.
I am going to create a new file called file.
You can see that it is appearing here instead of w sl location.
So we don't want this file okay.
So what I'm going to do now is I'm going to copy all the tutorials.
If you are familiar with Openfoam, you will know that all the people use the tutorials to do anything
we want.
So the command here is CP space hyphen r dollar home underscore tutorials space dot.
Don't miss the dot.
So once you do that the tutorials folder will be copied here.
If you are completely new to openfoam, just follow this.
Trust me with the process.
Don't worry what this tutorial means.
Why are we doing this and all?
You will get a hold of it later, but for now just copy the tutorials folder here and whenever you are
following any Openfoam tutorial, open this location.
First, type OIF zero six Ubuntu Terminal.
Then you will be able to, uh, get to this location.
Once you get to this location, then you can do the tutorials that they are telling you.
So in fact, we will create one more folder where you will be able to, uh, copy all the tutorials,
create separate folder for all the cases that you are running instead of putting everything in the tutorials.
So we will also create that once this copying is done.
So once your tutorials folder is completely copied, just create a new folder called run.
Then you can enter the folder called run through this okay.
Now in fact you can open this location every time, right?
So when you open a new terminal this will be something like this.
Right.
So once the terminal is open just type of 20 406.
Then it will take you there.
Then you can enter the run location.
So this is where it is.
Then you can run any case that you want.
So there is also another way.
Let's say you are having multiple folder inside run.
Then you have to navigate right.
Instead of that you can just right click here.
Open in terminal okay.
Any location this works for any location.
Open any location in windows.
Just right click open in terminal.
So once it is open in the terminal just type WSL enter.
Then it will open the ubuntu terminal here.
Then you don't have to worry about opening the location through your terminal.
And this will work all the time for any location.
Okay this is open.
So that's it for the installation of Openfoam.
Then you can follow the other tutorials in other videos.
Make sure to like the video if you liked it.
If you have any doubts you can comment down in the video.
Thank you.