Cantera / cantera

Chemical kinetics, thermodynamics, and transport tool suite
https://cantera.org
Other
580 stars 341 forks source link

Enable multiphase equilibrium calculations involving surface phases #1720

Open speth opened 1 week ago

speth commented 1 week ago

Problem description

Equilibrating a mixture that contains an interface phase fails. I don't think there's any fundamental reason why such phases shouldn't be able to be included in a multiphase equilibrium calculation.

Steps to reproduce

import cantera as ct
surf = ct.Interface('diamond.yaml', 'diamond_100')
mix = ct.Mixture([
    (surf, 1e-5),
    (surf.adjacent['diamond'], 1.0),
    (surf.adjacent['gas'], 0.4)
])
mix.equilibrate('TP')

Behavior

File ~/src/cantera/build/python/cantera/mixture.pyx:330, in cantera.mixture.Mixture.equilibrate()
    328     successively more verbose information.
    329 """
--> 330 self.mix.equilibrate(stringify(XY.upper()), stringify(solver), rtol,
    331                      max_steps, max_iter, estimate_equil, log_level)

CanteraError: 
*******************************************************************************
CanteraError thrown by Phase::assignDensity:
density must be positive. density = nan
*******************************************************************************

System information

Additional context

Originally reported on the Users' Group.