Similar to the previous commit b25f489, run() is here refactored in
preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, stepReport, solverTimer,
totalTimer, and adaptiveTimeStepping, which are made private class
variables.
As discussed in the previous commit 224ddd9 runSimulator() needs to be
refactored to avoid code duplication when executeStepInit() is
implemented (see later commit). Here, runSimulator() is refactored into
a runSimulatorInitOrRun() that takes a callback function. When
runSimulatorInit() is implemented it will pass a different callback that
only initializes the simulator. Currently, runSimulator() passes the
callback runSimulatorRunCallback_() which runs the whole simulation.
The final output of the simulation summary in runSimulator() is also
refactored into a runSimulatorAfterSim_() method.
Currently, execute() calls runSimulator() to run the simulation. When
the Python step_init() is implemented (see a later commit), it will
instead call an executeStepInit() that will need to do the same
initialization as in execute() except that it should call a
runSimulatorInit() instead of runSimulator(). In order to avoid code
duplication for execute() and executeStepInit(), execute() is here
refactored into an execute_() method.
Currently, the Python run() calls flowEbosBlackoilMain() to start the
simulation (which calls execute() in FlowMainEbos). The Python
step_init() method should also do the setup in flowEbosBlackoilMain()
but it should not call execute() directly. In order to avoid code
duplication for run() and step_init(), the initialization part of
flowEbosBlackoilMain() is isolated into a flowEbosBlackoilMain_init()
We would like to add a step() method to simulators.cpp, that will let a
Python script advance the simulator one report step at a time. Before
calling step(), the Python script will have to call a step_init()
method that initializes the simulator, similar to what is done in run()
now. In order to avoid duplication of code in run() and step_init() the
run() method is here refactored into a prepareRun_() function that can
be called from both step_init() and from run().