Merge pull request #3406 from GitPaean/new_fixing_guide_rate_update_together

[new attempt] updating the guide rates for all the wells and groups at the same time
This commit is contained in:
Bård Skaflestad 2021-06-30 12:40:45 +02:00 committed by GitHub
commit 5ddac2e8d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 5 deletions

View File

@ -322,10 +322,8 @@ namespace Opm {
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
std::vector<double> pot(numPhases(), 0.0);
const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx);
WellGroupHelpers::updateGuideRateForProductionGroups(fieldGroup, schedule(), phase_usage_, reportStepIdx, simulationTime, this->wellState(), this->groupState(), comm, &guideRate_, pot);
WellGroupHelpers::updateGuideRatesForInjectionGroups(fieldGroup, schedule(), summaryState, phase_usage_, reportStepIdx, this->wellState(), this->groupState(), &guideRate_, local_deferredLogger);
WellGroupHelpers::updateGuideRatesForWells(schedule(), phase_usage_, reportStepIdx, simulationTime, this->wellState(), comm, &guideRate_);
WellGroupHelpers::updateGuideRates(fieldGroup, schedule(), summaryState, this->phase_usage_, reportStepIdx, simulationTime,
this->wellState(), this->groupState(), comm, &this->guideRate_, pot, local_deferredLogger);
try {
// Compute initial well solution for new wells and injectors that change injection type i.e. WAG.
for (auto& well : well_container_) {

View File

@ -1306,6 +1306,27 @@ namespace WellGroupHelpers
return std::make_pair(current_rate > target_rate, scale);
}
template <class Comm>
void updateGuideRates(const Group& group,
const Schedule& schedule,
const SummaryState& summary_state,
const PhaseUsage& pu,
const int report_step,
const double sim_time,
WellState& well_state,
const GroupState& group_state,
const Comm& comm,
GuideRate* guide_rate,
std::vector<double>& pot,
Opm::DeferredLogger& deferred_logger)
{
guide_rate->updateGuideRateExpiration(sim_time, report_step);
updateGuideRateForProductionGroups(group, schedule, pu, report_step, sim_time, well_state, group_state, comm, guide_rate, pot);
updateGuideRatesForInjectionGroups(group, schedule, summary_state, pu, report_step, well_state, group_state, guide_rate, deferred_logger);
updateGuideRatesForWells(schedule, pu, report_step, sim_time, well_state, comm, guide_rate);
}
template <class Comm>
void updateGuideRateForProductionGroups(const Group& group,
const Schedule& schedule,
@ -1454,7 +1475,20 @@ namespace WellGroupHelpers
const double& simTime, \
const WellState& wellState, \
const Dune::CollectiveCommunication<__VA_ARGS__>& comm, \
GuideRate* guideRate);
GuideRate* guideRate); \
template \
void updateGuideRates<Dune::CollectiveCommunication<__VA_ARGS__>>(const Group& group, \
const Schedule& schedule, \
const SummaryState& summary_state, \
const PhaseUsage& pu, \
const int report_step, \
const double sim_time, \
WellState& well_state, \
const GroupState& group_state, \
const Dune::CollectiveCommunication<__VA_ARGS__>& comm,\
GuideRate* guide_rate, \
std::vector<double>& pot,\
Opm::DeferredLogger& deferred_logger);
#if HAVE_MPI
INSTANCE_WELLGROUP_HELPERS(MPI_Comm)

View File

@ -100,6 +100,20 @@ namespace WellGroupHelpers
GroupState& group_state,
std::vector<double>& groupTargetReduction);
template <class Comm>
void updateGuideRates(const Group& group,
const Schedule& schedule,
const SummaryState& summary_state,
const PhaseUsage& pu,
int report_step,
double sim_time,
WellState& well_state,
const GroupState& group_state,
const Comm& comm,
GuideRate* guide_rate,
std::vector<double>& pot,
Opm::DeferredLogger& deferred_logge);
template <class Comm>
void updateGuideRateForProductionGroups(const Group& group,
const Schedule& schedule,