Skip to content

Commit ad30929

Browse files
committed
Revert "remove option to use deprecated cantera api"
This reverts commit ab15a7b.
1 parent 4beb257 commit ad30929

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

rmgpy/kinetics/arrhenius.pyx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,14 @@ cdef class Arrhenius(KineticsModel):
232232
"""
233233
self._A.value_si *= factor
234234

235-
def to_cantera_kinetics(self):
235+
def to_cantera_kinetics(self, arrhenius_class=False):
236236
"""
237237
Converts the RMG Arrhenius object to a cantera ArrheniusRate or
238238
the auxiliary cantera Arrhenius class (used by falloff reactions).
239239
Inputs for both are (A,b,E) where A is in units of m^3/kmol/s, b is dimensionless, and E is in J/kmol
240+
241+
arrhenius_class: If ``True``, uses cantera.Arrhenius (for falloff reactions). If ``False``, uses
242+
Cantera.ArrheniusRate
240243
"""
241244

242245
import cantera as ct
@@ -266,7 +269,10 @@ cdef class Arrhenius(KineticsModel):
266269

267270
b = self._n.value_si
268271
E = self._Ea.value_si * 1000 # convert from J/mol to J/kmol
269-
return ct.ArrheniusRate(A, b, E)
272+
if arrhenius_class:
273+
return ct.Arrhenius(A, b, E)
274+
else:
275+
return ct.ArrheniusRate(A, b, E)
270276

271277
def set_cantera_kinetics(self, ct_reaction, species_list):
272278
"""
@@ -918,7 +924,7 @@ cdef class PDepArrhenius(PDepKineticsModel):
918924
assert isinstance(ct_reaction.rate, ct.PlogRate), "Must have a Cantera PlogRate attribute"
919925

920926
pressures = copy.deepcopy(self._pressures.value_si)
921-
ctArrhenius = [arr.to_cantera_kinetics() for arr in self.arrhenius]
927+
ctArrhenius = [arr.to_cantera_kinetics(arrhenius_class=True) for arr in self.arrhenius]
922928

923929
new_rates = ct.PlogRate(list(zip(pressures, ctArrhenius)))
924930
ct_reaction.rate = new_rates

rmgpy/kinetics/falloff.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ cdef class Lindemann(PDepKineticsModel):
234234
"""
235235
import cantera as ct
236236

237-
high_rate = self.arrheniusHigh.to_cantera_kinetics()
238-
low_rate = self.arrheniusLow.to_cantera_kinetics()
237+
high_rate = self.arrheniusHigh.to_cantera_kinetics(arrhenius_class=True)
238+
low_rate = self.arrheniusLow.to_cantera_kinetics(arrhenius_class=True)
239239
return ct.LindemannRate(low=low_rate, high=high_rate)
240240

241241

@@ -413,6 +413,6 @@ cdef class Troe(PDepKineticsModel):
413413
T2 = self.T2.value_si
414414
falloff = [A, T3, T1, T2]
415415

416-
high = self.arrheniusHigh.to_cantera_kinetics()
417-
low = self.arrheniusLow.to_cantera_kinetics()
416+
high = self.arrheniusHigh.to_cantera_kinetics(arrhenius_class=True)
417+
low = self.arrheniusLow.to_cantera_kinetics(arrhenius_class=True)
418418
return ct.TroeRate(high=high, low=low, falloff_coeffs=falloff)

0 commit comments

Comments
 (0)