From e15760856c12f25b12add10327dbc7d6370b7839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Wed, 25 Sep 2013 15:38:55 +0200 Subject: [PATCH] RESV: Ignore phase distribution for non-PRODUCERs The WellsManager class handles INJECTORS by assigning a phase distribution (W->ctrls[i]->distr) that coincides with the injected fluid for the corresponding well (e.g., {1,0,0} for WATER injectors in a three-phase WATER/OIL/GAS simulation). This, however, meshes poorly with the restriction that all phase components must be ONE in the case of wells constrained by total reservoir volume flow targets (RESV) that was introduced in commit b7d1634. This change-set limits the restriction on phase distributions to PRODUCERs only and is a tentative solution to GitHub PR #360. --- opm/core/pressure/tpfa/ifs_tpfa.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/opm/core/pressure/tpfa/ifs_tpfa.c b/opm/core/pressure/tpfa/ifs_tpfa.c index 9c7a2eec1..68d058db3 100644 --- a/opm/core/pressure/tpfa/ifs_tpfa.c +++ b/opm/core/pressure/tpfa/ifs_tpfa.c @@ -379,12 +379,21 @@ assemble_well_contrib(int nc , break; case RESERVOIR_RATE: - for (p = 0; p < np; p++) { - if (ctrls->distr[np * ctrls->current + p] != 1.0) { - *ok = 0; - break; + if (W->type[w] == PRODUCER) { + /* Ensure minimal consistency. A PRODUCER should + * specify a phase distribution of all ones in the + * case of RESV controls. */ + for (p = 0; p < np; p++) { + if (ctrls->distr[np * ctrls->current + p] != 1.0) { + *ok = 0; + break; + } } + } else { + /* Ignore phase distribution for non-PRODUCERs */ + *ok = 1; } + if (*ok) { assemble_rate_well(nc, w, W, mt, wdp, h); }