From 8b4c5c81cbe732dd61d0749741bee0aa955461d6 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 22 Jan 2020 12:48:27 +0100 Subject: [PATCH 1/3] update InitConfig serialization new member for gravity was added --- opm/simulators/utils/ParallelRestart.cpp | 9 ++++++--- tests/test_ParallelRestart.cpp | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index a3598e370..04316e113 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -591,6 +591,7 @@ std::size_t packSize(const InitConfig& data, Dune::MPIHelper::MPICommunicator co return packSize(data.getEquil(), comm) + packSize(data.getFoamConfig(), comm) + packSize(data.filleps(), comm) + + packSize(data.hasGravity(), comm) + packSize(data.restartRequested(), comm) + packSize(data.getRestartStep(), comm) + packSize(data.getRestartRootName(), comm); @@ -2398,6 +2399,7 @@ void pack(const InitConfig& data, std::vector& buffer, int& position, pack(data.getEquil(), buffer, position, comm); pack(data.getFoamConfig(), buffer, position, comm); pack(data.filleps(), buffer, position, comm); + pack(data.hasGravity(), buffer, position, comm); pack(data.restartRequested(), buffer, position, comm); pack(data.getRestartStep(), buffer, position, comm); pack(data.getRestartRootName(), buffer, position, comm); @@ -4379,17 +4381,18 @@ void unpack(InitConfig& data, std::vector& buffer, int& position, { Equil equil; FoamConfig foam; - bool filleps, restartRequested; + bool filleps, hasGravity, restartRequested; int restartStep; std::string restartRootName; unpack(equil, buffer, position, comm); unpack(foam, buffer, position, comm); unpack(filleps, buffer, position, comm); + unpack(hasGravity, buffer, position, comm); unpack(restartRequested, buffer, position, comm); unpack(restartStep, buffer, position, comm); unpack(restartRootName, buffer, position, comm); - data = InitConfig(equil, foam, filleps, restartRequested, - restartStep, restartRootName); + data = InitConfig(equil, foam, filleps, hasGravity, + restartRequested, restartStep, restartRootName); } void unpack(SimulationConfig& data, std::vector& buffer, int& position, diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 04e58f085..ebe8ed018 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -758,7 +758,7 @@ BOOST_AUTO_TEST_CASE(InitConfig) #if HAVE_MPI Opm::InitConfig val1(Opm::Equil({getEquilRecord(), getEquilRecord()}), Opm::FoamConfig({getFoamData(), getFoamData()}), - true, true, 20, "test1"); + true, true, true, 20, "test1"); auto val2 = PackUnpack(val1); BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2)); BOOST_CHECK(val1 == std::get<0>(val2)); @@ -2453,7 +2453,7 @@ BOOST_AUTO_TEST_CASE(EclipseConfig) "test2", true, "test3", false); Opm::InitConfig init(Opm::Equil({getEquilRecord(), getEquilRecord()}), Opm::FoamConfig({getFoamData(), getFoamData()}), - true, true, 20, "test1"); + true, true, true, 20, "test1"); Opm::DynamicState rsched({Opm::RestartSchedule(1, 2, 3)}, 2); Opm::DynamicState> rkw({{{"test",3}}}, 3); Opm::RestartConfig restart(getTimeMap(), 1, true, rsched, rkw, {false, true}); From 7f9f65811fef0e98f1579dcd3482009a418f22d4 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 22 Jan 2020 10:31:23 +0100 Subject: [PATCH 2/3] changed: avoid deck usage on non-root processes setting up gravity this is achieved by using the InitConfig member from EclipseState instead --- ebos/eclproblem.hh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index f0b80d442..32a15225b 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -666,10 +666,9 @@ public: // disables gravity, else the standard value of the gravity constant at sea level // on earth is used this->gravity_ = 0.0; - const auto& deck = simulator.vanguard().deck(); if (EWOMS_GET_PARAM(TypeTag, bool, EnableGravity)) this->gravity_[dim - 1] = 9.80665; - if (deck.hasKeyword("NOGRAV")) + if (!eclState.getInitConfig().hasGravity()) this->gravity_[dim - 1] = 0.0; if (enableTuning_) { From b7a2612ecf9b2e70a74a67acd36d304b4fd6661b Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 22 Jan 2020 11:45:03 +0100 Subject: [PATCH 3/3] avoid deck usage on non-root processes checking for EQUIL this is achieved by using the InitConfig member from EclipseState instead --- ebos/eclproblem.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 32a15225b..80b0e2fb0 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -2466,12 +2466,12 @@ private: { const auto& simulator = this->simulator(); const auto& vanguard = simulator.vanguard(); + const auto& eclState = vanguard.eclState(); - const auto& deck = vanguard.deck(); - if (!deck.hasKeyword("EQUIL")) - readExplicitInitialCondition_(); - else + if (eclState.getInitConfig().hasEquil()) readEquilInitialCondition_(); + else + readExplicitInitialCondition_(); readBlackoilExtentionsInitialConditions_();