Are you writing solvers for single or double precision?
Hello everyone,
I saw that one expert I know, only writes their solvers with double precision. It seems a little unproductive to me, since I also like to do simulations with single precision, since they're 2X faster, but only half as accurate. In most cases, the results are good enough, and I can explore design changes easily. So, for my own solver, I'm making sure that both single and double precision can be used. What do others in the forum do? PS : Having a single precision solver has other advantages too. Main one is to be able to run fast simulations during the solver development phase and profile the performance of the code. Thanks and regards ~sayan |
I strictly prefer double precision in development, because there are several little subtle issues in a general CFD code that won't come out in single precision or you couldn't be sure about them. Single precision is tested just after that.
In production it's just up to the user but, again, my personal preference is for double for the same reasons above. Probably after a first single precision run |
Quote:
I mainly use single precision because it's extremely fast. |
As Paolo addressed, the issue should be explored by experiencing what happens for some iterative methods applied on some particular matrix. Maybe more than a CFD topic, is a numerical analysis topic.
Briefly speaking, single precision can cause an accumulation of the error. |
Just a very simple example of the problem
https://www.ibm.com/support/pages/si...point-accuracy |
Quote:
Have come across cases that do not converge in single precision or in mixed precision. One of the them actually wasted 2 weeks before someone run it in double precision where it finally converged without issues. |
As mentioned by Filippo, the main reason is that, in single precision, you need to be a sort of magician to have everything under control. I simply don't have time to analyze every single math operation when I develop in the beginning, maybe later.
More generally, you want to be sure that things actually work in double precision as well. Also, some CFD pieces have inherent discontinuities (wall functions, gradient limiters, etc.) that might kick in unexpectedly, and spoil your convergence. When you develop you want to be sure that you catch them |
|
|
Flow statistics are also of concern. In single precision you have to be careful even for simple averages over, say, 100 million cells
|
Quote:
|
All times are GMT -4. The time now is 13:25. |