mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-11-03 12:47:42 -06:00
WellModel: make a copy of events at start of time step
these can be modified during sub-stepping, and the wcycle code needs the original events for decision making
This commit is contained in:
1 parent
0ef839d44a
commit
787c6cf3ae
3 files changed
+14
-11
No files matched your search
@@ -425,7 +425,9 @@ public:
|
||||
wmatcher,
|
||||
this->wellModel_().wellOpenTimes(),
|
||||
this->wellModel_().wellCloseTimes(),
|
||||
[timeStep, &wg_events = schedule[reportStep].wellgroup_events()](const std::string& name)
|
||||
[timeStep,
|
||||
&wg_events = this->wellModel_().reportStepStartEvents()]
|
||||
(const std::string& name)
|
||||
{
|
||||
if (timeStep != 0) {
|
||||
return false;
|
||||
|
||||
@@ -226,6 +226,7 @@ public:
|
||||
|
||||
const std::map<std::string, double>& wellOpenTimes() const { return well_open_times_; }
|
||||
const std::map<std::string, double>& wellCloseTimes() const { return well_close_times_; }
|
||||
const WellGroupEvents& reportStepStartEvents() const { return report_step_start_events_; }
|
||||
|
||||
std::vector<int> getCellsForConnections(const Well& well) const;
|
||||
|
||||
@@ -523,6 +524,7 @@ protected:
|
||||
WGState<Scalar> active_wgstate_;
|
||||
WGState<Scalar> last_valid_wgstate_;
|
||||
WGState<Scalar> nupcol_wgstate_;
|
||||
WellGroupEvents report_step_start_events_; //!< Well group events at start of report step
|
||||
|
||||
bool wellStructureChangedDynamically_{false};
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace Opm {
|
||||
DeferredLogger local_deferredLogger{};
|
||||
|
||||
this->report_step_starts_ = true;
|
||||
|
||||
this->report_step_start_events_ = this->schedule()[timeStepIdx].wellgroup_events();
|
||||
|
||||
this->rateConverter_ = std::make_unique<RateConverterType>
|
||||
(this->phase_usage_, std::vector<int>(this->local_num_cells_, 0));
|
||||
@@ -790,12 +790,13 @@ namespace Opm {
|
||||
if (nw > 0) {
|
||||
well_container_.reserve(nw);
|
||||
|
||||
const auto& wg_events = this->schedule()[report_step].wellgroup_events();
|
||||
const auto& wmatcher = this->schedule().wellMatcher(report_step);
|
||||
const auto& wcycle = this->schedule()[report_step].wcycle.get();
|
||||
|
||||
// First loop and check for status changes. This is necessary
|
||||
// as wcycle needs the updated open/close times.
|
||||
std::for_each(this->wells_ecl_.begin(), this->wells_ecl_.end(),
|
||||
[this, &wg_events](const auto& well_ecl)
|
||||
[this, &wg_events = this->report_step_start_events_](const auto& well_ecl)
|
||||
{
|
||||
if (!well_ecl.hasConnections()) {
|
||||
// No connections in this well. Nothing to do.
|
||||
@@ -820,9 +821,6 @@ namespace Opm {
|
||||
}
|
||||
});
|
||||
|
||||
const auto& wmatcher = this->schedule().wellMatcher(report_step);
|
||||
const auto& wcycle = this->schedule()[report_step].wcycle.get();
|
||||
|
||||
// Grab wcycle states. This needs to run before the schedule gets processed
|
||||
const auto cycle_states = wcycle.wellStatus(this->simulator_.time(),
|
||||
wmatcher,
|
||||
@@ -947,10 +945,11 @@ namespace Opm {
|
||||
}
|
||||
|
||||
if (!wcycle.empty()) {
|
||||
auto schedule_open = [&wg_events](const std::string& name)
|
||||
{
|
||||
return wg_events.hasEvent(name, ScheduleEvents::REQUEST_OPEN_WELL);
|
||||
};
|
||||
const auto schedule_open =
|
||||
[&wg_events = this->report_step_start_events_](const std::string& name)
|
||||
{
|
||||
return wg_events.hasEvent(name, ScheduleEvents::REQUEST_OPEN_WELL);
|
||||
};
|
||||
for (const auto& [wname, wscale] : wcycle.efficiencyScale(this->simulator_.time(),
|
||||
this->simulator_.timeStepSize(),
|
||||
wmatcher,
|
||||
|
||||
Reference in new issue
Block a user