[Opm] Flow UNRST binary file format
joaho at statoil.com
Fri Feb 10 14:54:05 UTC 2017
The reading and writing of binary eclipse files is handled by the ert library: https://github.com/Ensembles/ert which flow links to. The data in a binary Eclipse file are organised in "keywords" (mind you - these keywords are very different from the keywords used in the eclipse input file!). In the ert library a keyword is implemented with the C stucture ecl_kw: https://github.com/Ensembles/ert/blob/master/libecl/src/ecl_kw.c - and the full restart file is organized in the ecl_file structure: https://github.com/Ensembles/ert/blob/master/libecl/src/ecl_file.c
So when extracting the data you are interested in you have (at least) two alternatives:
1. You can use the RestartIO class from the the opm-output and write a small C++ program - that way you will only be working with C++/Opm datastructures.
2. You can write an ert program using the low level ecl_xxx datastructures; if going this way you can use the python bindings.
Personally I would use the ERT Python bindings; then your script could be something like this:
block_list = [(1,2,3) , (3,4,5)] # NB: These block numbers should start counting at zero.
from ert.ecl import EclGrid
from ert.ecl import EclRestartFile
case = sys.argv
grid = EclGrid("%s.EGRID" % case)
rst_file = EclRestartFile("%s.UNRST" % case)
with open("pressure.txt", "w") as f:
time_list = rst_file.timeList( )
for index,time in enumerate( time_list );
view = rst_file.restartView( seqnum_index = index )
kw = view["PRESSURE"]
f.write("%s" % time_list)
for (i,j,k) in block_list:
f.write( "%g " % kw[i,j,k])
Please just e-mail me directly if you have further questions.
From: Opm <opm-bounces at opm-project.org> on behalf of bobmerrill at mersep.com <bobmerrill at mersep.com>
Sent: Thursday, February 9, 2017 4:32:29 PM
To: opm at opm-project.org
Subject: [Opm] Flow UNRST binary file format
Dear OPM Mailing List:
Where can I find the binary format for the UNRST file? Resinsight is a
good visualisation tool, but if I want to use Flow for numerical well
testing, I need to extract the pressures of a block (or blocks) for every
timestep and output the same to a well testing application.
The “Results” pane in Resinsight provides a plot of the selected cell’s
property vs. time, but I need to create a text file of that data with
(time, value) pairs. I need the time values to be output with a precision
of 1E-5 to 1E-4 days (approximately 1-10 seconds) for near wellbore
Once I get the binary format, I’ll write a Perl or Python script to read
it and extract the necessary data. I'd be happy to share it, if it works.
Opm mailing list
Opm at opm-project.org
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Opm