Skip to content

Commit

Permalink
[ck2cti] Add support for surface coverage dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Jul 15, 2016
1 parent db90a7c commit de9bb5b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
20 changes: 20 additions & 0 deletions interfaces/cython/cantera/ck2cti.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,22 @@ class SurfaceArrhenius(Arrhenius):
"""
An Arrhenius-like reaction occurring on a surface
"""
def __init__(self, *args, **kwargs):
Arrhenius.__init__(self, *args, **kwargs)
self.coverages = []

def rateStr(self):
s = Arrhenius.rateStr(self)

if self.coverages:
if len(self.coverages) == 1:
covs = self.coverages[0]
else:
covs = self.coverages
s = '\n{0}Arrhenius({1},\n{2}coverage={3})'.format(
' '*17, s[1:-1], ' '*27, list(covs))
return s


def to_cti(self, reactantstr, arrow, productstr, indent=0):
rxnstring = reactantstr + arrow + productstr
Expand Down Expand Up @@ -1374,6 +1390,10 @@ def parseExpression(expression, dest):
falloff = Sri(A=A, B=B, C=C)
else:
falloff = Sri(A=A, B=B, C=C, D=D, E=E)
elif 'cov' in line.lower():
C = tokens[1].split()
arrhenius.coverages.append(
(C[0], fortFloat(C[1]), fortFloat(C[2]), fortFloat(C[3])))

elif 'cheb' in line.lower():
# Chebyshev parameters
Expand Down
8 changes: 7 additions & 1 deletion interfaces/cython/cantera/ctml_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@

import sys

# Python 2/3 compatibility
try:
basestring
except NameError:
basestring = str

def _printerr(*args):
# All debug and error output should go to stderr
print(*args, file=sys.stderr)
Expand Down Expand Up @@ -1015,7 +1021,7 @@ def __init__(self,
self._c = [A, b, E]

if coverage:
if isinstance(coverage[0], str):
if isinstance(coverage[0], basestring):
self._cov = [coverage]
else:
self._cov = coverage
Expand Down

0 comments on commit de9bb5b

Please sign in to comment.