The Gibbs multiphase equilbrium solver unexpectedly fails to solve some constant T and P equilibrium problems. The following code demonstrates some cases which fail:
import cantera as ct
gas = ct.Solution('gri30.xml')
carbon = ct.Solution('graphite.xml')
T = 923
P = ct.one_atm
mcomps = 200
nSuccess = 0
nFail = 0
for m in range(mcomps):
for n in range(m):
gas.TPX = T, P, {'C': n, 'H': mcomps-m, 'O': m-n}
X0 = gas.mole_fraction_dict()
mix = ct.Mixture([(gas, 1.0), (carbon, 0.0)])
# mix = ct.Mixture([(gas, 1.0)])
mix.T = T
mix.P = ct.one_atm
try:
mix.equilibrate('TP', solver='gibbs', max_steps=1000)
nSuccess += 1
except RuntimeError:
print X0
nFail += 1
print 'Successful equilibrations:', nSuccess
print 'Failed equilibrations:', nFail
This currently gives 150 failures out of 19900 cases. The number of failures for the simpler configuration where only the gas phase is present is even higher -- 1292 cases out of 19900.
Decreasing the temperature significantly increases the failure rate. At 600 K, the failure rate is 2264 cases for the two-phase configuration and 4770 cases for the gas-phase-only configuration.
Increasing max_steps helps, but even allowing 100000 steps, there are still 15 cases that fail in the baseline scenario.
The above code is adapted from an example provided by Colin Gore in this thread on the Cantera Users' Group.
The Gibbs multiphase equilbrium solver unexpectedly fails to solve some constant T and P equilibrium problems. The following code demonstrates some cases which fail:
This currently gives 150 failures out of 19900 cases. The number of failures for the simpler configuration where only the gas phase is present is even higher -- 1292 cases out of 19900.
Decreasing the temperature significantly increases the failure rate. At 600 K, the failure rate is 2264 cases for the two-phase configuration and 4770 cases for the gas-phase-only configuration.
Increasing
max_stepshelps, but even allowing 100000 steps, there are still 15 cases that fail in the baseline scenario.The above code is adapted from an example provided by Colin Gore in this thread on the Cantera Users' Group.