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

Simplify Molar Mixture Properties #1837

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ischoegl
Copy link
Member

@ischoegl ischoegl commented Jan 7, 2025

Changes proposed in this pull request

There are some instances where ThermoPhase objects use redundant code for the evaluation of molar mixture properties.

This PR seeks to provide a more uniform approach to evaluating molar properties. By default, average properties should be calculated as a weighted sum, e.g. $\bar{h} = \sum X_k \bar{h}_k$. getPartialMolar<> getters are used to obtain partial molar properties.

  • default behavior for molar mixture properties is changed to summation rather than throwing an exception
  • improve exception handling for any virtual ThermoPhase method that is not implemented
  • redundant/equivalent overrides are removed unless speed advantages are apparent

One caveat is that this approach has limitations for intEnergy_mole and cv_mole. These properties are implemented differently as they are largely based on simplified thermodynamic relationships rather than summations. Interestingly, an attempt to base intEnergy_mole on getPartialMolarIntEnergies causes failures in the zeroD module, albeit only on windows and sundials runners.

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

@ischoegl ischoegl added the Thermo label Jan 7, 2025
@ischoegl ischoegl force-pushed the simplify-molar-thermo-props branch from 70d10e2 to e6d5de4 Compare January 7, 2025 03:40
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 69.09091% with 17 lines in your changes missing coverage. Please review.

Project coverage is 74.39%. Comparing base (2e0d8ac) to head (3e3b709).

Files with missing lines Patch % Lines
include/cantera/thermo/ThermoPhase.h 61.36% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1837      +/-   ##
==========================================
- Coverage   74.41%   74.39%   -0.02%     
==========================================
  Files         382      382              
  Lines       53411    53328      -83     
  Branches     9026     9020       -6     
==========================================
- Hits        39747    39676      -71     
+ Misses      10617    10606      -11     
+ Partials     3047     3046       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ischoegl ischoegl force-pushed the simplify-molar-thermo-props branch from e6d5de4 to 987dfbe Compare January 7, 2025 04:30
@ischoegl ischoegl marked this pull request as ready for review January 7, 2025 05:50
@ischoegl ischoegl requested a review from a team January 7, 2025 06:15
@ischoegl ischoegl force-pushed the simplify-molar-thermo-props branch from 40981d9 to 1d4127d Compare January 7, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant