Skip to content

Commit

Permalink
Some unit handling
Browse files Browse the repository at this point in the history
  • Loading branch information
moyner committed Apr 29, 2024
1 parent 81963f0 commit a033fae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/InputParser/keywords/grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,17 @@ function parse_keyword!(data, outer_data, units, cfg, f, v::Val{:MULTREGT})
data["MULTREGT"] = mreg
end

function parse_keyword!(data, outer_data, units, cfg, f, v::Union{
Val{:MULTX}, Val{:MULTY}, Val{:MULTZ},
Val{Symbol("MULTX-")}, Val{Symbol("MULTY-")}, Val{Symbol("MULTZ-")}
}
)
const MULTXYZ_TYPE = Union{Val{:MULTX}, Val{:MULTY}, Val{:MULTZ},Val{Symbol("MULTX-")}, Val{Symbol("MULTY-")}, Val{Symbol("MULTZ-")}}

function parse_keyword!(data, outer_data, units, cfg, f, v::MULTXYZ_TYPE)
k = unpack_val(v)
parse_and_set_grid_data!(data, outer_data, units, cfg, f, k, unit = :id, default = 1.0)
end

function unit_type(::MULTXYZ_TYPE)
return :id
end

const THERMAL_CONDUCTIVITY_TYPE = Union{Val{:THCROCK}, Val{:THCWATER}, Val{:THCGAS}, Val{:THCSOLID}, Val{:THCAVE}}

function parse_keyword!(data, outer_data, units, cfg, f, v::THERMAL_CONDUCTIVITY_TYPE)
Expand Down Expand Up @@ -198,6 +200,10 @@ function parse_keyword!(data, outer_data, units, cfg, f, v::REGION_TYPE)
parse_and_set_grid_data!(data, outer_data, units, cfg, f, k, T = Int)
end

function unit_type(::REGION_TYPE)
return :id
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:PORO})
parse_and_set_grid_data!(data, outer_data, units, cfg, f, :PORO)
end
Expand Down
10 changes: 10 additions & 0 deletions src/InputParser/keywords/props.jl
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,13 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:AQUCT})
parser_message(cfg, outer_data, "AQUCT", PARSER_MISSING_SUPPORT)
end


function parse_keyword!(data, outer_data, units, cfg, f, v::Val{:SWATINIT})
k = unpack_val(v)
parser_message(cfg, outer_data, "SWATINIT", PARSER_JUTULDARCY_MISSING_SUPPORT)
parse_and_set_grid_data!(data, outer_data, units, cfg, f, k, unit = unit_type(k))
end

function unit_type(::Val{:SWATINIT})
return :id
end

0 comments on commit a033fae

Please sign in to comment.