Skip to content

Commit

Permalink
Set a tolerance for value comparisons to 1e-10
Browse files Browse the repository at this point in the history
  • Loading branch information
emorway-usgs committed Jan 21, 2025
1 parent a565c20 commit 4ff6251
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions autotest/test_gwe_decay01.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def build_models(idx, test):

def check_output(idx, test):
print("evaluating results...")
msg = (
"Differences detected between the simulated results for zeroth-order "
"energy decay and the expected solution for decay specified in "
)
msg0 = msg + "the aqueous phase."
msg1 = msg + "the solid phase."
msg2 = msg + "both the aqueous and solid phases."

# read transport results from GWE model
name = cases[idx]
Expand All @@ -152,13 +159,13 @@ def check_output(idx, test):
print("temperature evaluation: " + str(temp_analy_w))

if "aqe" in name:
assert temp_ts[-1, 1] == temp_analy_w[-1]
assert np.isclose(temp_ts[-1, 1], temp_analy_w[-1], atol=1e-10), msg0

if "sld" in name:
assert temp_ts[-1, 1] == temp_analy_s[-1]
assert np.isclose(temp_ts[-1, 1], temp_analy_s[-1], atol=1e-10), msg1

if "both" in name:
assert temp_ts[-1, 1] == temp_analy_ws[-1]
assert np.isclose(temp_ts[-1, 1], temp_analy_ws[-1], atol=1e-10), msg2


# - No need to change any code below
Expand Down

0 comments on commit 4ff6251

Please sign in to comment.