Files
ResInsight/GrpcInterface/Python/rips/PythonExamples/create_wbs_plot.py

51 lines
1.4 KiB
Python
Raw Permalink Normal View History

import os
import grpc
# Load ResInsight Processing Server Client Library
import rips
2021-01-26 20:48:01 +01:00
# Connect to ResInsight instance
resInsight = rips.Instance.find()
2020-03-03 10:43:07 +01:00
# Get all GeoMech cases
cases = resInsight.project.descendants(rips.GeoMechCase)
2020-03-03 10:43:07 +01:00
# Get all well paths
well_paths = resInsight.project.well_paths()
2020-03-03 10:43:07 +01:00
# Ensure there's at least one well path
if len(well_paths) < 1:
print("No well paths in project")
exit(1)
# Create a set of WbsParameters
params = rips.WbsParameters()
params.user_poisson_ratio = 0.23456
params.user_ucs = 123
2020-03-03 10:43:07 +01:00
# Loop through all cases
for case in cases:
2021-01-26 20:48:01 +01:00
assert isinstance(case, rips.GeoMechCase)
2020-03-03 10:43:07 +01:00
min_res_depth, max_res_depth = case.reservoir_depth_range()
# Find a good output path
case_path = case.file_path
folder_name = os.path.dirname(case_path)
2020-03-03 10:43:07 +01:00
# Import formation names
2021-01-26 20:48:01 +01:00
case.import_formation_names(
formation_files=[
"D:/Projects/ResInsight-regression-test/ModelData/norne/Norne_ATW2013.lyr"
]
)
2020-03-03 10:43:07 +01:00
# create a folder to hold the snapshots
2021-01-26 20:48:01 +01:00
dirname = os.path.join(folder_name, "snapshots")
2020-03-03 10:43:07 +01:00
print("Exporting to: " + dirname)
2021-01-26 20:48:01 +01:00
for well_path in well_paths[0:4]: # Loop through the first five well paths
2020-03-03 10:43:07 +01:00
# Create plot with parameters
2021-01-26 20:48:01 +01:00
wbsplot = case.create_well_bore_stability_plot(
well_path=well_path.name, time_step=0, parameters=params
)