mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[ck2cti] Add support for MWON and MWOFF keywords
This commit is contained in:
@@ -467,10 +467,15 @@ class SurfaceArrhenius(Arrhenius):
|
||||
Arrhenius.__init__(self, *args, **kwargs)
|
||||
self.coverages = []
|
||||
self.is_sticking = False
|
||||
self.motz_wise = None
|
||||
|
||||
def rateStr(self):
|
||||
if self.is_sticking:
|
||||
return ' stick({0})'.format(Arrhenius.rateStr(self)[1:-1])
|
||||
if self.motz_wise is None:
|
||||
return ' stick({0})'.format(Arrhenius.rateStr(self)[1:-1])
|
||||
else:
|
||||
return ' stick({0}, motz_wise={1})'.format(
|
||||
Arrhenius.rateStr(self)[1:-1], self.motz_wise)
|
||||
elif not self.coverages:
|
||||
return ' ' + Arrhenius.rateStr(self)
|
||||
|
||||
@@ -931,6 +936,7 @@ class Parser(object):
|
||||
self.output_energy_units = 'cal/mol' # for the output file
|
||||
self.quantity_units = 'mol' # for the current REACTIONS section
|
||||
self.output_quantity_units = 'mol' # for the output file
|
||||
self.motz_wise = None
|
||||
self.warning_as_error = True
|
||||
|
||||
self.elements = []
|
||||
@@ -1314,6 +1320,12 @@ class Parser(object):
|
||||
if 'stick' in line.lower():
|
||||
arrhenius.is_sticking = True
|
||||
|
||||
if 'mwon' in line.lower():
|
||||
arrhenius.motz_wise = True
|
||||
|
||||
if 'mwoff' in line.lower():
|
||||
arrhenius.motz_wise = False
|
||||
|
||||
if 'dup' in line.lower():
|
||||
# Duplicate reaction
|
||||
reaction.duplicate = True
|
||||
@@ -1759,17 +1771,21 @@ class Parser(object):
|
||||
# Reactions section
|
||||
inHeader = False
|
||||
for token in tokens[1:]:
|
||||
units = token.upper()
|
||||
if units in ENERGY_UNITS:
|
||||
self.energy_units =ENERGY_UNITS[units]
|
||||
token = token.upper()
|
||||
if token in ENERGY_UNITS:
|
||||
self.energy_units =ENERGY_UNITS[token]
|
||||
if not self.processed_units:
|
||||
self.output_energy_units = ENERGY_UNITS[units]
|
||||
elif units in QUANTITY_UNITS:
|
||||
self.quantity_units = QUANTITY_UNITS[units]
|
||||
self.output_energy_units = ENERGY_UNITS[token]
|
||||
elif token in QUANTITY_UNITS:
|
||||
self.quantity_units = QUANTITY_UNITS[token]
|
||||
if not self.processed_units:
|
||||
self.output_quantity_units = QUANTITY_UNITS[units]
|
||||
self.output_quantity_units = QUANTITY_UNITS[token]
|
||||
elif token == 'MWON':
|
||||
self.motz_wise = True
|
||||
elif token == 'MWOFF':
|
||||
self.motz_wise = False
|
||||
else:
|
||||
raise InputParseError("Unrecognized energy or quantity unit, {0!r}".format(units))
|
||||
raise InputParseError("Unrecognized token on REACTIONS line, {0!r}".format(token))
|
||||
|
||||
self.processed_units = True
|
||||
|
||||
@@ -2060,6 +2076,11 @@ class Parser(object):
|
||||
lines.append('# Reaction data')
|
||||
lines.append(delimiterLine)
|
||||
|
||||
if self.motz_wise is True:
|
||||
lines.append('enable_motz_wise()')
|
||||
elif self.motz_wise is False:
|
||||
lines.append('disable_motz_wise()')
|
||||
|
||||
for i,r in enumerate(self.reactions):
|
||||
lines.extend('# '+c for c in r.comment.split('\n') if c)
|
||||
lines.append('\n# Reaction {0}'.format(i+1))
|
||||
|
||||
@@ -387,8 +387,11 @@ class chemkinConverterTest(utilities.CanteraTest):
|
||||
# Sticking coefficients
|
||||
self.assertFalse(surf.reaction(1).is_sticking_coefficient)
|
||||
self.assertTrue(surf.reaction(2).is_sticking_coefficient)
|
||||
self.assertTrue(surf.reaction(2).use_motz_wise_correction)
|
||||
self.assertTrue(surf.reaction(4).is_sticking_coefficient)
|
||||
self.assertFalse(surf.reaction(4).use_motz_wise_correction)
|
||||
self.assertTrue(surf.reaction(4).duplicate)
|
||||
self.assertTrue(surf.reaction(6).use_motz_wise_correction)
|
||||
|
||||
# Coverage dependencies
|
||||
covdeps = surf.reaction(1).coverage_deps
|
||||
|
||||
@@ -25,7 +25,7 @@ _Pt_ PT 1 S 300.0 3000.0 1000.0 1
|
||||
0.00000000E+00 0.00000000E+00 0.00000000E+00 0.00000000E+00 4
|
||||
END
|
||||
|
||||
REACTIONS JOULES/MOLE
|
||||
REACTIONS JOULES/MOLE MWON
|
||||
H2 + 2_Pt_ => 2H_Pt 4.4579E+10 0.5 0.0
|
||||
FORD/_Pt_ 1/
|
||||
2H_Pt => H2 + 2_Pt_ 3.70E+21 0.00 67400.0
|
||||
@@ -36,11 +36,12 @@ END
|
||||
O2 + 2_Pt_ => 2O_Pt 1.80E+21 -0.5 0.0
|
||||
DUPLICATE
|
||||
O2 + 2_Pt_ => 2O_Pt 0.023 0.00 0.00
|
||||
DUPLICATE STICK
|
||||
DUPLICATE STICK MWOFF
|
||||
2O_Pt => O2 + 2_Pt_ 3.70E+21 0.00 213200.0
|
||||
COV/O_Pt 0.0 0.0 -60000.0/
|
||||
O + _Pt_ => O_Pt 1.00 0.0 0.0
|
||||
STICK
|
||||
MWON
|
||||
H2O + _Pt_ => H2O_Pt 0.75 0.0 0.0
|
||||
STICK
|
||||
H2O_Pt => H2O + _Pt_ 1.0E+13 0.00 40300.0
|
||||
|
||||
Reference in New Issue
Block a user