Commit Graph
7 Commits
Author SHA1 Message Date
Håkon Hægland 11eaa3d7d4 Implement Python step_init() method.
The step_init() method initializes the simulation. It is required for
the Python script to run step_init() before calling the step() method (which will be
implemented in the next commit).
2020-03-02 11:56:50 +01:00
Håkon Hægland b125ad415d [Style] Fix naming of Python functions.
Fix naming style for Python API functions to conform with PEP 8
recommendations.
2020-02-29 07:02:26 +01:00
Håkon Hægland bb208047a8 Refactor run() in SimulatorFullyImplicit....hpp
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.
2020-02-28 20:41:48 +01:00
Håkon Hægland b25f48971c Refactor runSimulator()
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.
2020-02-27 21:32:53 +01:00
Håkon Hægland 224ddd9b73 Refactor execute()
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.
2020-02-26 22:45:52 +01:00
Håkon Hægland 2a1c1f9bfd Refactor flowEbosBlackoilMain()
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()
2020-02-26 12:45:53 +01:00
Håkon Hægland c66b564b35 Refactor run() into prepareRun_()
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().
2020-02-25 00:52:38 +01:00