mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2609 from hakonhagland/refactor_flowebos2
Refactors flow_ebos_blackoil.cpp (2)
This commit is contained in:
@@ -46,8 +46,8 @@ void flowEbosBlackoilSetDeck(double setupTime, Deck *deck, EclipseState& eclStat
|
||||
Vanguard::setExternalSummaryConfig(&summaryConfig);
|
||||
}
|
||||
|
||||
// ----------------- Main program -----------------
|
||||
int flowEbosBlackoilMain(int argc, char** argv, bool outputCout, bool outputFiles)
|
||||
std::unique_ptr<Opm::FlowMainEbos<TTAG(EclFlowProblem)>>
|
||||
flowEbosBlackoilMainInit(int argc, char** argv, bool outputCout, bool outputFiles)
|
||||
{
|
||||
// we always want to use the default locale, and thus spare us the trouble
|
||||
// with incorrect locale settings.
|
||||
@@ -59,8 +59,14 @@ int flowEbosBlackoilMain(int argc, char** argv, bool outputCout, bool outputFile
|
||||
Dune::MPIHelper::instance(argc, argv);
|
||||
#endif
|
||||
|
||||
Opm::FlowMainEbos<TTAG(EclFlowProblem)> mainfunc;
|
||||
return mainfunc.execute(argc, argv, outputCout, outputFiles);
|
||||
return std::make_unique<Opm::FlowMainEbos<TTAG(EclFlowProblem)>>();
|
||||
}
|
||||
|
||||
// ----------------- Main program -----------------
|
||||
int flowEbosBlackoilMain(int argc, char** argv, bool outputCout, bool outputFiles)
|
||||
{
|
||||
auto mainfunc = flowEbosBlackoilMainInit(argc, argv, outputCout, outputFiles);
|
||||
return mainfunc->execute(argc, argv, outputCout, outputFiles);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,10 +21,15 @@
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/simulators/flow/FlowMainEbos.hpp>
|
||||
|
||||
namespace Opm {
|
||||
void flowEbosBlackoilSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
|
||||
|
||||
int flowEbosBlackoilMain(int argc, char** argv, bool outputCout, bool outputFiles);
|
||||
|
||||
std::unique_ptr<Opm::FlowMainEbos<TTAG(EclFlowProblem)>>
|
||||
flowEbosBlackoilMainInit(int argc, char** argv, bool outputCout, bool outputFiles);
|
||||
}
|
||||
|
||||
#endif // FLOW_EBOS_BLACKOIL_HPP
|
||||
|
||||
@@ -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 {
|
||||
//NOTE: exitCode was set by initialize_() above;
|
||||
return std::unique_ptr<FlowMainEbosType>(); // nullptr
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int dispatchDynamic_()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user