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

Binary files

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By alberto
  • 1 Post By olivierG

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 30, 2010, 12:07
Default Binary files
  #1
New Member
 
Join Date: Aug 2010
Posts: 15
Rep Power: 16
amtri is on a distinguished road
Hello,

I have 2 separate questions regarding OpenFOAM binary output:

1) Is there a flag in the OpenFOAM file structure that can tell me whether binary data is written in single or double precision?

2) Also, is there a way to tell whether big or little endian is used to write the binary data in the file?

Thanks.

-amtri
amtri is offline   Reply With Quote

Old   September 17, 2010, 02:05
Default
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by amtri View Post
Hello,

I have 2 separate questions regarding OpenFOAM binary output:

1) Is there a flag in the OpenFOAM file structure that can tell me whether binary data is written in single or double precision?
Binary files should be written with the precision of the compiled code (double if you use the double precision solver, float if you use the single precision solver), since their purpose is not to lose accuracy when storing data.
OpenFOAM compiles in double precision mode by default.

Best,
Ramzy1990 likes this.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   March 15, 2011, 05:15
Default
  #3
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20
bastil is on a distinguished road
Quote:
Originally Posted by alberto View Post
Binary files should be written with the precision of the compiled code (double if you use the double precision solver, float if you use the single precision solver)
Thats true. However, I am looking for a way to save meshes in double precision but run solver in single precision. Therefore, this solver needs to be able to read/write double precision. Has anybody done this before?

Regards Bastian
bastil is offline   Reply With Quote

Old   March 16, 2011, 00:43
Default
  #4
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
What is the logic behind this? You would lose the double precision used in the mesh immediately at the first operation you force to be single precision.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   March 16, 2011, 03:59
Default
  #5
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20
bastil is on a distinguished road
Quote:
Originally Posted by alberto View Post
What is the logic behind this? You would lose the double precision used in the mesh immediately at the first operation you force to be single precision.
I will gain a speedup of 40%!
The accuracy differences between SP and DP for my cases are very small.
I can reproduce this behaviour with the ASCII-option: Saving my mesh with 6 digits prevents simpleFoam from running both in SP and DP but saving with 10 digits makes simpleFoam to run in both SP and DP. However SP is about 40% quicker and I don't really want to save in ASCII as it doubles the required diskspace.

Regards Bastian

Last edited by bastil; March 16, 2011 at 04:17.
bastil is offline   Reply With Quote

Old   March 16, 2011, 19:35
Default
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
You can simply save the mesh in compressed format as ASCII, and then switch to binary for the data.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   March 17, 2011, 10:01
Default
  #7
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 18
olivierG is on a distinguished road
hello,

On some testcase i did some time ago, with a lot of time step saving, I've got the best speedup with compressed ascii file, binary file where little slower, and ascii file much slower.
so try compressed file !

olivier
lifeinhand likes this.
olivierG 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
UDF issue MASOUD Fluent UDF and Scheme Programming 14 December 6, 2012 14:39
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 04:01
Problems in compiling paraview in Suse 10.3 platform chiven OpenFOAM Installation 3 December 1, 2009 08:21
Error to re-open fluent case file J.Gimbun FLUENT 0 April 27, 2006 09:42
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 21:51


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