Eclipse油藏数值模拟软件的二进制文件格式解析

 

经过连续多天的奋战(后来又经过了1年的完善),终于搞明白eclipse数模软件输出的egrid、init、unrst等二进制输出文件的格式了。在egrid文件中看到了下面这些关键词和相关的参数,真是高兴啊:

After continuous effort for some days, I understood the binary format of Eclipse(Reservoir Simulation software), such as EGRID, INIT, UNRST... It's exciting for displaying the following keywords and parameters:

FILEHEAD
3 2005
MAPUNITS
METRES
MAPAXES
775209.9 632416.1 774800.4 632811.8 775196.1 633221.4
GRIDUNIT
METRES
GRIDHEAD
1 100 50 19
COORD
-108.4868 356.3878 1930.576 -108.4868 ...
ZCORN
1935.727 1934.945 1934.945 1933.606 1933.606 ...
ACTNUM
0 0 0 0 0 0 0 0 ...
ENDGRID

根据对格式的了解,用C#编写了EclipseParser库,可以验证、读取所有Eclipse二进制文件中的内容。

I have written an EclipseParser library according to the binary format. The DLL can verify and read all contents of Eclipse binary files such as EGRID, INIT, UNRST, etc.

  

EclipseBinaryFileStruct.cs中的代码片段:

Code segment of EclipseBinaryFileStruct.cs:

    /// <summary>
    /// Eclipse二进制文件中支持的五种数据类型,用枚举表示
/// five data types can be identified by eclipse binary format /// </summary> public enum EclipseDataType { INTE, // 4字节,整数, 4 bytes, integer REAL, // 4字节,单精度浮点数, 4 bytes, single float LOGI, // 4字节,布尔值, 4 bytes, boolean DOUB, // 8字节,双精度浮点数, 8 bytes, double float CHAR // 字符型, character } /// <summary> /// eclipse的关键字块,eclipse使用几百个关键字来进行输入和输出的控制 /// 关键字相当于命令,关键字后面会出现0个或多个EclipseDataBlock块,相当于命令所带的参数
/// Eclipse has a lot of keywords for controling input and output of reservoir model
/// a keyword, likes command, succed 0 or more EclipseDataBlock which is the parameters of the command /// </summary> public struct EclipseKeywordBlock { public int lenBlockHead; // 首先是4字节的整数,用来记录块的长度,一定是16 // 也就是说后面的keyword, lenData和type三项一共占16个字节 public string keyword; // 8个字节,用来记录eclipse的关键字,不足8个字符的关键字要补空格 public int lenData; // 4字节,表示关键字后面出现的数据块(分为整型、浮点、布尔、字符等)的个数 public EclipseDataType type; // 4字节,表示关键字块后面出现的数据块中各个数据的类型 public int lenBlockTail; // 在块的结尾处还是4字节的整数,与前面的lenBlockHead是相等的,也一定是16 }

 

基于EclipseParser库,写了个ecldump程序,可以dump出二进制文件内容的细节信息,dump出来的结果如下: 

I have written a "ecldump" program. It can dump details of the binary files.

keyword block: [16] FILEHEAD 100 INTE [16]
data block
(1): [400] 320010000000000000000 ... [400]

keyword block: [
16] MAPAXES 6 REAL [16]
data block
(1): [24] 587000594640058700059465005871005946500 [24]

keyword block: [
16] GRIDUNIT 2 CHAR [16]
data block
(1): [16] "METRES " [16]

keyword block: [
16] GRIDHEAD 100 INTE [16]
data block
(1): [400] 15050600000000000000 ... [400]

keyword block: [
16] COORD 15606 REAL [16]
data block
(1): [4000] 01000002444.32601000002588.396... [4000]

另外,写了ecl2txt程序(Eclipse二进制文件转换程序),可以把静态属性和动态属性按层、时间步导出为文本文件,当前版本为1.2。

Moreover, I have written ecl2txt program(C# source code).

ecl2txt 1.2版本主要功能有:

ecl2txt version 1.2 features:

(1)可读取E100、E300生成的EGRID、INIT、UNRST文件,把静态属性和动态属性以文本格式输出。

Can read E100/E300 EGRID,INIT,UNRST files, output static and dynamic properties to text format.

(2)UNRST文件不存在时,也支持读取X0000、X0001...这些按时间步输出的属性文件

If UNRST doesn't exist, it can read X0000, X0001, X0002... timestep files.

(3)三种文本格式输出,XYZ,XYZV,XYZVIJK

Three output format: XYZ, XYZV, XYZVIJK

(4)可按指定值输出无效网格

output invalid grids to specified value.

(5)中英文属性名称显示

translate keyword to chinese characters(of course, can english words)

(6)随时可取消转换过程

Canel the convert process at any time.

(7)一键删除大量的临时性输出文件

ONE key deletes the temporary output text files.

试用程序Try it version 1.0 请点这里下载 版本2.1可以打开GRID文件, 下载2.1试用版

(注意:Demo版只能读第0层数据)

2013.11.05 version 2.1 can parse *.GRID files. download 2.1 trial files.

(Attention: only 0 layer can be read in DEMO version)

Contact me. (slofslb ~ qq.com)

 

读出模型后,可以用OpenInventor可视化出来,效果如下:

eclipse三维模型用openinventor实现的可视化效果图

 

---------------------------------------------------------------------------------------------------------------------
作者:毒龙的程序人生{speeding}http://www.cnblogs.com/speeding/
版权声明:本文的版权归作者和博客园共有,转载时须注明本文的详细链接,否则作者将保留追究其法律责任。

posted @ 2010-08-04 12:45  申龙斌的程序人生  阅读(7826)  评论(17编辑  收藏  举报