Skip to content

Commit

Permalink
Add some keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
moyner committed Nov 4, 2024
1 parent 6ecd3ac commit d41c324
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/InputParser/keywords/grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ function parse_keyword!(data, outer_data, units, cfg, f, v::Union{Val{:DX}, Val{
data["$k"] = Δ
end

function parse_keyword!(data, outer_data, units, cfg, f, v::Union{Val{:DXV}, Val{:DYV}, Val{:DZV}})
k = unpack_val(v)
Δ = parse_deck_vector(f, Float64)
swap_unit_system_fast!(Δ, units, Val(:length))
data["$k"] = Δ
end

function unit_type(::Union{Val{:DX}, Val{:DY}, Val{:DZ}})
return :length
end
Expand Down
28 changes: 27 additions & 1 deletion src/InputParser/keywords/props.jl
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:SCALECRS})
end
end


function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:DENSITY})
tdims = [NaN, NaN, NaN]
nreg = number_of_tables(outer_data, :pvtnum)
Expand All @@ -401,6 +400,33 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:DENSITY})
data["DENSITY"] = out
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:GRAVITY})
tdims = [45.5, 1.0, 0.7773]
file_units = current_unit_system(outer_data)
if file_units == :field
rho_wat = 62.4
rho_air = 0.076363
elseif file_units == :lab
rho_wat = 1.0
rho_air = 0.0012232
elseif file_units in (:si, :metric)
rho_wat = 1000.0
rho_air = 1.22
else
error("Unknown unit system: $units")
end
nreg = number_of_tables(outer_data, :pvtnum)
out = []
for i = 1:nreg
rec = read_record(f)
t = parse_defaulted_line(rec, tdims)
grav_oil = 141.15/(t[1]+131.5)
vals = [grav_oil*rho_wat, t[2]*rho_wat, t[3]*rho_air]
push!(out, vals)
end
data["DENSITY"] = out
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Union{Val{:RSCONST}, Val{:RSCONSTT}})
rec = read_record(f)
# TODO: This is missing units.
Expand Down
6 changes: 6 additions & 0 deletions src/InputParser/keywords/runspec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:WATER})
data["WATER"] = true
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:TEMP})
# TODO: We treat this as an alias, not sure if this is correct.
data["THERMAL"] = true
data["TEMP"] = true
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:OIL})
data["OIL"] = true
end
Expand Down
8 changes: 8 additions & 0 deletions src/InputParser/keywords/schedule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:TUNING})
skip_records(f, 3)
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:TUNINGDP})
skip_records(f, 1)
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:GCONTOL})
skip_records(f, 1)
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:RPTSCHED})
read_record(f)
end
Expand Down
2 changes: 1 addition & 1 deletion src/InputParser/keywords/solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:PRESSURE})
data["PRESSURE"] = p
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:RTEMP})
function parse_keyword!(data, outer_data, units, cfg, f, ::Union{Val{:RTEMP}, Val{:RTEMPA}})
nreg = number_of_tables(outer_data, :eosnum)
out = Float64[]
for i in 1:nreg
Expand Down

0 comments on commit d41c324

Please sign in to comment.