reduce the test input files and modify the tests to keep them working

This commit is contained in:
12Chao
2021-03-25 15:56:07 -04:00
committed by Steven C. DeCaluwe
parent 5513452d6b
commit 448c281c3c
6 changed files with 61 additions and 221 deletions

View File

@@ -1086,10 +1086,10 @@ class TestReaction(utilities.CanteraTest):
r = ct.BlowersMaselReaction({'O':1, 'H2':1}, {'H':1, 'OH':1})
r.rate = ct.BlowersMasel(3.87e1, 2.7, 6260*1000*4.184, 1e9*1000*4.184)
gas1 = ct.Solution('BM_example.yaml')
gas1 = ct.Solution('BM_test.yaml')
gas2 = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',
species=self.species, reactions=[r])
species=gas1.species(), reactions=[r])
gas1.TP = self.gas.TP
gas2.TP = self.gas.TP
@@ -1102,13 +1102,13 @@ class TestReaction(utilities.CanteraTest):
gas1.net_rates_of_progress[0], rtol=1e-7)
def test_Blowers_Masel_rate(self):
gas = ct.Solution('BM_example.yaml')
gas = ct.Solution('BM_test.yaml')
R = gas.reaction(0)
self.assertNear(R.rate(gas.T, gas.delta_enthalpy[0]),
gas.forward_rate_constants[0], rtol=1e-7)
def test_negative_A_blowersmasel(self):
species = ct.Species.listFromFile('BM_example.yaml')
species = ct.Solution('BM_test.yaml').species()
r = ct.BlowersMaselReaction({'O':1, 'H2':1}, {'H':1, 'OH':1})
r.rate = ct.BlowersMasel(-3.87e1, 2.7, 6260*1000*4.184, 1e9)
@@ -1123,7 +1123,7 @@ class TestReaction(utilities.CanteraTest):
species=species, reactions=[r])
def test_Blowers_Masel_change_enthalpy(self):
gas = ct.Solution('BM_example.yaml')
gas = ct.Solution('BM_test.yaml')
r = gas.reaction(0)
E0 = r.rate.intrinsic_activation_energy
w = r.rate.bond_energy
@@ -1183,10 +1183,11 @@ class TestReaction(utilities.CanteraTest):
self.assertNear(surf1.net_rates_of_progress[1],
surf2.net_rates_of_progress[0])
def test_BMinterface(self):
gas = ct.Solution('BM_ptcombust.yaml')
surf1 = ct.Interface('BM_ptcombust.yaml', 'Pt_surf', [gas])
r1 = ct.BMInterfaceReaction()
def test_BlowersMaselinterface(self):
gas = ct.Solution('gri30.yaml')
gas.TPX = 300, ct.one_atm, {"CH4": 0.095, "O2": 0.21, "AR": 0.79}
surf1 = ct.Interface('BM_test.yaml', 'Pt_surf', [gas])
r1 = ct.BlowersMaselInterfaceReaction()
r1.reactants = 'H(S):2'
r1.products = 'H2:1, PT(S):2'
r1.rate = ct.BlowersMasel(3.7e20, 0, 67.4e6, 1e9)
@@ -1318,7 +1319,7 @@ class TestReaction(utilities.CanteraTest):
self.assertNear(kf[4], kf[5])
def test_modify_BlowersMasel(self):
gas = ct.Solution('BM_example.yaml')
gas = ct.Solution('BM_test.yaml')
gas.X = 'H2:0.1, H2O:0.2, O2:0.7, O:1e-4, OH:1e-5, H:2e-5'
gas.TP = self.gas.TP
R = gas.reaction(0)
@@ -1399,8 +1400,9 @@ class TestReaction(utilities.CanteraTest):
self.assertNear(2.0 * k1[9], k2[9]) # sticking coefficient = 1.0
def test_modify_BMinterface(self):
gas = ct.Solution('BM_ptcombust.yaml', 'gas')
surf = ct.Interface('BM_ptcombust.yaml', 'Pt_surf', [gas])
gas = ct.Solution('gri30.yaml')
gas.TPX = 300, ct.one_atm, {"CH4": 0.095, "O2": 0.21, "AR": 0.79}
surf = ct.Interface('BM_test.yaml', 'Pt_surf', [gas])
surf.coverages = 'O(S):0.1, PT(S):0.5, H(S):0.4'
gas.TP = surf.TP
@@ -1419,8 +1421,9 @@ class TestReaction(utilities.CanteraTest):
self.assertNear(k2, k3)
def test_modify_BMsticking(self):
gas = ct.Solution('BM_ptcombust.yaml', 'gas')
surf = ct.Interface('BM_ptcombust.yaml', 'Pt_surf', [gas])
gas = ct.Solution('gri30.yaml')
gas.TPX = 300, ct.one_atm, {"CH4": 0.095, "O2": 0.21, "AR": 0.79}
surf = ct.Interface('BM_test.yaml', 'Pt_surf', [gas])
surf.coverages = 'O(S):0.1, PT(S):0.5, H(S):0.4'
gas.TP = surf.TP
@@ -1434,8 +1437,9 @@ class TestReaction(utilities.CanteraTest):
def test_BMmotz_wise(self):
# Motz & Wise off for all reactions
gas1 = ct.Solution('BM_ptcombust.yaml', 'gas')
surf1 = ct.Interface('BM_ptcombust.yaml', 'Pt_surf', [gas1])
gas1 = ct.Solution('gri30.yaml')
gas1.TPX = 300, ct.one_atm, {"CH4": 0.095, "O2": 0.21, "AR": 0.79}
surf1 = ct.Interface('BM_test.yaml', 'Pt_surf', [gas1])
surf1.coverages = 'O(S):0.1, PT(S):0.5, H(S):0.4'
gas1.TP = surf1.TP

View File

@@ -95,21 +95,22 @@ species:
reactions:
- equation: 2 H(S) => H2 + 2 PT(S) # Reaction 1
type: surface-Blowers-Masel
type: Blowers-Masel
rate-constant: {A: 3.7e+21, b: 0, Ea0: 67400, w: 1000000}
coverage-dependencies:
H(S): {a: 0.0, m: 0.0, E: -6000.0}
- equation: H + PT(S) => H(S) # Reaction 2
type: surface-Blowers-Masel
type: Blowers-Masel
sticking-coefficient: {A: 1.0, b: 0, Ea0: 0, w: 1000000}
- equation: H2O + PT(S) => H2O(S) # Reaction 3
type: surface-Blowers-Masel
type: Blowers-Masel
sticking-coefficient: {A: 0.75, b: 0, Ea0: 0, w: 1000000}
- equation: O2 + 2 PT(S) => 2 O(S) # Reaction 4
type: surface-Blowers-Masel
type: Blowers-Masel
sticking-coefficient: {A: 0.023, b: 0, Ea0: 0, w: 1000000}
Motz-Wise: false
- equation: OH + PT(S) => OH(S) # Reaction 5
type: surface-Blowers-Masel
type: Blowers-Masel
sticking-coefficient: {A: 1.0, b: 0, Ea0: 0, w: 100000}
Motz-Wise: true
Motz-Wise: true

View File

@@ -1,86 +0,0 @@
description: |-
This is the minimal example tweaked from Hydrogen-Oxygen
submechanism extracted from GRI-Mech 3.0. It should only
be used for testing the Blowers Masel reaction class in
gas phase.
generator: ck2yaml
input-files: [h2o2.inp, gri30_tran.dat]
cantera-version: 2.5.0
date: Wed, 11 Dec 2019 16:59:04 -0500
units: {length: cm, time: s, quantity: mol, activation-energy: cal/mol}
phases:
- name: ohmech
thermo: ideal-gas
elements: [O, H, Ar, N]
species: [H2, H, O, OH, H2O, O2]
kinetics: gas
state: {T: 300.0, P: 1 atm}
species:
- name: H2
composition: {H: 2}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [2.34433112, 7.98052075e-03, -1.9478151e-05, 2.01572094e-08, -7.37611761e-12,
-917.935173, 0.683010238]
- [3.3372792, -4.94024731e-05, 4.99456778e-07, -1.79566394e-10, 2.00255376e-14,
-950.158922, -3.20502331]
- 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]
- name: O
composition: {O: 1}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [3.1682671, -3.27931884e-03, 6.64306396e-06, -6.12806624e-09, 2.11265971e-12,
2.91222592e+04, 2.05193346]
- [2.56942078, -8.59741137e-05, 4.19484589e-08, -1.00177799e-11, 1.22833691e-15,
2.92175791e+04, 4.78433864]
- name: OH
composition: {O: 1, H: 1}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [3.99201543, -2.40131752e-03, 4.61793841e-06, -3.88113333e-09, 1.3641147e-12,
3615.08056, -0.103925458]
- [3.09288767, 5.48429716e-04, 1.26505228e-07, -8.79461556e-11, 1.17412376e-14,
3858.657, 4.4766961]
- name: H2O
composition: {H: 2, O: 1}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [4.19864056, -2.0364341e-03, 6.52040211e-06, -5.48797062e-09, 1.77197817e-12,
-3.02937267e+04, -0.849032208]
- [3.03399249, 2.17691804e-03, -1.64072518e-07, -9.7041987e-11, 1.68200992e-14,
-3.00042971e+04, 4.9667701]
- name: O2
composition: {O: 2}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [3.78245636, -2.99673416e-03, 9.84730201e-06, -9.68129509e-09, 3.24372837e-12,
-1063.94356, 3.65767573]
- [3.28253784, 1.48308754e-03, -7.57966669e-07, 2.09470555e-10, -2.16717794e-14,
-1088.45772, 5.45323129]
reactions:
- equation: O + H2 <=> H + OH # Reaction 1
type: Blowers-Masel
rate-constant: {A: 3.87e+04, b: 2.7, Ea0: 6260.0, w: 1e9}

View File

@@ -18,30 +18,26 @@ phases:
thermo: ideal-gas
elements: [O, H, C, N, Ar]
species:
- gri30.yaml/species: [H2, H, O, O2, OH, H2O, HO2, H2O2, C, CH, CH2, CH2(S),
CH3, CH4, CO, CO2, HCO, CH2O, CH2OH, CH3O, CH3OH, C2H, C2H2, C2H3,
C2H4, C2H5, C2H6, HCCO, CH2CO, HCCOH, AR, N2]
- gri30.yaml/species: [H2, H, O, O2, OH, H2O, CH4, AR, N2]
skip-undeclared-elements: true
kinetics: gas
reactions:
- gri30.yaml/reactions: declared-species
reactions: [gas-reactions]
transport: mixture-averaged
state:
T: 300.0
P: 1.01325e+05
X: {CH4: 0.095, O2: 0.21, AR: 0.79}
- name: Pt_surf
thermo: ideal-surface
elements: [Pt, H, O, C]
species: [PT(S), H(S), H2O(S), OH(S), O(S)]
species: [{Pt-surf-species: all}]
kinetics: surface
reactions: all
reactions: [Pt-reactions]
state:
T: 900.0
coverages: {O(S): 0.0, PT(S): 0.5, H(S): 0.5}
site-density: 2.7063e-09
species:
Pt-surf-species:
- name: PT(S)
composition: {Pt: 1}
thermo:
@@ -91,21 +87,30 @@ species:
- [1.945418, 9.1761647e-04, -1.1226719e-07, -9.9099624e-11, 2.4307699e-14,
-1.4005187e+04, -11.531663]
reactions:
gas-reactions:
- equation: O + H2 <=> H + OH # Reaction 1
type: Blowers-Masel
rate-constant: {A: 38700, b: 2.7, Ea0: 2.619184e4, w: 4.184e9}
Pt-reactions:
- equation: 2 H(S) => H2 + 2 PT(S) # Reaction 1
type: surface-Blowers-Masel
type: Blowers-Masel
rate-constant: {A: 3.7e+21, b: 0, Ea0: 67400, w: 1000000}
coverage-dependencies:
H(S): {a: 0.0, m: 0.0, E: -6000.0}
- equation: H + PT(S) => H(S) # Reaction 2
type: surface-Blowers-Masel
type: Blowers-Masel
sticking-coefficient: {A: 1.0, b: 0, Ea0: 0, w: 1000000}
- equation: H2O + PT(S) => H2O(S) # Reaction 3
type: surface-Blowers-Masel
type: Blowers-Masel
sticking-coefficient: {A: 0.75, b: 0, Ea0: 0, w: 1000000}
- equation: O2 + 2 PT(S) => 2 O(S) # Reaction 4
type: surface-Blowers-Masel
type: Blowers-Masel
sticking-coefficient: {A: 0.023, b: 0, Ea0: 0, w: 1000000}
- equation: OH + PT(S) => OH(S) # Reaction 5
type: surface-Blowers-Masel
sticking-coefficient: {A: 1.0, b: 0, Ea0: 0, w: 100000}
type: Blowers-Masel
sticking-coefficient: {A: 1.0, b: 0, Ea0: 0, w: 100000}
- equation: H2 + 2 PT(s) => 2 H(s)
type: Blowers-Masel
rate-constant: {A: 4.4579e10, b: 0.5, Ea0: 0.0, w: 1000000}
orders: {H2: 1.0, PT(s): 1.0}

View File

@@ -1,84 +0,0 @@
phases:
- name: gas
thermo: ideal-gas
species: [{gas-species: all}]
state: {T: 900 K, P: 1 atm, X: {H2: 0.4, Ar: 0.6}}
- name: Pt-surf
thermo: ideal-surface
kinetics: surface
reactions: [Pt-reactions]
species: [{Pt-surf-species: all}]
site-density: 2.7063e-9 mol/cm^2
state: {T: 900 K, P: 1 atm, coverages: {Pt(s): 0.5, H(s): 0.4, O(s): 0.1}}
gas-species:
- name: H2
composition: {H: 2}
thermo:
model: NASA7
temperature-ranges: [200.0, 1000.0, 3500.0]
data:
- [2.34433112, 0.00798052075, -1.9478151e-05, 2.01572094e-08, -7.37611761e-12,
-917.935173, 0.683010238]
- [3.3372792, -4.94024731e-05, 4.99456778e-07, -1.79566394e-10, 2.00255376e-14,
-950.158922, -3.20502331]
- 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,
25473.6599, -0.446682853]
- [2.50000001, -2.30842973e-11, 1.61561948e-14, -4.73515235e-18, 4.98197357e-22,
25473.6599, -0.446682914]
- name: Ar
composition: {Ar: 1}
thermo:
model: NASA7
temperature-ranges: [300.0, 5000.0]
data:
- [2.5, 0.0, 0.0, 0.0, 0.0, -745.375, 4.366]
Pt-surf-species:
- name: Pt(s)
composition: {Pt: 1}
thermo:
model: constant-cp
- name: H(s)
composition: {H: 1, Pt: 1}
thermo:
model: NASA7
temperature-ranges: [300, 1000, 3000]
data:
- [-1.3029877E+00, 5.4173199E-03, 3.1277972E-07, -3.2328533E-09,
1.1362820E-12, -4.2277075E+03, 5.8743238E+00]
- [1.0696996E+00, 1.5432230E-03, -1.5500922E-07, -1.6573165E-10,
3.8359347E-14, -5.0546128E+03, -7.1555238E+00]
- name: O(s)
composition: {O: 1, Pt: 1}
thermo:
model: NASA7
temperature-ranges: [300, 1000, 3000]
data:
- [-9.4986904E-01, 7.4042305E-03, -1.0451424E-06, -6.1120420E-09,
3.3787992E-12, -1.3209912E+04, 3.6137905E+00]
- [1.9454180E+00, 9.1761647E-04, -1.1226719E-07, -9.9099624E-11,
2.4307699E-14, -1.4005187E+04, -1.1531663E+01]
Pt-reactions:
- equation: H2 + 2 Pt(s) => 2 H(s)
type: surface-Blowers-Masel
rate-constant: {A: 4.4579e10 cm^3/mol/s, b: 0.5, Ea0: 0.0 J/mol, w: 1000000 J/mol}
orders: {H2: 1.0, Pt(s): 1.0}
- equation: 2 H(s) => H2 + 2 Pt(s)
type: surface-Blowers-Masel
rate-constant: {A: 3.7e21 cm^2/mol/s, b: 0, Ea0: 67400 J/mol, w: 1000000 J/mol}
coverage-dependencies: {H(s): {a: 0, m: 0, E: -6000 J/mol}}
- equation: H + Pt(s) => H(s)
type: surface-Blowers-Masel
sticking-coefficient: [1.0, 0.0, 0.0, 1000000]

View File

@@ -275,26 +275,26 @@ TEST(Kinetics, InterfaceKineticsFromYaml)
TEST(Kinetics, BMInterfaceKineticsFromYaml)
{
shared_ptr<ThermoPhase> gas(newPhase("surface-phases-BM.yaml", "gas"));
shared_ptr<ThermoPhase> surf_tp(newPhase("surface-phases-BM.yaml", "Pt-surf"));
shared_ptr<ThermoPhase> gas(newPhase("BM_test.yaml", "gas"));
shared_ptr<ThermoPhase> surf_tp(newPhase("BM_test.yaml", "Pt_surf"));
shared_ptr<SurfPhase> surf = std::dynamic_pointer_cast<SurfPhase>(surf_tp);
std::vector<ThermoPhase*> phases{surf_tp.get(), gas.get()};
auto kin = newKinetics(phases, "surface-phases-BM.yaml", "Pt-surf");
EXPECT_EQ(kin->nReactions(), (size_t) 3);
EXPECT_EQ(kin->nTotalSpecies(), (size_t) 6);
auto R1 = kin->reaction(0);
auto IR1 = std::dynamic_pointer_cast<BMInterfaceReaction>(R1);
EXPECT_DOUBLE_EQ(R1->orders["Pt(s)"], 1.0);
auto kin = newKinetics(phases, "BM_test.yaml", "Pt_surf");
EXPECT_EQ(kin->nReactions(), (size_t) 6);
EXPECT_EQ(kin->nTotalSpecies(), (size_t) 14);
auto R1 = kin->reaction(5);
auto IR1 = std::dynamic_pointer_cast<BlowersMaselInterfaceReaction>(R1);
EXPECT_DOUBLE_EQ(R1->orders["PT(s)"], 1.0);
EXPECT_DOUBLE_EQ(IR1->rate.preExponentialFactor(), 4.4579e7);
auto R2 = kin->reaction(1);
auto IR2 = std::dynamic_pointer_cast<BMInterfaceReaction>(R2);
auto R2 = kin->reaction(0);
auto IR2 = std::dynamic_pointer_cast<BlowersMaselInterfaceReaction>(R2);
EXPECT_DOUBLE_EQ(IR2->rate.preExponentialFactor(), 3.7e20);
EXPECT_DOUBLE_EQ(IR2->coverage_deps["H(s)"].E, -6e6 / GasConstant);
EXPECT_DOUBLE_EQ(IR2->coverage_deps["H(S)"].E, -6e6 / GasConstant);
EXPECT_FALSE(IR2->is_sticking_coefficient);
auto R3 = kin->reaction(2);
auto IR3 = std::dynamic_pointer_cast<BMInterfaceReaction>(R3);
auto R3 = kin->reaction(1);
auto IR3 = std::dynamic_pointer_cast<BlowersMaselInterfaceReaction>(R3);
EXPECT_TRUE(IR3->is_sticking_coefficient);
}