Merge pull request #494 from totto82/crossflow

Add support for banning cross-flow in a well
This commit is contained in:
Atgeirr Flø Rasmussen 2015-10-19 14:41:17 +02:00
commit 2bf42e1eb2

View File

@ -1041,6 +1041,25 @@ namespace detail {
selectProducingPerforations[c] = 1; selectProducingPerforations[c] = 1;
} }
// Handle cross flow
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) {
if (!wells().allow_cf[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.
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 // HANDLE FLOW INTO WELLBORE
// compute phase volumetric rates at standard conditions // compute phase volumetric rates at standard conditions
std::vector<ADB> cq_ps(np, ADB::null()); std::vector<ADB> cq_ps(np, ADB::null());