Note
This page is automatically generated from the Protocol Buffer definition files.
Last updated: Generated by generate_protobuf_docs.py
ResInsight uses Protocol Buffers (protobuf) for efficient data serialization and communication between Python and the ResInsight application via gRPC. The protobuf definitions define the structure of data that can be exchanged with ResInsight.
The generated Python classes from these protobuf files are used as return types and parameters in many rips API methods.
The Protocol Buffer definition files (.proto) are automatically downloaded from the ResInsight repository and stored in the docs/proto directory.
The generated Python files are located in docs/rips/generated/ and include:
These are the most commonly used Protocol Buffer structures in the ResInsight Python API.
Source: SimulatorTables.proto
Repeated Fields:
| Field | Type | Description |
|---|---|---|
| compdat | list[SimulatorCompdatEntry] | |
| welspecs | list[SimulatorWelspecsEntry] | |
| welsegs | list[SimulatorWelsegsEntry] | |
| compsegs | list[SimulatorCompsegsEntry] | |
| wsegvalv | list[SimulatorWsegvalvEntry] | |
| wsegaicd | list[SimulatorWsegaicdEntry] |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| well_name | str | |
| grid_i | int | |
| grid_j | int | |
| upper_k | int | |
| lower_k | int | |
| open_shut_flag | str |
Optional Attributes:
| Field | Type | Description |
|---|---|---|
| saturation | float | None | |
| transmissibility | float | None | |
| diameter | float | None | |
| kh | float | None | |
| skin_factor | float | None | |
| d_factor | float | None | |
| direction | str | None | |
| start_md | float | None | |
| end_md | float | None | |
| comment | str | None |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| well_name | str | |
| group_name | str | |
| grid_i | int | |
| grid_j | int | |
| phase | str |
Optional Attributes:
| Field | Type | Description |
|---|---|---|
| bhp_depth | float | None | |
| drainage_radius | float | None | |
| inflow_equation | str | None | |
| auto_shut_in | str | None | |
| cross_flow | str | None | |
| pvt_num | int | None | |
| hydrostatic_density_calc | str | None | |
| fip_region | int | None |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| wellpath_name | str | |
| case_id | int |
Source: Definitions.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| x | float | |
| y | float | |
| z | float |
Source: Definitions.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| i | int | |
| j | int | |
| k | int |
Source: Definitions.proto
Source: Definitions.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| c0 | Vec3d | |
| c1 | Vec3d | |
| c2 | Vec3d | |
| c3 | Vec3d | |
| c4 | Vec3d | |
| c5 | Vec3d | |
| c6 | Vec3d | |
| c7 | Vec3d |
Source: Definitions.proto
Source: Definitions.proto
Source: Definitions.proto
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| case_id | int |
Repeated Fields:
| Field | Type | Description |
|---|---|---|
| wellpath_names | list[str] |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| well_name | str | |
| top_depth | float | |
| top_length | float | |
| info_type | str |
Optional Attributes:
| Field | Type | Description |
|---|---|---|
| wellbore_volume | float | None | |
| pressure_omponents | str | None | |
| flow_model | str | None |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| segment_1 | int | |
| segment_2 | int | |
| branch | int | |
| join_segment | int | |
| length | float | |
| depth | float |
Optional Attributes:
| Field | Type | Description |
|---|---|---|
| diameter | float | None | |
| roughness | float | None | |
| description | str | None |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| header | SimulatorWelsegsHeaderEntry |
Repeated Fields:
| Field | Type | Description |
|---|---|---|
| row | list[SimulatorWelsegsRowEntry] |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| i | int | |
| j | int | |
| k | int | |
| branch | int | |
| distance_start | float | |
| distance_end | float |
Optional Attributes:
| Field | Type | Description |
|---|---|---|
| grid_name | str | None |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| well_name | str | |
| segment_number | int | |
| cv | float | |
| area | float |
Optional Attributes:
| Field | Type | Description |
|---|---|---|
| extra_length | float | None | |
| pipe_d | float | None | |
| roughness | float | None | |
| pipe_a | float | None | |
| status | str | None | |
| max_a | float | None |
Source: SimulatorTables.proto
Attributes:
| Field | Type | Description |
|---|---|---|
| well_name | str | |
| segment_1 | int | |
| segment_2 | int | |
| strength | float | |
| max_abs_rate | float | |
| flow_rate_exponent | float | |
| visc_exponent | float |
Optional Attributes:
| Field | Type | Description |
|---|---|---|
| length | float | None | |
| density_cali | float | None | |
| viscosity_cali | float | None | |
| critical_value | float | None | |
| width_trans | float | None | |
| max_visc_ratio | float | None | |
| method_scaling_factor | int | None | |
| status | str | None | |
| oil_flow_fraction | float | None | |
| water_flow_fraction | float | None | |
| gas_flow_fraction | float | None | |
| oil_visc_fraction | float | None | |
| water_visc_fraction | float | None | |
| gas_visc_fraction | float | None | |
| description | str | None |
The :meth:`rips.WellPath.completion_data` method returns a SimulatorTableData object containing well completion information:
import rips
# Connect to ResInsight
resinsight = rips.Instance.find()
project = resinsight.project
# Get a case
case = project.cases()[0]
# Get well path
well_path = project.well_paths()[0]
# Get completion data
completion_data = well_path.completion_data(case.id)
# Access COMPDAT entries
for compdat_entry in completion_data.compdat:
print(f"Well: {compdat_entry.well_name}")
print(f" Grid location: i={compdat_entry.grid_i}, j={compdat_entry.grid_j}")
print(f" K layers: {compdat_entry.upper_k} to {compdat_entry.lower_k}")
print(f" Status: {compdat_entry.open_shut_flag}")
if compdat_entry.HasField('transmissibility'):
print(f" Transmissibility: {compdat_entry.transmissibility}")
if compdat_entry.HasField('diameter'):
print(f" Diameter: {compdat_entry.diameter}")
# Access WELSPECS entries
for welspecs_entry in completion_data.welspecs:
print(f"Well: {welspecs_entry.well_name}")
print(f" Group: {welspecs_entry.group_name}")
print(f" Phase: {welspecs_entry.phase}")
print(f" Grid location: i={welspecs_entry.grid_i}, j={welspecs_entry.grid_j}")
if welspecs_entry.HasField('bhp_depth'):
print(f" BHP Depth: {welspecs_entry.bhp_depth}")Many protobuf messages contain optional fields. Use the HasField() method to check if an optional field is set:
# Check if optional field is set before accessing
if entry.HasField('saturation'):
saturation_value = entry.saturation
else:
saturation_value = None
# Or use getattr with a default value
saturation = getattr(entry, 'saturation', None)Many protobuf messages use Vec3d (3D double vector) or Vec3i (3D integer vector) for coordinates:
# Vec3d example (cell centers, coordinates)
cell_centers = grid.cell_centers()
for center in cell_centers.centers:
print(f"Center: x={center.x}, y={center.y}, z={center.z}")
# Vec3i example (grid indices)
grid_dims = grid.dimensions()
print(f"Grid dimensions: i={grid_dims.i}, j={grid_dims.j}, k={grid_dims.k}")- :doc:`rips` - Main API documentation
- :doc:`GeneratedClasses` - Auto-generated class documentation
- :doc:`PythonExamples` - Python code examples