[Input] Add ck2yaml test for non-reactant order handling

This commit is contained in:
Ray Speth
2024-07-22 08:23:31 +02:00
committed by Ingmar Schoegl
parent 16abc2a6ba
commit 52bb3a6cfc
3 changed files with 90 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
ELEMENTS H C END
SPECIES H R1A R1B P1 P2A END
REACTIONS
R1A+R1B=>H+P1 1e12 0.0 20000.0
FORD / R1A 1.5 /
FORD / P2A 0.5 /
END
+73
View File
@@ -0,0 +1,73 @@
generator: ck2yaml
input-files: [err-nonreactant-order.inp, dummy-thermo.dat]
cantera-version: 3.1.0a2
date: Fri, 28 Jun 2024 13:10:15 -0400
units: {length: cm, time: s, quantity: mol, activation-energy: cal/mol}
phases:
- name: gas
thermo: ideal-gas
elements: [H, C]
species: [H, R1A, R1B, P1, P2A]
kinetics: gas
state: {T: 300.0, P: 1 atm}
species:
- name: H
composition: {H: 1}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [2.5, 7.05332819e-13, -1.99591964e-15, 2.30081632e-18, -9.27732332e-22,
2.54736599e+04, -0.446682853]
- [2.50000001, -2.30842973e-11, 1.61561948e-14, -4.73515235e-18, 4.98197357e-22,
2.54736599e+04, -0.446682914]
note: 'NOTE: All of this thermo data is bogus'
- name: R1A
composition: {C: 1, H: 4}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [5.14987613, -0.0136709788, 4.91800599e-05, -4.84743026e-08, 1.66693956e-11,
-1.02466476e+04, -4.64130376]
- [0.074851495, 0.0133909467, -5.73285809e-06, 1.22292535e-09, -1.0181523e-13,
-9468.34459, 18.437318]
- name: R1B
composition: {C: 1, H: 4}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [5.14987613, -0.0136709788, 4.91800599e-05, -4.84743026e-08, 1.66693956e-11,
-1.02466476e+04, -4.64130376]
- [0.074851495, 0.0133909467, -5.73285809e-06, 1.22292535e-09, -1.0181523e-13,
-9468.34459, 18.437318]
- name: P1
composition: {C: 2, H: 7}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [5.14987613, -0.0136709788, 4.91800599e-05, -4.84743026e-08, 1.66693956e-11,
-1.02466476e+04, -4.64130376]
- [0.074851495, 0.0133909467, -5.73285809e-06, 1.22292535e-09, -1.0181523e-13,
-9468.34459, 18.437318]
- name: P2A
composition: {C: 1, H: 4}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [5.14987613, -0.0136709788, 4.91800599e-05, -4.84743026e-08, 1.66693956e-11,
-1.02466476e+04, -4.64130376]
- [0.074851495, 0.0133909467, -5.73285809e-06, 1.22292535e-09, -1.0181523e-13,
-9468.34459, 18.437318]
reactions:
- equation: R1A + R1B => H + P1 # Reaction 1
rate-constant: {A: 1.0e+12, b: 0.0, Ea: 2.0e+04}
orders: {R1A: 1.5, P2A: 0.5}
nonreactant-orders: true
+9
View File
@@ -259,6 +259,15 @@ class ck2yamlTest(utilities.CanteraTest):
ref, gas = self.checkConversion("negative-order.yaml", output)
self.checkKinetics(ref, gas, [300, 800, 1450, 2800], [5e3, 1e5, 2e6])
def test_nonreactant_order(self):
with pytest.raises(ck2yaml.InputError, match="Non-reactant order for reaction"):
self.convert("nonreactant-order.inp", thermo="dummy-thermo.dat")
output = self.convert("nonreactant-order.inp", thermo="dummy-thermo.dat",
permissive=True)
ref, gas = self.checkConversion("nonreactant-order.yaml", output)
self.checkKinetics(ref, gas, [300, 800, 1450, 2800], [5e3, 1e5, 2e6])
def test_negative_A_factor(self):
output = self.convert('negative-rate.inp', thermo='dummy-thermo.dat')
gas = ct.Solution(output) # Validate the mechanism