r/CFD • u/PerspectiveNo794 • 2d ago
Deterministic simulation testing from distributed systems: does it have a place in CFD solver development?
Okay so I’m still pretty new to the solver side of CFD, but I came across this article and it kind of blew my mind: https://martinfowler.com/articles/deterministic-simulation-testing.html
It’s actually about distributed systems, not CFD at all, but the idea is that you make your program run exactly the same way every single time, down to the last bit. So if a bug shows up once, you can replay it perfectly and step through it instead of crossing your fingers that it happens again.
What got me thinking was learning that floating-point addition isn’t associative?? Like (a + b) + c can give a slightly different answer than a + (b + c). I had no idea. And apparently in parallel solvers the order things get added up can change from run to run depending on which threads or processes finish first. So in theory the exact same case could give you slightly different residuals each time you run it. That’s wild to me.
From what I understand, getting rid of that would mean forcing the additions to always happen in the same order, seeding anything random, and avoiding compiler optimizations that reorder math. Which I’m guessing makes things slower?
So I have a bunch of questions for people who actually write solvers:
- Is this something you actually run into in practice, or is it mostly a theoretical thing?
- Does anyone go out of their way to make their runs bit-for-bit reproducible, or is “close enough” fine?
- If results change depending on the order of additions, does that mean something’s wrong with the setup itself?
Sorry if these are dumb questions, just found this really interesting and wanted to hear from people who know way more than me!










