Add support for banning crossflow in the well equations

This commit is contained in:
Tor Harald Sandve 2015-10-06 11:45:05 +02:00
parent 0f40727fa2
commit 3f089b10d8

View File

@ -1040,7 +1040,27 @@ namespace detail {
else
selectProducingPerforations[c] = 1;
}
bool banCrossFlow = true;
if (banCrossFlow)
{
const V numInjectingPerforations = (wops_.p2w * ADB::constant(selectInjectingPerforations)).value();
const V numProducingPerforations = (wops_.p2w * ADB::constant(selectProducingPerforations)).value();
for (int w = 0; w < nw; ++w) {
for (int perf = wells().well_connpos[w] ; perf < wells().well_connpos[w+1]; ++perf) {
// Crossflow is not allowed; reverse flow is prevented.
// At least one of the perforation must be open in order to have a meeningful
// equation to solve. For the special case where all perforations have reverse flow,
// and the target rate is non-zero all of the perforations are keept open.
// TODO: Handle the case where all perfororations have reverse flow and the rate is zero
if (wells().type[w] == INJECTOR && numInjectingPerforations[w] > 0) {
selectProducingPerforations[perf] = 0.0;
} else if (wells().type[w] == PRODUCER && numProducingPerforations[w] > 0 ){
selectInjectingPerforations[perf] = 0.0;
}
}
}
}
// HANDLE FLOW INTO WELLBORE
// compute phase volumetric rates at standard conditions
std::vector<ADB> cq_ps(np, ADB::null());