mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move guideRateUpdateIsNeeded into BlackoilWellModelGuideRates
This commit is contained in:
parent
d42cdd409b
commit
9f78e0454d
@ -1191,33 +1191,4 @@ runWellPIScaling(const int timeStepIdx,
|
|||||||
this->last_run_wellpi_ = timeStepIdx;
|
this->last_run_wellpi_ = timeStepIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BlackoilWellModelGeneric::
|
|
||||||
guideRateUpdateIsNeeded(const int reportStepIdx) const {
|
|
||||||
auto need_update =
|
|
||||||
std::any_of(this->well_container_generic_.begin(),
|
|
||||||
this->well_container_generic_.end(),
|
|
||||||
[](const WellInterfaceGeneric* well)
|
|
||||||
{
|
|
||||||
return well->changedToOpenThisStep();
|
|
||||||
});
|
|
||||||
if (!need_update && this->report_step_starts_) {
|
|
||||||
const auto& events = this->schedule()[reportStepIdx].wellgroup_events();
|
|
||||||
constexpr auto effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE
|
|
||||||
+ ScheduleEvents::INJECTION_TYPE_CHANGED
|
|
||||||
+ ScheduleEvents::WELL_SWITCHED_INJECTOR_PRODUCER
|
|
||||||
+ ScheduleEvents::NEW_WELL;
|
|
||||||
|
|
||||||
need_update = std::any_of(this->well_container_generic_.begin(),
|
|
||||||
this->well_container_generic_.end(),
|
|
||||||
[&events](const WellInterfaceGeneric* well)
|
|
||||||
{
|
|
||||||
return events.hasEvent(well->name(), effective_events_mask);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this->comm_.max(static_cast<int>(need_update));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -320,8 +320,6 @@ protected:
|
|||||||
const SummaryConfig& summaryConfig,
|
const SummaryConfig& summaryConfig,
|
||||||
DeferredLogger& deferred_logger);
|
DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
bool guideRateUpdateIsNeeded(const int reportStepIdx) const;
|
|
||||||
|
|
||||||
// create the well container
|
// create the well container
|
||||||
virtual void createWellContainer(const int time_step) = 0;
|
virtual void createWellContainer(const int time_step) = 0;
|
||||||
virtual void initWellContainer(const int reportStepIdx) = 0;
|
virtual void initWellContainer(const int reportStepIdx) = 0;
|
||||||
|
@ -569,5 +569,30 @@ assignGroupGuideRates(const Group& group,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BlackoilWellModelGuideRates::
|
||||||
|
guideRateUpdateIsNeeded(const int reportStepIdx) const
|
||||||
|
{
|
||||||
|
const auto& genWells = wellModel_.genericWells();
|
||||||
|
auto need_update =
|
||||||
|
std::any_of(genWells.begin(), genWells.end(),
|
||||||
|
[](const WellInterfaceGeneric* well)
|
||||||
|
{
|
||||||
|
return well->changedToOpenThisStep();
|
||||||
|
});
|
||||||
|
if (!need_update && wellModel_.reportStepStarts()) {
|
||||||
|
const auto& events = wellModel_.schedule()[reportStepIdx].wellgroup_events();
|
||||||
|
constexpr auto effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE
|
||||||
|
+ ScheduleEvents::INJECTION_TYPE_CHANGED
|
||||||
|
+ ScheduleEvents::WELL_SWITCHED_INJECTOR_PRODUCER
|
||||||
|
+ ScheduleEvents::NEW_WELL;
|
||||||
|
|
||||||
|
need_update = std::any_of(genWells.begin(), genWells.end(),
|
||||||
|
[&events](const WellInterfaceGeneric* well)
|
||||||
|
{
|
||||||
|
return events.hasEvent(well->name(), effective_events_mask);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return wellModel_.comm().max(static_cast<int>(need_update));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -62,6 +62,9 @@ public:
|
|||||||
const std::unordered_map<std::string, data::GroupGuideRates>& groupGuideRates,
|
const std::unordered_map<std::string, data::GroupGuideRates>& groupGuideRates,
|
||||||
data::GroupData& gdata) const;
|
data::GroupData& gdata) const;
|
||||||
|
|
||||||
|
//! \brief Check if a guide rate update is needed.
|
||||||
|
bool guideRateUpdateIsNeeded(const int reportStepIdx) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief Obtain guide rate values.
|
//! \brief Obtain guide rate values.
|
||||||
void getGuideRateValues(const GuideRate::RateVector& qs,
|
void getGuideRateValues(const GuideRate::RateVector& qs,
|
||||||
|
@ -918,7 +918,8 @@ namespace Opm {
|
|||||||
|
|
||||||
//update guide rates
|
//update guide rates
|
||||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||||
if (alq_updated || guideRateUpdateIsNeeded(reportStepIdx)) {
|
if (alq_updated || BlackoilWellModelGuideRates(*this).
|
||||||
|
guideRateUpdateIsNeeded(reportStepIdx)) {
|
||||||
const double simulationTime = ebosSimulator_.time();
|
const double simulationTime = ebosSimulator_.time();
|
||||||
const auto& comm = ebosSimulator_.vanguard().grid().comm();
|
const auto& comm = ebosSimulator_.vanguard().grid().comm();
|
||||||
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
||||||
|
Loading…
Reference in New Issue
Block a user