mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Refactor flow_ebos_blackoil.cpp (2)
NOTE: this pull request depends on #2555 which should be merged first. A rewrite of the outdated PR #2543. Refactors flow_ebos_blackoil.cpp such that we can choose not to execute the whole simulation using the flowEbosBlackoilMain() function but instead only initialize by calling flowEbosBlackoilMainInit(). This is necessary to implement a Python step() method that can advance the simulator one report step at a time. Also adds a method initFlowEbosBlackoil() to Main.hpp that can be used directly from the Python interface's BlackOilSimulator object to gain access to the FlowMainEbos object before it has initialized the simulation main loop.
This commit is contained in:
@@ -117,6 +117,7 @@ namespace Opm
|
||||
class Main
|
||||
{
|
||||
private:
|
||||
using FlowMainEbosType = Opm::FlowMainEbos<TTAG(EclFlowProblem)>;
|
||||
enum class FileOutputMode {
|
||||
//! \brief No output to files.
|
||||
OUTPUT_NONE = 0,
|
||||
@@ -174,6 +175,30 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
// To be called from the Python interface code. Only do the
|
||||
// initialization and then return a pointer to the FlowEbosMain
|
||||
// object that can later be accessed directly from the Python interface
|
||||
// to e.g. advance the simulator one report step
|
||||
std::unique_ptr<FlowMainEbosType> initFlowEbosBlackoil(int& exitCode)
|
||||
{
|
||||
exitCode = EXIT_SUCCESS;
|
||||
if (initialize_<TTAG(FlowEarlyBird)>(exitCode)) {
|
||||
// TODO: check that this deck really represents a blackoil
|
||||
// case. E.g. check that number of phases == 3
|
||||
Opm::flowEbosBlackoilSetDeck(
|
||||
setupTime_,
|
||||
deck_.get(),
|
||||
*eclipseState_,
|
||||
*schedule_,
|
||||
*summaryConfig_);
|
||||
return Opm::flowEbosBlackoilMainInit(
|
||||
argc_, argv_, outputCout_, outputFiles_);
|
||||
} else {
|
||||
exitCode = EXIT_FAILURE;
|
||||
return std::unique_ptr<FlowMainEbosType>(); // nullptr
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int dispatchDynamic_()
|
||||
{
|
||||
|
Reference in New Issue
Block a user