diff --git a/doc/sphinx/cti/reactions.rst b/doc/sphinx/cti/reactions.rst index fed1b218b..dc8143f0d 100644 --- a/doc/sphinx/cti/reactions.rst +++ b/doc/sphinx/cti/reactions.rst @@ -51,14 +51,17 @@ Arrhenius function .. math:: - k_f(T) = A T^n \exp(-E/\hat{R}T) + k_f(T) = A T^b \exp(-E/\hat{R}T) which is defined with an :class:`Arrhenius` entry:: - rate_coeff = Arrhenius(A=1.0e13, n=0, E=(7.3, 'kcal/mol')) + rate_coeff = Arrhenius(A=1.0e13, b=0, E=(7.3, 'kcal/mol')) rate_coeff = Arrhenius(1.0e13, 0, (7.3, 'kcal/mol')) -As a shorthand, if the ``rate_coeff`` field is assigned a sequence of three numbers, these are assumed to be :math:`(A, n, E)` in the modified Arrhenius function:: +Note: the usage of ``n`` as the temperature exponent has been deprecated. It is +still available in version 2.2 but will be removed. + +As a shorthand, if the ``rate_coeff`` field is assigned a sequence of three numbers, these are assumed to be :math:`(A, b, E)` in the modified Arrhenius function:: rate_coeff = [1.0e13, 0, (7.3, 'kcal/mol')] # equivalent to above @@ -71,11 +74,11 @@ units of the rate of progress (different for homogeneous and heterogeneous reactions), it is usually best not to specify units for *A*, in which case they will be computed taking all of these factors into account. -Note: if :math:`n \ne 0`, then the term :math:`T^n` should have units of -:math:`K^n`, which would change the units of *A*. This is not done, however, so +Note: if :math:`b \ne 0`, then the term :math:`T^b` should have units of +:math:`K^b`, which would change the units of *A*. This is not done, however, so the units associated with A are really the units for :math:`k_f` . One way to -formally express this is to replace :math:`T^n` by the non-dimensional quantity -:math:`[T/(1 K)]^n`. +formally express this is to replace :math:`T^b` by the non-dimensional quantity +:math:`[T/(1 K)]^b`. The ID String ------------- @@ -147,9 +150,9 @@ combustion mechanism [#Smith1997]_ are shown below:: reaction( "O + HO2 <=> OH + O2", [2.00000E+13, 0.0, 0]) reaction( "O + H2O2 <=> OH + HO2", [9.63000E+06, 2.0, 4000]) reaction( "O + HCCO <=> H + 2 CO", [1.00000E+14, 0.0, 0]) - reaction( "H + O2 + AR <=> HO2 + AR", [7.00000E+17, -0.8, 0]) - reaction( "HO2 + C3H7 <=> O2 + C3H8", [2.55000E+10, 0.255, -943]) - reaction( "HO2 + C3H7 => OH + C2H5 + CH2O", [2.41000E+13, 0.0, 0]) + reaction( "H + O2 + AR <=> HO2 + AR", kf=Arrhenius(A=7.00000E+17, b=-0.8, E=0)) + reaction( equation = "HO2 + C3H7 <=> O2 + C3H8", kf=Arrhenius(2.55000E+10, 0.255, -943)) + reaction( equation = "HO2 + C3H7 => OH + C2H5 + CH2O", kf=[2.41000E+13, 0.0, 0]) Three-Body Reactions ==================== diff --git a/interfaces/cython/cantera/ck2cti.py b/interfaces/cython/cantera/ck2cti.py index 7690afbed..cdcabf22c 100644 --- a/interfaces/cython/cantera/ck2cti.py +++ b/interfaces/cython/cantera/ck2cti.py @@ -367,9 +367,9 @@ class Arrhenius(KineticsModel): Represent a set of modified Arrhenius kinetics. The kinetic expression has the form - .. math:: k(T) = A \\left( \\frac{T}{T_0} \\right)^n \\exp \\left( - \\frac{E_\\mathrm{a}}{RT} \\right) + .. math:: k(T) = A \\left( \\frac{T}{T_0} \\right)^b \\exp \\left( - \\frac{E_\\mathrm{a}}{RT} \\right) - where :math:`A`, :math:`n`, :math:`E_\\mathrm{a}`, and :math:`T_0` are the + where :math:`A`, :math:`b`, :math:`E_\\mathrm{a}`, and :math:`T_0` are the parameters to be set, :math:`T` is absolute temperature, and :math:`R` is the gas law constant. The attributes are: @@ -378,17 +378,17 @@ class Arrhenius(KineticsModel): =============== =================== ======================================== `A` :class:`Quantity` The preexponential factor in s^-1, m^3/mol*s, etc. `T0` :class:`Quantity` The reference temperature in K - `n` :class:`Quantity` The temperature exponent + `b` :class:`Quantity` The temperature exponent `Ea` :class:`Quantity` The activation energy in J/mol =============== =================== ======================================== """ - def __init__(self, A=0.0, n=0.0, Ea=0.0, T0=1.0, **kwargs): + def __init__(self, A=0.0, b=0.0, Ea=0.0, T0=1.0, **kwargs): KineticsModel.__init__(self, **kwargs) self.A = A self.T0 = T0 - self.n = n + self.b = b self.Ea = Ea def isPressureDependent(self): @@ -408,7 +408,7 @@ class Arrhenius(KineticsModel): else: Ea = "({0}, '{1}')".format(*self.Ea) - return '[{0}, {1}, {2}]'.format(A, self.n, Ea) + return '[{0}, {1}, {2}]'.format(A, self.b, Ea) def to_cti(self, reactantstr, arrow, productstr, indent=0): rxnstring = reactantstr + arrow + productstr @@ -420,7 +420,7 @@ class PDepArrhenius(KineticsModel): A kinetic model of a phenomenological rate coefficient k(T, P) using the expression - .. math:: k(T,P) = A(P) T^{n(P)} \\exp \\left[ \\frac{-E_\\mathrm{a}(P)}{RT} \\right] + .. math:: k(T,P) = A(P) T^{b(P)} \\exp \\left[ \\frac{-E_\\mathrm{a}(P)}{RT} \\right] where the modified Arrhenius parameters are stored at a variety of pressures and interpolated between on a logarithmic scale. The attributes are: @@ -452,7 +452,7 @@ class PDepArrhenius(KineticsModel): rxnstring = reactantstr + arrow + productstr lines = ['pdep_arrhenius({0!r},'.format(rxnstring)] prefix = ' '*(indent+15) - template = '[({0}, {1!r}), {2.A[0]:e}, {2.n}, {2.Ea[0]}],' + template = '[({0}, {1!r}), {2.A[0]:e}, {2.b}, {2.Ea[0]}],' for pressure,arrhenius in zip(self.pressures[0], self.arrhenius): lines.append(prefix + template.format(pressure, self.pressures[1], @@ -1046,7 +1046,7 @@ class Parser(object): # The first line contains the reaction equation and a set of modified Arrhenius parameters tokens = lines[0].split() A = float(tokens[-3]) - n = float(tokens[-2]) + b = float(tokens[-2]) Ea = float(tokens[-1]) reaction = ''.join(tokens[:-3]) @@ -1136,7 +1136,7 @@ class Parser(object): # The rest of the first line contains Arrhenius parameters arrhenius = Arrhenius( A=(A,kunits), - n=n, + b=b, Ea=(Ea, energy_units), T0=(1,"K"), parser=self @@ -1163,7 +1163,7 @@ class Parser(object): tokens = tokens[1].split() arrheniusLow = Arrhenius( A=(float(tokens[0].strip()),klow_units), - n=float(tokens[1].strip()), + b=float(tokens[1].strip()), Ea=(float(tokens[2].strip()),energy_units), T0=(1,"K"), parser=self @@ -1175,7 +1175,7 @@ class Parser(object): tokens = tokens[1].split() arrheniusHigh = Arrhenius( A=(float(tokens[0].strip()),kunits), - n=float(tokens[1].strip()), + b=float(tokens[1].strip()), Ea=(float(tokens[2].strip()),energy_units), T0=(1,"K"), parser=self @@ -1194,7 +1194,7 @@ class Parser(object): tokens = tokens[1].split() revReaction.kinetics = Arrhenius( A=(float(tokens[0].strip()),klow_units), - n=float(tokens[1].strip()), + b=float(tokens[1].strip()), Ea=(float(tokens[2].strip()),energy_units), T0=(1,"K"), parser=self @@ -1276,7 +1276,7 @@ class Parser(object): tokens = tokens[1].split() pdepArrhenius.append([float(tokens[0].strip()), Arrhenius( A=(float(tokens[1].strip()),kunits), - n=float(tokens[2].strip()), + b=float(tokens[2].strip()), Ea=(float(tokens[3].strip()),energy_units), T0=(1,"K"), parser=self diff --git a/interfaces/cython/cantera/ctml_writer.py b/interfaces/cython/cantera/ctml_writer.py index cfce89ab8..afa6e6b94 100644 --- a/interfaces/cython/cantera/ctml_writer.py +++ b/interfaces/cython/cantera/ctml_writer.py @@ -958,22 +958,42 @@ class rate_expression(object): class Arrhenius(rate_expression): def __init__(self, A = 0.0, - n = 0.0, + b = 0.0, E = 0.0, coverage = [], - rate_type = ''): + rate_type = '', + n = None): """ :param A: The pre-exponential coefficient. Required input. If entered without units, the units will be computed considering all factors that affect the units. The resulting units string is written to the CTML file individually for each reaction pre-exponential coefficient. - :param n: + :param b: The temperature exponent. Dimensionless. Default: 0.0. :param E: Activation energy. Default: 0.0. + :param coverage: + + :param rate_type: + + :param n: + The temperature exponent. Dimensionless. Default: 0.0. Deprecated usage + provided for compatibility. """ - self._c = [A, n, E] + if n is not None and b != 0.0: + raise CTI_Error("n and b cannot both be specified for the " + "temperature exponent. Specify one or the other.") + elif n is not None and b == 0.0: + b = n + print("Warning: Usage of n to specify the temperature exponent is " + "deprecated and will be removed in a future version. Use b " + "to specify the temperature exponent by keyword. Please check " + "your cti file for places where the temperature exponent of " + "the reaction rate is set by n = XXX and change them to " + "b = XXX.") + + self._c = [A, b, E] self._type = rate_type if coverage: @@ -1033,8 +1053,8 @@ reactant, but this reaction has """+str(ngas)+': '+str(gas_species)) c.addChild('m', repr(cov[2])) addFloat(c, 'e', cov[3], fmt = '%f', defunits = _ue) -def stick(A = 0.0, n = 0.0, E = 0.0, coverage = []): - return Arrhenius(A = A, n = n, E = E, coverage = coverage, rate_type = 'stick') +def stick(A = 0.0, b = 0.0, E = 0.0, coverage = []): + return Arrhenius(A = A, b = b, E = E, coverage = coverage, rate_type = 'stick') def getPairs(s): @@ -1059,10 +1079,10 @@ class reaction(object): """ :param equation: A string specifying the chemical equation. - :param rate_coeff: + :param kf: The rate coefficient for the forward direction. If a sequence of - three numbers is given, these will be interpreted as [A, n,E] in - the modified Arrhenius function :math:`A T^n exp(-E/\hat{R}T)`. + three numbers is given, these will be interpreted as [A, b, E] in + the modified Arrhenius function :math:`A T^b exp(-E/\hat{R}T)`. :param id: An optional identification string. If omitted, it defaults to a four-digit numeric string beginning with 0001 for the first @@ -1224,7 +1244,7 @@ class reaction(object): if isinstance(kf, rate_expression): k = kf else: - k = Arrhenius(A = kf[0], n = kf[1], E = kf[2]) + k = Arrhenius(A = kf[0], b = kf[1], E = kf[2]) k.build(kfnode, self.unit_factor(), gas_species = self._igspecies, name = nm, rxn_phase = self._rxnphase) @@ -1265,9 +1285,9 @@ class three_body_reaction(reaction): A string specifying the chemical equation. The reaction can be written in either the association or dissociation directions, and may be reversible or irreversible. - :param rate_coeff: + :param kf: The rate coefficient for the forward direction. If a sequence of - three numbers is given, these will be interpreted as [A,n,E] in + three numbers is given, these will be interpreted as [A, b, E] in the modified Arrhenius function. :param efficiencies: A string specifying the third-body collision efficiencies. @@ -1346,14 +1366,14 @@ class falloff_reaction(pdep_reaction): """ :param equation: A string specifying the chemical equation. - :param rate_coeff_inf: + :param kf: The rate coefficient for the forward direction in the high-pressure limit. If a sequence of three numbers is given, these will be - interpreted as [A, n,E] in the modified Arrhenius function. - :param rate_coeff_0: + interpreted as [A, b, E] in the modified Arrhenius function. + :param kf0: The rate coefficient for the forward direction in the low-pressure limit. If a sequence of three numbers is given, these will be - interpreted as [A, n,E] in the modified Arrhenius function. + interpreted as [A, b, E] in the modified Arrhenius function. :param efficiencies: A string specifying the third-body collision efficiencies. The efficiency for unspecified species is set to 1.0. @@ -1392,11 +1412,11 @@ class chemically_activated_reaction(pdep_reaction): :param kLow: The rate coefficient for the forward direction in the low-pressure limit. If a sequence of three numbers is given, these will be - interpreted as [A, n,E] in the modified Arrhenius function. + interpreted as [A, b, E] in the modified Arrhenius function. :param kHigh: The rate coefficient for the forward direction in the high-pressure limit. If a sequence of three numbers is given, these will be - interpreted as [A, n,E] in the modified Arrhenius function. + interpreted as [A, b, E] in the modified Arrhenius function. :param efficiencies: A string specifying the third-body collision efficiencies. The efficiency for unspecified species is set to 1.0. @@ -1436,9 +1456,9 @@ class pdep_arrhenius(reaction): def __init__(self, equation='', *args, **kwargs): self.pressures = [] self.arrhenius = [] - for p, A, n, Ea in args: + for p, A, b, Ea in args: self.pressures.append(p) - self.arrhenius.append((A, n, Ea)) + self.arrhenius.append((A, b, Ea)) reaction.__init__(self, equation, self.arrhenius, **kwargs) self._type = 'plog' @@ -1522,15 +1542,15 @@ class surface_reaction(reaction): """ :param equation: A string specifying the chemical equation. - :param rate_coeff: + :param kf: The rate coefficient for the forward direction. If a sequence of - three numbers is given, these will be interpreted as [A, n,E] in + three numbers is given, these will be interpreted as [A, b, E] in the modified Arrhenius function. :param sticking_prob: The reactive sticking probability for the forward direction. This can only be specified if there is only one bulk-phase reactant and it belongs to an ideal gas phase. If a sequence of three numbers is - given, these will be interpreted as [A, n,E] in the modified + given, these will be interpreted as [A, b, E] in the modified Arrhenius function. :param id: An optional identification string. If omitted, it defaults to a