CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Solution diverging on using double precision

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 22, 2013, 04:11
Default Solution diverging on using double precision
  #1
New Member
 
Join Date: Jun 2010
Posts: 20
Rep Power: 16
qrie is on a distinguished road
Hi,

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?

Thanks!
Qrie
qrie is offline   Reply With Quote

Old   January 22, 2013, 12:29
Default
  #2
Senior Member
 
Martin Hegedus
Join Date: Feb 2011
Posts: 500
Rep Power: 19
Martin Hegedus is on a distinguished road
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
}
Martin Hegedus is offline   Reply With Quote

Old   January 23, 2013, 00:11
Default
  #3
New Member
 
Join Date: Jun 2010
Posts: 20
Rep Power: 16
qrie is on a distinguished road
That helps! Thank you!
qrie is offline   Reply With Quote

Reply

Tags
divergence, double precision


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parallel rasInterFoam openfoam_user OpenFOAM Running, Solving & CFD 4 November 1, 2008 05:14
When to use double precision Mark Render Main CFD Forum 10 January 21, 2008 13:16
re: Double precision and grid quality Wooster CFX 5 July 26, 2007 11:10
UDF & Double precision; Please help?? Asghari FLUENT 0 January 31, 2007 14:14
HELP! Diverging Solution for Incompressible Prob. Bob FLUENT 3 April 16, 2006 20:33


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