From 762ff6929d97303f38510d65039e463b1d4f1e89 Mon Sep 17 00:00:00 2001 From: Nicolas Kruse Date: Tue, 24 Jun 2025 10:56:14 +0200 Subject: [PATCH] test added for non-equilibrium cases --- tests/test_edge_case_results.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_edge_case_results.py diff --git a/tests/test_edge_case_results.py b/tests/test_edge_case_results.py new file mode 100644 index 0000000..f6e07d7 --- /dev/null +++ b/tests/test_edge_case_results.py @@ -0,0 +1,19 @@ +import pytest +import gaspype as gp + +def test_calculation_cold(): + # Testing a non-equilibrium case. Result is only + # determined by stoichiometry. + fs = gp.fluid_system(['CH4', 'H2O', 'H2', 'CO2', 'CO', 'O2']) + + el = gp.elements(gp.fluid({'H2': 1, 'CH4': 0.08, 'O2': 0.05}), fs=fs) + + composition = gp.equilibrium(el, 300, 1e5) + + print(el) + print(composition) + + ref_result = [8.00000000e-02, 1.00000000e-01, 9.00000000e-01, 3.01246781e-23, + 2.90783583e-27, 3.60487456e-82] + + assert composition.array_composition == pytest.approx(ref_result, abs=0.001)