Merge pull request #2501 from joakim-hove/add-python-arg

Add Python argument to Schedule constructor
This commit is contained in:
Joakim Hove 2020-03-27 13:44:09 +01:00 committed by GitHub
commit f425758c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 8 deletions

View File

@ -35,6 +35,7 @@
#include <opm/grid/cpgrid/GridHelpers.hpp>
#include <opm/core/props/satfunc/RelpermDiagnostics.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
@ -348,7 +349,7 @@ public:
// create the schedule object. Note that if eclState is supposed to represent
// the internalized version of the deck, this constitutes a layering
// violation.
internalEclSchedule_.reset(new Opm::Schedule(*deck_, *eclState_, *parseContext_, *errorGuard_));
internalEclSchedule_.reset(new Opm::Schedule(*deck_, *eclState_, *parseContext_, *errorGuard_, python));
eclSchedule_ = internalEclSchedule_.get();
}
else
@ -629,6 +630,7 @@ private:
Opm::EclipseState* eclState_;
Opm::Schedule* eclSchedule_;
Opm::SummaryConfig* eclSummaryConfig_;
Opm::Python python;
Dune::EdgeWeightMethod edgeWeightsMethod_;
bool ownersFirst_;

View File

@ -326,6 +326,7 @@ int main(int argc, char** argv)
std::cout << "Reading deck file '" << deckFilename << "'\n";
std::cout.flush();
}
Opm::Python python;
std::shared_ptr<Opm::Deck> deck;
std::shared_ptr<Opm::EclipseState> eclipseState;
std::shared_ptr<Opm::Schedule> schedule;
@ -371,9 +372,9 @@ int main(int argc, char** argv)
const auto& rst_filename = eclipseState->getIOConfig().getRestartFileName( init_config.getRestartRootName(), report_step, false );
Opm::EclIO::ERst rst_file(rst_filename);
const auto& rst_state = Opm::RestartIO::RstState::load(rst_file, report_step);
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard, &rst_state) );
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard, python, &rst_state) );
} else
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard));
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard, python));
setupMessageLimiter(schedule->getMessageLimits(), "STDOUT_LOGGER");
summaryConfig.reset( new Opm::SummaryConfig(*deck, *schedule, eclipseState->getTableManager(), parseContext, errorGuard));

View File

@ -33,6 +33,7 @@
#include <opm/common/OpmLog/EclipsePRTLog.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
@ -354,6 +355,7 @@ int mainFlow(int argc, char** argv)
std::cout << "Reading deck file '" << deckFilename << "'\n";
std::cout.flush();
}
Opm::Python python;
std::shared_ptr<Opm::Deck> deck;
std::shared_ptr<Opm::EclipseState> eclipseState;
std::shared_ptr<Opm::Schedule> schedule;
@ -390,7 +392,7 @@ int mainFlow(int argc, char** argv)
#else
eclipseState.reset(new Opm::EclipseState(*deck));
#endif
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard));
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard, python));
setupMessageLimiter(schedule->getMessageLimits(), "STDOUT_LOGGER");
summaryConfig.reset( new Opm::SummaryConfig(*deck, *schedule, eclipseState->getTableManager(), parseContext, errorGuard));
}

View File

@ -29,6 +29,7 @@
#include <sstream>
#include <iostream>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
@ -276,11 +277,12 @@ BOOST_AUTO_TEST_CASE( Test_Norne_PVT) {
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
Opm::ErrorGuard errorGuard;
Opm::Parser parser;
Opm::Python python;
auto deck = parser.parseFile("norne_pvt.data", parseContext, errorGuard);
Opm::EclipseState eclState(deck);
Opm::Schedule schedule(deck, eclState);
Opm::Schedule schedule(deck, eclState, python);
verify_norne_oil_pvt_region1(eclState, schedule);
verify_norne_oil_pvt_region2(eclState, schedule);

View File

@ -24,6 +24,7 @@
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@ -36,7 +37,8 @@ BOOST_AUTO_TEST_CASE(TestStoppedWells)
Opm::Parser parser;
Opm::Deck deck(parser.parseFile(filename));
Opm::EclipseState eclipseState(deck);
const Schedule sched(deck, eclipseState);
Opm::Python python;
const Schedule sched(deck, eclipseState, python);
// Both wells are open in the first schedule step
{

View File

@ -33,6 +33,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/grid/GridManager.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
@ -70,12 +71,13 @@ struct SetupTest {
{
const Opm::TableManager table ( deck );
const Opm::Runspec runspec (deck);
schedule.reset( new Opm::Schedule(deck, *ecl_state));
schedule.reset( new Opm::Schedule(deck, *ecl_state, python));
summaryState.reset( new Opm::SummaryState(std::chrono::system_clock::from_time_t(schedule->getStartTime())));
}
current_timestep = 0;
};
Opm::Python python;
std::unique_ptr<const Opm::EclipseState> ecl_state;
std::unique_ptr<const Opm::Schedule> schedule;
std::unique_ptr<Opm::SummaryState> summaryState;

View File

@ -22,6 +22,7 @@
#define BOOST_TEST_MODULE WellStateFIBOTest
#include <opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <boost/test/unit_test.hpp>
@ -51,7 +52,7 @@ struct Setup
: es (deck)
, pu (Opm::phaseUsageFromDeck(es))
, grid (es.getInputGrid())
, sched(deck, es)
, sched(deck, es, python)
, st(std::chrono::system_clock::from_time_t(sched.getStartTime()))
{
initWellPerfData();
@ -101,6 +102,7 @@ struct Setup
}
}
Opm::Python python;
Opm::EclipseState es;
Opm::PhaseUsage pu;
Opm::GridManager grid;