From 4771874c757942807f40baa66e8a90e8f69ef25e Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 2 Dec 2017 13:59:09 -0500 Subject: [PATCH] [ck2cti] Allowing negative reaction orders requires '--permissive' option --- interfaces/cython/cantera/ck2cti.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/interfaces/cython/cantera/ck2cti.py b/interfaces/cython/cantera/ck2cti.py index a475b7f28..d0c857f4c 100644 --- a/interfaces/cython/cantera/ck2cti.py +++ b/interfaces/cython/cantera/ck2cti.py @@ -256,9 +256,10 @@ class Reaction(object): """ - def __init__(self, index=-1, reactants=None, products=None, kinetics=None, + def __init__(self, parser, index=-1, reactants=None, products=None, kinetics=None, reversible=True, duplicate=False, fwdOrders=None, thirdBody=None, ID=''): + self.parser = parser self.index = index self.reactants = reactants # list of (stoichiometry, species) tuples self.products = products # list of (stoichiometry, specis) tuples @@ -320,7 +321,8 @@ class Reaction(object): if any((float(x) < 0 for x in self.fwdOrders.values())): options.append('negative_orders') - logging.info('Allowing negative reaction order for reaction {0}.'.format(self.index)) + self.parser.warn('Negative reaction order for reaction {} ({}{}{}).'.format( + self.index, self.reactantString, arrow, self.productString)) if len(options) == 1: optStr = repr(options[0]) @@ -1239,7 +1241,8 @@ class Parser(object): raise InputParseError("Failed to find reactant/product delimiter in reaction string.") # Create a new Reaction object for this reaction - reaction = Reaction(reactants=[], products=[], reversible=reversible) + reaction = Reaction(reactants=[], products=[], reversible=reversible, + parser=self) def parseExpression(expression, dest): falloff3b = None @@ -1362,7 +1365,8 @@ class Parser(object): revReaction = Reaction(reactants=reaction.products, products=reaction.reactants, thirdBody=reaction.thirdBody, - reversible=False) + reversible=False, + parser=self) revReaction.kinetics = Arrhenius( A=(float(tokens[0].strip()), klow_units),