How to calculate equilibrium for a system involving an interface and several phases

34 views
Skip to first unread message

Mikael Larsen

unread,
Jun 12, 2024, 5:20:11 AMJun 12
to Cantera Users' Group
Hi
when I am trying to calculate an equilibrium involving surface reaction I get the following fault:
Traceback (most recent call last):
  File "C:\Users\rml\PycharmProjects\ThermoChemistry\calc-thermochemistry.py", line 21, in <module>
    mix.equilibrate('TP')
  File "build\\python\\cantera\\mixture.pyx", line 336, in cantera.mixture.Mixture.equilibrate
cantera._utils.CanteraError:
*******************************************************************************
CanteraError thrown by Phase::assignDensity:
density must be positive. density = -nan
*******************************************************************************


Source code:

import cantera as ct

p = 1e0*ct.one_atm # pressure
T = 1073.0 # surface temperature

gas = ct.Solution("CaCO3-calcination-surface.yaml""gas")
CaCO3_phase = ct.Solution("CaCO3-calcination-surface.yaml","CaCO3_s")
CaO_phase = ct.Solution("CaCO3-calcination-surface.yaml""CaO_s")
surf_phase = ct.Interface("CaCO3-calcination-surface.yaml""CaO_surf"adjacent=[gas, CaCO3_phase, CaO_phase])

surf_phase.TPX = T, p, 'CaO(S): 1e8, CO2(S):1 '
gas.TPX = T, p, 'N2:1, CO2:0'
CaCO3_phase.TP = T, p
CaO_phase.TP = T, p

mix = ct.Mixture([(gas, 11.357), (CaCO3_phase, 10), (CaO_phase, 0.01), (surf_phase, 2.7063e-5)])
mix.T = T
mix.P = p
mix.equilibrate('TP')
print(mix.report())

If I omit (surf_phase, 2.7063e-5) from the Mixture then Cantera calculates the right equilibrium for the mixture - however; the surface is omitted. It seems like Cantera is missing density data for the surface?! I have set the moles for the gasphase as the amount of moles in 1 m³ and for the surface as moles on 1 m².
Creating a reactor network with the involved phases and surface seems to work fine - except it is not possible to calculate an equilibrium for a reactor network as far as I know.
So, am I doing something wrong or ...?

Thanks in advance
Mikael
CaCO3-calcination-surface.yaml

Ray Speth

unread,
Jun 21, 2024, 4:01:13 PM (11 days ago) Jun 21
to Cantera Users' Group

Hi Mikael,

The inability to include interface phases is one of many deficiencies of the Mixture class. Given the multiple orders of magnitude difference between the moles in the bulk phases and the moles on the surface, I think you could get pretty close by equilibrating all the bulk phases and then calling the advance_coverages_to_steady_state() method of the surface. This will lead to a small amount of non-conservation, as bulk phase objects won’t have their states updated as part of that calculation, but given the small number of moles on the surface, that may be close enough.

Using the reactor network would work as well, assuming you have a system of reversible reactions set up among the phases. You can try the ReactorNet.advance_to_steady_state method, or just integrate to some large time that’s much longer than any reaction timescales.

Regards,
Ray

Reply all
Reply to author
Forward
0 new messages