Accuracy and Robustness of CFD codes
Can a CFD code be accurate and robust at the same time?
This post is just a little reflection on the potential of the CFD codes to meet the highest results’ expectations for a large range of input data.
It seems to be an eternal question, when developing a CFD code and later choosing simulation setup, how much effort to put on accuracy which may likely lead to a narrow range of usable applications. Or to put the major effort on developing the code ability to take a wide range of input data and boundary conditions.
To give just a bit of context, I am around for 16 years. When I was a master degree student and later Ph.D., I myself have developed two working CFD in-house codes from a scratch. Those codes made their jobs and based on them I got my degrees. Later, during my stay at von Karman Institute for Fluid Dynamics, I have worked on developing in-house multiphysics code CoolFluid. From 2009 on, I already knew I will dedicate my nearest future to the open-source business, specifically to OpenFOAM. In the last couple of years, I am involved in product management of TCFD. Besides that, I have user experience with most of the major commercial CFD codes available.
Nobody trusts cfd simulation, except the one who made it. Everybody trusts the measurement, except the one who made it.
What is meant by the accuracy in CFD? Standard CFD means solving Navier-Stokes equations. For industrial 3D turbulent problems, it is impossible to get their analytical solution. For that reason, the CFD results are most often compared with the experimental measurements. Interesting is, that it is much easier to trust measurement because it is real. The simulation is not. Simulation is fully virtual. Here comes the reality: Nobody trusts cfd simulation, except the one who made it. Everybody trusts the measurement, except the one who made it. CFD is not perfect, neither the measurement is. But it is the CFD, who has to chase the measurement results and never the other way around. This is the game we play and these are the rules, no matter how much we like it or not at all.
While the accuracy understanding is quite clear, the robustness might have a few different meanings. A code can be robust or not, in terms of taking a wide range of flow conditions. For example, the flow may be at the edge of stability by simulating a point which is far away from the design point (e.g. a point close to choke at compressors). Or, a code can be robust in terms of taking an imperfect input data - this is, in fact, a way of the user-friendliness. For example, invalid mesh, unphysical data, or incompatible settings. The first kind of the robustness is valuable, the second one might be dangerous.
When increasing the robustness you almost always lose some accuracy.
CFD codes can use a lot of tricks to increase the robustness (user-friendliness) at the expense of accuracy. I do not want to torture you with too many details. I’ll give you one example. To make the fluid flow functions nice and to make the convergence smooth you can locally change a numerical scheme. The numerical scheme is a formula of the certain numerical order and can play with the amount of the artificial viscosity. Artificial viscosity dumps the oscillations of the solution and acts in the simulation as the normal viscosity. It increases friction, dumps oscillations and stabilizes the flow. A higher order scheme is more accurate than lower order, but higher order is much less stable than lower order. As a result, a code can apply a certain filter, which can locally change the order both in time and space. Doing so, a code can give up certain accuracy to gain a bit more stability - robustness. There are many other convergence stabilizing methods for increasing the robustness. For example, limiting quantities and fluxes, or locking undesirable mesh cells, etc… Remember, when increasing the robustness you almost always lose some accuracy. This enhancement wouldn’t be necessarily wrong if the user would have complete control over it.
Most of the codes are rather robust than accurate
For the last two decades, CFD is not (only) a science anymore. It is business. The codes have to be sold. Users are more likely to pick those codes, who are user-friendly. As a result, a CFD code marketplace is just a big competition in user-friendliness. Commercial codes, at any cost, want to please their users. They are being developed to be very tolerant to their users. They tend to create results from any input data - no matter how accurate. The accuracy is discussed sometime later. One might be surprised when learned that commercial codes (like all the mainstream goods) often do not give the most accurate results. Remember, codes are made in a way to please their users. As a result, many codes are rather robust than accurate.
Maybe you noticed, that the general reputation of CFD as a tool is actually pretty bad. I already stopped counting how many times I heard that CFD really stands for ‘Colored Fluid Dynamics’ or my favorite one ‘Colors For Directors’. The reason is exactly the one that mainstream codes are too robust and they generate whatever results. Varying from excellent to totally nonsense results. Over the time, CFD has lost its credibility.
In-house codes and open-source codes are usually very transparent and strict to their code purity. If their simulations are set well, they usually give very accurate results - otherwise, they do not converge at all. The good news is, that with open-source codes (as well as with the in-house codes) if the solution eventually converges - then the results are usually very accurate.
Open-source is typically closer to the measurement data
In the company I work for, we develop workflows which CFD part is based on open-source. Over the time, we have done many benchmarks to compare codes each other or with measurements. The results completely confirm this. For example, in every turbomachinery benchmark, we have seen, open-source code gives a bit higher efficiency than commercial code. Open-source is typically closer to the measurement data. The reason is obvious (commercial codes have too much artificial viscosity in them).
Maybe you noticed that solving Navier-Stokes equations did not make any major breakthrough for many years. Sure, the computational power keeps growing. The simulations are bigger. But the methods are the same. The question is, is the Finite Volume method stale? The fact is, the commercial codes focus on keeping their current users, rather than reaching new ones. Perhaps, the major reason for the rise of Lattice-Boltzmann methods in the last years is NS is not being developed anymore. Let’s see.
Conclusion
Finally, let's get back to the original question. Can a CFD code be accurate and robust at the same time? No, not really. It simply can’t.
For the same reason, why Formula One car can’t win Rallye Monte Carlo or Dakar. It is the purpose, Formula One car was created for the circuit race, it performs best right there. And the best always means being without compromises.
Accuracy and robustness are like two rabbits, who are running the opposite directions. You are about to send your dog (code) to chase them. That is not an easy task. And on top of that, when trying to chase both of them, you risk losing them all.
This post is quite general. I will be glad if you let me know your opinion on this topic. We can discuss it more in detail.
Engineer
1 年Too biased and really misleading.
Projektleiter EDV bei Universit?tsklinikum Leipzig
3 年Thank you for that valuable lecture. OpenFoam has the advantage that you can choose whether it is mostly robust or mostly accurate. But you need at least an idea about what the schemes, boundary conditions, mesh quality and relaxation and limiting factors represent. I recommend starting simple and robust and go step by step to accurate and as complex as possible. Try to understand what happens in every step. Increase accuracy (and give up robustness) only where it is needed. Most models I see in the public are much too complicated: Too complicated geometry, all physical effects in one simulation. I counts to split this into pieces and simulate them separately. You need a plan how to combine the results, and you have to make some compromises. But such a result, with all simplification and compromises, is mostly much more reliable in comparison to a complex model simulated with the most accurate approach – if this finishes at all.
Simulation & Modeling for Engineering | Technical & Sales Leadership | 30 years in Digital Technology & Transformation
4 年"The fact is, the commercial codes focus on keeping their current users, rather than reaching new ones". I have not found this. In fact, the larger commercial vendors (and their sales teams) are measured closely by their organic growth and specifically that which is derived from gaining new clients (not just new business).
CFD Specialist | Thermal and Fluids Consultant | Free Mentoring | LinkedIn Top Contributor | Follow on Linkedin
5 年1/2 Thanks a lot Lubos Pirkl! This is the kind of posts that I love the most as it's the kind that touches many topics for discussion around a main theme presented clearly. Navier-Stokes equations are deterministic (under the classical Newtonian mechanics assumption). Under its range of validity and given precise state of the system at a present moment they supply a future state of the system. The issue is that we are far from fully understanding the equations themselves (let alone solving them) and will never have a precise current state of even the simplest of systems. Actually, we are not even trying to solve the equations, but limit ourselves to a numerical counterpart of them. Moreover, it is not clear what we mean by "measurement". Different types of experiments have VERY different objectives. I think we should be very precise by what we mean by "close to experiments". An experiment may stray from reality in many ways, and even DNS will be "close" only if we define our notion of "closeness" well (see my take about validation): https://allaboutcfdtomers.blog/2019/10/10/turbulence-modeling-best-practice-guidelines-standard-evms-part-ii/
CFD Scientist and High Performance Computing Specialist.
5 年I slightly disagree with the article when it claims that high order scheme tend to be more accurate than low order. However, in fully agree with it when it says that CFD has become more commercial than science. Making solver robust means making them less accurate and less physics predicting capable. Very nice article overall ! You conclusion is just perfect. I’ve mentioned that several times to product managers at different commercial CFD companies. In fact, that was the last discussion I had with my PhD advisor after I graduated, I told him “unless we go back to the drawing table and think harder to come up with newer methods, we are going to refurbished the same solution from the last 30 years” we have more power but the same algorithms. I rather be in the romantic and group of people that fail with new methods, than in that group that publishes the same thing with new numbers over and over again.