ResInsight/GrpcInterface/Python/rips/PythonExamples/soil_porv_sync.py

34 lines
1.1 KiB
Python
Raw Normal View History

##############################################################################
# This example will create a derived result for each time step synchronously
##############################################################################
import rips
import time
2019-09-19 06:25:04 -05:00
resinsight = rips.Instance.find()
start = time.time()
2021-01-26 13:48:01 -06:00
case = resinsight.project.cases()[0]
# Read the full porv result
2021-01-26 13:48:01 -06:00
porv_results = case.active_cell_property("STATIC_NATIVE", "PORV", 0)
2019-09-19 08:14:01 -05:00
time_step_info = case.time_steps()
2021-01-26 13:48:01 -06:00
for i in range(0, len(time_step_info)):
# Read the full SOIl result for time step i
2021-01-26 13:48:01 -06:00
soil_results = case.active_cell_property("DYNAMIC_NATIVE", "SOIL", i)
# Generate the result by looping through both lists in order
results = []
for soil, porv in zip(soil_results, porv_results):
results.append(soil * porv)
# Send back result
2021-01-26 13:48:01 -06:00
case.set_active_cell_property(results, "GENERATED", "SOILPORVSync", i)
end = time.time()
print("Time elapsed: ", end - start)
print("Transferred all results back")
2021-01-26 13:48:01 -06:00
view = case.views()[0].apply_cell_result("GENERATED", "SOILPORVSync")