How to start with OpenFOAM

How to start with OpenFOAM

A few recommendations for OpenFOAM beginners on how to start working with OpenFOAM from a scratch. OpenFOAM is really a great CFD software. It is easy to get, but the price you pay is a time you spend on learning it. This price is always higher than expected in the first place. If succeeded the value you get is huge. People keep asking us how to start with OpenFOAM all the time. I decided to put together this little thought experiment on starting with OpenFOAM. After nine years in the OpenFOAM business, I have seen hundreds of people starting with OpenFOAM from a scratch. Some of them succeeded, some of them failed. It’s quite a gamble - but you can do quite a lot with your odds. It is only you who decides whether you succeed or fail. Based on experiences, we made with those who succeeded, my recommendations for beginners would be the following.

Start with tutorials

Run as many OpenFOAM tutorials as possible. Just run them and only watch the results in detail. Learn the OpenFOAM case structure. Learn ParaView. That is the way enough that you should do, in the very first time when learning OpenFOAM.

Master OpenFOAM slowly, but surely

The most typical fail of the beginners is rushing to a big spectacular simulation and they do not understand how it works in the OpenFOAM environment. For the complexity, they got quickly disappointed and give up. If you are smart enough, take it easy. Start with very simple cases (single phase, steady-state, incompressible, laminar, 2D, ...) - they are easy to understand and they converge quickly. Play with them. Add a complexity later.

Grow your predicting skills

Later modify the case set-up and follow the difference. Refine the mesh. Unrefine the mesh. Change your turbulence model. Change viscosity. Change a numerical scheme. Add a boundary layer. ... Do the modifications one-by-one, not all together! Always follow the effect of one particular modification. You should grow your predicting skills now. And remember, you’ll be paid off in the future.

Read the code

If you want to work with OpenFOAM at any level higher than just a user, you have to understand the code. After some time, you should start reading the code. Try to understand it. It may be difficult in the beginning. It gets much easier in time. I can promise you, later you will learn the code is the best source of documentation at all.  

Search the internet

It is almost certain, that a similar work that you need to do, it has been done by someone else already. You should give it a try and find it and take a lesson.

Ask for help

There is always someone who can give you a feedback or help. Do not hide in a box with your issues. Go to the CFD forums and social media and ask for the help. Ask an expert. Find someone who cares. Asking is for free.

Always remember the last modification

You should keep in mind what was the latest update you made in your project. Both on the coding side and on the case set-up side. If anything goes wrong, you can take a step back to restore the latest working version. For this reason, I can not recommend doing major modifications at 2 AM when you come back from a party. It might be difficult remember the last modification and restore when a mess found in the morning. Sooner or later you will need a subversion system anyway.

Engineering is superior to coding

I have seen many times a myth, that you should know C++ to work with OpenFOAM. That is not true at all. Of course, C++ coding skills are extremely useful - but CFD engineering skills are superior to coding skills - in a field of CFD. You always should realize what you are looking for. A typical misunderstanding we observe is, that people overestimate the coding skills (how to do that) and underestimate the CFD engineering skills (what to do). And remember, what to do (the aim) is superior to how to do that (the way to do). You would be surprised how little C++ skills are needed for most of the projects. In OpenFOAM, you seldom find a project where you need to start coding from a scratch. Copy & Modify method is extremely effective.

Be patient

The difference between success and failure might be a stupid little thing. We keep seeing again and again, that in CFD, the 90% of all errors are human errors. For this reason, please, check everything twice. BTW: The automation helps a lot to avoid the human errors. What is also interesting, from our technical support department we know, that 80% of all issues are somehow related to boundary conditions.

Master the mesh, master the solution

The mesh is critical in CFD. That’s for sure. The importance of the mesh in CFD is simply huge. I only note here, that the mesh matters more in terms of the quality of the results than in terms of working or not working. And also, I always recommend to start any new project with a coarse mesh, to run a lot of sensitivity tests on simulation parameters in a short period of time. And when you feel you are in a good way, then you can refine the mesh and go for the big simulation. Lastly, do the mesh convergence tests if you can.

Taking an OpenFOAM training helps

An OpenFOAM training is not needed for success. But If an OpenFOAM training is in your range, I definitely recommend it. OpenFOAM training speeds up a learning process really a lot. Training saves a time and it gives you the whole picture. Many tips and tricks have been already discovered. On the other hand, lots of people made it without a training. And lots of people failed with the training. So, the training is definitely not a condition for success. But helps a lot.

Learn by doing!

The best for the last. The action is the most effective tool in OpenFOAM learning process. Reading only, or talking only, it doesn't help at all. CFD is too complicated science to be learned only theoretically. When learning OpenFOAM, or any other CFD code, the best what you can do is to get to the action as much as possible and: play, try, modify, test, simulate, evaluate, think, judge and never give up!

I leave you with that. Feel free to get in touch with me. I will gladly discuss this topic with you.

Thanks

Like
Reply

Thanks so much for this! I was feeling a bit overwhelmed by OpenFOAM, but your direction helps a LOT.

Like
Reply
Hongbin Wang

Associate Air Quality Consultant at WSP

2y

Thanks very much. I think c++ is very important for people who are self-taught. and also need to do some development.

Like
Reply
Ahmed H Hafez

Senior CFD Application Engineer. Lecturer Assistant & PhD Researcher at Aerospace Department, Cairo University

2y

I asked if you had a tutorials for Openfoam as this great post 😎 It'll be so useful for us 😊

Like
Reply
Uwe Pilz

Projektleiter EDV bei Universitätsklinikum Leipzig

2y

Thank you. This summarizes my own insight.

Like
Reply

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics