Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FlowNet work with pyscal 0.6.x, and add possibility of using pyscal's SCALrecommendation #199

Merged
merged 28 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased]

### Added
- [#199](https://github.com/equinor/flownet/pull/199) Added the possibility of defining a 'base' value for all parameters related to relative permeability. This provides the opportunity to interpolate between three relative permeability models. All the 'min' values will be used to construct a pessimistic or low model, the 'base' values are used for a 'base' model, and the 'high' values are used for an optimistic or high model value. The history matching can then be done with only one (two for three phase models - oil/water and gas/oil interpolated independently) relative permeability parameter(s) per SATNUM region.
- [#188](https://github.com/equinor/flownet/pull/188) The possibility to extract regions from an input simulation model extended to also include SATNUM regions. For relative permeability, the scheme keyword can be set to 'regions_from_sim' in the configuration file.
- [#189](https://github.com/equinor/flownet/pull/189) User can now provide both a _base_ configuration file, and an optional extra configuration file which will be used to override the base settings.

## [0.3.0] - 2020-09-14
### Changed
- [#199](https://github.com/equinor/flownet/pull/199) Removed deprecated parameters in pyscal ('krowend', 'krogend') from config file. Added 'kroend' to config file.

## [0.3.0] - 2020-09-14
### Added
- [#160](https://github.com/equinor/flownet/pull/160) Adds the possibility to extract regions from an existing model when the data source is a simulation model. For equil, the scheme key can be set to 'regions_from_sim'
- [#157](https://github.com/equinor/flownet/pull/157) Adds a new 'time-weighted average open perforation location' perforation strategy called `time_avg_open_location`.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"opm>=2020.10",
"pandas~=1.0",
"pyarrow>=0.14",
"pyscal~=0.5.1",
"pyscal~=0.6.1",
"pyvista>=0.23",
"pyyaml>=5.2",
"scikit-learn>=0.22",
Expand Down
68 changes: 59 additions & 9 deletions src/flownet/ahm/_run_ahm.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _from_regions_to_flow_tubes(
network: FlowNet network instance
field_data: FlowData class with information from simulation model data source
ti2ci: A dataframe with index equal to tube model index, and one column which equals cell indices.
name: The name of the region parameter
region_name: The name of the region parameter

Returns:
A list with values for 'name' region for each tube in the FlowNet model
Expand All @@ -61,7 +61,7 @@ def _from_regions_to_flow_tubes(
ijk = field_data.grid.find_cell(xyz_mid[0][j], xyz_mid[1][j], xyz_mid[2][j])
if ijk is not None and field_data.grid.active(ijk=ijk):
tube_regions.append(field_data.init(region_name)[ijk])
if tube_regions != []:
if tube_regions:
df_regions.append(mode(tube_regions).mode.tolist()[0])
else:
df_regions.append(None)
Expand Down Expand Up @@ -399,6 +399,12 @@ def run_flownet_history_matching(

relperm_parameters = {key: relperm_dict[key] for key in relperm_dict}

relperm_interp_values: Optional[pd.DataFrame] = (
pd.DataFrame(columns=list(relperm_parameters.keys()) + ["CASE", "SATNUM"])
if config.model_parameters.relative_permeability.interpolate
else None
)

defined_satnum_regions = []
if config.model_parameters.relative_permeability.scheme == "regions_from_sim":
relp_config_satnum = config.model_parameters.relative_permeability.regions
Expand All @@ -413,13 +419,56 @@ def run_flownet_history_matching(
idx = defined_satnum_regions.index(i)
else:
idx = defined_satnum_regions.index(None)
info = [
relperm_parameters.keys(),
[getattr(relp_config_satnum[idx], key).min for key in relperm_parameters],
[getattr(relp_config_satnum[idx], key).max for key in relperm_parameters],
[False] * len(relperm_parameters),
[i] * len(relperm_parameters),
]
if config.model_parameters.relative_permeability.interpolate:
interp_info = [
[
getattr(relp_config_satnum[idx], key).min
for key in relperm_parameters
]
+ ["low"]
+ [i],
[
getattr(relp_config_satnum[idx], key).base
for key in relperm_parameters
]
+ ["base"]
+ [i],
[
getattr(relp_config_satnum[idx], key).max
for key in relperm_parameters
]
+ ["high"]
+ [i],
]
info: List = [["interpolate"], [-1], [1], [False], [i]]
if {"oil", "gas", "water"}.issubset(config.flownet.phases):
add_info = ["interpolate gas", -1, 1, False, i]
for j, val in enumerate(add_info):
info[j].append(val)

else:
info = [
relperm_parameters.keys(),
[
getattr(relp_config_satnum[idx], key).min
for key in relperm_parameters
],
[
getattr(relp_config_satnum[idx], key).max
for key in relperm_parameters
],
[False] * len(relperm_parameters),
[i] * len(relperm_parameters),
]

if isinstance(relperm_interp_values, pd.DataFrame):
relperm_interp_values = relperm_interp_values.append(
pd.DataFrame(
list(map(list, interp_info)),
columns=list(relperm_parameters.keys()) + ["CASE", "SATNUM"],
),
ignore_index=True,
)

relperm_dist_values = relperm_dist_values.append(
pd.DataFrame(
Expand Down Expand Up @@ -585,6 +634,7 @@ def run_flownet_history_matching(
ti2ci,
df_satnum,
config.flownet.phases,
interpolation_values=relperm_interp_values,
fast_pyscal=fast_pyscal,
),
Equilibration(
Expand Down
Loading