mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3888 from totto82/stop_tgr2
fix trivial group target
This commit is contained in:
commit
75ccd88f4f
@ -669,7 +669,6 @@ namespace Opm {
|
|||||||
case Well::ProducerCMode::RESV:
|
case Well::ProducerCMode::RESV:
|
||||||
zero_rate_control = is_zero(prod_controls.resv_rate);
|
zero_rate_control = is_zero(prod_controls.resv_rate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Might still have zero rate controls, but is pressure controlled.
|
// Might still have zero rate controls, but is pressure controlled.
|
||||||
zero_rate_control = false;
|
zero_rate_control = false;
|
||||||
|
@ -39,6 +39,7 @@ SingleWellState::SingleWellState(const std::string& name_,
|
|||||||
, surface_rates(pu_.num_phases)
|
, surface_rates(pu_.num_phases)
|
||||||
, reservoir_rates(pu_.num_phases)
|
, reservoir_rates(pu_.num_phases)
|
||||||
, perf_data(perf_input.size(), pressure_first_connection, !is_producer, pu_.num_phases)
|
, perf_data(perf_input.size(), pressure_first_connection, !is_producer, pu_.num_phases)
|
||||||
|
, trivial_target(false)
|
||||||
{
|
{
|
||||||
for (std::size_t perf = 0; perf < perf_input.size(); perf++) {
|
for (std::size_t perf = 0; perf < perf_input.size(); perf++) {
|
||||||
this->perf_data.cell_index[perf] = perf_input[perf].cell_index;
|
this->perf_data.cell_index[perf] = perf_input[perf].cell_index;
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
std::vector<double> surface_rates;
|
std::vector<double> surface_rates;
|
||||||
std::vector<double> reservoir_rates;
|
std::vector<double> reservoir_rates;
|
||||||
PerfData perf_data;
|
PerfData perf_data;
|
||||||
|
bool trivial_target;
|
||||||
SegmentState segments;
|
SegmentState segments;
|
||||||
Events events;
|
Events events;
|
||||||
Well::InjectorCMode injection_cmode{Well::InjectorCMode::CMODE_UNDEFINED};
|
Well::InjectorCMode injection_cmode{Well::InjectorCMode::CMODE_UNDEFINED};
|
||||||
|
@ -163,7 +163,7 @@ activeProductionConstraint(const SingleWellState& ws,
|
|||||||
if (controls.hasControl(Well::ProducerCMode::THP) && currentControl != Well::ProducerCMode::THP) {
|
if (controls.hasControl(Well::ProducerCMode::THP) && currentControl != Well::ProducerCMode::THP) {
|
||||||
const auto& thp = getTHPConstraint(summaryState);
|
const auto& thp = getTHPConstraint(summaryState);
|
||||||
double current_thp = ws.thp;
|
double current_thp = ws.thp;
|
||||||
if (thp > current_thp) {
|
if (thp > current_thp && !ws.trivial_target) {
|
||||||
// If WVFPEXP item 4 is set to YES1 or YES2
|
// If WVFPEXP item 4 is set to YES1 or YES2
|
||||||
// switching to THP is prevented if the well will
|
// switching to THP is prevented if the well will
|
||||||
// produce at a higher rate with THP control
|
// produce at a higher rate with THP control
|
||||||
@ -1120,6 +1120,10 @@ getGroupProductionTargetRate(const Group& group,
|
|||||||
const auto& rates = ws.surface_rates;
|
const auto& rates = ws.surface_rates;
|
||||||
const auto current_rate = -tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers.
|
const auto current_rate = -tcalc.calcModeRateFromRates(rates); // Switch sign since 'rates' are negative for producers.
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
|
if (target_rate == 0.0) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
if (current_rate > 1e-14)
|
if (current_rate > 1e-14)
|
||||||
scale = target_rate/current_rate;
|
scale = target_rate/current_rate;
|
||||||
return scale;
|
return scale;
|
||||||
|
@ -982,6 +982,9 @@ namespace Opm
|
|||||||
for (int p = 0; p<np; ++p) {
|
for (int p = 0; p<np; ++p) {
|
||||||
ws.surface_rates[p] *= scale;
|
ws.surface_rates[p] *= scale;
|
||||||
}
|
}
|
||||||
|
ws.trivial_target = false;
|
||||||
|
} else {
|
||||||
|
ws.trivial_target = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user