mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6935 Extend python example with more than one model.
This commit is contained in:
parent
f146402864
commit
4e2273b357
@ -9,7 +9,7 @@ resinsight = rips.Instance.find()
|
||||
# Example code
|
||||
project = resinsight.project
|
||||
|
||||
# Create fracture model template
|
||||
# Look for input files in the home directory of the user
|
||||
home_dir = expanduser("~")
|
||||
elastic_properties_file_path = (Path(home_dir) / "elastic_properties.csv").as_posix()
|
||||
print("Elastic properties file path:", elastic_properties_file_path)
|
||||
@ -17,6 +17,7 @@ print("Elastic properties file path:", elastic_properties_file_path)
|
||||
facies_properties_file_path = (Path(home_dir) / "facies_id.roff").as_posix()
|
||||
print("Facies properties file path:", facies_properties_file_path)
|
||||
|
||||
# Create stim plan model template
|
||||
fmt_collection = project.descendants(rips.StimPlanModelTemplateCollection)[0]
|
||||
stim_plan_model_template = fmt_collection.new_stim_plan_model_template(elastic_properties_file_path=elastic_properties_file_path,
|
||||
facies_properties_file_path=facies_properties_file_path)
|
||||
@ -51,8 +52,10 @@ elastic_properties = stim_plan_model_template.elastic_properties()
|
||||
elastic_properties.add_property_scaling(formation="Garn", facies="Calcite", property="YOUNGS_MODULUS", scale=1.44)
|
||||
|
||||
|
||||
well_name = "B-2 H"
|
||||
|
||||
# Find a well
|
||||
well_path = project.well_path_by_name("B-2 H")
|
||||
well_path = project.well_path_by_name(well_name)
|
||||
print("well path:", well_path)
|
||||
stim_plan_model_collection = project.descendants(rips.StimPlanModelCollection)[0]
|
||||
|
||||
@ -64,27 +67,43 @@ case = cases[0]
|
||||
time_steps = case.time_steps()
|
||||
time_step = time_steps[len(time_steps) - 1]
|
||||
|
||||
# Create fracture model at a give measured depth
|
||||
measured_depth = 3200.0
|
||||
stim_plan_model = stim_plan_model_collection.new_stim_plan_model(eclipse_case=case,
|
||||
time_step=time_step,
|
||||
well_path=well_path,
|
||||
measured_depth=measured_depth,
|
||||
stim_plan_model_template=stim_plan_model_template)
|
||||
|
||||
export_folder = tempfile.gettempdir()
|
||||
|
||||
print("Exporting fracture model to: ", export_folder)
|
||||
stim_plan_model.export_to_file(directory_path=export_folder)
|
||||
stim_plan_models = []
|
||||
|
||||
# Create and export a StimPlan model for each depth
|
||||
measured_depths = [ 3200.0, 3400.0, 3600.0 ]
|
||||
for measured_depth in measured_depths:
|
||||
|
||||
# Create stim plan model at a give measured depth
|
||||
stim_plan_model = stim_plan_model_collection.new_stim_plan_model(eclipse_case=case,
|
||||
time_step=time_step,
|
||||
well_path=well_path,
|
||||
measured_depth=measured_depth,
|
||||
stim_plan_model_template=stim_plan_model_template)
|
||||
stim_plan_models.append(stim_plan_model)
|
||||
|
||||
# Make the well name safer to use as a directory path
|
||||
well_name_part = well_name.replace(" ", "_")
|
||||
directory_path = Path(export_folder) / '{}_{}'.format(well_name_part, int(measured_depth))
|
||||
|
||||
# Create the folder
|
||||
directory_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
print("Exporting fracture model to: ", directory_path)
|
||||
stim_plan_model.export_to_file(directory_path=directory_path.as_posix())
|
||||
|
||||
# Create a fracture mode plot
|
||||
stim_plan_model_plot_collection = project.descendants(rips.StimPlanModelPlotCollection)[0]
|
||||
stim_plan_model_plot = stim_plan_model_plot_collection.new_stim_plan_model_plot(stim_plan_model=stim_plan_model)
|
||||
|
||||
print("Exporting fracture model plot to: ", directory_path)
|
||||
stim_plan_model_plot.export_snapshot(export_folder=directory_path.as_posix())
|
||||
|
||||
# Create a fracture mode plot
|
||||
stim_plan_model_plot_collection = project.descendants(rips.StimPlanModelPlotCollection)[0]
|
||||
stim_plan_model_plot = stim_plan_model_plot_collection.new_stim_plan_model_plot(stim_plan_model=stim_plan_model)
|
||||
|
||||
print("Exporting fracture model plot to: ", export_folder)
|
||||
stim_plan_model_plot.export_snapshot(export_folder=export_folder)
|
||||
|
||||
print("Setting measured depth and perforation length.")
|
||||
stim_plan_model.measured_depth = 3300.0
|
||||
stim_plan_model.perforation_length = 123.445
|
||||
stim_plan_model.update()
|
||||
stim_plan_models[0].measured_depth = 3300.0
|
||||
stim_plan_models[0].perforation_length = 123.445
|
||||
stim_plan_models[0].update()
|
||||
|
Loading…
Reference in New Issue
Block a user