OPM / opm-core

Collection of utilities, solvers and other components.
http://www.opm-project.org
GNU General Public License v3.0
44 stars 50 forks source link

Question: How OPM handles well sources in multi-cell wells? #1214

Closed FoamScience closed 4 years ago

FoamScience commented 4 years ago

Hello everyone,

I'm a bit concerned about the way OPM's well facilities handle multi-cell well source terms (wells with many perforated cells in a single completion).

Assume I have a global ORAT flow rate for the completion. We can't just assume all cells will contribute the same amount (Or even, their contributions will depend only on their volume), can we? So, how does OPM derive the source term used in equations for each cell??

I tracked down the logic to somewhere in the WellState class but can't do any better because wellrates_ vector has the length of numPhases*numWells but I expect it to consider the flow rate into each cell!

Also, perfrates_ is totally confusing me as it's not really used in the class; so I assume it has some other purpose?

I'm just getting starting exploring the code base, so, appologies if the questions sounds trivial.

alfbr commented 4 years ago

I am afraid you are looking at code that has been deprecated for a long time. For the current code parts comprising the reservoir simulator Flow, you need to look at opm-common, opm-grid, opm-material, opm-models and opm-simulators. It sounds like you are asking how COMPLUMP is handled, I believe that answer is similarly to all simulators supporting the input format. Please have a look at the manual, found here: https://opm-project.org/?page_id=955 Basically, well equations are solved depending on type of well. You can test yourselt with one of the supported data sets in the opm-tests repository.

bska commented 4 years ago

Assume I have a global ORAT flow rate for the completion.

I'm afraid I don't really understand what you mean by the word "completion" here. Flow uses this term to describe multiple reservoir connections (couplings between a well and the reservoir cells) grouped into a single entity, mostly for automated workover procedures.

As it happens, Flow does not support imposing rate constraints at the completion or connection levels. Rather, Flow interprets an ORAT constraint (limit/target) as being imposed for the well as a whole. In other words, an ORAT value (e.g., 10,000 bbl/day) requests that the well as a whole produce 10,000 bbl/day and distribute that rate amongst its reservoir connections in such a way that the entire well honours that constraint. The flow of phase a through a single reservoir connection i of well w is modelled using the relation

q_wia = T_wi * M_ai * (p_i - p_wi)

in which T_wi is the connection transmissibility factor, M_ai is mobility of phase a at connection i, p_i is the cell pressure in the cell intersected by connection i, and p_wi is the well-bore pressure at connection i. The total well-level flow rate of phase a is then the sum over all connections of this q_wia quantity and it is this sum that we set equal to the ORAT value specified by the user (or some other mechanism). Doing so, in turn, creates a non-linear equation for the well's bottom-hole pressure since the p_wi value is related to that BHP value through a gravity term (in the simplest case) and solving that well constraint equation is part of solving the coupled reservoir/well system.

We can't just assume all cells will contribute the same amount (Or even, their contributions will depend only on their volume), can we? So, how does OPM derive the source term used in equations for each cell??

That is correct, and we do not assume such a relation.

perfrates_ is totally confusing me as it's not really used in the class; so I assume it has some other purpose?

We assign those values for output purposes. They are not really used as part of the simulator.

FoamScience commented 4 years ago

@alfbr Thanks for pointing me to "COMPLUMP". That clarified a whole bunch of things. @bska Thanks for the quick and detailed reply which actually answered my question.

I'm modelling the well source with

q_wia = x_i * p_i + y_i * BHP + c_i

where x_i, y_i and c_i are some coeffs that depend on mobility, transmissibility and gravity of the phase in the cell.

I was under the impression that if q_wa is constrained for the whole well, a relation between q_wia and q_wa can be derived/approximated somehow. I then thought of sticking q_wia into c_i directly (hoping to get rid of the diagonal part of the well matrix altogether) but it looks like I was dreaming.

Thanks again for your amazing support.

atgeirr commented 4 years ago

Issue resolved, closing. Reopen if necessary.