Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only check trivial_target for GRUP when checking in THP #6018

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions opm/simulators/wells/SingleWellState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ SingleWellState(const std::string& name_,
, reservoir_rates(pu_.num_phases)
, prev_surface_rates(pu_.num_phases)
, perf_data(perf_input.size(), pressure_first_connection, !is_producer, pu_.num_phases)
, trivial_target(false)
, trivial_group_target(false)
{
for (std::size_t perf = 0; perf < perf_input.size(); perf++) {
this->perf_data.cell_index[perf] = perf_input[perf].cell_index;
Expand Down Expand Up @@ -351,7 +351,7 @@ bool SingleWellState<Scalar>::operator==(const SingleWellState& rhs) const
this->prev_surface_rates == rhs.prev_surface_rates &&
this->perf_data == rhs.perf_data &&
this->filtrate_conc == rhs.filtrate_conc &&
this->trivial_target == rhs.trivial_target &&
this->trivial_group_target == rhs.trivial_group_target &&
this->segments == rhs.segments &&
this->events == rhs.events &&
this->injection_cmode == rhs.injection_cmode &&
Expand Down
4 changes: 2 additions & 2 deletions opm/simulators/wells/SingleWellState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SingleWellState {
serializer(surface_rates);
serializer(reservoir_rates);
serializer(prev_surface_rates);
serializer(trivial_target);
serializer(trivial_group_target);
serializer(segments);
serializer(events);
serializer(injection_cmode);
Expand Down Expand Up @@ -110,7 +110,7 @@ class SingleWellState {
std::vector<Scalar> reservoir_rates;
std::vector<Scalar> prev_surface_rates;
PerfData<Scalar> perf_data;
bool trivial_target;
bool trivial_group_target;
SegmentState<Scalar> segments;
Events events;
WellInjectorCMode injection_cmode{WellInjectorCMode::CMODE_UNDEFINED};
Expand Down
4 changes: 3 additions & 1 deletion opm/simulators/wells/WellConstraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ activeProductionConstraint(const SingleWellState<Scalar>& ws,
if (well_.wellHasTHPConstraints(summaryState) && currentControl != Well::ProducerCMode::THP) {
const auto& thp = well_.getTHPConstraint(summaryState);
Scalar current_thp = ws.thp;
if (thp > current_thp && !ws.trivial_target) {
// For trivial group targets (for instance caused by NETV) we dont want to flip to THP control.
const bool dont_check = (currentControl == Well::ProducerCMode::GRUP && ws.trivial_group_target);
if (thp > current_thp && !dont_check) {
// If WVFPEXP item 4 is set to YES1 or YES2
// switching to THP is prevented if the well will
// produce at a higher rate with THP control
Expand Down
6 changes: 4 additions & 2 deletions opm/simulators/wells/WellInterface_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1500,9 +1500,11 @@ namespace Opm
for (int p = 0; p<np; ++p) {
ws.surface_rates[p] *= scale;
}
ws.trivial_target = false;
ws.trivial_group_target = false;
} else {
ws.trivial_target = true;
// If group target is trivial we dont want to flip to other controls. To avoid oscillation we store
// this information in the well state and explicitly check for this condition when evaluating well controls.
ws.trivial_group_target = true;
}
break;
}
Expand Down