Complete OpenFOAM tutorial - from geometry creation to postprocessing
HTML-код
- Опубликовано: 20 авг 2024
- Consider supporting me on Patreon: / interfluo
When I was trying to learn openfoam, I began by looking up tutorials on youtube. Most of the so-called tutorials I found simply taught users how to run a pre-loaded case, this basically amounted to typing in a meshing command followed by an execute calculation command. In this video I hope to provide users with enough information that they feel comfortable running their own custom simulation.
One step I left out was creating the initial project folder; to do this simply copy a tutorial example that closely resembles what you want to do. If I left anything else out or was too vague, leave it in the comments and I will do my best to help.
GitHub files: github.com/Int...
Time-Stamps:
0:00 - Introduction/Overview
1:09 - Geometry: ANSYS DesignModeler
2:35 - Generate Mesh: Fluent Mesh
3:57 - Exporting Mesh File
4:27 - Navigate to project folder
5:05 - convert mesh to OpenFOAM format
5:36 - Check and modify boundary conditions
6:46 - Calculation Control
7:23 - Check mesh in ParaView
8:36 - run calculation
8:56 - save results
9:20 - post process in ParaView
10:40 - animation/closing remarks
probably the best tutorial for learning openfoam, being a beginner. other tutorials runs a pre-loaded case which is hard to learn and understand.
Really glad to hear that!
Fantastic video! Short and simple and easy to understand. Of course, before we watch the video, we must have some basics of OpenFOAM (at least tried Lid Caity driven case) and Ansys-FLUENT. Keep up the good effort. Hope you have create more new videos.
This is not a complete tutorial... You have edited some of the files in system and you have not shown what you have done. blockMeshDict for example has "upperWall", "lowerWall" and "frontAndBack", whereas our geometry has just wall. I have no idea what values to put in the matrices for wall. Running this setup throws errors. So this is another frustrating, incomplete OpenFOAM tutorial....
I get this error:
"--> FOAM Warning :
From void Foam::polyBoundaryMesh::calcGroupIDs() const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 100
Removed group 'wall' which clashes with patch 2 of the same name.
--> FOAM Warning :
From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList&, bool, bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 915
Cannot find any patch or group names matching lowerWall
--> FOAM Warning :
From Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList&, bool, bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 921
Cannot find any patch names matching lowerWall
Sampled surface:
nearWall -> vtk
sampledPatchInternalField: nearWall : patches:1(lowerWall)"
EDIT: seems to run now. The only change I made was making sure that deltaT = 0.0001. However, my point stands with the blockMeshDict file. Why does it still run even though upper/lower/front and back are mentioned there? And if I want to only mention "wall", how do I find the values to put in the matrix?
One the Best tutorial among all the videos on openfoam , appreciated the work!
informative , clear and lucid, need some more videos on brain aneurysms ANYSY and openFOAM, shall keep waiting. Thanks
Thousand thanks to you man. Keep up the charity work.
Much appreciated!
Thanks a lot. I was at a loss when simscale severely limited the community offer to only 10 simulations. OpenFOAM is not as intuitive but seems quite powerful.
This got me excited about going back to openfoam again and experiment after hopelessly struggling with that 90 degree elbow flow tutorial during my uni years
I had a similar experience but I wasn't even able to install it. I definitely recommend trying it out again, once you work out a few simulations the software becomes fairly intuitive, Good luck!
This tutorial is absolutely great, it helped me a lot with a school porject
that is great to hear
A true legend for this
amazing tutorial. definitely, it helps me in my project work. Hope you make more video like this, Thank you.
More to come!
Oh wow! I just started learning OpenFOAM two weeks ago and I'm in the exact position you described. Its really difficult to find actually helpful (beginner focussed) content out there :(. Thanks for making this! :) I did have a question if you have the time. I'm trying to simulate airflow around an air rifle pellet (basically a bullet) as if in a wind tunnel. How do I best go about setting up the original case folder? I could indeed just copy a folder like the motorBike tutorial, but every file there already seems customized to fit the motorbike.obj model. Is there a more basic way to create a case folder that works for general models or does that require extensive knowledge beyond a beginners capacity?
Hey, thanks for the comment! The general procedure I follow is first defining the flow type and solver I am looking to use. In the case of an air rifle pellet I would think that you most likely want to use a solver for a compressible flow. I would then find the example with the most similar boundary conditions to the ones I am trying to simulate. In the case you explained I would likely use: tutorials/compressible/sonicFoam/RAS/nacaAirfoil directory.
Hope this helps
is it possible to create geometry on OpenFOAM without using ANSYS software?
@@interfluo6420 Yeah but, don't boundary conditions reflect the geometry of the mesh you're using? A bullet has a different shape to an airfoil, how do you set boundary conditions on the exact geometry of the bullet?
You need to change the definition of the boundaries for each parameter file in the 0 folder, when anasy divides the mesh you need to remember your naming and define the different boundaries according to the naming
Good Tutorial. A few comments. You missed where to set the model in the constant folder. I know it's LES, but say someone wants to go with a RAS KOmegaSST model instead. Maybe it's out of the scope of the tutorial. Also, it would be helpful to go over the boundary conditions. For instance, why is there an inletOutlet condition on the outlet of U and what is a turbulent inlet condition. A lot of tutorials miss explaining what boundary conditions are and OpenFOAM is very sensitive to them. The angle you're taking in your tutorials is great and needed, thank you and keep it up.
Thank you for the comment, I will definitely take it into consideration for future videos
A good attempt but flies through a lot of parts that I still cannot get to work. Glad someone is trying but learning OpenFoam has without a doubt been the most frustrating thing I've ever tried.
Hi. Thank you for your tutorial. Unfortunately m, I was disappointedat. I mean the content of the video and its description are not identical: No focus on how to setup the case, no focus on the turbulence model, why to choose that model, how to set its coefficients, how to set the boundary/initial conditions in 0 folder. The main focus was only on mesh generation which is relatively easy compared to case preparation and proper setup itself.
I have some more in depth videos coming up, this one was really geared towards beginners. You are correct, I assumed people would be able to find a close enough example in the tutorial folder that they wouldn't have to worry too much about the actual case set-up, that is why I went over that part pretty fast. I linked a github repository if you need any files, Thanks for the feedback
@@interfluo6420 Thank you. I look forward to watching them!
Thank you so much for this. I really needed something like this!
Wonderful to hear, thanks!
Thank you a lot! I am learning to apply LES in building ventilation simulation in bluecfd and I find this video very helpful and straightforward! I have a very simple question: why do we use OpenFoam to do simulation if we have Ansys Fluent? What's the advantage of OpenFoam compared to Ansys Fluent?
Several reason, the main one when I first started was that I only had access to an academic license (limiting me to 500,000 cells). Since then I have really come to like openfoam, having direct access to the code opens up a lot of possibilities and I honestly also like the workflow and file system used for openfoam.
@@interfluo6420 what are the alternatives if we don't have Ansys at all? How do we create the model and mesh?
Excellent simulation
Nice tutorial. FYI, I would have preferred it without any music.
Very comprehensive. Liked the video..cudos
Glad you liked it!
try to make videos as simple as possible from scratch the way you are making now.thank you very much.
oh boy this tutorial rocks!
Great video! Could you do a tutorial on open channel flow (like square or trapezoidal crossection of the channel)
Great suggestion! that is something I have considered doing but will likely be some time down the road because I have so many projects I want to work on first
@@interfluo6420 great video but tell me in what use cases this would be better than Ansys
AMAZING, very good job. If you have a Patreon page, let us know!!
I will make one, thanks for the suggestion!
I made one: www.patreon.com/Interfluo
Hey!
Nice video, thanks for sharing!
Thank you! if you can help to show result (coefficients,..) will be better
thanks for the tutorial, can you tell me which folders "0, constants, system" you used?
Even in 2023, most of the so called "tutorials" simply load one of the examples in the installation folder of the package. I find your tutorial very useful, but would like to know other non commercial alternatives to create a (probably complex) mesh.
As far as my understanding goes, the mesh you created in Ansys was a custom one. How did you get the 0, constant, and system files for the simulation to run? The rest of the video is very informative, so thanks.
did you find the solution to this?
@@user-fd1rq5to6w did you get it?
Extremely cool!
I cant get ANYSY to work. Are there any alternatives? I use Fusion 360 to generate my Geometry but I dont know how to generate a Mesh for CFD. I am trying to learn CFD for my hobby, building RC planes.
yeah, there are plenty of options. In some of my other videos I use snappyHexMesh and cfMesh for instance but you can also use gmsh. I am sure there are plenty of other options I am forgetting to mention but those are the first free ones that come to mind
@@interfluo6420 Thank you for answering this quickly. I actually got ANSYS to work but struggle with the installation of OpenFOAM. My User folder has a space in it and I think thats a problem for Ubuntu. I have created a new User an will try to install it there. When i tried to run a tutorial to see if the installation works i got an error something like this:
fileName::stripInvalid() called for invalid fileName commandtouse
For debug level (= 2) > 1 this is considered fatal
Now I have solved this problem as well. I am struggeling with transfering my Mesh to OpenFOAM. Where did you save it? I dont even know where OpenFOAM is located to be honest. I ran a tutorial and it worked, following the commands on the OpenFOAM Download webside.
I successfully completed my first simulation. While writing this comment, i am runing my first parallel case. Thank you for the help, although some parts of this Video were rushed. Still, you are the reason my first simulation worked
Thanks
Thanks buddy.
thank you for the tutorial! it is great!!
Glad you like it!
Excellent!
How would I go about testing how loud a whistle is? Say I was designing a whistle and I wanted to compare designs to see what is the loudest whistle within the range of human perception
I have been able to follow everything up until the fluent3DToMesh command. It is giving me: "FOAM FATAL IO ERROR: Essential value for keyword 'field' not set. In function entry: scalarTransport in file /.../controlDict at line 130 The function entry should be: scalarTransport(field = )".
Regarding the path, I copied the folder from the github repo titled OpenFOAM-pisoFoam-LES-Step-1-main and placed it in my tutorials/.../LES path making sure to add the mesh.msh file also. What changes do I need to make to the controlDict file to correct the error?
Does the use of designmodeler add anything or is it just geometry creation. Us non commercial users are stuck with open source software
It's no openFoam tutorial if i need ansys for the mesh...
i ran the pisofoam however there is an error:
--> FOAM FATAL IO ERROR: (openfoam-2106)
Unexpected EOF while reading dictionary entry
From static bool Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int)
in file db/dictionary/entry/entryIO.C at line 165.
do you know how to fix this? thanks in advance
So I know that EOF errors occur when the program unexpectedly encounters the end of the file. This is likely cause by a missing parenthesis or semi colon somewhere in that dictionary. Unfortunately I don't know of any easy way of doing this besides checking all of the files manually, the problem shouldn't be in the files I uploaded unless their was an error when you downloaded them, it appear to be in your db/dictionary/entry/entryIO.C at line 165.
Any chance you could add time stamps? I keep coming back to this video as I'm learning different steps! would help me greatly!
yup, I will work on it now! good suggestion
just added them, I hope they help!
can you plese tell us how you set up the 0,constant and system folders?
so I just need a case a case that is already written? which cases are good for simulating a water pump impeler and a other case for simulating car aerodynamics?
Great video! A question Why is the value of k on internal field cero? Is this value for the definition of turbulentinlet on the inlet? Best regards.
Can you please do same for flow over cylinder and calculate drag and lift? Thank you
can you make a video about the software you used to generate this msh file
Hi gréât job, Can we use sketchup models, and how we van show thé animation indice unreal engine, if its possible, and van we use a big model as e parc of city with terrain (topographic as montzin)? Thank you
god bless your soul.
thank you it is interesting.. I just started learning OpenFOAM just now I am learning to apply aerodynamic effect simulation on buses...and i do not have the software please send me the app software
Does anyone know how to open a .msh in Paraview? I've tried installing a couple of plugins to no avail.
how do you create the files in 0, constant, and system folder?
Hello,
I am discovering OpenFOAM, I keep having an error in the console where I doesn't find my .msh file. I am using Ubuntu 20.04 with the same OpenFOAM version (20.12). Any help would be really appreciated, thank you.
Also, besides this error, how should we setup the 0, system and constant folders' files ?
The only two thing I can think of is to make sure your mesh file is in the correct location (you should have your folder containing 0, system, constants, and .msh file); the other thing is to make sure that you export the mesh in the correct format (I show how in the video).
If you watch some of my newer videos I go a bit more into depth on how to set up the 0 folder, but I honestly haven't done a full length tutorial yet because it changes a lot depending on solver and turbulence model used. I would suggest using: www.fluidmechanics101.com/pages/tools.html . I am slowly developing a calculator myself and you will be able to find it here: github.com/Interfluo/CFD-tools
@@interfluo6420 Thank you for your reply,
I tried with another computer and now it works! I don't really get why for the moment... but anyway I can continue my project now.
Also, thanks for your work it seems really great ! I found Open FOAM very difficult to understand at first glance, because of the lack of documentation. It is great to have such a great community working on it!
Nice! It's possible use ANSYS to plot results from OpenFOAM?
hmmm, I am honestly not sure...
I just have a question. Why using ansys instead of an free alternative? I mean, I suppose the idea by using OpenFoam is to avoid privative software.
I have plenty of videos where I use other meshing software, all of my recent stuff as a matter of fact. It was just the way I first learned OpenFoam and I have been moving away from this method. Honestly I just think it is a good place to start and then discover other software which tends to be a bit more complicated to use.
Hi,
How do you make a 3D colormap like you have right at the start of the video ?
Hi. Thanks for the helpful videos. I am a beginner in openfoam currently learning it in windows Ubuntu LTS.
When I modify any case file in a text editor, I have to everything give it the read permission in terminal before solution. But, you do not seem to be doing it. Please tell me how can I give permission once and all for all case files so that I can also use it seamlessly like you.
Thanks in advance.
Hey, I installed OpenFOAM following this video: ruclips.net/video/cUbC0MrkiOA/видео.html . I don't remember, but their may be a step in it that can help you. I have never had an issue opening up files in a text editor (notepad or notepad++ is what I use) so I don't really know how to help you. Hopefully someone else who has resolved a similar issue will see your comment and reply, good luck!
@@interfluo6420 Thank you for the kind response. I recently reinstalled openfoam exactly as per your installation video but the problem still persisted. I extensively searched for it on internet and unfortunately there are no clear solutions to it, although couple of people have reported similar issue. However, fortunately after trying several text editors, I found that notepad and MS visual code are working well and I do not have to provide the read permission after every edit.
Thanks again!
Hello, I appreciate the efforts that you have made as I am in a similar boat as you appeared to be. The question I have is how do I get the software that you use to make the mesh? When I look it up it appears to be for professionals and students not hobbyists like me. Do you know how I can get a mesh without having to spend excessive amounts of money?
there are several options for free meshing software like gmsh, snappyhexmesh, cfmesh, etc... These days I am using a commercial meshing software called Pointwise, this is by far the best meshing software I have used. Unfortunately, the opensource software for meshing is far inferior to the commercial ones in my experience.
can we run the animation with a random .stl?
May i ask something really simple ? If you import geometry from ansys and you generate mesh in ansys , why not to run it in ansys fluent?
I am having the same question.
Also if I don't have the Ansys license How should I generate the geometry?
what are the specifications of your computer?
3600X and 48gb of ram is what I am using to run OpenFoam along with a fairly quick SSD
great tutorial but music in the background is very annoying
It does little good to post a tutorial for Open Source software, and then use very expensive CAD tools to make the model.
Making the tutorial depend on ANSYS Modeler kind of defeats the purpose. If we had ANSYS then we would probably not be worried about OpenFOAM.
hello, when making my model and checking with Paraview, i have something called patch/walls and it doesn't allow me to pisoFoam the file as it says "cannot find Patchfield entry for wall". It also removes the group wall since it clashes with the patch called wall. Should I delete the patch called wall ? I honestly don't know from what it came from
Did you recover from it ? I’ve the same issue
@@floriantur6021 I think i abandoned it, don't really know the answer unfortunately. What probably matters only is to change the parameters in the boundary files and the 0 files such as U, nut ... etc
Hey could you please tell me a way to design the geometry than using ANSYS. I run Openfoam on linux. Thanks
Yeah, if you watch some of my other videos I cover some of the different options available. I would recommend my video on cfmesh for instance.
Hi, thank you for the detailed guide! I'm new to OpenFOAM and ubuntu in general, but everytime I try to create a folder in my ubuntu directory, I dont have permission to open it through the ubuntu terminal to i.e. run the solver pisoFoam. It says that it doesn't have the permission to open the "p" in my "0" folder? I don't know how to get around this and give ubuntu the permission it needs to open the files and run the solver. Any ideas on how to overcome this?
did you overcome this?
@@subhrajitroy1477 Yes with the following command: " chmod u+x All* " when i was inside the directory
I can't get Ansys to generate a mesh like yours. It creates a mesh on the surface and not on the inside of whenever I try to get it generate my mesh. No matter what I do Ansys just creates a mesh that is on the outside of my geometry, so it never works.
hmm, I have never had this issue.
the only suggestions I can think of are to:
1.) try switching to wireframe view, maybe you are making the internal mesh but can't see it
2.) make sure that you are hitting "generate mesh" and not "generate surface mesh"
3.) try a different meshing software, my latest video cover cfmesh for instance (ruclips.net/video/e2N-h0e_SmM/видео.html)
that is the best I can do without seeing what is going on, hope it helps!
@@interfluo6420 I've messaged you on linkedin. I'm hoping we can DM each other because I could really use some help.
@@interfluo6420 I've done everything exactly as you have and it still won't work.
@@interfluo6420 anytime I create my own mesh it never works. I've been trying to get something to work for the last two days straight. I'm about to give up because I feel like I've wasted so much time trying.
you had me till you mentioned Ansys. thought you were gonna use open-source software like gmsh to create the geometry. not everyone has/will have ansys after uni.
Hey Hasnain, in most my other videos I use open source meshing software. Hopefully you kind find something helpful in that content.
Hey, cheers for your video. Do you intend to share the code in a repo?
sure, I will make one. check in the description
@@interfluo6420 thanks!
okay, I just added it
@@interfluo6420 greatly appreciated!
I dont have ansys
Give more tutorials in openfoam
Working on it right now!
Hey, quick question. Do we ever create our own controlDict and other files? As in, are problems always run by making use of the different cases given inside the 'tutorials' folder in OpenFOAM? Will there be a requirement to create out own controlDicts and/or other files? Thanks a bunch!
As I have advanced more in OpenFOAM the amount of modification to the cases has increased but I would never create one from scratch. But you will notice in my newer videos that I do change cases significantly by adding functions, adjustable time-steps, scalar transport, etc...
@@interfluo6420 Thanks for getting back so quickly, appreciate it! So basically you would just identify what problem you need to solve (multiphase, incomp., etc) and use the included case files in which you can modify the various parameters? If one were to create their own files, would you know how to go about that?
Your videos are awesome, kudos!
Yeah, that is the basic premise. I am not really sure as far as making your own files from scratch, people have likely written programs to generate the, but I haven’t looked into it. Their are so many examples that I have never had trouble finding a couple of cases that I can put together for the problem I am solving.
Thanks a lot for your efforts 🌹
Just wonder when did you modified the Boundary Conditions of the case, I think you have just opened the files, but it would much helpful if you change something then show that change in post processing.
Also you mentioned Courant number, but didn’t say what to do with it.
Thank you very much again :)
Thanks for the comment! In some of my later videos I go over these things more in depth. As a matter of fact, I have a video coming in a few days where I will make sure to go more in depth into the turbulence model, boundary conditions, etc…
If you have an ANSYS FLUENT license, why would you use OpenFOAM?! 🤔 please create a tutorial to use Gmsh for geometry and mesh generation.
This workflow is actually fairly common in science, where custom/modified solvers are used in OpenFOAM.
Can you do a tutorial on
Oversetting mesh and also on dynamic meshing, I'm about to give up there isn't just enough material.
There are videos from "Wolf Dynamics" no offence him, but I can't understand the accent.
This is a topic I am considering and will likely cover in the near future, but I am honestly running into some of the issues you mentioned. Thanks for the suggestion!
well you did not do a better job, incomprehensible
It's just so annoying. He rushes through everything and then doesn't even show/tell what he did with the base tutorial files he copied in order to make the simulation run. "just play around a bit and see what happens" - THAT IS NOT THE POINT OF A TUTORIAL. Show us exactly what you're doing so we can recreate it exactly, AND THEN we can play around and see what happens.
@@Tommybotham you can slow down the playback speed on the vid....also watch more tutorials
its been almost 20 years and this guys didnt build an user interface.
Hi, I've encountered this error, any insights on how to solve this? Thanks.
# Probe 0 (0.0254 0.0253 0) # Not Found
# Probe 1 (0.0508 0.0253 0) # Not Found
# Probe 2 (0.0762 0.0253 0) # Not Found
# Probe 3 (0.1016 0.0253 0) # Not Found
# Probe 4 (0.127 0.0253 0) # Not Found
# Probe 5 (0.1524 0.0253 0) # Not Found
# Probe 6 (0.1778 0.0253 0) # Not Found
You may have an extra function in your control dictionary, try to create a new empty directory and add only the files I provide.
Hmmm... I'm planning on learning CFD and I found OpenFOAM. But after watching this, I don't think it's a software for beginners... Do you happen to have any recommendation for newbies? I've seen my friend use Ansys but it seems just as complicated...
P.S.: I have little to no experience with linux or whatever Ubuntu is....
iam gay
music is not helpful ... distracting...but the video is otherwise great...
Naw music is fire
There has to be something a little bit more user-friendly than this. This seems like trash. The fact that you have to go from the GUI to the command line prompt is redundant.