From 013ef86a14d7bbea0ce31193182f8e49648c11e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Nyb=C3=B8?= Date: Thu, 17 Aug 2023 15:18:23 +0200 Subject: [PATCH] Allow negative swirr values (-1 <= swirr <= 1) --- pyscal/gasoil.py | 8 +++++++- pyscal/wateroil.py | 22 +++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/pyscal/gasoil.py b/pyscal/gasoil.py index 48a123df..5cca8a96 100644 --- a/pyscal/gasoil.py +++ b/pyscal/gasoil.py @@ -73,11 +73,17 @@ def __init__( if h is None: h = 0.01 - assert -epsilon < swirr < 1.0 + epsilon, "0 <= swirr <= 1 is required" + assert -epsilon - 1 < swirr < 1.0 + epsilon, "-1 <= swirr <= 1 is required" assert -epsilon < sgcr < 1, "0 <= sgcr < 1 is required" assert -epsilon < swl < 1, "0 <= swl < 1 is required" assert -epsilon < sorg < 1, "0 <= sorg < 1 is required" + if swirr < 0: + logger.warning( + f"Negative swirr value, {swirr}, detected. Negative values are allowed," + " but you should ensure that this is intentional." + ) + if krgendanchor is None: krgendanchor = "" diff --git a/pyscal/wateroil.py b/pyscal/wateroil.py index 0f130590..5ce08288 100644 --- a/pyscal/wateroil.py +++ b/pyscal/wateroil.py @@ -77,12 +77,18 @@ def __init__( _sgcr and _sgl are only to be used by the GasWater object. """ - assert -epsilon < swirr < 1.0 + epsilon - assert -epsilon < swl < 1.0 + epsilon - assert -epsilon < swcr < 1.0 + epsilon - assert -epsilon < sorw < 1.0 + epsilon + assert ( + -epsilon - 1 < swirr < 1.0 + epsilon + ), f"swirr = {swirr}, -1 <= swirr <= 1 is required" + assert -epsilon < swl < 1.0 + epsilon, f"swl = {swl}, 0 <= swl < 1 is required" + assert ( + -epsilon < swcr < 1.0 + epsilon + ), f"swcr = {swcr}, 0 <= swcr < 1 is required" + assert ( + -epsilon < sorw < 1.0 + epsilon + ), f"sorw = {sorw}, 0 <= sorw < 1 is required" if socr is not None: - assert -epsilon < socr < 1.0 + epsilon + assert -epsilon < socr < 1.0 + epsilon, "0 <= socr < 1 is required" if h is None: h = 0.01 @@ -91,6 +97,12 @@ def __init__( assert swcr < 1 - sorw assert swirr < 1 - sorw + if swirr < 0: + logger.warning( + f"Negative swirr value, {swirr}, detected. Negative values are allowed," + " but you should ensure that this is intentional." + ) + self.swcomment: str = "" h_min = 1.0 / float(SWINTEGERS)