Skip to content

Commit

Permalink
[UnitTests] Retain coverage of legacy electrochemistry implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Mar 15, 2022
1 parent 5dd7c2d commit 4807abb
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 1 deletion.
10 changes: 9 additions & 1 deletion interfaces/cython/cantera/test/test_kinetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,10 @@ def test_ratio2(self):

class TestSofcKinetics(utilities.CanteraTest):
""" Test based on sofc.py """
_mech = "sofc.yaml"

def test_sofc(self):
mech = "sofc.yaml"
mech = self._mech
T = 1073.15 # T in K
P = ct.one_atm
TPB_length_per_area = 1.0e7 # TPB length per unit area [1/m]
Expand Down Expand Up @@ -902,6 +904,12 @@ def cathode_curr(E):
self.compare(data, self.test_data_path / "sofc-test.csv", rtol=1e-7)


@pytest.mark.usefixtures("allow_deprecated")
class TestSofcKinetics2(TestSofcKinetics):
""" Test using legacy framework; included to retain coverage """
_mech = "sofc2.yaml"


class TestDuplicateReactions(utilities.CanteraTest):
infile = 'duplicate-reactions.yaml'

Expand Down
93 changes: 93 additions & 0 deletions test/data/sofc2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
description: |-
This is a copy of sofc.yaml that uses the legacy framework.
It is retained to prevent a decrease in test coverage.
generator: cti2yaml
cantera-version: 2.5.0
date: Wed, 11 Dec 2019 16:59:15 -0500
input-files: [sofc.cti]

units: {length: cm, quantity: mol, activation-energy: kJ/mol}

phases:
- name: gas
thermo: ideal-gas
elements: [H, O, N]
species:
- gri30.yaml/species: [H2, H2O, N2, O2]
transport: mixture-averaged
state:
T: 1073.15
P: 1.01325e+05
X: {H2: 0.95, H2O: 0.05}
- name: metal
thermo: electron-cloud
elements: [E]
species:
- sofc.yaml/species: [electron]
state:
T: 1073.15
X: {electron: 1.0}
density: 9.0 kg/m^3
- name: oxide_bulk
thermo: lattice
elements: [O, E]
species:
- sofc.yaml/species: [Ox, VO**]
state:
T: 1073.15
P: 1.01325e+05
X: {Ox: 0.95, VO**: 0.05}
site-density: 0.0176 mol/cm^3
- name: metal_surface
thermo: ideal-surface
adjacent-phases: [gas]
elements: [H, O]
species:
- sofc.yaml/species: [(m), H(m), O(m), OH(m), H2O(m)]
kinetics: surface
reactions:
- sofc.yaml/metal_surface-reactions: declared-species
state:
T: 973.0
coverages: {(m): 0.5, H(m): 0.5}
site-density: 2.6e-09
- name: oxide_surface
thermo: ideal-surface
adjacent-phases: [gas, oxide_bulk]
elements: [O, H, E]
species:
- sofc.yaml/species: [(ox), O''(ox), OH'(ox), H2O(ox)]
kinetics: surface
reactions:
- sofc.yaml/oxide_surface-reactions: declared-species
state:
T: 1073.15
coverages: {O''(ox): 2.0, (ox): 0.0}
site-density: 2.0e-09
- name: tpb
thermo: edge
adjacent-phases: [metal, metal_surface, oxide_surface]
elements: [H, O]
species:
- sofc.yaml/species: [(tpb)]
kinetics: edge
reactions: [tpb-reactions]
state:
T: 1073.15
coverages: {(tpb): 1.0}
site-density: 5.0e-17
deprecated: >-
The input file 'sofc2.yaml' is deprecated and will be removed after Cantera 2.6.
tpb-reactions:
- equation: H(m) + O''(ox) <=> (m) + electron + OH'(ox) # Reaction 10
id: edge-f2
rate-constant: {A: 5.0e+13, b: 0.0, Ea: 120.0}
beta: 0.5
type: electrochemical-legacy
- equation: O(m) + (ox) + 2 electron <=> (m) + O''(ox) # Reaction 11
id: edge-f3
rate-constant: {A: 5.0e+13, b: 0.0, Ea: 120.0}
beta: 0.5
type: electrochemical-legacy

0 comments on commit 4807abb

Please sign in to comment.