mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-29 12:33:49 -06:00
Bugfix. Fix setting initial rates in updateWellControls
- The initial rates are only set to target values for single phase producers (orat, wrat, grat). - For injectors compi is used to determine the initial target rates.
This commit is contained in:
parent
c1b1b9296f
commit
94aa360fe6
@ -1610,11 +1610,33 @@ namespace detail {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SURFACE_RATE:
|
case SURFACE_RATE:
|
||||||
|
// assign target value as initial guess for injectors and
|
||||||
|
// single phase producers (orat, grat, wrat)
|
||||||
|
const WellType& well_type = wells().type[w];
|
||||||
|
if (well_type == INJECTOR) {
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
if (distr[phase] > 0.0) {
|
const double& compi = wells().comp_frac[np * w + phase];
|
||||||
|
if (compi > 0.0) {
|
||||||
|
xw.wellRates()[np*w + phase] = target * compi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (well_type == PRODUCER) {
|
||||||
|
// for single phase producers sum of distr should be 1.0
|
||||||
|
double sumdistr = distr[0];
|
||||||
|
for (int phase = 1; phase < np; ++phase) {
|
||||||
|
sumdistr += distr[phase];
|
||||||
|
}
|
||||||
|
std::cout << sumdistr << std::endl;
|
||||||
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
|
if (distr[phase] > 0.0 && sumdistr == 1.0 ) {
|
||||||
xw.wellRates()[np*w + phase] = target * distr[phase];
|
xw.wellRates()[np*w + phase] = target * distr[phase];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
OPM_THROW(std::logic_error, "Expected PRODUCER or INJECTOR type of well");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user