Make the Python interface use the TpfaLinearizer.

This commit is contained in:
Atgeirr Flø Rasmussen 2022-10-04 11:44:35 +02:00
parent d7ba860bf1
commit a7a5a7a98d
7 changed files with 40 additions and 15 deletions

View File

@ -26,16 +26,6 @@
#include <opm/models/blackoil/blackoillocalresidualtpfa.hh>
#include <opm/models/discretization/common/tpfalinearizer.hh>
namespace Opm {
namespace Properties {
namespace TTag {
struct EclFlowProblemTPFA {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
}
}
namespace Opm {
namespace Properties {
@ -54,6 +44,16 @@ namespace Opm {
namespace Opm
{
std::unique_ptr<FlowMainEbos<Properties::TTag::EclFlowProblemTPFA>>
flowEbosBlackoilTpfaMainInit(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.
resetLocale();
return std::make_unique<FlowMainEbos<Properties::TTag::EclFlowProblemTPFA>>(
argc, argv, outputCout, outputFiles);
}
// ----------------- Main program -----------------
int flowEbosBlackoilTpfaMain(int argc, char** argv, bool outputCout, bool outputFiles)

View File

@ -17,11 +17,34 @@
#ifndef FLOW_EBOS_BLACKOIL_TPFA_HPP
#define FLOW_EBOS_BLACKOIL_TPFA_HPP
#include <memory>
namespace Opm {
namespace Properties {
namespace TTag {
struct EclFlowProblem;
struct EclFlowProblemTPFA {
using InheritsFrom = std::tuple<EclFlowProblem>;
};
}
}
}
namespace Opm {
//! \brief Main function used in flow binary.
int flowEbosBlackoilTpfaMain(int argc, char** argv, bool outputCout, bool outputFiles);
template<class TypeTag> class FlowMainEbos;
//! \brief Initialization function used in flow binary and python simulator.
std::unique_ptr<FlowMainEbos<Properties::TTag::EclFlowProblemTPFA>>
flowEbosBlackoilTpfaMainInit(int argc, char** argv, bool outputCout, bool outputFiles);
//! \brief Main function used in flow_brine binary.
int flowEbosBlackoilTpfaMainStandalone(int argc, char** argv);

View File

@ -29,6 +29,7 @@
#include <opm/simulators/utils/ParallelFileMerger.hpp>
#include <opm/simulators/utils/moduleVersion.hpp>
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <flow/flow_ebos_blackoil.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/IOConfig/IOConfig.hpp>

View File

@ -235,7 +235,7 @@ public:
return exitCode;
}
using FlowMainEbosType = FlowMainEbos<Properties::TTag::EclFlowProblem>;
using FlowMainEbosType = FlowMainEbos<Properties::TTag::EclFlowProblemTPFA>;
// 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
@ -255,7 +255,7 @@ public:
std::move(this->actionState_),
std::move(this->wtestState_),
summaryConfig_);
return flowEbosBlackoilMainInit(
return flowEbosBlackoilTpfaMainInit(
argc_, argv_, outputCout_, outputFiles_);
} else {
//NOTE: exitCode was set by initialize_() above;

View File

@ -33,7 +33,7 @@ namespace Opm::Pybind {
class PyBlackOilSimulator
{
private:
using TypeTag = Opm::Properties::TTag::EclFlowProblem;
using TypeTag = Opm::Properties::TTag::EclFlowProblemTPFA;
using Simulator = Opm::GetPropType<TypeTag, Opm::Properties::Simulator>;
public:

View File

@ -32,7 +32,7 @@ namespace Opm::Pybind {
class BlackOilSimulator
{
private:
using TypeTag = Opm::Properties::TTag::EclFlowProblem;
using TypeTag = Opm::Properties::TTag::EclFlowProblemTpfa;
using Simulator = Opm::GetPropType<TypeTag, Opm::Properties::Simulator>;
public:

View File

@ -24,6 +24,7 @@
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/simulators/flow/Main.hpp>
#include <opm/simulators/flow/FlowMainEbos.hpp>
#include <flow/flow_ebos_blackoil.hpp>
// NOTE: EXIT_SUCCESS, EXIT_FAILURE is defined in cstdlib
#include <cstdlib>
#include <iostream>
@ -79,7 +80,7 @@ py::array_t<double> PyBlackOilSimulator::getPorosity()
int PyBlackOilSimulator::run()
{
auto mainObject = Opm::Main( deckFilename_ );
return mainObject.runStatic<Opm::Properties::TTag::EclFlowProblem>();
return mainObject.runStatic<Opm::Properties::TTag::EclFlowProblemTPFA>();
}
void PyBlackOilSimulator::setPorosity( py::array_t<double,