From b9b1e734cbe9b094ad0e2bdc963bbdb523a40ca8 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 3 Jul 2020 17:20:06 +0200 Subject: [PATCH] Add data::GroupValues member to RestartValue --- ebos/eclwriter.hh | 21 +++++++++++-------- opm/simulators/utils/ParallelRestart.cpp | 3 ++- opm/simulators/wells/BlackoilWellModel.hpp | 1 + .../wells/BlackoilWellModel_impl.hpp | 3 ++- tests/test_ParallelRestart.cpp | 3 ++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index 6e87d0775..e35320918 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -343,6 +343,7 @@ public: // output using eclWriter if enabled auto localWellData = simulator_.problem().wellModel().wellData(); + auto localGroupData = simulator_.problem().wellModel().groupData(reportStepNum, simulator_.vanguard().schedule()); Opm::data::Solution localCellData = {}; if (! isSubStep) { @@ -353,16 +354,14 @@ public: } if (collectToIORank_.isParallel()) { - const auto localGroupData = simulator_.problem().wellModel() - .groupData(reportStepNum, simulator_.vanguard().schedule()); - collectToIORank_.collect(localCellData, eclOutputModule_.getBlockData(), localWellData, localGroupData); } if (this->collectToIORank_.isIORank()) { this->writeOutput(reportStepNum, isSubStep, std::move(localCellData), - std::move(localWellData)); + std::move(localWellData), + std::move(localGroupData)); } } @@ -719,10 +718,11 @@ private: } } - void writeOutput(const int reportStepNum, - const bool isSubStep, - ::Opm::data::Solution&& localCellData, - ::Opm::data::Wells&& localWellData) + void writeOutput(const int reportStepNum, + const bool isSubStep, + ::Opm::data::Solution&& localCellData, + ::Opm::data::Wells&& localWellData, + ::Opm::data::GroupValues&& localGroupData) { const Scalar curTime = simulator_.time() + simulator_.timeStepSize(); const Scalar nextStepSize = simulator_.problem().nextTimeStepSize(); @@ -733,7 +733,10 @@ private: : std::move(localCellData), isParallel ? this->collectToIORank_.globalWellData() - : std::move(localWellData) + : std::move(localWellData), + + isParallel ? this->collectToIORank_.globalGroupData() + : std::move(localGroupData) }; if (simulator_.vanguard().eclState().getSimulationConfig().useThresholdPressure()) { diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index fb4745a61..d48dbeceb 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -826,7 +826,8 @@ RestartValue loadParallelRestart(const EclipseIO* eclIO, Action::State& actionSt #if HAVE_MPI data::Solution sol; data::Wells wells; - RestartValue restartValues(sol, wells); + data::GroupValues groups; + RestartValue restartValues(sol, wells, groups); if (eclIO) { diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index f9f55864a..4ca3a4d68 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -403,6 +403,7 @@ namespace Opm { // convert well data from opm-common to well state from opm-core void wellsToState( const data::Wells& wells, + const data::GroupValues& groups, const PhaseUsage& phases, const bool handle_ms_well, WellStateFullyImplicitBlackoil& state ) const; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 6974b43e1..87e5d032d 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -545,7 +545,7 @@ namespace Opm { const size_t numCells = Opm::UgGridHelpers::numCells(grid()); const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal()); well_state_.resize(wells_ecl_, schedule(), handle_ms_well, numCells, phaseUsage, well_perf_data_, summaryState, globalNumWells); // Resize for restart step - wellsToState(restartValues.wells, phaseUsage, handle_ms_well, well_state_); + wellsToState(restartValues.wells, restartValues.groups, phaseUsage, handle_ms_well, well_state_); } previous_well_state_ = well_state_; @@ -1597,6 +1597,7 @@ namespace Opm { void BlackoilWellModel:: wellsToState( const data::Wells& wells, + const data::GroupValues& groups, const PhaseUsage& phases, const bool handle_ms_well, WellStateFullyImplicitBlackoil& state) const diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index f987b4516..6bc7d776a 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -320,8 +320,9 @@ BOOST_AUTO_TEST_CASE(RestartKey) BOOST_AUTO_TEST_CASE(RestartValue) { Opm::data::WellRates wells1; + Opm::data::GroupValues groups1; wells1.insert({"test_well", getWell()}); - Opm::RestartValue val1(getSolution(), wells1); + Opm::RestartValue val1(getSolution(), wells1, groups1); auto val2 = PackUnpack(val1); DO_CHECKS(RestartValue) }