diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 96431bbed..3c75712aa 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -398,7 +398,7 @@ namespace Opm { void updateWellControls(Opm::DeferredLogger& deferred_logger, const bool checkGroupControls); - void updateAndCommunicateGroupData(Opm::DeferredLogger& deferred_logger); + void updateAndCommunicateGroupData(); void updateNetworkPressures(); // setting the well_solutions_ based on well_state. diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 41a269e98..9275ce0f3 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -306,7 +306,7 @@ namespace Opm { well_state_ = previous_well_state_; well_state_.disableGliftOptimization(); - updateAndCommunicateGroupData(local_deferredLogger); + updateAndCommunicateGroupData(); const int reportStepIdx = ebosSimulator_.episodeIndex(); const double simulationTime = ebosSimulator_.time(); std::string exc_msg; @@ -390,9 +390,15 @@ namespace Opm { } } - //compute well guideRates + //update guide rates const auto& comm = ebosSimulator_.vanguard().grid().comm(); + const auto& summaryState = ebosSimulator_.vanguard().summaryState(); + std::vector pot(numPhases(), 0.0); + const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx); + WellGroupHelpers::updateGuideRateForProductionGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, well_state_, comm, guideRate_.get(), pot); + WellGroupHelpers::updateGuideRatesForInjectionGroups(fieldGroup, schedule(), summaryState, phase_usage_, reportStepIdx, well_state_, guideRate_.get(), local_deferredLogger); WellGroupHelpers::updateGuideRatesForWells(schedule(), phase_usage_, reportStepIdx, simulationTime, well_state_, comm, guideRate_.get()); + try { // Compute initial well solution for new wells and injectors that change injection type i.e. WAG. for (auto& well : well_container_) { @@ -1318,7 +1324,7 @@ namespace Opm { // For no well active globally we simply return. if( !wellsActive() ) return ; - updateAndCommunicateGroupData(deferred_logger); + updateAndCommunicateGroupData(); updateNetworkPressures(); @@ -1332,7 +1338,7 @@ namespace Opm { // Check group's constraints from higher levels. updateGroupHigherControls(deferred_logger, switched_groups); - updateAndCommunicateGroupData(deferred_logger); + updateAndCommunicateGroupData(); // Check wells' group constraints and communicate. for (const auto& well : well_container_) { @@ -1342,7 +1348,7 @@ namespace Opm { switched_wells.insert(well->name()); } } - updateAndCommunicateGroupData(deferred_logger); + updateAndCommunicateGroupData(); } // Check individual well constraints and communicate. @@ -1353,7 +1359,7 @@ namespace Opm { const auto mode = WellInterface::IndividualOrGroup::Individual; well->updateWellControl(ebosSimulator_, mode, well_state_, deferred_logger); } - updateAndCommunicateGroupData(deferred_logger); + updateAndCommunicateGroupData(); } @@ -1396,7 +1402,7 @@ namespace Opm { template void BlackoilWellModel:: - updateAndCommunicateGroupData(Opm::DeferredLogger& deferred_logger) + updateAndCommunicateGroupData() { const int reportStepIdx = ebosSimulator_.episodeIndex(); const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx); @@ -1420,13 +1426,6 @@ namespace Opm { std::vector groupTargetReductionInj(numPhases(), 0.0); WellGroupHelpers::updateGroupTargetReduction(fieldGroup, schedule(), reportStepIdx, /*isInjector*/ true, phase_usage_, *guideRate_, well_state_nupcol_, well_state_, groupTargetReductionInj); - // the guiderate update should not be part of this function - // remove in seperate PR since it affects existing functionality - const double simulationTime = ebosSimulator_.time(); - std::vector pot(numPhases(), 0.0); - WellGroupHelpers::updateGuideRateForProductionGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, well_state_, comm, guideRate_.get(), pot); - WellGroupHelpers::updateGuideRatesForInjectionGroups(fieldGroup, schedule(), summaryState, phase_usage_, reportStepIdx, well_state_, guideRate_.get(), deferred_logger); - WellGroupHelpers::updateREINForGroups(fieldGroup, schedule(), reportStepIdx, phase_usage_, summaryState, well_state_nupcol_, well_state_); WellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol_, well_state_);