Merge remote-tracking branch 'upstream/master' into new_numerical_aquifer

This commit is contained in:
Kai Bao 2021-03-15 12:16:09 +01:00
commit 1bd7d8775a
3 changed files with 21 additions and 29 deletions

View File

@ -208,7 +208,7 @@ namespace Opm
void SimulatorReport::fullReports(std::ostream& os) const
{
os << " Time(day) TStep(day) Assembly LSolve LSetup Update Output WellIt Lins NewtIt LinIt Conv\n";
os << " Time(day) TStep(day) Assembly LSetup LSolve Update Output WellIt Lins NewtIt LinIt Conv\n";
for (size_t i = 0; i < this->stepreports.size(); ++i) {
const SimulatorReportSingle& sr = this->stepreports[i];
os.precision(10);

View File

@ -271,26 +271,6 @@ namespace Opm {
well_state_.initWellStateMSWell(wells_ecl_, phase_usage_, &previous_well_state_);
}
const int nw = wells_ecl_.size();
for (int w = 0; w <nw; ++w) {
const auto& well = wells_ecl_[w];
const uint64_t effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE
+ ScheduleEvents::PRODUCTION_UPDATE
+ ScheduleEvents::INJECTION_UPDATE
+ ScheduleEvents::NEW_WELL;
if(!schedule()[timeStepIdx].wellgroup_events().hasEvent(well.name(), effective_events_mask))
continue;
if (well.isProducer()) {
const auto controls = well.productionControls(summaryState);
well_state_.currentProductionControls()[w] = controls.cmode;
}
else {
const auto controls = well.injectionControls(summaryState);
well_state_.currentInjectionControls()[w] = controls.cmode;
}
}
const Group& fieldGroup = schedule().getGroup("FIELD", timeStepIdx);
WellGroupHelpers::setCmodeGroup(fieldGroup, schedule(), summaryState, timeStepIdx, well_state_);
@ -403,10 +383,11 @@ namespace Opm {
const auto& comm = ebosSimulator_.vanguard().grid().comm();
WellGroupHelpers::updateGuideRatesForWells(schedule(), phase_usage_, reportStepIdx, simulationTime, well_state_, comm, guideRate_.get());
try {
// Compute initial well solution for new wells
// Compute initial well solution for new wells and injectors that change injection type i.e. WAG.
for (auto& well : well_container_) {
const uint64_t effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE
+ ScheduleEvents::NEW_WELL;
+ ScheduleEvents::INJECTION_TYPE_CHANGED
+ ScheduleEvents::NEW_WELL;
const auto& events = schedule()[reportStepIdx].wellgroup_events();
const bool event = report_step_starts_ && events.hasEvent(well->name(), effective_events_mask);

View File

@ -167,6 +167,16 @@ namespace Opm
current_injection_controls_.resize(nw);
current_production_controls_.resize(nw);
for (int w = 0; w < nw; ++w) {
if (wells_ecl[w].isProducer()) {
const auto controls = wells_ecl[w].productionControls(summary_state);
currentProductionControls()[w] = controls.cmode;
}
else {
const auto controls = wells_ecl[w].injectionControls(summary_state);
currentInjectionControls()[w] = controls.cmode;
}
}
perfRateSolvent_.clear();
perfRateSolvent_.resize(nperf, 0.0);
@ -196,6 +206,11 @@ namespace Opm
continue;
}
if (is_producer_[newIndex] != prevState->is_producer_[oldIndex]) {
// Well changed to/from injector from/to producer, do not use its privious values.
continue;
}
// bhp
bhp()[ newIndex ] = prevState->bhp()[ oldIndex ];
@ -207,12 +222,8 @@ namespace Opm
// continue;
//}
// if there is no effective control event happens to the well, we use the current_injection/production_controls_ from prevState
// otherwise, we use the control specified in the deck
if (!effective_events_occurred_[w]) {
current_injection_controls_[ newIndex ] = prevState->currentInjectionControls()[ oldIndex ];
current_production_controls_[ newIndex ] = prevState->currentProductionControls()[ oldIndex ];
}
current_injection_controls_[ newIndex ] = prevState->currentInjectionControls()[ oldIndex ];
current_production_controls_[ newIndex ] = prevState->currentProductionControls()[ oldIndex ];
// wellrates
for( int i=0, idx=newIndex*np, oldidx=oldIndex*np; i<np; ++i, ++idx, ++oldidx )