[CTI] Allow CTI files containing only reaction definitions

The reactions in these files can be referenced by other CTI/XML files, or used
directly to create Reaction objects. The absence of a phase definition requires
that either (a) all reactions are in bulk phases, or (b) the rate constants are
given in kmol, meter, second units since it is impossible to determine the
dimensionality of the concentration for each species.
This commit is contained in:
Ray Speth 2015-04-27 16:08:01 -04:00
parent caf71b839c
commit b6ac3ce995

View file

@ -1188,21 +1188,27 @@ class reaction(object):
nm = -999 nm = -999
nl = -999 nl = -999
mindim = 4 if _phases:
for ph in _phases: mindim = 4
if ph.has_species(s): for ph in _phases:
nm, nl = ph.conc_dim() if ph.has_species(s):
if ph.is_ideal_gas(): nm, nl = ph.conc_dim()
self._igspecies.append(s) if ph.is_ideal_gas():
if not ph in rxnph: self._igspecies.append(s)
rxnph.append(ph) if not ph in rxnph:
self._dims[ph._dim] += 1 rxnph.append(ph)
if ph._dim < mindim: self._dims[ph._dim] += 1
self._rxnphase = ph if ph._dim < mindim:
mindim = ph._dim self._rxnphase = ph
break mindim = ph._dim
if nm == -999: break
raise CTI_Error("species "+s+" not found") if nm == -999:
raise CTI_Error("species "+s+" not found")
else:
# If no phases are defined, assume all reactants are in bulk
# phases
nm = 1
nl = -3
self.mdim += nm*ns self.mdim += nm*ns
self.ldim += nl*ns self.ldim += nl*ns