CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

writePrecision has any effect in accuracy?

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By Bernhard
  • 1 Post By immortality

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 12, 2013, 01:43
Default writePrecision has any effect in accuracy?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
does writePrecision has any effect on results or its only for representation of numbers to the user? which value is better?
Code:
writePrecision  10;
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 12, 2013, 03:12
Default
  #2
Member
 
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 13
hrushi.397 is on a distinguished road
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.
hrushi.397 is offline   Reply With Quote

Old   August 12, 2013, 03:36
Default
  #3
Senior Member
 
Join Date: Mar 2010
Location: Germany
Posts: 154
Rep Power: 16
cutter is on a distinguished road
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.
cutter is offline   Reply With Quote

Old   August 12, 2013, 04:17
Default
  #4
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
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?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 12, 2013, 04:23
Default
  #5
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29
niklas will become famous soon enoughniklas will become famous soon enough
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.
niklas is offline   Reply With Quote

Old   August 12, 2013, 04:39
Default
  #6
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
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?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 12, 2013, 04:49
Default
  #7
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29
niklas will become famous soon enoughniklas will become famous soon enough
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
niklas is offline   Reply With Quote

Old   August 12, 2013, 04:57
Default
  #8
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
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 "."?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 12, 2013, 09:45
Default
  #9
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
Quote:
Originally Posted by immortality View Post
unless there is a way to convert binary files need to change to ascii ones
Consider foamFormatConvert
Bernhard is offline   Reply With Quote

Old   August 13, 2013, 04:08
Default
  #10
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
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:
Attached Images
File Type: jpg p_writePrecision=2.jpg (11.7 KB, 104 views)
File Type: jpg T_writePrecision=2.jpg (11.5 KB, 79 views)
File Type: jpg U_writePrecision=2.jpg (13.4 KB, 85 views)
File Type: jpg rho_writePrecision=2.jpg (11.6 KB, 82 views)
cfdonline2mohsen likes this.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   August 13, 2013, 04:12
Default
  #11
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
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.
Attached Images
File Type: jpg p_writePrecision=12.jpg (12.6 KB, 71 views)
File Type: jpg T_writePrecision=12.jpg (12.1 KB, 50 views)
File Type: jpg U_writePrecision=12.jpg (13.1 KB, 46 views)
File Type: jpg rho_writePrecision=12.jpg (12.0 KB, 58 views)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Reply


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
Accuracy of wall shear and velocity kjetil OpenFOAM Running, Solving & CFD 10 April 27, 2010 13:35
Temporal accuracy ganesh Main CFD Forum 0 February 29, 2008 05:32
effect of order of temporal accuracy zonexo Main CFD Forum 4 August 14, 2006 00:36
Can 'shock waves' occur in viscous fluid flows? diaw Main CFD Forum 104 February 16, 2006 05:44
accuracy of Discontinuous Galerkin Qu Kun Main CFD Forum 0 September 6, 2004 09:19


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