Skip to content

Commit 4679986

Browse files
committed
Update rips module, proto files, and Python examples
1 parent e03439f commit 4679986

File tree

11 files changed

+627
-87
lines changed

11 files changed

+627
-87
lines changed

docs/rips/PythonExamples/case_and_grid_operations/polygon_region_from_project.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ def point_in_polygon_2d(px, py, polygon_xy):
2727
for i in range(n):
2828
xi, yi = polygon_xy[i][0], polygon_xy[i][1]
2929
xj, yj = polygon_xy[j][0], polygon_xy[j][1]
30-
if ((yi > py) != (yj > py)) and (
31-
px < (xj - xi) * (py - yi) / (yj - yi) + xi
32-
):
30+
if ((yi > py) != (yj > py)) and (px < (xj - xi) * (py - yi) / (yj - yi) + xi):
3331
inside = not inside
3432
j = i
3533
return inside
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"""
2+
Example demonstrating how to create a stand-alone ICV valve,
3+
shut it and move it deeper
4+
"""
5+
6+
import rips
7+
8+
rips_instance = rips.Instance.find()
9+
well_path_coll = rips_instance.project.well_path_collection()
10+
11+
# Create main well path using ModeledWellPath with targets
12+
main_well_path = well_path_coll.add_new_object(rips.ModeledWellPath)
13+
main_well_path.name = "main_well_check_connection"
14+
main_well_path.update()
15+
16+
# Add geometry targets to main well path
17+
main_geometry = main_well_path.well_path_geometry()
18+
main_geometry.append_well_target([1000.0, 2000.0, 0.0]) # Surface
19+
main_geometry.append_well_target([1000.0, 2000.0, -100.0]) # 100m down
20+
main_geometry.append_well_target([1000.0, 2000.0, -300.0]) # 300m down
21+
main_geometry.append_well_target([1000.0, 2000.0, -500.0]) # 500m down
22+
main_geometry.use_auto_generated_target_at_sea_level = False
23+
main_geometry.update()
24+
25+
# Add a stand-alone valve at md 240
26+
valve = main_well_path.add_icv_valve(240.0)
27+
28+
# default for valve should be open
29+
if valve.is_open:
30+
print("Valve %s is open!" % valve.name)
31+
else:
32+
print("Valve shut!")
33+
34+
# close valve and move it to md = 275
35+
valve.is_open = False
36+
valve.start_measured_depth = 275
37+
valve.update()
38+
39+
# valve should now be shut
40+
if valve.is_open:
41+
print("Valve %s is open!" % valve.name)
42+
else:
43+
print("Valve shut!")
44+
45+
# valve should be at md = 275
46+
print("Valve measured depth: " + str(valve.start_measured_depth))
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"""
2+
Example demonstrating how to create well paths from XYZ coordinates
3+
and add a tie-in valve, adjusting the valve MD to a custom value.
4+
"""
5+
6+
import rips
7+
8+
rips_instance = rips.Instance.find()
9+
10+
11+
well_path_coll = rips_instance.project.well_path_collection()
12+
13+
# Create main well path using ModeledWellPath with targets
14+
main_well_path = well_path_coll.add_new_object(rips.ModeledWellPath)
15+
main_well_path.name = "main_well_check_connection"
16+
main_well_path.update()
17+
18+
# Add geometry targets to main well path
19+
main_geometry = main_well_path.well_path_geometry()
20+
main_geometry.append_well_target([1000.0, 2000.0, 0.0]) # Surface
21+
main_geometry.append_well_target([1000.0, 2000.0, -100.0]) # 100m down
22+
main_geometry.append_well_target([1000.0, 2000.0, -300.0]) # 300m down
23+
main_geometry.append_well_target([1000.0, 2000.0, -500.0]) # 500m down
24+
main_geometry.use_auto_generated_target_at_sea_level = False
25+
main_geometry.update()
26+
27+
measured_depth = 150
28+
lateral = main_well_path.append_lateral(measured_depth)
29+
30+
# Get the valve template collection
31+
valve_templates = rips_instance.project.valve_templates()
32+
33+
# create an ICV valve template
34+
icv_template = valve_templates.add_template(
35+
completion_type="ICV",
36+
orifice_diameter=12.5,
37+
flow_coefficient=0.85,
38+
user_label="Custom ICV for Lateral",
39+
)
40+
41+
# Enable well valve
42+
valve = lateral.enable_outlet_valve(
43+
enable=True, icv_template=icv_template, use_custom_valve_md=False
44+
)
45+
46+
# Enable a custom md for the outlet valve
47+
tiein = lateral.tie_in()
48+
49+
custom_enabled, custom_md = tiein.custom_outlet_valve_md
50+
print("Custom outlet valve md: " + str(custom_enabled))
51+
52+
tiein.custom_outlet_valve_md = (True, 200.0)
53+
tiein.update()
54+
55+
custom_enabled, custom_md = tiein.custom_outlet_valve_md
56+
print("Custom outlet valve md: " + str(custom_enabled) + " at " + str(custom_md))

docs/rips/__init__.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
import logging
22
import os
33
import sys
4+
from typing import List
45

56
# Configure null handler to prevent "No handler found" warnings
67
logging.getLogger("rips").addHandler(logging.NullHandler())
78

89
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "generated"))
910

10-
from .resinsight_classes import * # noqa: F403
11+
from .resinsight_classes import * # noqa: F403, E402
1112

12-
from .case import Case as Case, EclipseCase as EclipseCase, GeoMechCase as GeoMechCase
13-
from .grid import Grid as Grid
14-
from .instance import Instance as Instance
15-
from .view import View as View
16-
from .project import Project as Project
17-
from .plot import Plot as Plot, PlotWindow as PlotWindow
18-
from .contour_map import (
13+
from .case import Case as Case, EclipseCase as EclipseCase, GeoMechCase as GeoMechCase # noqa: E402
14+
from .grid import Grid as Grid # noqa: E402
15+
from .instance import Instance as Instance # noqa: E402
16+
from .view import View as View # noqa: E402
17+
from .project import Project as Project # noqa: E402
18+
from .plot import Plot as Plot, PlotWindow as PlotWindow # noqa: E402
19+
from .contour_map import ( # noqa: E402
1920
EclipseContourMap as EclipseContourMap,
2021
GeoMechContourMap as GeoMechContourMap,
2122
)
22-
from .well_log_plot import WellLogPlot as WellLogPlot
23-
from .well_path import WellPath as WellPath
24-
from . import well_path_collection as well_path_collection # noqa: F401
25-
from .simulation_well import SimulationWell as SimulationWell
26-
from .exception import RipsError as RipsError
27-
from .surface import RegularSurface as RegularSurface
28-
from . import well_events as well_events # noqa: F401
29-
30-
from typing import List
23+
from .well_log_plot import WellLogPlot as WellLogPlot # noqa: E402
24+
from .well_path import WellPath as WellPath # noqa: E402
25+
from . import well_path_collection as well_path_collection # noqa: F401, E402
26+
from .simulation_well import SimulationWell as SimulationWell # noqa: E402
27+
from .exception import RipsError as RipsError # noqa: E402
28+
from .surface import RegularSurface as RegularSurface # noqa: E402
29+
from . import well_events as well_events # noqa: F401, E402
3130

3231
__all__: List[str] = []
3332
for key in class_dict(): # noqa: F405

0 commit comments

Comments
 (0)