2019-08-19 06:46:14 -05:00
|
|
|
##############################################################################
|
|
|
|
# This example will create a derived result for each time step synchronously
|
|
|
|
##############################################################################
|
|
|
|
|
2019-06-03 14:11:27 -05:00
|
|
|
import rips
|
2019-08-15 01:07:43 -05:00
|
|
|
import time
|
2019-05-30 11:52:38 -05:00
|
|
|
|
2019-09-19 06:25:04 -05:00
|
|
|
resinsight = rips.Instance.find()
|
2019-08-15 01:07:43 -05:00
|
|
|
start = time.time()
|
2019-11-21 01:13:15 -06:00
|
|
|
case = resinsight.project.cases()[0]
|
2019-05-30 11:52:38 -05:00
|
|
|
|
2019-08-19 06:46:14 -05:00
|
|
|
# Read the full porv result
|
2019-09-23 04:50:33 -05: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()
|
2019-05-30 11:52:38 -05:00
|
|
|
|
2019-09-19 08:14:01 -05:00
|
|
|
for i in range (0, len(time_step_info)):
|
2019-08-19 06:46:14 -05:00
|
|
|
# Read the full SOIl result for time step i
|
2019-09-23 04:50:33 -05:00
|
|
|
soil_results = case.active_cell_property('DYNAMIC_NATIVE', 'SOIL', i)
|
2019-08-19 06:46:14 -05:00
|
|
|
|
|
|
|
# Generate the result by looping through both lists in order
|
2019-05-30 11:52:38 -05:00
|
|
|
results = []
|
2019-09-19 08:14:01 -05:00
|
|
|
for (soil, porv) in zip(soil_results, porv_results):
|
2019-05-30 11:52:38 -05:00
|
|
|
results.append(soil * porv)
|
|
|
|
|
2019-08-19 06:46:14 -05:00
|
|
|
# Send back result
|
2019-09-23 04:50:33 -05:00
|
|
|
case.set_active_cell_property(results, 'GENERATED', 'SOILPORVSync', i)
|
2019-08-15 01:07:43 -05:00
|
|
|
|
|
|
|
end = time.time()
|
|
|
|
print("Time elapsed: ", end - start)
|
|
|
|
|
2019-08-19 06:46:14 -05:00
|
|
|
print("Transferred all results back")
|
|
|
|
|
2019-09-19 07:47:48 -05:00
|
|
|
view = case.views()[0].apply_cell_result('GENERATED', 'SOILPORVSync')
|