Add Events member to SingleWellState

This commit is contained in:
Joakim Hove 2021-08-04 10:08:31 +02:00
parent 379e938ee1
commit c381459804
4 changed files with 6 additions and 16 deletions

View File

@ -612,7 +612,7 @@ namespace Opm {
if (this->wellTestState_.hasWellClosed(well_name)) {
// TODO: more checking here, to make sure this standard more specific and complete
// maybe there is some WCON keywords will not open the well
auto& events = this->wellState().events(w);
auto& events = this->wellState().well(w).events;
if (events.hasEvent(WellState::event_mask)) {
if (wellTestState_.lastTestTime(well_name) == ebosSimulator_.time()) {
// The well was shut this timestep, we are most likely retrying
@ -1424,7 +1424,7 @@ namespace Opm {
if (!well->isOperable() ) continue;
auto& events = this->wellState().events(well->indexOfWell());
auto& events = this->wellState().well(well->indexOfWell()).events;
if (events.hasEvent(WellState::event_mask)) {
well->updateWellStateWithTarget(ebosSimulator_, this->groupState(), this->wellState(), deferred_logger);
// There is no new well control change input within a report step,

View File

@ -21,6 +21,7 @@
#define OPM_SINGLE_WELL_STATE_HEADER_INCLUDED
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
namespace Opm {
@ -33,6 +34,7 @@ public:
double bhp{0};
double thp{0};
double temperature{};
Events events;
void init_timestep(const SingleWellState& other);
void shut();

View File

@ -257,15 +257,12 @@ void WellState::init(const std::vector<double>& cellPressures,
well_dissolved_gas_rates_.clear();
well_vaporized_oil_rates_.clear();
this->events_.clear();
{
const auto& wg_events = schedule[report_step].wellgroup_events();
for (const auto& ecl_well : wells_ecl) {
const auto& wname = ecl_well.name();
if (wg_events.has(wname))
this->events_.add( wname, wg_events.at(wname) );
else
this->events_.add( wname, Events() );
this->well(wname).events = wg_events.at(wname);
}
}
@ -363,7 +360,7 @@ void WellState::init(const std::vector<double>& cellPressures,
continue;
// If new target is set using WCONPROD, WCONINJE etc. we use the new control
if (!this->events_[w].hasEvent(WellState::event_mask)) {
if (!new_well.events.hasEvent(WellState::event_mask)) {
current_injection_controls_[ newIndex ] = prevState->currentInjectionControl(oldIndex);
current_production_controls_[ newIndex ] = prevState->currentProductionControl(oldIndex);
}

View File

@ -148,10 +148,6 @@ public:
static void calculateSegmentRates(const std::vector<std::vector<int>>& segment_inlets, const std::vector<std::vector<int>>&segment_perforations,
const std::vector<double>& perforation_rates, const int np, const int segment, std::vector<double>& segment_rates);
Events& events(std::size_t well_index) {
return this->events_[well_index];
}
/// One rate pr well
double solventWellRate(const int w) const;
@ -393,11 +389,6 @@ private:
// should be zero for injection wells
WellContainer<double> well_vaporized_oil_rates_;
// some events happens to the well, like this well is a new well
// or new well control keywords happens
// \Note: for now, only WCON* keywords, and well status change is considered
WellContainer<Events> events_;
WellContainer<SegmentState> segment_state;
// Productivity Index