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

When to use double precision

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 20, 2008, 02:57
Default When to use double precision
  #1
Mark Render
Guest
 
Posts: n/a
Hi,

in what cases it is recommended to use double instead of single precision for CFD calcs? When can I expect advantages from running double prec?

Best regards, Mark
  Reply With Quote

Old   January 20, 2008, 08:56
Default Re: When to use double precision
  #2
Harish
Guest
 
Posts: n/a
Try to use double precision as often as possible unless you have a reason for not doing so.
  Reply With Quote

Old   January 20, 2008, 11:18
Default Re: When to use double precision
  #3
Deepak
Guest
 
Posts: n/a
Is double precision means only added accuracy and it also has to do something with convergence?

What i use to do is that when i have less computational resources, i go for single or else double..
  Reply With Quote

Old   January 21, 2008, 01:50
Default Re: When to use double precision
  #4
Mayur
Guest
 
Posts: n/a
see if ur avg. pressure values r large compared to pr. difference values then u need to go for double. Else single is sufficient.
  Reply With Quote

Old   January 21, 2008, 04:32
Default Re: When to use double precision
  #5
Jonas Larsson
Guest
 
Posts: n/a
Double precision removes the potential problem that round-off errors affect your solution or convergence. There is a bit more written about it in the Best Practice Guidelines for Turbomachinery CFD in CFD-Wiki. Here is a direct link to the relevant chapter:

http://www.cfd-online.com/Wiki/Best_...uble_precision
  Reply With Quote

Old   January 21, 2008, 05:14
Default Re: When to use double precision
  #6
rt
Guest
 
Posts: n/a
first, if your system is 64bit and u do not have memory constraint, always use dp, computational time is almost the same.

but when dp: as Jonas said dp just decrease rounding error (with proper scaling you could control them too), usually we do not need dp precision in floating point arithmetic but we have to use its due to other problem raised by rounding error.

i just state an example: assume iterative solution of Ax=b, if this system be ill-posed (e.g. pressure equation in multiphase flow, or generally Poisson equation with discontinuity in diffusion coefficient) small perturbation in the initial guess leads to large perturbation in solution (x, of next iteration) so decrease convergence or leads to divergence. So in this case we like to use precision as large as possible (just try by a numerical experiment), for more details look at Iterative Method book of Y. Saad, is online available (this issue is discussed where very nice).

Another example is solution of stiff ODE, the same scenario could be happen.

Hope this helps.

  Reply With Quote

Old   January 21, 2008, 05:57
Default Re: When to use double precision
  #7
Robin Bornoff
Guest
 
Posts: n/a
I'm certainly no expert in stiff ODEs or the like but the reason we introduced a dp solver into Flotherm was to resolve perception issues of incomplete convergence of temperature in models that have heat flow through high conductivity solids, e.g. the rather common case of heatsinks on smaller dissipating IC components.

With thermal conductivities ~300 W/mK small differences in dT (e.g. roundoff generated) give rise to large heat fluxes and associated perpetual small residuals. From a results perspective these errors were non-contributory to the overall thermal resistance of the heat flow path. So, double precision does remove these errors achieving a further one or two orders of magnitude decrease in residual error (with a painful increase in memory footprint) but the results of interest, temperature of the IC component, does not change.
  Reply With Quote

Old   January 21, 2008, 06:03
Default Re: When to use double precision
  #8
Steve
Guest
 
Posts: n/a
If you need DP then you should think about changing your code.
  Reply With Quote

Old   January 21, 2008, 08:58
Default Re: When to use double precision
  #9
Quarkz
Guest
 
Posts: n/a
Hi rt, u mention that "if your system is 64bit and u do not have memory constraint, always use dp, computational time is almost the same".

so if my OS is 32bit, will the computional time be similar too whether using dp or sp? I code in fortran and my code is in dp. I wonder if there's any difference if I've a 64bit OS. btw, the compiler also has to be 64bit, is that so? btw, my comp has 2gb ram.

Thanks!

  Reply With Quote

Old   January 21, 2008, 10:01
Default Re: When to use double precision
  #10
rt
Guest
 
Posts: n/a
I just express my personal experience, so i do not have an explicit answer to ur question, if u google in this regard u could found sufficient materials.

also cpu companies have some recipes about how to program which is compatible with your cpu, some year ago i read somthing about AMD32, i think that u sholud refer to such resources for more details, e.g. i read that there is not any cpu time benefit (but maybe drawback) to convert integer*4 to integer*1 (in fortran)! (consider data offseting on register memory of cpu)

maybe other members of this foroum has more information ?

  Reply With Quote

Old   January 21, 2008, 12:16
Default Re: When to use double precision
  #11
Gerrit Groot
Guest
 
Posts: n/a
I completely agree with Steve.

Everybody here is claiming that double precision is indispensible, but if you non-dimensionalise well, single precision must be enough.

Double precision is an era dependent concept, what was double in the past may be single in the future, so eehhh...
  Reply With Quote

Reply

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
Continuing User Defined Real Gas Model issues aeroman FLUENT 6 April 8, 2016 03:34
Parallel User Defined Real Gas Model aeroman FLUENT 4 July 1, 2015 06:09
Missing math.h header Travis FLUENT 4 January 15, 2009 11:48
what's wrong about my code for 2d burgers equation morxio Main CFD Forum 3 April 27, 2007 10:38
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23


All times are GMT -4. The time now is 01:14.