PO.PVT.Table.PVTO


Description

Lays black-oil properties out as the records of an Eclipse-format `PVTO` keyword (live oil, FIELD units), ready to turn into deck text. A PVTO record is one solution GOR: its first line gives the Rs, the bubble point at that Rs, and Bo and μo there; the lines under it are the undersaturated branch, the same oil compressed above its bubble point, each a pressure with its Bo and μo; a slash ends the record. The function computes nothing. The saturated rows (Rs in scf/STB, the bubble point, Bo and μo, one row a record, Rs rising) and each record's branch (a row of pressures and the Bo and μo at each, the same row as its record) come from the sheet, from `PO.PVT.*` or the lab. A branch can be shorter than the others: blank cells at its end are left out, so the records are ragged as PVTO's are. Entered as `=PO.PVT.Table.PVTO(Rs, Pb, Bo, Uo, Pu, Bou, Uou)` in a Microsoft 365 cell it spills the whole table. The result has a fixed shape, so a sheet can also read it a cell at a time with `INDEX`: one line for each saturated row and one for each branch column, each line Rs in Mscf/STB (on a record's first line only), pressure, Bo, μo, and "/" on the record's last line. A line a short branch doesn't use is "" throughout.

Formula

=LAMBDA(Rs, Pb, Bo, Uo, Pu, Bou, Uou, LET( n, ROWS(Rs), m, COLUMNS(Pu), w, m + 1, MAKEARRAY(n * w, 5, LAMBDA(line, col, LET( i, INT((line - 1) / w) + 1, j, MOD(line - 1, w), more, IF(j = m, FALSE, ISNUMBER(INDEX(Pu, i, j + 1))), IF(j = 0, CHOOSE(col, INDEX(Rs, i) / 1000, INDEX(Pb, i), INDEX(Bo, i), INDEX(Uo, i), IF(more, "", "/")), IF(ISNUMBER(INDEX(Pu, i, j)), CHOOSE(col, "", INDEX(Pu, i, j), INDEX(Bou, i, j), INDEX(Uou, i, j), IF(more, "", "/")), "")))))))

Parameters

Parameter Unit Description
Rs scf/STB Solution GOR of each record, a column, rising
Pb psia Bubble point of each record
Bo rb/STB Oil FVF at each record's bubble point
Uo cp Oil viscosity at each record's bubble point
Pu psia Each record's branch pressures, a row per record, above its bubble point and rising; blanks at the end of a short branch
Bou rb/STB Oil FVF at each branch pressure, the shape of Pu
Uou cp Oil viscosity at each branch pressure, the shape of Pu

Examples

Invocation Expected
=ROWS(PO.PVT.Table.PVTO({258.927;768}, {1000;2502.88}, {1.210258;1.498357}, {0.37587;0.257514}, {2000,"";3000,4000}, {1.191346,"";1.484283,1.466755}, {0.425816,"";0.27024,0.302363})) 6
=INDEX(PO.PVT.Table.PVTO({258.927;768}, {1000;2502.88}, {1.210258;1.498357}, {0.37587;0.257514}, {2000,"";3000,4000}, {1.191346,"";1.484283,1.466755}, {0.425816,"";0.27024,0.302363}), 1, 1) 0.258927
=INDEX(PO.PVT.Table.PVTO({258.927;768}, {1000;2502.88}, {1.210258;1.498357}, {0.37587;0.257514}, {2000,"";3000,4000}, {1.191346,"";1.484283,1.466755}, {0.425816,"";0.27024,0.302363}), 2, 4) 0.425816
=INDEX(PO.PVT.Table.PVTO({258.927;768}, {1000;2502.88}, {1.210258;1.498357}, {0.37587;0.257514}, {2000,"";3000,4000}, {1.191346,"";1.484283,1.466755}, {0.425816,"";0.27024,0.302363}), 4, 1) 0.768
=INDEX(PO.PVT.Table.PVTO({258.927;768}, {1000;2502.88}, {1.210258;1.498357}, {0.37587;0.257514}, {2000,"";3000,4000}, {1.191346,"";1.484283,1.466755}, {0.425816,"";0.27024,0.302363}), 6, 3) 1.466755
=COUNT(PO.PVT.Table.PVTO({258.927;768}, {1000;2502.88}, {1.210258;1.498357}, {0.37587;0.257514}, {2000,"";3000,4000}, {1.191346,"";1.484283,1.466755}, {0.425816,"";0.27024,0.302363})) 17
=SUMPRODUCT(--(PO.PVT.Table.PVTO({258.927;768}, {1000;2502.88}, {1.210258;1.498357}, {0.37587;0.257514}, {2000,"";3000,4000}, {1.191346,"";1.484283,1.466755}, {0.425816,"";0.27024,0.302363})="/")) 2
=SUMPRODUCT(--(PO.PVT.Table.PVTO({258.927;768}, {1000;2502.88}, {1.210258;1.498357}, {0.37587;0.257514}, {2000,"";3000,4000}, {1.191346,"";1.484283,1.466755}, {0.425816,"";0.27024,0.302363})="")) 11

Need a custom LAMBDA? Suggest a New Lambda