Skip to content

Commit a8c91ec

Browse files
committed
Usability fixes to table generator
1 parent 021a750 commit a8c91ec

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/PVTExperiments/interface.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ function generate_pvt_tables(eos, z, T_res;
5151
n_pvdo = 20,
5252
n_undersaturated = 5
5353
)
54+
if p_range[1] <= p_range[2]
55+
p_range = (p_range[2], p_range[1])
56+
end
5457
z = collect(Float64, z)
5558
z ./= sum(z)
5659

src/PVTExperiments/tables.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ Generate a PVTO (live oil) table from DLE or MSS experiment data.
1313
- `p_sc`: Standard condition pressure (Pa). Default: 101325.0
1414
- `T_sc`: Standard condition temperature (K). Default: 288.706
1515
- `separator_stages`: Optional separator stages. If provided, MSS is used for surface conditions.
16+
- `extend`: Whether to extend the table with an entry at p_range[1] if it's above bubble point. Default: true.
1617
"""
1718
function pvto_table(eos, z, T;
1819
p_range = (50e6, 1e5),
1920
n_rs = 15,
2021
n_undersaturated = 5,
2122
p_sc = 101325.0,
2223
T_sc = 288.706,
23-
separator_stages = nothing
24+
separator_stages = nothing,
25+
extend = true
2426
)
2527
z = collect(Float64, z)
2628
z ./= sum(z)
@@ -124,6 +126,15 @@ function pvto_table(eos, z, T;
124126
push!(Bo_entries, Bo_us)
125127
push!(mu_entries, props_us.μ_l)
126128
end
129+
130+
if p_range[1] > p_bubble + 1e5 && extend
131+
# Add an entry at p_range[1] if it's above bubble point
132+
props_us = flash_and_properties(eos, p_range[1], T, z_oil_at_level)
133+
Bo_us = props_us.V_mol_l / (V_oil_st / liq_frac)
134+
push!(p_entries, p_range[1])
135+
push!(Bo_entries, Bo_us)
136+
push!(mu_entries, props_us.μ_l)
137+
end
127138
end
128139

129140
push!(Rs_values, Rs)

0 commit comments

Comments
 (0)