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

I156 new perf strat #157

Merged
merged 14 commits into from
Sep 1, 2020
4 changes: 2 additions & 2 deletions .github/workflows/flownet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ jobs:
INPUT_MODEL_FOLDER: ./flownet-testdata/${{ matrix.flownet-model }}/input_model
# If you want the CI to (temporarily) run against your fork of the testdada,
# change the value her from "equinor" to your username.
TESTDATA_REPO_OWNER: equinor
TESTDATA_REPO_OWNER: wouterjdb
# If you want the CI to (temporarily) run against another branch than master,
# change the value her from "master" to the relevant branch name.
TESTDATA_REPO_BRANCH: master
TESTDATA_REPO_BRANCH: i157-new-strat
run: |
git clone --depth 1 --branch $TESTDATA_REPO_BRANCH https://github.com/$TESTDATA_REPO_OWNER/flownet-testdata.git
if [ -f "$INPUT_MODEL_FOLDER/${{ matrix.flownet-model }}.tar.gz" ]; then
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]
### Added
- [#157](https://github.com/equinor/flownet/pull/157) Adds a new 'time-weighted average open perforation location' perforation strategy called `time_avg_open_location`.
- [#115](https://github.com/equinor/flownet/pull/150) Adds this changelog.
- [#146](https://github.com/equinor/flownet/pull/146) Added about page to documentation with logo of industry and research institute partners.
- [#138](https://github.com/equinor/flownet/pull/138) Print message to terminal when the schedule is being generated instead of utter silence.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@
"Operating System :: OS Independent",
"Natural Language :: English",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3) ",
],
)
42 changes: 42 additions & 0 deletions src/flownet/data/from_flow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import warnings
from pathlib import Path
from typing import Union, List
import datetime

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -42,6 +43,7 @@ def __init__(

self._perforation_handling_strategy: str = perforation_handling_strategy

# pylint: disable=too-many-branches
def _coordinates(self) -> pd.DataFrame:
"""
Function to extract well coordinates from an Flow simulation.
Expand Down Expand Up @@ -69,6 +71,46 @@ def multi_xyz_append(append_obj_list):
elif self._perforation_handling_strategy == "multiple":
xyz = [global_conns]
coord_append = multi_xyz_append
elif self._perforation_handling_strategy == "time_avg_open_location":
connection_open_time = {}

for i, conn_status in enumerate(self._wells[well_name]):
time = datetime.datetime.strptime(
str(conn_status.simulationTime()), "%Y-%m-%d %H:%M:%S"
)
if i == 0:
prev_time = time

for connection in conn_status.globalConnections():
if connection.ijk() not in connection_open_time:
connection_open_time[connection.ijk()] = 0.0
elif connection.isOpen():
connection_open_time[connection.ijk()] += (
time - prev_time
).total_seconds()
else:
connection_open_time[connection.ijk()] += 0.0

prev_time = time

xyz_values = np.zeros((1, 3), dtype=np.float64)
total_open_time = sum(connection_open_time.values())

if total_open_time > 0:
for connection, open_time in connection_open_time.items():
xyz_values += np.multiply(
np.array(self._grid.get_xyz(ijk=connection)),
open_time / total_open_time,
)
else:
for connection, open_time in connection_open_time.items():
xyz_values += np.divide(
np.array(self._grid.get_xyz(ijk=connection)),
len(connection_open_time.items()),
)

xyz = tuple(*xyz_values)

else:
raise Exception(
f"perforation strategy {self._perforation_handling_strategy} unknown"
Expand Down
3 changes: 1 addition & 2 deletions tests/test_one_dimensional.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@


def test_one_dimensional(tmp_path: pathlib.Path) -> None:
"""Single one dimensional flow Model example
"""
"""Single one dimensional flow Model example"""

n_grid_cells = 10
model_cross_section_area = 40 # m^2
Expand Down