CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Solution diverging on using double precision (

qrie January 22, 2013 04:11

Solution diverging on using double precision

I have an incompressible Navier Stokes code that was working fine as long as I was using single precision. When I converted to double precision, the residues are very high. Why is this happening?


Martin Hegedus January 22, 2013 12:29

A bug in your code?

Sometimes issues like the following may occur

if (xx == 0.0) {
then do something

Under single precision this might work but double does not if xx is very small but not equal to 0.0, for example xx=1.0e-12. Single precision would round value to zero. Error tolerances should be used.

if (abs(xx) < 1.0e-8) {
then do something

qrie January 23, 2013 00:11

That helps! Thank you! :)

All times are GMT -4. The time now is 16:20.