changed: subclass Main for python

move the initFlowBlackoil method into it

in particular we then avoid the FlowMainType type alias
in Main.hpp
This commit is contained in:
Arne Morten Kvarving
2024-09-09 14:26:24 +02:00
parent fc96e9da75
commit 2a9d81227b
4 changed files with 64 additions and 25 deletions

View File

@@ -174,26 +174,6 @@ public:
return exitCode;
}
using FlowMainType = FlowMain<Properties::TTag::FlowProblemTPFA>;
// To be called from the Python interface code. Only do the
// initialization and then return a pointer to the FlowMain
// object that can later be accessed directly from the Python interface
// to e.g. advance the simulator one report step
std::unique_ptr<FlowMainType> initFlowBlackoil(int& exitCode)
{
exitCode = EXIT_SUCCESS;
if (initialize_<Properties::TTag::FlowEarlyBird>(exitCode)) {
// TODO: check that this deck really represents a blackoil
// case. E.g. check that number of phases == 3
this->setupVanguard();
return flowBlackoilTpfaMainInit(
argc_, argv_, outputCout_, outputFiles_);
} else {
//NOTE: exitCode was set by initialize_() above;
return std::unique_ptr<FlowMainType>(); // nullptr
}
}
//! \brief Used for test_outputdir.
int justInitialize()
{

View File

@@ -20,7 +20,7 @@
#ifndef OPM_PY_BLACKOIL_SIMULATOR_HEADER_INCLUDED
#define OPM_PY_BLACKOIL_SIMULATOR_HEADER_INCLUDED
#include <opm/simulators/flow/Main.hpp>
#include <python/simulators/PyMain.hpp>
#include <opm/simulators/flow/FlowMain.hpp>
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/parametersystem.hpp>
@@ -82,7 +82,7 @@ private:
// This *must* be declared before other pointers
// to simulator objects. This in order to deinitialize
// MPI at the correct time (ie after the other objects).
std::unique_ptr<Opm::Main> main_;
std::unique_ptr<Opm::PyMain> main_;
std::unique_ptr<Opm::FlowMain<TypeTag>> flow_main_;
Simulator* simulator_;