Fully support switching types of wells (injector <-> producer) in ACTIONX

For this we need to make sure that status in ECL matches the
simulator, the surface rates make sense and the containers used for reporting.
This commit is contained in:
Markus Blatt committed 2025-03-18 22:29:30 +01:00
1 parent 4df94af7f0
commit 197f82e830
3 files changed
+39 -4

No files matched your search

@@ -867,7 +867,10 @@ updateEclWellsConstraints(const int timeStepIdx,
auto& ws = this->wellState().well(wellIdx);
ws.updateStatus(well.getStatus());
ws.update_targets(well, st);
auto switchToProducer = ws.update_type_and_targets(well, st);
if (switchToProducer) {
this->wellState().switchToProducer(well.name());
}
});
}
+29 -2
View File
@@ -323,13 +323,40 @@ update_injector_targets(const Well& ecl_well, const SummaryState& st)
}
template<class Scalar>
void SingleWellState<Scalar>::
update_targets(const Well& ecl_well, const SummaryState& st)
bool SingleWellState<Scalar>::
update_type_and_targets(const Well& ecl_well, const SummaryState& st)
{
bool switchedToProducer = false;
if (this->producer != ecl_well.isProducer()) {
// type has changed due to ACTIONX
// Make sure that we consistent with the ecl_well
switchedToProducer = this->producer = ecl_well.isProducer();
if (switchedToProducer) {
this->production_cmode = ecl_well.productionControls(st).cmode;
// clear injection rates
for(auto&& val: this->surface_rates) {
if (val > 0.0) {
val = 0.0;
}
}
} else {
perf_data.prepareInjectorContainers();
this->injection_cmode = ecl_well.injectionControls(st).cmode;
// clear production rates
for(auto&& val: this->surface_rates) {
if (val < 0.0) {
val = 0.0;
}
}
}
}
if (this->producer)
this->update_producer_targets(ecl_well, st);
else
this->update_injector_targets(ecl_well, st);
return switchedToProducer;
}
template<class Scalar>
+6 -1
View File
@@ -126,7 +126,12 @@ public:
void reset_connection_factors(const std::vector<PerforationData<Scalar>>& new_perf_data);
void update_producer_targets(const Well& ecl_well, const SummaryState& st);
void update_injector_targets(const Well& ecl_well, const SummaryState& st);
void update_targets(const Well& ecl_well, const SummaryState& st);
/// \brief update the type of the well and the targets.
///
/// This called after ACTIONX is executed to update well rates. The new status is
/// in ecl_well and st.
/// \return whether well was switched to a producer
bool update_type_and_targets(const Well& ecl_well, const SummaryState& st);
void updateStatus(WellStatus status);
void init_timestep(const SingleWellState& other);
void shut();