Single or double precision
I was writing some numerical advice in the CFDWiki Best Practise Guidelines for Turbomachinery CFD.
From my experience, mainly on pure aero simulations (not with combustion, acoustics etc.), you only need to do use double precision if you have very well resolved boundary layers (y plus below 1). For inviscid euler simulations and coarse wallfunction simulations it is most often sufficient with a single precision solver. Anyone disagree? Is this the case also for more special simulations involving combustion, acoustics, etc. ? Or should the advice about single or double precision be enhanced with details about different types of simulations? 
Re: Single or double precision
There is a lot of theories about this. The main issue is whether you can afford the memory for double precision or not  memory was an issue 1015 years ago but now frankly I don't care.
Regarding the actual accuracy, in most external aerodynamics simulations you are OK with single precision. Ideally, the linear equation solver should be written in double precision (but not necessarily the coefficients). One needs to keep in mind that 1e6 as a convergence criterion for a single precision would be really really tight. However, as you move towards more complex physics, single precision will bite you. Examples include free surface (density ratio), combustion, spray, incylinder simulation (think mesh motion at timestep size of 0.01 deg crank angle) etc. In any case, my philosophy (when running OpenFOAM) is to use double precision and not worry about roundoff errors OR run single precision and compensate by engaging the brain :) Hrv 
Re: Single or double precision
That was the feeling I had  when running physics that create strong gradients it is often good to run in double precision. I added a bit of your thoughts to the best practise guidelines for turbomachinery CFD that I was working on. You can see the roundoff section here:
http://www.cfdonline.com/Wiki/Best_...undoff_errors If you have any other suggestions please let me know. 
Re: Single or double precision
I always use double precision. Memory is not a constraint now. I do not know whether CPU times are different for single versus double precision. If the code is single precision, and in future you feel the need for double precision, then you will have some work to do to convert the code, especially with fortran, considering even all math functions come in two flavours. Hence I prefer to use double precision all the time.

Re: Single or double precision
I prefer to use double precision, because some variables, like temperature, pressure and turbulent dissipation take quite large values (for example temperature=400 K, pressure= 150000 Pa, epsilon=10000 m^2/s^3), and especially for pressure the "lost" digits with single precision are important.

Re: Single or double precision
Yes, that is why codes often do not use the real pressure but instead use a gauge pressure, which is the pressure difference compared to the ambient pressure. That way you avoid excessive roundoff errors when computing pressure differences etc.

Re: Single or double precision
Memory is always a constraint :) I still haven't used a computer which I haven't used up all the memory on. Many years ago CPU times used to be almost double for double precision. However, this is not the case for modern CPUs. Usually double precision is something like 30% slower I would guess, but I haven't really checked it in detail lately. Anyone have any recent details on the speed and memory difference when running CFD software in single or double precision? With the explosive growth of hardware and compilers these things change.
With a good fortran compiler it is usually very trivial to switch to double precision. With the compiler I used a long time ago all you had to do was to add a r8 switch when you compiled your code. 
Re: Single or double precision
But in some applications (like incylinder simulation) pressure increases up to 15 bar during compression (15.E+5 Pa) and the difference compared to the ambient pressure is 14.E+5 Pa, again a very large number for single precision.

Re: Single or double precision
Personally, I tend to use single precision most of the time for reasons of efficiency but writing your code so that you can change one parameter, recompile and run in double precision is important for checking that roundoff really is limiting the convergence and not, for example, some boundary condition issue. It is also one of the standard checks to gain information when you observe something you do not understand in the behaviour of your code.
To expand on the point of Hrvoje, engaging the brain and writing code so that it can run in single precision when, for example, you are running a compressible code at low Mach number, teaches you a fair amount about good ways to normalise, express and difference terms. I would suggest that your advice should be that the wise researcher uses both single and double precision. 
Re: Single or double precision
Sounds like an application where double precision is not a bad idea.

Re: Single or double precision
I wouldn't call 15.E+5 a large number. Large compared with acoustic perturbations perhaps, but not compared with ambient pressure numbers. I've never found the need for DP for state variables. Cumulative crank angles and time yes, stiff chemical equations yes, state variables no.

Re: Single or double precision
With g77/gfortran, there does not seem to be any way to switch variables during compilation. Aren't all computations actually done with the same precision in the floating point registers ? It would seem that the difference would arise due to the overhead of moving data into and out of registers, which may be smaller for single precision, and also better cache utilization ??? Of course this may be significant.

Re: Single or double precision
In my experience on AMD64, there is not sensible difference between 4byte and 8byte data word,
Also i mention that (i am not certain) when i read something about programming for AMD64 cpu, they adviced to use 4byte data word alwase, and using smaller type (especially 1byte) not only increase performance but also decrease executation speed (consider data offset,...) 
Re: Single or double precision
>they adviced to use 4byte data word alwase an error, must be corrected to: they adviced to use 8byte data word alwase

Re: Single or double precision
Hi Jonas,
for turbomachinery, especially later stages of an axial compressor the geometry and mesh should be generated in double precision because the whole problem is offset from the axis of rotation by the hub radius. As Hrv points out the coefficients should be ok single precision. BUT to get them you need difference of dimensions. Say you are doing a tip gap which is the order of 0.01[in] which is divided into 10 cells...that is NOT fine today! This gives dimensions on the order of 0.001! Then an offset of 10[in] starts to put you in real trouble. Unfortunatly many meshes are still not written out in double precision today. I always run in double precision today as well. Regards, Bak_Flow 
Re: Single or double precision
I agree with Hrvoje's comments. Using doubleprecision is my norm  in fact, I'd go for anything beyond that, if it were available.
Then, at least, we could silence the eternal  it is all due to 'numeric error'  wherever that bogey may come from. desA 
double precision and single precision
hi all,
I am using double precision in CFD Fluent for my problem having temperature limits from 300 to 30,000 K. it would be grateful if i get clear idea about single precision and double precision.In my problem if i change double precision to single precision there is difference in result.i want to know the reason for the difference and also i want to confirm whether it is because of roundoff error. Thanks in advance.. 
All times are GMT 4. The time now is 18:11. 