Skip to content

Commit 4c98a7a

Browse files
committed
Move thermo_coverage_dependence from NASAPolynomial to NASA
1 parent 2aed70b commit 4c98a7a

File tree

2 files changed

+15
-30
lines changed

2 files changed

+15
-30
lines changed

rmgpy/thermo/nasa.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ from rmgpy.thermo.wilhoit cimport Wilhoit
3434
cdef class NASAPolynomial(HeatCapacityModel):
3535

3636
cdef public double cm2, cm1, c0, c1, c2, c3, c4, c5, c6
37-
cdef public dict _thermo_coverage_dependence
3837

3938
cpdef dict as_dict(self)
4039

rmgpy/thermo/nasa.pyx

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,19 @@ cdef class NASAPolynomial(HeatCapacityModel):
4444
seven-coefficient and nine-coefficient variations are supported.
4545
The attributes are:
4646
47-
=========================== ============================================================
48-
Attribute Description
49-
=========================== ============================================================
50-
`coeffs` The seven or nine NASA polynomial coefficients
51-
`Tmin` The minimum temperature in K at which the model is valid, or zero if unknown or undefined
52-
`Tmax` The maximum temperature in K at which the model is valid, or zero if unknown or undefined
53-
`E0` The energy at zero Kelvin (including zero point energy)
54-
`thermo_coverage_dependence` The coverage dependence of the thermo
55-
`comment` Information about the model (e.g. its source)
56-
=========================== ============================================================
47+
========= ============================================================
48+
Attribute Description
49+
========= ============================================================
50+
`coeffs` The seven or nine NASA polynomial coefficients
51+
`Tmin` The minimum temperature in K at which the model is valid, or zero if unknown or undefined
52+
`Tmax` The maximum temperature in K at which the model is valid, or zero if unknown or undefined
53+
`E0` The energy at zero Kelvin (including zero point energy)
54+
`comment` Information about the model (e.g. its source)
55+
========= ============================================================
5756
5857
"""
5958

60-
def __init__(self, coeffs=None, Tmin=None, Tmax=None, E0=None, label='', thermo_coverage_dependence=None, comment=''):
59+
def __init__(self, coeffs=None, Tmin=None, Tmax=None, E0=None, label='', comment=''):
6160
HeatCapacityModel.__init__(self, Tmin=Tmin, Tmax=Tmax, E0=E0, label=label, comment=comment)
6261
self.coeffs = coeffs
6362

@@ -75,7 +74,6 @@ cdef class NASAPolynomial(HeatCapacityModel):
7574
if self.Tmax is not None: string += ', Tmax={0!r}'.format(self.Tmax)
7675
if self.E0 is not None: string += ', E0={0!r}'.format(self.E0)
7776
if self.label != '': string += ', label="""{0}"""'.format(self.label)
78-
if self.thermo_coverage_dependence is not None: string += ', thermo_coverage_dependence={0!r}'.format(self.thermo_coverage_dependence)
7977
if self.comment != '': string += ', comment="""{0}"""'.format(self.comment)
8078
string += ')'
8179
return string
@@ -84,7 +82,7 @@ cdef class NASAPolynomial(HeatCapacityModel):
8482
"""
8583
A helper function used when pickling an object.
8684
"""
87-
return (NASAPolynomial, ([self.cm2, self.cm1, self.c0, self.c1, self.c2, self.c3, self.c4, self.c5, self.c6], self.Tmin, self.Tmax, self.E0, self.label, self.thermo_coverage_dependence, self.comment))
85+
return (NASAPolynomial, ([self.cm2, self.cm1, self.c0, self.c1, self.c2, self.c3, self.c4, self.c5, self.c6], self.Tmin, self.Tmax, self.E0, self.label, self.comment))
8886

8987
cpdef dict as_dict(self):
9088
output_dictionary = super(NASAPolynomial, self).as_dict()
@@ -111,21 +109,6 @@ cdef class NASAPolynomial(HeatCapacityModel):
111109
else:
112110
raise ValueError('Invalid number of NASA polynomial coefficients; expected 7 or 9, got {0:d}.'.format(len(value)))
113111

114-
property thermo_coverage_dependence:
115-
"""The coverage dependence of the thermo"""
116-
def __get__(self):
117-
return self._thermo_coverage_dependence
118-
def __set__(self, value):
119-
self._thermo_coverage_dependence = {}
120-
if value:
121-
for species, parameters in value.items():
122-
# just the polynomial model for now
123-
processed_parameters = {'model': parameters['model'],
124-
'enthalpy-coefficients': [quantity.Dimensionless(p) for p in parameters['enthalpy-coefficients']],
125-
'entropy-coefficients': [quantity.Dimensionless(p) for p in parameters['entropy-coefficients']],
126-
}
127-
self._thermo_coverage_dependence[species] = processed_parameters
128-
129112
cpdef double get_heat_capacity(self, double T) except -1000000000:
130113
"""
131114
Return the constant-pressure heat capacity in J/mol*K at the specified
@@ -240,6 +223,7 @@ cdef class NASA(HeatCapacityModel):
240223
self.polynomials = list(polynomials.values())
241224
else:
242225
self.polynomials = polynomials
226+
self.thermo_coverage_dependence = thermo_coverage_dependence
243227

244228
def __repr__(self):
245229
"""
@@ -254,6 +238,7 @@ cdef class NASA(HeatCapacityModel):
254238
if self.Cp0 is not None: string += ', Cp0={0!r}'.format(self.Cp0)
255239
if self.CpInf is not None: string += ', CpInf={0!r}'.format(self.CpInf)
256240
if self.label != '': string += ', label="""{0}"""'.format(self.label)
241+
if self.thermo_coverage_dependence is not None: string += ', thermo_coverage_dependence={0!r}'.format(self.thermo_coverage_dependence)
257242
if self.comment != '': string += ', comment="""{0}"""'.format(self.comment)
258243
string += ')'
259244
return string
@@ -262,7 +247,7 @@ cdef class NASA(HeatCapacityModel):
262247
"""
263248
A helper function used when pickling an object.
264249
"""
265-
return (NASA, (self.polynomials, self.Tmin, self.Tmax, self.E0, self.Cp0, self.CpInf, self.label, self.comment))
250+
return (NASA, (self.polynomials, self.Tmin, self.Tmax, self.E0, self.Cp0, self.CpInf, self.label, self.thermo_coverage_dependence, self.comment))
266251

267252
cpdef dict as_dict(self):
268253
"""
@@ -434,6 +419,7 @@ cdef class NASA(HeatCapacityModel):
434419
poly.change_base_entropy(deltaS)
435420
return self
436421

422+
# need to modify this to include the thermo coverage dependence
437423
def to_cantera(self):
438424
"""
439425
Return the cantera equivalent NasaPoly2 object from this NASA object.

0 commit comments

Comments
 (0)