Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification to add_LET_pc_pd #439

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/pyscal/wateroil.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,11 +929,14 @@ def add_LET_pc_pd(
Tt: float,
Pcmax: float,
Pct: float,
Ftp: Optional[bool] = False,
) -> None:
"""Add a primary drainage LET capillary pressure curve.

Docs: https://wiki.equinor.com/wiki/index.php/Res:The_LET_correlation_for_capillary_pressure

It includes a welldefined threshold pressure Pct if required, and Ftp is a flag that is either True or False defining whether a
threshold pressure should be used or not.
Note that Pc where Sw > 1 - sorw will appear linear because
there are no saturation points in that interval.
"""
Expand All @@ -945,16 +948,24 @@ def add_LET_pc_pd(
assert epsilon < Tt < MAX_EXPONENT_PC
assert Pct <= Pcmax

# swnpc is a normalized saturation, but normalized with
# respect to swirr, not to swl (the swirr here is sometimes
# called 'swirra' - asymptotic swirr)
# LET Pc is provides and finite Pc value, thus swirr does not fit into the concept
# swnpc is generated upon object initialization, but overwritten
# here and normalized with respect to swl
self.table["SWNPC"] = (self.table["SW"] - self.swl) / (1 - self.swl)

# The "forced part"
self.table["Ffpcow"] = (1 - self.table["SWNPC"]) ** Lp / (
(1 - self.table["SWNPC"]) ** Lp + Ep * self.table["SWNPC"] ** Tp
)

# The gradual rise part:
self.table["Ftpcow"] = self.table["SWNPC"] ** Lt / (
self.table["Ftpcow"] = (1-Ftp)*self.table["SWNPC"] ** Lt / (
self.table["SWNPC"] ** Lt + Et * (1 - self.table["SWNPC"]) ** Tt
)

# Putting it together:
self.table["PC"] = (
(Pcmax - Pct) * self.table["Ffpcow"] - Pct * self.table["Ftpcow"] + Pct
Expand All @@ -966,7 +977,7 @@ def add_LET_pc_pd(
"-- LET correlation for primary drainage Pc;\n"
f"-- Lp={Lp:g}, Ep={Ep:g}, Tp={Tp:g}, "
f"Lt={Lt:g}, Et={Et:g}, Tt={Tt:g}, "
f"Pcmax={Pcmax:g}, Pct={Pct:g}\n"
f"Pcmax={Pcmax:g}, Pct={Pct:g}, Ftp={Ftp}\n"
)

def add_LET_pc_imb(
Expand Down
5 changes: 5 additions & 0 deletions tests/test_wateroil_pc.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ def test_let_pc_pd():
assert np.isclose(wateroil.table["PC"].min(), 0)
# (everything is linear)

#Test for added threshold in the function
wateroil.add_LET_pc_pd(Lp=1, Ep=1, Tp=1, Lt=1, Et=1, Tt=1, Pcmax=10, Pct=5, Ftp=True)
assert np.isclose(wateroil.table["PC"].max(), 10)
assert np.isclose(wateroil.table["PC"].min(), 5)

wateroil.add_LET_pc_pd(Lp=10, Ep=10, Tp=10, Lt=10, Et=10, Tt=10, Pcmax=10, Pct=5)
assert np.isclose(wateroil.table["PC"].max(), 10)
assert np.isclose(wateroil.table["PC"].min(), 0)
Expand Down
Loading