#22: OpenFOAM boundary conditions demystified!
The exact method I use to get this right every time...[PDF pack inside]
The Digital Engineer is growing fast and kept free for readers with support.
If you’d like to support me directly, click here to donate (and get a mention too! 😊).
If you’d like to advertise your engineering-related educational course, pro or open-source / public-domain tool, contact me at hi@nasserm.com or DM me on LinkedIn.
Thank you for your continued encouragement and support.
When I first started using simulation tools I was totally confused.
It was whilst at University in 2007 I was presented with a research assignment involving the use of a wind tunnel and CFD software, namely ‘Phoenics’ by CHAM.
It had an odd-looking image of a coarse-to-fine grid with a 3D car model ‘sitting’ on the floor. Something a little like this:

Whilst it did at least have a GUI, I was still unsure how to use it with the myriad of settings and options.
What confused me the most was the idea of boundary conditions 🤯…
Sure, I understood I needed to have some kind of ‘Inlet’ for fluid flow to enter and an ‘outlet’ for the air to exit, much like a physical wind tunnel.
But what about the other ‘walls’ / edges of the domain?
What about the model surfaces themselves?
So I did what most beginners do: I guessed.
This led to the solver consistently crashing and non-convergence at best.
I eventually got around it and understood where I was going wrong…
Let's get to it.
What is a Boundary Condition (BC) anyway?
A boundary condition defines how the fluid behaves at the edges of your simulation domain / the interfaces of fluid and model.
Let’s look at this using a CFD learning tool I’ve been developing lately for absolute clarity.
Consider a simple plate / square domain CFD case:


Note: whilst this CFD learning tool is still in development, I opened the waitlist publicly a few weeks ago. If this is the first time you’re hearing of it or you haven’t signed up the waitlist click here for some incredible early supporter perks!.
Boundary conditions tell your solver:
What’s entering or leaving the domain
How the fluid behaves at walls or interfaces (like at geometry or a different type of fluid - air, water, oil etc.)
Which variables (velocity, pressure, temperature etc.) are controlled or solved
Incorrect boundary condition setup can result in convergence issues, solver crashes and crazy, non-physical results!

Yes, it gets a little more complex than this simple case, but it should demonstrate the control you have over boundaries as the person setting up the case.
Always start by drawing it out
When you visualise the scenario in the form of a simplistic scientific diagram, you reduce the complexity into a native model.

You can see from this simple case we have all boundaries stationary with velocity (U) equating to 0, except the top one which is moving at a constant rate of 1 m/s in the positive X direction.
This way you already will have gathered key information before launching your CFD tool and simply have to ‘translate’ it for the software to solve.
In OpenFOAM, If these are the actual requirements then the velocity(U) at the boundaries shown, will translate into:
Top (moving wall) =
fixedValue
, uniform(1,0,0)Left, bottom and right walls (fixed, solid walls) = no
Slip
As you can see, understanding, even this simple case, is crucial before approaching your CFD tools.
This is how every study should begin.
Boundary Condition types in OpenFOAM
This is the important first step - knowing the boundary condition types available.
Let’s briefly break down a few of the most common types:
fixedValue
– You’re telling the solver: “Hey, hold this value constant here.”zeroGradient
– You’re saying: “Let this value adjust naturally, but don’t let it change abruptly across the boundary.”
There are many more - slip, noSlip
, pressureInletOutletVelocity
, etc.
Each serves a different purpose as demonstrated above.
I had questions like:
Which should I use?
Why should I use this one?
When should I apply this setting?
Is there a better, more appropriate one?
You can skip all of that…
The thing that finally helped me crack boundary conditions was understanding why each type exists and what their ideal use case was.
My secret weapon: my PDF cheat sheets which saves me time and frustration.
Now I just use this every time I have to setup a new case or trouble-shoot a failing one...
✅ Prevent solver crashes + setup errors
✅ Lets you focus on your simulation goals
✅ OpenFOAM-ready but solver-agnostic (can be used with others)
✅ Compatible with all modern OpenFOAM versions including v12 / v2506+
What you get:
Cheat sheet #1: Boundary condition types - what and when to use them
Cheat sheet #2: Common mistakes and actual solutions for complete clarity
Cheat sheet #3: Boundary condition learning pathways / recommendations depending on your experience
Boundary conditions don't need to be scary or confusing.
They themselves and the terminology is rooted in physics and computing.
You just need a guide, built from experience and that’s exactly what this is.
Until next time keep foaming and simulating with confidence!
Nasser
Connect with me:
🗣️ Comment below - I read every single one!
🙌 Follow me on LinkedIn: https://www.linkedin.com/in/nassermushtaq/
📧 Send me an email: hi@nasserm.com
Disclaimer:
All content in this post and newsletter is my own production and do not reflect the opinions or positions of my employers, partners or associates.
For those considering but not yet purchased the boundary conditions pack of PDFs: the reduced price ends Tuesday 11am London time. If you can't place an order please get in touch and let me know why. Ultimately I'm trying to create resources for you which extend from my posts and save you real time / effort in using CFD tools / OpenFOAM. Thank you for your continued support 🙏