|
[Sponsors] |
April 8, 2013, 15:49 |
Json
|
#1 |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
I am wondering why doesn't OpenFOAM go with JSON format for its files? That would be easier for other programmers to parse.
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China Last edited by lakeat; April 8, 2013 at 16:44. |
|
April 8, 2013, 16:12 |
|
#2 |
Senior Member
Join Date: Dec 2011
Posts: 111
Rep Power: 19 |
There is absolutely no rational reason for a tool like OpenFOAM to use JSON, XML or any other text/ASCII/UTF-8 based storage format. This is simply because 99.99999% (approx.) of the data stored as results from a CFD simulation is floating point numbers. Storing this as text is highly inefficient, independent on the format chosen (current format/JSON/XML etc.).
In my opinion, the only sensible choice is to store the data in a binary format. This should be based on commonly available and freely licensed APIs. My suggestions is HDF5 or CGNS, witch are two quite different formats (HDF5 is a general HPC data container, while CGNS is a CFD-specific file format). |
|
April 8, 2013, 16:29 |
|
#3 |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
Thanks, It is actually just this (1-99.99999%=0.00001%) files like fvSchemes or fvSolution that are what I am interested in and are what I would like to parse with. The information in these files is "kind of" "config" information.
Anyway, my point is, no matter what format OF uses, either HDF5 or CGNS or any other "popular" format, the outsiders can then use a relatively "standalone" program to parse OF files "cleanly" without calling OF libraries.
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China |
|
April 8, 2013, 17:56 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Writing a parser for the OpenFOAM-format is not THAT difficult. I mean: I managed with the parser that is in PyFoam. There are some interesting corner-cases but if you use a parser-generator then writing a parser that correctly reads >90% of all OF-files is pretty straight forward. And in principle the OF-format is just lists and dictionaries so if your programming language supports these then you "only" have to map the parsed data onto those data structures
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
April 8, 2013, 17:58 |
|
#5 | |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
Quote:
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China |
||
|
|