CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   writePrecision has any effect in accuracy? (https://www.cfd-online.com/Forums/openfoam/122077-writeprecision-has-any-effect-accuracy.html)

immortality August 12, 2013 01:43

writePrecision has any effect in accuracy?
 
does writePrecision has any effect on results or its only for representation of numbers to the user? which value is better?
Code:

writePrecision  10;

hrushi.397 August 12, 2013 03:12

I think it does. Since the NS equ is non-linear, it will amplify the errors if they are introduced due to precision, particularly if you are solving a problem with turbulence.

cutter August 12, 2013 03:36

In my understanding it has no effect on the internal accuracy during the solution process. The effects described in the previous post should only occur when starting from a state that has been written to disk with a lower precision.

immortality August 12, 2013 04:17

thanks both Hrushi and Cutter
then if I improve writePrecision from 10 to 12 for example does the results become more accurate(because of more significant figures)? or it produce some amplifying errors in return?
my case is unsteady turbulent and compressible,which value you suggest?

niklas August 12, 2013 04:23

you should always use binary format and then the writePrecision is just for presentation and has no effect.

If you have ascii format and perform a parallel calculation you should be aware that the processore to processor communication is streamed via the Pstream library and thus the precision can be influential,
but Im not sure.

immortality August 12, 2013 04:39

Hi Niklas
thanks,I need to make some changes in variables(around each 500000 iterations)in groovyBC during run so it seems I can't use binary files unless there is a way to convert binary files need to change to ascii ones so that performing modifications can be done.
how can see which value is specified for Pstream?
what value is better in your opinion?
what may be its other effects? it causes to take more space on disc and more run time too?

niklas August 12, 2013 04:49

i suggest you perform a simple parallel run test on one of the tutorials and
test with 2 different values on writePrecision
for instance 3 and 12
if the results differ...then you know

immortality August 12, 2013 04:57

OK
does it account for all the digits or digits after points?
for example if a number is 12345.111 and writePrecision be 5 it will included in calculations with 12345? isn't there away so that we can specify number of digits after "."?

Bernhard August 12, 2013 09:45

Quote:

Originally Posted by immortality (Post 445108)
unless there is a way to convert binary files need to change to ascii ones

Consider foamFormatConvert

immortality August 13, 2013 04:08

4 Attachment(s)
Hi
It seems a bit tricky.in variables like pressure and temperature that a multi-diagonal matrix is solved for them it seems that writePrecision has not much effect BUT in rho that is calculated from other fields by perfect gas equation it is important.
I tested rhoCentralFoam/forwardStep for two different writePrecisions 2 and 12.
these are writePrecisions 2; results:

immortality August 13, 2013 04:12

4 Attachment(s)
due to limitation of numbers of attachments(5) I put writePrecision=5 results here.
correct if my conclusion isn't true.
I appreciate for other comments and experiments.:)


All times are GMT -4. The time now is 15:30.