Skip to content

Commit

Permalink
Fix h_min after unintended change
Browse files Browse the repository at this point in the history
SWINTEGERS was changed in 469bb84, and other critical usage of that
constant has to be adjusted accordingly.

There are still other places where SWINTEGERS are used, but as
long as tests pass they should be fine.

Also adjust the lower limit for h in test_slgof_hypo. If h can
become much lower than h_min, hypothesis shrinking in case of
errors becomes very slow.
  • Loading branch information
berland committed Oct 4, 2024
1 parent d6f0bf7 commit b845e1e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/pyscal/gasoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(

assert isinstance(krgendanchor, str), "krgendanchor must be a string"

h_min = 1.0 / float(SWINTEGERS)
h_min = 10.0 / float(SWINTEGERS)
if h < h_min:
logger.warning(
"Requested saturation step length (%g) too small, reset to %g", h, h_min
Expand Down
2 changes: 1 addition & 1 deletion src/pyscal/wateroil.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __init__(

self.swcomment: str = ""

h_min = 1.0 / float(SWINTEGERS)
h_min = 10.0 / float(SWINTEGERS)
if h < h_min:
logger.warning(
"Requested saturation step length (%g) too small, reset to %g", h, h_min
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gasoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_gasoil_init():
# Test too small h:
gasoil = GasOil(swl=0.1, h=0.00000000000000000001)
# (a warning is printed that h is truncated)
assert gasoil.h == 1 / SWINTEGERS
assert gasoil.h == 10 / SWINTEGERS


def test_conserve_sgcr(mocker):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_slgof.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_numerical_problems(swl, sorg, sgcr):
st.floats(min_value=0.0, max_value=0.3),
st.floats(min_value=0.0, max_value=0.3),
st.floats(min_value=0.0, max_value=0.3),
st.floats(min_value=1.0 / float(100 * SWINTEGERS), max_value=0.5),
st.floats(min_value=1.0 / SWINTEGERS, max_value=0.5),
)
def test_slgof_hypo(swl, sorg, sgcr, h):
"""Shotgun-testing of slgof"""
Expand Down

0 comments on commit b845e1e

Please sign in to comment.