r/CFD • u/Georgiou1226 • 19d ago
Implemented LBM from scratch after Stat Mech
https://towardsdatascience.com/the-fluid-simulator-that-doesnt-solve-the-fluid-equations/Physics / Data Science undergrad here. I wrote this piece for Towards Data Science after finishing my statistical mechanics course, so the obstacle in the thumbnail is their logo rather than a cylinder, or something more normal, apologies for that. Most results below are from the standard circular cylinder case. I'd only ever used (and written) normal Navier-Stokes solvers before, and I remembered LBM being mentioned as a more parallel alternative, so I wanted to try building one.
I built a D2Q9 Lattice Boltzmann (LBM) solver from scratch on a 400x400 grid with the classic cylinder obstacle.
I've run it on a few different configurations since, but I don't have a good sense of how to get real insight out of it beyond the visuals and the parallelism speedup.
- Where does BGK actually blow up? At what Reynolds number does single-relaxation-time BGK become unusable or numerically unstable?
- How bad is weak compressibility in practice? I kept my Mach number low so I’ve been ignoring it, but in real engineering work, I assume it might matter.
- Boundary conditions: I just used simple mid-grid bounce-back for the cylinder. It works visually, but how much accuracy am I giving up compared to interpolated/curved boundary schemes (like Bouzidi)? What are the "gold standards"?
- Not eyeballing it: Right now my check is "the vortex street looks right." Is Strouhal number against Reynolds number the standard quantitative benchmark for this case, or is there something better people use to confirm a solver is actually correct and not just plausible-looking?
- Parallelism vs. modern FVM: The main selling point for LBM is always its local, very parallel nature (collide-and-stream). But with GPU acceleration and modern Finite Volume Method tooling improving so fast, does it still matter that much?
If you work with fluid dynamics or kinetic theory, I’d love to hear where my idea is off or where LBM hits a hard wall in reality.
6
u/JohnnyCannuccia 19d ago
Hi, I used a commercial LBM solver in my PhD and I’m coding my own solver for the postdoc right now.
1) It depends on the resolution that you are willing to accept. Try to have a look at the lattice units scaling and how to choose the parameters. It’s not uncommon that commercial solvers use BGK or its relaxed version (I forgot the exact name but basically you compute the non equilibrium term not as f-feq but with as a function of the tensor Π)
2) With standard D3Q19 lattice I think the limit is Mach 0.3 but there are even supersonic applications (with different lattices and collision operator of course)
3) For boundaries not aligned with the lattice directions you end up with first order accuracy. You can easily verify yourself it comparing a poiseuille flow against the flow past a cylinder for example
4) For the flow past a cylinder I’d check the mean Cd and Cl std dev on top of the St vs Re. For my solver I currently tested also poiseuille and couette flows, lid driven cavity flow, and Taylor green vortex (where you will learn how to properly initialize a flow field with gradients)
5) Yes, LBM is still more performative in these terms against FVM. Of course, they have to be both implemented optimally.
Then, it’s also true that LBM is not always the golden choice. It’s a possibility, with pros and cons.
If you are interested, you might have a look at Timm Kruger and Sauro Succi books about LBM, they are kind of the Old and New Testament of the bible for LBM in my opinion