opm-common/tests/wclose.py
Joakim Hove 46b663218a Enable running normal ACTIONX keywords from PYACTION
The run() function invoked by PYACTION has got a new fifth argument which is a
callable the script should utilize to apply the keywords from an ACTIONX
keyword. The callable is implemented as C++ lambda which will run the
Schedule::iterateScheduleSection() method and make sure an updated
SimulatorUpdate variable can be passed back to the simulator.
2022-01-25 10:04:43 +01:00

25 lines
943 B
Python

import sys
def run(ecl_state, schedule, report_step, summary_state, actionx_callback):
sys.stdout.write("Running PYACTION arg1:{}\n".format(ecl_state))
if "FOPR" in summary_state:
sys.stdout.write("Have FOPR: {}\n".format( summary_state["FOPR"] ))
else:
sys.stdout.write("Missing FOPR\n")
grid = ecl_state.grid()
sys.stdout.write("Grid dimensions: ({},{},{})\n".format(grid.nx, grid.ny, grid.nz))
prod_well = schedule.get_well("PROD1", report_step)
sys.stdout.write("Well status: {}\n".format(prod_well.status()))
if not "list" in storage:
storage["list"] = []
storage["list"].append(report_step)
sys.stdout.write("storage[list]: {}\n".format(storage["list"]))
if summary_state.well_var("PROD1", "WWCT") > 0.80:
schedule.shut_well("PROD1", report_step)
schedule.open_well("PROD2", report_step)
summary_state.update("RUN_COUNT", 1)
return True