Skip to content

Commit

Permalink
add doc strings, print difference
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Oct 17, 2023
1 parent acb0430 commit 505fc37
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ def siverts_law(T, S_0, E_S, pressure):


def test_festim_vs_fenics_permeation_benchmark():
"""Runs a problem with pure fenicsx and the same problem with FESTIM and
raise ValueError if difference is too high"""
repetitions = 10

fenics_times = []
Expand All @@ -196,7 +198,11 @@ def test_festim_vs_fenics_permeation_benchmark():

diff = (np.abs(fenics_time - festim_time) / ((fenics_time + festim_time) / 2)) * 100
if diff > 20:
raise ValueError(f"festim is {diff:.1f}% slower than fenics")
raise ValueError(
f"festim is {diff:.1f}% slower than fenics, current acceptble threshold of 20%"
)
else:
print(f"festim is {diff:.1f}% slower than fenics")


if __name__ == "__main__":
Expand Down

0 comments on commit 505fc37

Please sign in to comment.