Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Element potential" equilibrium solver finds incorrect solution for Redlich-Kwong phase #847

Closed
speth opened this issue Apr 14, 2020 · 1 comment · Fixed by #898
Closed

Comments

@speth
Copy link
Member

speth commented Apr 14, 2020

System information

  • Cantera version: current master (29437ef)
  • OS: any
  • Python version: 3.8 / any

To Reproduce

import cantera as ct
import numpy as np

gas = ct.Solution('nDodecane_Reitz.cti', 'nDodecane_RK')
reversible = np.array([R.reversible for R in gas.reactions()])
major_species = ['co2','h2o','co','h2','ch4']
TPX = 1100, 200*ct.one_atm, 'CH4:1.0, O2:0.2'

gas.TPX = TPX
gas.equilibrate('TP', solver='element_potential')
rop_ep = gas.net_rates_of_progress[reversible]
X_ep = gas[major_species].X

gas.TPX = TPX
gas.equilibrate('TP', solver='gibbs')
rop_gibbs = gas.net_rates_of_progress[reversible]
X_gibbs = gas[major_species].X

gas.TPX = TPX
gas.equilibrate('TP', solver='vcs')
rop_vcs = gas.net_rates_of_progress[reversible]
X_vcs = gas[major_species].X

gas2 = ct.Solution('nDodecane_Reitz.cti', 'nDodecane_IG')
gas2.TPX = TPX
gas2.equilibrate('TP', solver='gibbs')
rop_ig = gas2.net_rates_of_progress[reversible]
X_ig = gas2[major_species].X

print('Element potential:', X_ep, max(abs(rop_ep)))
print('Gibbs:            ', X_gibbs, max(abs(rop_gibbs)))
print('VCS:              ', X_vcs, max(abs(rop_vcs)))
print('Ideal gas (Gibbs):', X_ig, max(abs(rop_vcs)))

Expected behavior

  • Equilibrium mole fractions using the Redlich-Kwong model should be the same for all equilibrium solvers
  • Net reaction rate for all reversible reactions should be zero (to within rounding error)
  • Equilibrium using the ideal gas and Redlich-Kwong models should be somewhat different

Actual behavior

Element potential: [0.05060651 0.10176701 0.08695059 0.17343714 0.5871918 ] 0.022609974784086218
Gibbs:             [0.05062318 0.10508309 0.08508188 0.16642096 0.59274197] 8.117562178000526e-12
VCS:               [0.05062318 0.10508309 0.08508188 0.16642096 0.59274197] 2.313936819930973e-10
Ideal gas (Gibbs): [0.05060651 0.10176701 0.08695059 0.17343714 0.5871918 ] 2.313936819930973e-10
  • Element potential solver gives a solution that is different from the other two solvers
  • Net reaction rates are non-zero
  • Element potential solution appears to correspond to the ideal gas solution
@decaluwe
Copy link
Member

Thanks for raising this, @speth - I think your commentary over on the PengRobinson PR #641 is correct - this has to do with the function RedlichKwongMFTP::setToEquilState making no use of the interaction parameters (a_coeff and b_coeff), no? It appears to just use the reference state data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants