mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-12 17:02:02 -05:00
Add trivial well equation when there is no flow
Fixes case when all perforations in a well are crossflowing while crossflow is not allowed
This commit is contained in:
1 parent
07339be80e
commit
84c33e0e96
1 file changed
+18
-8
@@ -226,6 +226,7 @@ namespace Opm {
|
|||||||
|
|
||||||
const double volume = 0.002831684659200; // 0.1 cu ft;
|
const double volume = 0.002831684659200; // 0.1 cu ft;
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
|
double total_flux = 0.0;
|
||||||
|
|
||||||
for (int perf = wells().well_connpos[w] ; perf < wells().well_connpos[w+1]; ++perf) {
|
for (int perf = wells().well_connpos[w] ; perf < wells().well_connpos[w+1]; ++perf) {
|
||||||
|
|
||||||
@@ -243,6 +244,7 @@ namespace Opm {
|
|||||||
|
|
||||||
// subtract sum of phase fluxes in the well equations.
|
// subtract sum of phase fluxes in the well equations.
|
||||||
resWell_[w][flowPhaseToEbosCompIdx(p1)] -= cq_s[p1].value;
|
resWell_[w][flowPhaseToEbosCompIdx(p1)] -= cq_s[p1].value;
|
||||||
|
total_flux += cq_s[p1].value;
|
||||||
|
|
||||||
// assemble the jacobians
|
// assemble the jacobians
|
||||||
for (int p2 = 0; p2 < np; ++p2) {
|
for (int p2 = 0; p2 < np; ++p2) {
|
||||||
@@ -260,15 +262,23 @@ namespace Opm {
|
|||||||
// Store the perforation pressure for later usage.
|
// Store the perforation pressure for later usage.
|
||||||
well_state.perfPress()[perf] = well_state.bhp()[w] + wellPerforationPressureDiffs()[perf];
|
well_state.perfPress()[perf] = well_state.bhp()[w] + wellPerforationPressureDiffs()[perf];
|
||||||
}
|
}
|
||||||
|
if (std::abs(total_flux) == 0) { // add a trivial equation for the case when there is no flow
|
||||||
// add vol * dF/dt + Q to the well equations;
|
for (int p1 = 0; p1 < np; ++p1) {
|
||||||
for (int p1 = 0; p1 < np; ++p1) {
|
invDuneD_[w][w][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p1)] += 1;
|
||||||
EvalWell resWell_loc = (wellVolumeFraction(w, p1) - F0_[w + nw*p1]) * volume / dt;
|
resWell_[w][flowPhaseToEbosCompIdx(p1)] += 0;
|
||||||
resWell_loc += getQs(w, p1);
|
}
|
||||||
for (int p2 = 0; p2 < np; ++p2) {
|
}
|
||||||
invDuneD_[w][w][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] += resWell_loc.derivatives[p2+3];
|
else {
|
||||||
|
|
||||||
|
// add vol * dF/dt + Q to the well equations;
|
||||||
|
for (int p1 = 0; p1 < np; ++p1) {
|
||||||
|
EvalWell resWell_loc = (wellVolumeFraction(w, p1) - F0_[w + nw*p1]) * volume / dt;
|
||||||
|
resWell_loc += getQs(w, p1);
|
||||||
|
for (int p2 = 0; p2 < np; ++p2) {
|
||||||
|
invDuneD_[w][w][flowPhaseToEbosCompIdx(p1)][flowToEbosPvIdx(p2)] += resWell_loc.derivatives[p2+3];
|
||||||
|
}
|
||||||
|
resWell_[w][flowPhaseToEbosCompIdx(p1)] += resWell_loc.value;
|
||||||
}
|
}
|
||||||
resWell_[w][flowPhaseToEbosCompIdx(p1)] += resWell_loc.value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user