mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
updating rates of multiphase with updateWellStateWithTargets
for StandardWellsDense model.
This commit is contained in:
parent
819aa90d84
commit
f70bb960dd
@ -2496,7 +2496,7 @@ namespace Opm {
|
|||||||
// surface condition. In this case, use existing
|
// surface condition. In this case, use existing
|
||||||
// flow rates as initial conditions as reservoir
|
// flow rates as initial conditions as reservoir
|
||||||
// rate acts only in aggregate.
|
// rate acts only in aggregate.
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case SURFACE_RATE:
|
case SURFACE_RATE:
|
||||||
// assign target value as initial guess for injectors and
|
// assign target value as initial guess for injectors and
|
||||||
@ -2505,24 +2505,50 @@ namespace Opm {
|
|||||||
if (well_type == INJECTOR) {
|
if (well_type == INJECTOR) {
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
const double& compi = wells().comp_frac[np * well_index + phase];
|
const double& compi = wells().comp_frac[np * well_index + phase];
|
||||||
// TODO: it was commented out from the master branch already.
|
if (compi > 0.0) {
|
||||||
//if (compi > 0.0) {
|
assert(distr[phase] > 0.);
|
||||||
|
xw.wellRates()[np*well_index + phase] = target * compi / distr[phase];
|
||||||
|
} else {
|
||||||
xw.wellRates()[np * well_index + phase] = target * compi;
|
xw.wellRates()[np * well_index + phase] = target * compi;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
} else if (well_type == PRODUCER) {
|
} else if (well_type == PRODUCER) {
|
||||||
// only set target as initial rates for single phase
|
// checking the number of the phases under control
|
||||||
// producers. (orat, grat and wrat, and not lrat)
|
|
||||||
// lrat will result in numPhasesWithTargetsUnderThisControl == 2
|
|
||||||
int numPhasesWithTargetsUnderThisControl = 0;
|
int numPhasesWithTargetsUnderThisControl = 0;
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
if (distr[phase] > 0.0) {
|
if (distr[phase] > 0.0) {
|
||||||
numPhasesWithTargetsUnderThisControl += 1;
|
numPhasesWithTargetsUnderThisControl += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(numPhasesWithTargetsUnderThisControl > 0);
|
||||||
|
|
||||||
|
// update the rates of phases under control based on the target,
|
||||||
|
// and also update rates of phases not under control to keep the rate ratio,
|
||||||
|
// assuming the mobility ratio does not change for the production wells
|
||||||
|
double orignal_rates_under_phase_control = 0.0;
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
if (distr[phase] > 0.0 && numPhasesWithTargetsUnderThisControl < 2 ) {
|
if (distr[phase] > 0.0) {
|
||||||
xw.wellRates()[np*well_index + phase] = target * distr[phase];
|
orignal_rates_under_phase_control += xw.wellRates()[np * well_index + phase] * distr[phase];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (orignal_rates_under_phase_control != 0.0 ) {
|
||||||
|
double scaling_factor = target / orignal_rates_under_phase_control;
|
||||||
|
|
||||||
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
|
xw.wellRates()[np * well_index + phase] *= scaling_factor;
|
||||||
|
}
|
||||||
|
} else { // scaling factor is not well defied when orignal_rates_under_phase_control is zero
|
||||||
|
if (orignal_rates_under_phase_control == 0.0) {
|
||||||
|
// only handle single-phase control
|
||||||
|
if (numPhasesWithTargetsUnderThisControl == 1) {
|
||||||
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
|
if (distr[phase] > 0.0) {
|
||||||
|
xw.wellRates()[np * well_index + phase] = target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user