RestartConfig has moved from EclipseState to Schedule

This commit is contained in:
Joakim Hove 2020-02-17 08:39:21 +01:00
parent 150dc54e79
commit 5ad4936025
9 changed files with 35 additions and 34 deletions

View File

@ -327,7 +327,7 @@ public:
}
if (!externalEclState_) {
internalEclState_.reset(new Opm::EclipseState(*deck_, *parseContext_, *errorGuard_));
internalEclState_.reset(new Opm::EclipseState(*deck_));
eclState_ = internalEclState_.get();
}
else {
@ -375,7 +375,7 @@ public:
// written to disk (every N report step)
int outputInterval = EWOMS_GET_PARAM(TypeTag, int, EclOutputInterval);
if (outputInterval >= 0)
eclState_->getRestartConfig().overrideRestartWriteInterval(outputInterval);
schedule().restart().overrideRestartWriteInterval(outputInterval);
}
/*!

View File

@ -219,7 +219,7 @@ public:
const Opm::SummaryConfig summaryConfig = simulator_.vanguard().summaryConfig();
// Only output RESTART_AUXILIARY asked for by the user.
const Opm::RestartConfig& restartConfig = simulator_.vanguard().eclState().getRestartConfig();
const Opm::RestartConfig& restartConfig = simulator_.vanguard().schedule().restart();
std::map<std::string, int> rstKeywords = restartConfig.getRestartKeywords(reportStepNum);
for (auto& keyValue: rstKeywords) {
keyValue.second = restartConfig.getKeyword(keyValue.first, reportStepNum);

View File

@ -350,7 +350,7 @@ int main(int argc, char** argv)
if ( outputCout )
Opm::checkDeck(*deck, parser, parseContext, errorGuard);
eclipseState.reset( new Opm::EclipseState(*deck, parseContext, errorGuard ));
eclipseState.reset( new Opm::EclipseState(*deck));
if (mpiRank == 0) {
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard));
setupMessageLimiter(schedule->getMessageLimits(), "STDOUT_LOGGER");

View File

@ -376,7 +376,7 @@ int mainFlow(int argc, char** argv)
if ( outputCout )
Opm::checkDeck(*deck, parser, parseContext, errorGuard);
eclipseState.reset( new Opm::EclipseState(*deck, parseContext, errorGuard ));
eclipseState.reset( new Opm::EclipseState(*deck ));
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard));
summaryConfig.reset( new Opm::SummaryConfig(*deck, *schedule, eclipseState->getTableManager(), parseContext, errorGuard));
setupMessageLimiter(schedule->getMessageLimits(), "STDOUT_LOGGER");

View File

@ -642,8 +642,7 @@ std::size_t packSize(const TimeMap& data, Dune::MPIHelper::MPICommunicator comm)
std::size_t packSize(const RestartConfig& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.ioConfig(), comm) +
packSize(data.timeMap(), comm) +
return packSize(data.timeMap(), comm) +
packSize(data.getFirstRestartStep(), comm) +
packSize(data.writeInitialRst(), comm) +
packSize(data.restartSchedule(), comm) +
@ -1754,6 +1753,7 @@ std::size_t packSize(const Schedule& data,
packSizeDynState(data.getActions(), comm) +
packSize(data.rftConfig(), comm) +
packSize(data.getNupCol(), comm) +
packSize(data.restart(), comm) +
packSize(data.getWellGroupEvents(), comm);
}
@ -1913,7 +1913,7 @@ std::size_t packSize(const EclipseConfig& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.init(), comm) +
packSize(data.restart(), comm);
packSize(data.io(), comm);
}
std::size_t packSize(const TransMult& data,
@ -2387,7 +2387,6 @@ void pack(const TimeMap& data, std::vector<char>& buffer, int& position,
void pack(const RestartConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.ioConfig(), buffer, position, comm);
pack(data.timeMap(), buffer, position, comm);
pack(data.getFirstRestartStep(), buffer, position, comm);
pack(data.writeInitialRst(), buffer, position, comm);
@ -3531,6 +3530,7 @@ void pack(const Schedule& data,
packDynState(data.getActions(), buffer, position, comm);
pack(data.rftConfig(), buffer, position, comm);
pack(data.getNupCol(), buffer, position, comm);
pack(data.restart(), buffer, position, comm);
pack(data.getWellGroupEvents(), buffer, position, comm);
}
@ -3707,7 +3707,7 @@ void pack(const EclipseConfig& data,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.init(), buffer, position, comm);
pack(data.restart(), buffer, position, comm);
pack(data.io(), buffer, position, comm);
}
void pack(const TransMult& data,
@ -4319,21 +4319,19 @@ void unpack(TimeMap& data, std::vector<char>& buffer, int& position,
void unpack(RestartConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
IOConfig ioConfig;
TimeMap timemap;
int firstRstStep;
bool writeInitialRst;
DynamicState<RestartSchedule> restart_sched;
DynamicState<std::map<std::string,int>> restart_keyw;
std::vector<bool> save_keyw;
unpack(ioConfig, buffer, position, comm);
unpack(timemap, buffer, position, comm);
unpack(firstRstStep, buffer, position, comm);
unpack(writeInitialRst, buffer, position, comm);
unpack(restart_sched, buffer, position, comm);
unpack(restart_keyw, buffer, position, comm);
unpack(save_keyw, buffer, position, comm);
data = RestartConfig(ioConfig, timemap, firstRstStep, writeInitialRst, restart_sched,
data = RestartConfig(timemap, firstRstStep, writeInitialRst, restart_sched,
restart_keyw, save_keyw);
}
@ -6053,6 +6051,7 @@ void unpack(Schedule& data, std::vector<char>& buffer, int& position,
DynamicState<std::shared_ptr<Action::Actions>> actions;
RFTConfig rftConfig;
DynamicState<int> nupCol;
RestartConfig restartConfig;
std::map<std::string,Events> wellGroupEvents;
unpack(timeMap, buffer, position, comm);
@ -6078,13 +6077,14 @@ void unpack(Schedule& data, std::vector<char>& buffer, int& position,
unpack(rftConfig, buffer, position, comm);
unpack(nupCol, buffer, position, comm);
unpack(restartConfig, buffer, position, comm);
unpack(wellGroupEvents, buffer, position, comm);
data = Schedule(timeMap, staticWells, groups, oilVapProps, events,
modifierDeck, tuning, messageLimits, runspec,
vfpProdTables, vfpInjTables, wellTestConfig,
wListManager, udqConfig, udqActive, guideRateConfig,
gconSale, gconSump, globalWhistCtlMode, actions,
rftConfig, nupCol, wellGroupEvents);
rftConfig, nupCol, restartConfig, wellGroupEvents);
}
void unpack(BrineDensityTable& data, std::vector<char>& buffer, int& position,
@ -6323,11 +6323,11 @@ void unpack(EclipseConfig& data,
Dune::MPIHelper::MPICommunicator comm)
{
InitConfig init;
RestartConfig restart;
IOConfig io;
unpack(init, buffer, position, comm);
unpack(restart, buffer, position, comm);
data = EclipseConfig(init, restart);
unpack(io, buffer, position, comm);
data = EclipseConfig(init, io);
}
void unpack(TransMult& data,

View File

@ -1251,7 +1251,7 @@ namespace Opm {
computeAverageFormationFactor(B_avg);
const Opm::SummaryConfig& summaryConfig = ebosSimulator_.vanguard().summaryConfig();
const bool write_restart_file = ebosSimulator_.vanguard().eclState().getRestartConfig().getWriteRestartFile(reportStepIdx);
const bool write_restart_file = ebosSimulator_.vanguard().schedule().restart().getWriteRestartFile(reportStepIdx);
int exception_thrown = 0;
try {
for (const auto& well : well_container_) {

View File

@ -250,6 +250,17 @@ Opm::TimeMap getTimeMap()
return Opm::TimeMap({123});
}
Opm::RestartConfig getRestartConfig()
{
Opm::DynamicState<Opm::RestartSchedule> rsched({Opm::RestartSchedule(1, 2, 3)}, 2);
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
Opm::IOConfig io(true, false, true, false, false, true, "test1", true,
"test2", true, "test3", false);
return Opm::RestartConfig(getTimeMap(), 1, true, rsched, rkw, {false, true});
}
Opm::PvtgTable getPvtgTable()
{
return Opm::PvtgTable(Opm::ColumnSchema("test1", Opm::Table::INCREASING,
@ -804,7 +815,7 @@ BOOST_AUTO_TEST_CASE(RestartConfig)
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
Opm::IOConfig io(true, false, true, false, false, true, "test1", true,
"test2", true, "test3", false);
Opm::RestartConfig val1(io, getTimeMap(), 1, true, rsched, rkw, {false, true});
Opm::RestartConfig val1(getTimeMap(), 1, true, rsched, rkw, {false, true});
auto val2 = PackUnpack(val1);
DO_CHECKS(RestartConfig)
#endif
@ -2201,6 +2212,7 @@ BOOST_AUTO_TEST_CASE(Schedule)
{{std::make_shared<Opm::Action::Actions>(acnts)}, 1},
rftc,
{std::vector<int>{1}, 1},
getRestartConfig(),
{{"test", events}});
auto val2 = PackUnpack(val1);
@ -2307,10 +2319,7 @@ BOOST_AUTO_TEST_CASE(EclipseConfig)
Opm::InitConfig init(Opm::Equil({getEquilRecord(), getEquilRecord()}),
Opm::FoamConfig({getFoamData(), getFoamData()}),
true, true, true, 20, "test1");
Opm::DynamicState<Opm::RestartSchedule> rsched({Opm::RestartSchedule(1, 2, 3)}, 2);
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
Opm::RestartConfig restart(io, getTimeMap(), 1, true, rsched, rkw, {false, true});
Opm::EclipseConfig val1{init, restart};
Opm::EclipseConfig val1{init, io};
auto val2 = PackUnpack(val1);
DO_CHECKS(EclipseConfig)

View File

@ -279,7 +279,7 @@ BOOST_AUTO_TEST_CASE( Test_Norne_PVT) {
auto deck = parser.parseFile("norne_pvt.data", parseContext, errorGuard);
Opm::EclipseState eclState(deck, parseContext, errorGuard);
Opm::EclipseState eclState(deck);
verify_norne_oil_pvt_region1( deck, eclState );
verify_norne_oil_pvt_region2( deck, eclState );

View File

@ -35,11 +35,9 @@
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/simulators/wells/VFPHelpers.hpp>
#include <opm/simulators/wells/VFPProdProperties.hpp>
@ -591,12 +589,7 @@ VFPPROD \n\
auto units = Opm::UnitSystem::newFIELD();
Opm::Parser parser;
auto deck = parser.parseString(table_str);
BOOST_REQUIRE(deck.hasKeyword("VFPPROD"));
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable table(deck.getKeyword("VFPPROD", 0), units);
Opm::VFPProdProperties properties(&table);
const int n = 5; //Number of points to check per axis
@ -653,7 +646,6 @@ BOOST_AUTO_TEST_CASE(ParseInterpolateRealisticVFPPROD)
Opm::filesystem::path file("VFPPROD2");
auto deck = parser.parseFile(file.string());
Opm::checkDeck(deck, parser, parseContext, errorGuard);
BOOST_REQUIRE(deck.hasKeyword("VFPPROD"));
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);