-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
BinarySolutionTabulatedThermo Gibbs/entropy change abruptly at composition limits #1303
Comments
Thank you, @dschmider-HSOG for the further investigation of these issues in #1302. I think PR #1442 cleans up most of these issues. The "abrupt" changes at the composition limits were a result of some floating point precision issues. From this starting point, it seems that the main remaining issue is with the calculation of the entropy for the mixture and each species, which has some surprising behavior. The following example, starting from the fixes in #1442, demonstrates this, plotting the mixture and partial molar enthalpies (left) and entropies (right): import numpy as np
import cantera as ct
import matplotlib.pyplot as plt
p = ct.Solution('lithium_ion_battery.yaml', 'anode')
inpdata = p.input_data
Xt = np.array(inpdata['tabulated-thermo']['mole-fractions'])
St = np.array(inpdata['tabulated-thermo']['entropy'])
Ht = np.array(inpdata['tabulated-thermo']['enthalpy'])
N = 500
X = np.vstack((np.ones(N) - np.linspace(1-1e-5, 1e-5, N),
np.linspace(1-1e-5, 1e-5, N))).T
s = ct.SolutionArray(p, N)
s.TPX = 350, 10*ct.one_atm, X
f, ax = plt.subplots(1, 2, figsize=(7,4))
R = ct.gas_constant
ax[0].plot(X[:,0], s.partial_molar_enthalpies[:,1] / (R * s.T), label=r'$h_{\rm V[anode]}$')
ax[0].plot(X[:,0], s.partial_molar_enthalpies[:,0] / (R * s.T), label=r'$h_{\rm Li[anode]}$')
ax[0].plot(X[:,0], s.enthalpy_mole / (R * s.T), label=r'$h_{\rm mix}$')
ax[0].plot(Xt, Ht / (ct.gas_constant * s.T[0]), '.', label='tabulated data')
ax[0].set(xlabel=r'$X_{\rm Li[anode]}$', ylabel='$h/RT$')
ax[0].legend()
ax[1].plot(X[:,0], s.partial_molar_entropies[:,1] / R, label=r'$s_{\rm V[anode]}$')
ax[1].plot(X[:,0], s.partial_molar_entropies[:,0] / R, label=r'$s_{\rm Li[anode]}$')
ax[1].plot(X[:,0], s.entropy_mole / R, label=r'$s_{\rm mix}$')
ax[1].plot(Xt, St / R, '.', label='tabulated data')
ax[1].plot(X[:,0], s.standard_entropies_R[:,0], label=r'$s^o_{\rm Li[anode]}$ ')
ax[1].legend()
ax[1].set(xlabel=r'$X_{\rm Li[anode]}$', ylabel='$s/R$') The following features of this raise suspicions to me:
I think if we can at least answer the question of what |
Problem description
The entropy and Gibbs free energy values for the
BinarySolutionTabulatedThermo
phase change abruptly to artificial values as the composition approaches the limit of being a pure phase of the "tabulated" species.Steps to reproduce
While I think it's perhaps acceptable for the partial molar entropies / chemical potentials to start taking on arbitrary values as their corresponding mole fractions go to zero, the molar entropy and Gibbs free energy should still tend toward a finite value at the limit of a single species.
Another way this is visible is that the standard chemical potentials for the "tabulated" species start to follow an unexpected trend below the last tabulated point (here, at X = 0.00575):
System information
main
at 8fbb4bcAdditional context
This was discovered as part of #1299, which implements Cantera/enhancements#114.
The text was updated successfully, but these errors were encountered: