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:
#!/usr/bin/env python
block_list = [(1,2,3) , (3,4,5)] # NB: These block numbers should start
counting at zero.
import sys
from ert.ecl import EclGrid
from ert.ecl import EclRestartFile
case = sys.argv[1]
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"][0]
f.write("%s" % time_list[2])
for (i,j,k) in block_list:
f.write( "%g " % kw[i,j,k])
f.write("\n")
Please just e-mail me directly if you have further questions.
Joakim
________________________________
From: Opm <[email protected]> on behalf of [email protected]
<[email protected]>
Sent: Thursday, February 9, 2017 4:32:29 PM
To: [email protected]
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
effects.
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.
Many thanks.
Regards,
Bob Merrill
_______________________________________________
Opm mailing list
[email protected]
http://opm-project.org/cgi-bin/mailman/listinfo/opm
-------------------------------------------------------------------
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
this message.
Thank you
_______________________________________________
Opm mailing list
[email protected]
http://opm-project.org/cgi-bin/mailman/listinfo/opm