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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 22, 2013, 03:11
Default Solution diverging on using double precision
  #1
New Member
 
Join Date: Jun 2010
Posts: 20
Rep Power: 15
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, 11: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 22, 2013, 23:11
Default
  #3
New Member
 
Join Date: Jun 2010
Posts: 20
Rep Power: 15
qrie is on a distinguished road
That helps! Thank you!
qrie is offline   Reply With Quote

Reply

Tags
divergence, double precision

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 04:14
When to use double precision Mark Render Main CFD Forum 10 January 21, 2008 12:16
re: Double precision and grid quality Wooster CFX 5 July 26, 2007 10:10
UDF & Double precision; Please help?? Asghari FLUENT 0 January 31, 2007 13:14
HELP! Diverging Solution for Incompressible Prob. Bob FLUENT 3 April 16, 2006 19:33


All times are GMT -4. The time now is 23:33.