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

Fix IdealSolidSolnPhase and BinarySolutionTabulatedThermo #1442

Merged
merged 5 commits into from
Mar 4, 2023

Conversation

speth
Copy link
Member

@speth speth commented Feb 26, 2023

Changes proposed in this pull request

  • Fix serialization of BinarySolutionTabulatedThermo to include tabulated molar volumes
  • Change interpolation of partial molar volumes in BinarySolutionTabulatedThermo so calculated values are consistent with the identity $\sum V_{m,k} X_k = V_m$.
  • Add missing $p V_m$ term in IdealSolidSolnPhase::gibbs_mole
  • In BinarySolutionTabulatedThermo, use molar volumes corresponding to the current mole fractions when calculating other thermo properties
  • Fix handling of mixtures very close to pure species conditions

If applicable, fill in the issue number this pull request is fixing

Closes #1301
Closes #1302

I was hoping this would also address #1303, but I still have some questions on that one about what the model is actually supposed to be doing.

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

Tabulated molar volumes were not being included in YAML output
…hermo

Calculate partial molar volumes based on linearly interpolated dV/dXtab
rather than linearly interpolating the partial molar volumes themselves,
which does not satisfy the identity Vm == sum(vm[k]*X[k]).
@speth speth added the Thermo label Feb 26, 2023
@codecov
Copy link

codecov bot commented Feb 26, 2023

Codecov Report

Merging #1442 (ac60a59) into main (6392724) will increase coverage by 0.01%.
The diff coverage is 95.00%.

@@            Coverage Diff             @@
##             main    #1442      +/-   ##
==========================================
+ Coverage   70.91%   70.93%   +0.01%     
==========================================
  Files         369      369              
  Lines       55232    55235       +3     
  Branches    18196    18196              
==========================================
+ Hits        39168    39179      +11     
+ Misses      13602    13594       -8     
  Partials     2462     2462              
Impacted Files Coverage Δ
...ude/cantera/thermo/BinarySolutionTabulatedThermo.h 100.00% <ø> (ø)
include/cantera/thermo/IdealSolidSolnPhase.h 89.47% <ø> (ø)
src/thermo/BinarySolutionTabulatedThermo.cpp 87.96% <94.44%> (-1.01%) ⬇️
src/thermo/IdealSolidSolnPhase.cpp 84.01% <100.00%> (+0.43%) ⬆️
include/cantera/base/ValueCache.h 100.00% <0.00%> (ø)
src/base/stringUtils.cpp 80.62% <0.00%> (+0.77%) ⬆️
...terfaces/dotnet/Cantera/src/Interop/InteropUtil.cs 69.62% <0.00%> (+8.86%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bryanwweber
Copy link
Member

I'm curious about this identity you mentioned: $\sum V_{m,k} X_k = V_m$

It seems like it should be sum V_(m, k) = V_m and V_(m, k) = X_k V_m, analogous to partial pressures. Is it because V_(m, k) is the partial molar volume?

…Thermo

Previously, calculations of partial molar enthalpies, entropies, and chemical
potentials were using the pure-species molar volumes rather than the ones
calculated by inverting the tabulated mixture molar volume.
…Thermo

Fixes behavior when the tabulated species mole fraction has become 1.0 to within
machine precision, while the other species mole fraction is not quite zero.
@speth
Copy link
Member Author

speth commented Feb 26, 2023

Yes, I meant $V_{m,k}$ as the partial molar volume, and it follows the same identities as the (partial molar) enthalpy, entropy, Gibbs free energy, etc. Partial pressure is I guess the odd man out, and not something used very often within Cantera.

Copy link
Member

@ischoegl ischoegl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this fix is covered by thermodynamic consistency tests (which pass), I am approving.

@speth speth merged commit c3eb05c into Cantera:main Mar 4, 2023
@speth speth deleted the fix-1302-binary-soln branch March 4, 2023 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants