Parsing of simulation cases
The most significant feature of this module is a parser for .DATA reservoir simulation cases. The format originated with the Eclipse reservoir simulator produced by SLB and is now used by many reservoir simulators. The most useful publicly available description of one such dialect is found in the OPM Flow manual.
GeoEnergyIO.InputParser.parse_data_file
— Functionparse_data_file(filename; units = :si)
parse_data_file(filename; units = :field)
data = parse_data_file("MY_MODEL.DATA")
Parse a .DATA file given by the path in filename
(industry standard input file) into a Dict with String keys. Units will be converted to strict SI unless you pass an alternative unit system like units = :field
. Setting units = nothing
will skip unit conversion. Note that the simulators in JutulDarcy.jl assumes that the unit system is internally consistent. It is highly recommended to parse to the SI units if you want to perform simulations with JutulDarcy.jl.
The best publicly available documentation on this format is available from the Open Porous Media (OPM) project's webpages: OPM Flow manual .
Keyword arguments
warn_parsing=true
: Produce a warning when keywords are not supported (or partially supported) by the parser.warn_feature=true
: Produce a warning when keywords are supported, but have limited or missing support in the numerical solvers inJutulDarcy.jl
.units=:si
: Symbol that indicates the unit system to be used in the output. Setting this tonothing
will return values without conversion, i.e. exactly what is in the input files.:si
will use strict SI. Other alternatives are:field
and:metric
.:lab
is currently unsupported.verbose=false
: Produce verbose output about parsing progress. For larger files, a lot of output will be generated. Useful when figuring out where a parser fails or spends a lot of time.
Note
This function only covers a small portion of the keywords that exist for various simulators. You will get warnings that indicate the level of support for keywords in both the parser and the numerical solvers when known keywords with limited support. Pull requests for new keywords are welcome!
The SUMMARY section is skipped due to the large volume of available keywords that are not essential to define simulation cases.
Let us for example parse the SPE1 dataset, turning into a nested Dict
containing all the entries of the data file. We use the unexported test_input_file_path
utility to get the path of a test file.
using GeoEnergyIO
spe1_pth = GeoEnergyIO.test_input_file_path("SPE1", "SPE1.DATA")
spe1 = parse_data_file(spe1_pth)
Dict{String, Any} with 6 entries:
"RUNSPEC" => OrderedDict{String, Any}("TITLE"=>"SPE1 - CASE 2", "DIMENS"=>[1…
"GRID" => OrderedDict{String, Any}("cartDims"=>(10, 10, 3), "CURRENT_BOX"…
"PROPS" => OrderedDict{String, Any}("PVTW"=>Any[[2.77e7, 1.038, 4.67022e-1…
"SUMMARY" => OrderedDict{String, Any}()
"SCHEDULE" => Dict{String, Any}("STEPS"=>OrderedDict{String, Any}[OrderedDict…
"SOLUTION" => OrderedDict{String, Any}("EQUIL"=>Any[[2560.32, 3.30948e7, 2575…
Handling unsupported keywords
Not all keywords are supported by the parser, but not all keywords are important. The input format is such that it is difficult to automatically skip keywords, but you an manually add keywords to the skip list:
GeoEnergyIO.InputParser.skip_kw!
— Functionskip_kw!(kw, num, msg = nothing)
Add a keyword to list of records that will be skipped on parsing.
kw
is the symbol (usually capitalized) of the keyword to skip, num is the number of expected records:
- 0 means that the keyword to skip has no data (for example "WATER" with no data to follow)
- 1 means that the keyword has a single record terminated by
/
- Any other number means a fixed number of lines, without termination by empty record.
- Inf means that the keyword has any number of records, terminated by a record without entries.
Adding keywords to the skip list is not persistent across Julia sessions and can be added to the top of your script. Contributions to the global skip list defined in the __init__
function of the parser are welcome.
using GeoEnergyIO
# Skip keyword without data
GeoEnergyIO.InputParser.skip_kw!(:MY_KW, 0)
# Keyword with a single record of data, e.g.
# MY_DATA_KW
# "some data" 1 2 3 /
GeoEnergyIO.InputParser.skip_kw!(:MY_DATA_KW, 1)
# Keyword with many records, terminated by empty record:
# MY_LONG_DATA_KW
# "some data" 1 2 3 /
# "more data" 4 5 6 /
# "even more data" 1 9 /
# /
GeoEnergyIO.InputParser.skip_kw!(:MY_LONG_DATA_KW, Inf)
69-element Vector{Tuple{Symbol, Union{Float64, Int64}, Union{Nothing, GeoEnergyIO.InputParser.PARSER_WARNING}}}:
(:PETOPTS, 1, nothing)
(:PARALLEL, 1, nothing)
(:MULTSAVE, 1, nothing)
(:VECTABLE, 1, nothing)
(:MULTSAVE, 1, nothing)
(:WHISTCTL, 1, GeoEnergyIO.InputParser.PARSER_JUTULDARCY_MISSING_SUPPORT)
(:MEMORY, 1, nothing)
(:OPTIONS3, 1, nothing)
(:TSCRIT, 1, GeoEnergyIO.InputParser.PARSER_JUTULDARCY_MISSING_SUPPORT)
(:CVCRIT, 1, GeoEnergyIO.InputParser.PARSER_JUTULDARCY_MISSING_SUPPORT)
⋮
(:VFPPROD, Inf, GeoEnergyIO.InputParser.PARSER_MISSING_SUPPORT)
(:VFPINJ, Inf, GeoEnergyIO.InputParser.PARSER_MISSING_SUPPORT)
(:WTRACER, Inf, GeoEnergyIO.InputParser.PARSER_MISSING_SUPPORT)
(:GCONINJE, Inf, GeoEnergyIO.InputParser.PARSER_MISSING_SUPPORT)
(:WTEST, Inf, GeoEnergyIO.InputParser.PARSER_MISSING_SUPPORT)
(:WLIST, Inf, GeoEnergyIO.InputParser.PARSER_MISSING_SUPPORT)
(:MY_KW, 0, nothing)
(:MY_DATA_KW, 1, nothing)
(:MY_LONG_DATA_KW, Inf, nothing)