Hi Chris,
Cantera’s reactor models work with any of the equations of state implemented as versions of the ThermoPhase
class. However, each reactor can only contain a single, homogeneous phase. If you specify an ideal gas model for the phase, then all species in the phase will be treated as part of an ideal gas.
A better way to handle this might be to try out a feature which was recently merged into the main branch, which is the ability to augment reactor governing equations in your own Python code. There is an Python example at https://github.com/Cantera/cantera/blob/main/interfaces/cython/cantera/examples/reactors/custom2.py, and documentation in the development version docs at https://cantera.org/documentation/dev/sphinx/html/cython/zerodim.html#extensiblereactor.
Regards,
Ray
Hi Chris,
Yes, that’s essentially correct. If you want to use the Peng-Robinson model, you need to provide either the Peng-Robinson parameters (a, b, and acentric factor) or the critical properties (critical temperature, critical pressure, and acentric factor) for each species.
However, you can get individual species to behave as though they were ideal gasses by specifying an arbitrarily low critical temperature and an arbitrarily high critical pressure. This can even be done programmatically by modifying the species data after it’s been loaded (a new feature for Cantera 2.6 that’s in the development version, which you are presumably already using if you’re working with the Peng-Robinson model).
import cantera as ct
species = ct.Species.listFromFile('gri30.yaml')
for S in species:
if 'critical-parameters' in S.input_data or 'equation-of-state' in S.input_data:
continue
S.update_user_data(
{'critical-parameters':
{'critical-temperature': 0.001,
'critical-pressure': 1e20,
'acentric-factor': 0.0
}
}
)
pr = ct.Solution(thermo='Peng-Robinson', species=species)
In this example, I added a check to skip species where there is already either a critical-parameters
field or an equation-of-state
field (under the presumption that it contains Peng-Robinson parameters, though you could make that more specific).
One thing I haven’t given thought to so far is whether the binary interaction parameters work out correctly in this limit, once you add some species with “real” Peng-Robinson coefficients.
Regards,
Ray