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:
Tor Harald Sandve 2016-03-18 13:16:23 +01:00
parent c1b1b9296f
commit 94aa360fe6

View File

@ -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;
} }