Skip to content

Commit ba32dcf

Browse files
committed
Update rips module and Python examples
1 parent 984cfa6 commit ba32dcf

File tree

6 files changed

+334
-27
lines changed

6 files changed

+334
-27
lines changed

docs/rips/PythonExamples/wells_and_fractures/modeled_well_path.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,20 @@
3131
coord = [1054.28, 250, -50]
3232
target = geometry.append_well_target(coord)
3333

34-
well_path.append_perforation_interval(3300, 3350, 0.2, 0.76)
34+
perforation = well_path.append_perforation_interval(3300, 3350, 0.2, 0.76)
35+
36+
# Make some changes to the AICD parameters of the valve template
37+
valve_templates = resinsight.project.valve_templates()
38+
aicd_template = valve_templates.valve_definitions()[0]
39+
aicd_parameters = aicd_template.aicd_parameters()
40+
aicd_parameters.max_flow_rate = 899.43
41+
aicd_parameters.density_calibration_fluid = 45.5
42+
aicd_parameters.update()
43+
44+
# Add a valve to the perforation interval
45+
valve = perforation.add_valve(
46+
template=aicd_template, start_md=3310, end_md=3340, valve_count=2
47+
)
3548

3649

3750
# Update skin factor of the perforation

docs/rips/case.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def create_multiple_fractures(
506506
if isinstance(well_path_names, str):
507507
well_path_names = [well_path_names]
508508
return self._execute_command(
509-
createMultipleFractures=Cmd.MultipleFracRequest(
509+
createMultipleFractures=Cmd.CreateMultipleFracRequest(
510510
caseId=self.id,
511511
templateId=template_id,
512512
wellPathNames=well_path_names,

docs/rips/generated/Commands_pb2.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/rips/generated/generated_classes.py

Lines changed: 186 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel:
2525
if ColorLegend.__custom_init__ is not None:
2626
ColorLegend.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2727

28+
class CompletionTemplateCollection(PdmObjectBase):
29+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
30+
31+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
32+
PdmObjectBase.__init__(self, pb2_object, channel)
33+
if CompletionTemplateCollection.__custom_init__ is not None:
34+
CompletionTemplateCollection.__custom_init__(self, pb2_object=pb2_object, channel=channel)
35+
36+
def valve_templates(self) -> Optional[ValveTemplateCollection]:
37+
"""
38+
39+
Returns:
40+
ValveTemplateCollection
41+
"""
42+
children = self.children("ValveTemplates", ValveTemplateCollection)
43+
return children[0] if len(children) > 0 else None
44+
45+
2846
class Case(PdmObjectBase):
2947
"""
3048
The ResInsight base class for Cases
@@ -1166,6 +1184,30 @@ def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel:
11661184
if Perforation.__custom_init__ is not None:
11671185
Perforation.__custom_init__(self, pb2_object=pb2_object, channel=channel)
11681186

1187+
def add_valve(self, start_md: float=0.000000000000000e+00, end_md: float=0.000000000000000e+00, valve_count: int=1, template: Optional[ValveTemplate]=None) -> WellPathValve:
1188+
"""
1189+
Add StimPlan Fracture
1190+
1191+
Arguments:
1192+
start_md (float):
1193+
end_md (float):
1194+
valve_count (int):
1195+
template (Optional[ValveTemplate]): Valve Template
1196+
Returns:
1197+
WellPathValve
1198+
"""
1199+
return self._call_pdm_method_return_value("AddValve", WellPathValve, start_md=start_md, end_md=end_md, valve_count=valve_count, template=template)
1200+
1201+
1202+
def valves(self) -> List[WellPathValve]:
1203+
"""Valves
1204+
1205+
Returns:
1206+
List[WellPathValve]
1207+
"""
1208+
return self.children("Valves", WellPathValve)
1209+
1210+
11691211
class PerforationCollection(CheckableNamedObject):
11701212
__custom_init__ = None #: Assign a custom init routine to be run at __init__
11711213

@@ -1438,6 +1480,18 @@ def surface_folder(self, folder_name: str="") -> SurfaceCollection:
14381480
return self._call_pdm_method_return_value("surfaceFolder", SurfaceCollection, folder_name=folder_name)
14391481

14401482

1483+
def valve_templates(self, ) -> ValveTemplateCollection:
1484+
"""
1485+
Get Valve Template Collection
1486+
1487+
Arguments:
1488+
1489+
Returns:
1490+
ValveTemplateCollection
1491+
"""
1492+
return self._call_pdm_method_return_value("valveTemplates", ValveTemplateCollection)
1493+
1494+
14411495
def well_path_collection(self, ) -> WellPathCollection:
14421496
"""
14431497
Get Well Path Collection
@@ -2386,6 +2440,53 @@ def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel:
23862440
if TriangleGeometry.__custom_init__ is not None:
23872441
TriangleGeometry.__custom_init__(self, pb2_object=pb2_object, channel=channel)
23882442

2443+
class ValveTemplate(NamedObject):
2444+
"""
2445+
Attributes:
2446+
flow_coefficient (float): Flow Coefficient
2447+
orifice_diameter (float): Orifice Diameter [mm]
2448+
"""
2449+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2450+
2451+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2452+
self.flow_coefficient: float = 7.000000000000000e-01
2453+
self.orifice_diameter: float = 8.000000000000000e+00
2454+
NamedObject.__init__(self, pb2_object, channel)
2455+
if ValveTemplate.__custom_init__ is not None:
2456+
ValveTemplate.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2457+
2458+
def aicd_parameters(self) -> Optional[WellPathAicdParameters]:
2459+
"""AICD Parameters
2460+
2461+
Returns:
2462+
WellPathAicdParameters
2463+
"""
2464+
children = self.children("AicdParameters", WellPathAicdParameters)
2465+
return children[0] if len(children) > 0 else None
2466+
2467+
2468+
class ValveTemplateCollection(PdmObjectBase):
2469+
"""
2470+
Attributes:
2471+
valve_units (str): One of [UNITS_METRIC, UNITS_FIELD, UNITS_UNKNOWN]
2472+
"""
2473+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2474+
2475+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2476+
self.valve_units: str = "UNITS_METRIC"
2477+
PdmObjectBase.__init__(self, pb2_object, channel)
2478+
if ValveTemplateCollection.__custom_init__ is not None:
2479+
ValveTemplateCollection.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2480+
2481+
def valve_definitions(self) -> List[ValveTemplate]:
2482+
"""
2483+
2484+
Returns:
2485+
List[ValveTemplate]
2486+
"""
2487+
return self.children("ValveDefinitions", ValveTemplate)
2488+
2489+
23892490
class WbsParameters(PdmObjectBase):
23902491
"""
23912492
Attributes:
@@ -2446,6 +2547,30 @@ def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel:
24462547
if SimulationWell.__custom_init__ is not None:
24472548
SimulationWell.__custom_init__(self, pb2_object=pb2_object, channel=channel)
24482549

2550+
class PlotCurve(PdmObjectBase):
2551+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2552+
2553+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2554+
PdmObjectBase.__init__(self, pb2_object, channel)
2555+
if PlotCurve.__custom_init__ is not None:
2556+
PlotCurve.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2557+
2558+
class WellLogPlotCurve(PlotCurve):
2559+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2560+
2561+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2562+
PlotCurve.__init__(self, pb2_object, channel)
2563+
if WellLogPlotCurve.__custom_init__ is not None:
2564+
WellLogPlotCurve.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2565+
2566+
class WellLogExtractionCurve(WellLogPlotCurve):
2567+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2568+
2569+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2570+
WellLogPlotCurve.__init__(self, pb2_object, channel)
2571+
if WellLogExtractionCurve.__custom_init__ is not None:
2572+
WellLogExtractionCurve.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2573+
24492574
class WellLogPlot(DepthTrackPlot):
24502575
"""
24512576
A Well Log Plot With a shared Depth Axis and Multiple Tracks
@@ -2494,30 +2619,6 @@ def parameters(self) -> Optional[WbsParameters]:
24942619
return children[0] if len(children) > 0 else None
24952620

24962621

2497-
class PlotCurve(PdmObjectBase):
2498-
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2499-
2500-
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2501-
PdmObjectBase.__init__(self, pb2_object, channel)
2502-
if PlotCurve.__custom_init__ is not None:
2503-
PlotCurve.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2504-
2505-
class WellLogPlotCurve(PlotCurve):
2506-
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2507-
2508-
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2509-
PlotCurve.__init__(self, pb2_object, channel)
2510-
if WellLogPlotCurve.__custom_init__ is not None:
2511-
WellLogPlotCurve.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2512-
2513-
class WellLogExtractionCurve(WellLogPlotCurve):
2514-
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2515-
2516-
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2517-
WellLogPlotCurve.__init__(self, pb2_object, channel)
2518-
if WellLogExtractionCurve.__custom_init__ is not None:
2519-
WellLogExtractionCurve.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2520-
25212622
class WellLogPlotCollection(PdmObjectBase):
25222623
__custom_init__ = None #: Assign a custom init routine to be run at __init__
25232624

@@ -2587,6 +2688,49 @@ def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel:
25872688
if FileWellPath.__custom_init__ is not None:
25882689
FileWellPath.__custom_init__(self, pb2_object=pb2_object, channel=channel)
25892690

2691+
class WellPathAicdParameters(PdmObjectBase):
2692+
"""
2693+
Attributes:
2694+
critical_water_liquid_fraction_emul (Optional[float]): Critical Water in Liquid Fraction for emulsions
2695+
density_calibration_fluid (Optional[float]): Calibration Fluid Density (kg/m^3)
2696+
device_open (bool): Device Open?
2697+
exponent_gas_density (Optional[float]): Density Exponent of Gas Fraction
2698+
exponent_gas_viscosity (Optional[float]): Viscosity Exponent of Gas Fraction
2699+
exponent_oil_density (Optional[float]): Density Exponent of Oil Fraction
2700+
exponent_oil_viscosity (Optional[float]): Viscosity Exponent of Oil Fraction
2701+
exponent_water_density (Optional[float]): Density Exponent of Water Fraction
2702+
exponent_water_viscosity (Optional[float]): Viscosity Exponent of Water Fraction
2703+
max_flow_rate (Optional[float]): Max Flow Rate for AICD Device (m^3 / day)
2704+
max_ratio_of_emulsion_visc (Optional[float]): Max Ratio of Emulsion to Continuous Viscosity
2705+
strength_aicd (Optional[float]): Strength of AICD
2706+
viscosity_calibration_fluid (Optional[float]): Calibration Fluid Viscosity (cP)
2707+
viscosity_function_exponent (Optional[float]): Viscosity Function Exponent
2708+
viscosity_transition_region_emul (Optional[float]): Emulsion Viscosity Transition Region
2709+
volume_flow_rate_exponent (Optional[float]): Volume Flow Rate Exponent
2710+
"""
2711+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2712+
2713+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2714+
self.critical_water_liquid_fraction_emul: Optional[float] = None
2715+
self.density_calibration_fluid: Optional[float] = None
2716+
self.device_open: bool = True
2717+
self.exponent_gas_density: Optional[float] = None
2718+
self.exponent_gas_viscosity: Optional[float] = None
2719+
self.exponent_oil_density: Optional[float] = None
2720+
self.exponent_oil_viscosity: Optional[float] = None
2721+
self.exponent_water_density: Optional[float] = None
2722+
self.exponent_water_viscosity: Optional[float] = None
2723+
self.max_flow_rate: Optional[float] = None
2724+
self.max_ratio_of_emulsion_visc: Optional[float] = None
2725+
self.strength_aicd: Optional[float] = None
2726+
self.viscosity_calibration_fluid: Optional[float] = None
2727+
self.viscosity_function_exponent: Optional[float] = None
2728+
self.viscosity_transition_region_emul: Optional[float] = None
2729+
self.volume_flow_rate_exponent: Optional[float] = None
2730+
PdmObjectBase.__init__(self, pb2_object, channel)
2731+
if WellPathAicdParameters.__custom_init__ is not None:
2732+
WellPathAicdParameters.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2733+
25902734
class WellPathCompletionSettings(PdmObjectBase):
25912735
"""
25922736
Attributes:
@@ -2768,6 +2912,19 @@ def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel:
27682912
if WellPathTarget.__custom_init__ is not None:
27692913
WellPathTarget.__custom_init__(self, pb2_object=pb2_object, channel=channel)
27702914

2915+
class WellPathValve(CheckableNamedObject):
2916+
"""
2917+
Attributes:
2918+
start_measured_depth (float): Start MD
2919+
"""
2920+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
2921+
2922+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
2923+
self.start_measured_depth: float = 0.000000000000000e+00
2924+
CheckableNamedObject.__init__(self, pb2_object, channel)
2925+
if WellPathValve.__custom_init__ is not None:
2926+
WellPathValve.__custom_init__(self, pb2_object=pb2_object, channel=channel)
2927+
27712928
class WellPathCollection(PdmObjectBase):
27722929
"""
27732930
Collection of Well Paths
@@ -2809,6 +2966,7 @@ def class_dict() -> Dict[str, Type[PdmObjectBase]]:
28092966
classes['CheckableNamedObject'] = CheckableNamedObject
28102967
classes['ColorLegend'] = ColorLegend
28112968
classes['CommandRouter'] = CommandRouter
2969+
classes['CompletionTemplateCollection'] = CompletionTemplateCollection
28122970
classes['CornerPointCase'] = CornerPointCase
28132971
classes['CurveIntersection'] = CurveIntersection
28142972
classes['DataContainerFloat'] = DataContainerFloat
@@ -2892,6 +3050,8 @@ def class_dict() -> Dict[str, Type[PdmObjectBase]]:
28923050
classes['TextAnnotation'] = TextAnnotation
28933051
classes['ThermalFractureTemplate'] = ThermalFractureTemplate
28943052
classes['TriangleGeometry'] = TriangleGeometry
3053+
classes['ValveTemplate'] = ValveTemplate
3054+
classes['ValveTemplateCollection'] = ValveTemplateCollection
28953055
classes['View'] = View
28963056
classes['ViewWindow'] = ViewWindow
28973057
classes['WbsParameters'] = WbsParameters
@@ -2902,12 +3062,14 @@ def class_dict() -> Dict[str, Type[PdmObjectBase]]:
29023062
classes['WellLogPlotCurve'] = WellLogPlotCurve
29033063
classes['WellLogPlotTrack'] = WellLogPlotTrack
29043064
classes['WellPath'] = WellPath
3065+
classes['WellPathAicdParameters'] = WellPathAicdParameters
29053066
classes['WellPathCollection'] = WellPathCollection
29063067
classes['WellPathCompletionSettings'] = WellPathCompletionSettings
29073068
classes['WellPathCompletions'] = WellPathCompletions
29083069
classes['WellPathFracture'] = WellPathFracture
29093070
classes['WellPathGeometry'] = WellPathGeometry
29103071
classes['WellPathTarget'] = WellPathTarget
3072+
classes['WellPathValve'] = WellPathValve
29113073
return classes
29123074

29133075
def class_from_keyword(class_keyword : str) -> Optional[Type[PdmObjectBase]]:

docs/rips/tests/test_commands.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
55

6+
import rips
67
import dataroot
78

89

@@ -27,3 +28,29 @@ def test_create_lgr_well(rips_instance, initialize_test):
2728
split_type="LGR_PER_WELL",
2829
)
2930
assert len(case.grids()) == 3
31+
32+
33+
def test_create_multiple_fractures(rips_instance, initialize_test):
34+
case = rips_instance.project.load_case(
35+
dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
36+
)
37+
38+
well_files = [dataroot.PATH + "/TEST10K_FLT_LGR_NNC/wellpath_a.dev"]
39+
rips_instance.project.import_well_paths(well_path_files=well_files)
40+
41+
fracture_instances = rips_instance.project.descendants(rips.WellPathFracture)
42+
assert len(fracture_instances) == 0
43+
44+
case.create_multiple_fractures(
45+
template_id=0,
46+
well_path_names="Well Path A",
47+
min_dist_from_well_td=100.0,
48+
max_fractures_per_well=5,
49+
top_layer=1,
50+
base_layer=30,
51+
spacing=100.0,
52+
action="REPLACE_FRACTURES",
53+
)
54+
55+
fracture_instances = rips_instance.project.descendants(rips.WellPathFracture)
56+
assert len(fracture_instances) > 0

0 commit comments

Comments
 (0)