Skip to content

Commit

Permalink
use relative error
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Oct 10, 2023
1 parent 746d54a commit 45334b8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/test_permeation_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,18 @@ def siverts_law(T, S_0, E_S, pressure):
)
analytical_flux = P_up**0.5 * permeability / L * (2 * summation + 1)

analytical_flux = np.abs(analytical_flux)

flux_values = np.array(np.abs(flux_values))
normalised_analytical_flux = analytical_flux / analytical_flux.max()
normalised_compute_flux = flux_values / flux_values.max()

diff = np.abs(normalised_analytical_flux - normalised_compute_flux)
error = diff.mean()
relative_error = (flux_values - analytical_flux) / analytical_flux

relative_error = relative_error[
np.where(analytical_flux > 0.01 * np.max(analytical_flux))
]
error = relative_error.mean()

assert error < 0.001
assert error < 0.01


if __name__ == "__main__":
Expand Down

0 comments on commit 45334b8

Please sign in to comment.