Python bindings for the blackoil simulator.

A simplified version of PR #2518 that uses a deck filename to construct
the simulator.

After private discussion with @joakim-hove it was decided that the
construction of the blackoil simulator from Python using deck,
ecliseState, schedule and summaryConfig as constructor arguments from
\#2518 should be replaced by a constructor taking only the deck filename
as parameter.

A rewrite of the Python bindings for the blackoil simulator using
pybind11 as introduced in PR #2127. The new version uses the
refactored flow.cpp introduced in PR #2516 and thus avoids duplication
of the code in simulators.cpp.

This PR will be the starting point for implementing the Python bindings
introduced in PR #2403.
This commit is contained in:
Håkon Hægland
2020-04-22 21:22:35 +02:00
parent b03609317f
commit f94553c5a7
4 changed files with 65 additions and 0 deletions

View File

@@ -64,6 +64,7 @@
#include <opm/simulators/utils/ParallelSerialization.hpp>
#endif
#include <string>
#include <type_traits>
BEGIN_PROPERTIES
@@ -126,6 +127,17 @@ namespace Opm
};
public:
Main(int argc, char** argv) : argc_(argc), argv_(argv) { }
Main(const std::string &filename)
{
deckFilename_.assign(filename);
flowProgName_.assign("flow");
argc_ = 2;
saveArgs_[0] = const_cast<char *>(flowProgName_.c_str());
saveArgs_[1] = const_cast<char *>(deckFilename_.c_str());
argv_ = saveArgs_;
}
Main(int argc,
char** argv,
std::shared_ptr<Opm::Deck> deck,
@@ -603,6 +615,9 @@ namespace Opm
bool outputCout_;
bool outputFiles_;
double setupTime_;
std::string deckFilename_;
std::string flowProgName_;
char *saveArgs_[2];
std::shared_ptr<Opm::Deck> deck_;
std::shared_ptr<Opm::EclipseState> eclipseState_;
std::shared_ptr<Opm::Schedule> schedule_;