Merge pull request #2703 from joakim-hove/restartvalue-add-group

Add data::GroupValues member to RestartValue
This commit is contained in:
Bård Skaflestad 2020-07-05 19:31:27 +02:00 committed by GitHub
commit fef0c7c03f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 12 deletions

View File

@ -343,6 +343,7 @@ public:
// output using eclWriter if enabled // output using eclWriter if enabled
auto localWellData = simulator_.problem().wellModel().wellData(); auto localWellData = simulator_.problem().wellModel().wellData();
auto localGroupData = simulator_.problem().wellModel().groupData(reportStepNum, simulator_.vanguard().schedule());
Opm::data::Solution localCellData = {}; Opm::data::Solution localCellData = {};
if (! isSubStep) { if (! isSubStep) {
@ -353,16 +354,14 @@ public:
} }
if (collectToIORank_.isParallel()) { if (collectToIORank_.isParallel()) {
const auto localGroupData = simulator_.problem().wellModel()
.groupData(reportStepNum, simulator_.vanguard().schedule());
collectToIORank_.collect(localCellData, eclOutputModule_.getBlockData(), localWellData, localGroupData); collectToIORank_.collect(localCellData, eclOutputModule_.getBlockData(), localWellData, localGroupData);
} }
if (this->collectToIORank_.isIORank()) { if (this->collectToIORank_.isIORank()) {
this->writeOutput(reportStepNum, isSubStep, this->writeOutput(reportStepNum, isSubStep,
std::move(localCellData), std::move(localCellData),
std::move(localWellData)); std::move(localWellData),
std::move(localGroupData));
} }
} }
@ -719,10 +718,11 @@ private:
} }
} }
void writeOutput(const int reportStepNum, void writeOutput(const int reportStepNum,
const bool isSubStep, const bool isSubStep,
::Opm::data::Solution&& localCellData, ::Opm::data::Solution&& localCellData,
::Opm::data::Wells&& localWellData) ::Opm::data::Wells&& localWellData,
::Opm::data::GroupValues&& localGroupData)
{ {
const Scalar curTime = simulator_.time() + simulator_.timeStepSize(); const Scalar curTime = simulator_.time() + simulator_.timeStepSize();
const Scalar nextStepSize = simulator_.problem().nextTimeStepSize(); const Scalar nextStepSize = simulator_.problem().nextTimeStepSize();
@ -733,7 +733,10 @@ private:
: std::move(localCellData), : std::move(localCellData),
isParallel ? this->collectToIORank_.globalWellData() isParallel ? this->collectToIORank_.globalWellData()
: std::move(localWellData) : std::move(localWellData),
isParallel ? this->collectToIORank_.globalGroupData()
: std::move(localGroupData)
}; };
if (simulator_.vanguard().eclState().getSimulationConfig().useThresholdPressure()) { if (simulator_.vanguard().eclState().getSimulationConfig().useThresholdPressure()) {

View File

@ -826,7 +826,8 @@ RestartValue loadParallelRestart(const EclipseIO* eclIO, Action::State& actionSt
#if HAVE_MPI #if HAVE_MPI
data::Solution sol; data::Solution sol;
data::Wells wells; data::Wells wells;
RestartValue restartValues(sol, wells); data::GroupValues groups;
RestartValue restartValues(sol, wells, groups);
if (eclIO) if (eclIO)
{ {

View File

@ -403,6 +403,7 @@ namespace Opm {
// convert well data from opm-common to well state from opm-core // convert well data from opm-common to well state from opm-core
void wellsToState( const data::Wells& wells, void wellsToState( const data::Wells& wells,
const data::GroupValues& groups,
const PhaseUsage& phases, const PhaseUsage& phases,
const bool handle_ms_well, const bool handle_ms_well,
WellStateFullyImplicitBlackoil& state ) const; WellStateFullyImplicitBlackoil& state ) const;

View File

@ -545,7 +545,7 @@ namespace Opm {
const size_t numCells = Opm::UgGridHelpers::numCells(grid()); const size_t numCells = Opm::UgGridHelpers::numCells(grid());
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal()); 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 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_; previous_well_state_ = well_state_;
@ -1597,6 +1597,7 @@ namespace Opm {
void void
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
wellsToState( const data::Wells& wells, wellsToState( const data::Wells& wells,
const data::GroupValues& groups,
const PhaseUsage& phases, const PhaseUsage& phases,
const bool handle_ms_well, const bool handle_ms_well,
WellStateFullyImplicitBlackoil& state) const WellStateFullyImplicitBlackoil& state) const

View File

@ -320,8 +320,9 @@ BOOST_AUTO_TEST_CASE(RestartKey)
BOOST_AUTO_TEST_CASE(RestartValue) BOOST_AUTO_TEST_CASE(RestartValue)
{ {
Opm::data::WellRates wells1; Opm::data::WellRates wells1;
Opm::data::GroupValues groups1;
wells1.insert({"test_well", getWell()}); wells1.insert({"test_well", getWell()});
Opm::RestartValue val1(getSolution(), wells1); Opm::RestartValue val1(getSolution(), wells1, groups1);
auto val2 = PackUnpack(val1); auto val2 = PackUnpack(val1);
DO_CHECKS(RestartValue) DO_CHECKS(RestartValue)
} }