Add number_of_moles property and extensive thermodynamic properties to Material#709
Merged
bobmyhill merged 12 commits intogeodynamics:mainfrom Nov 28, 2025
Merged
Add number_of_moles property and extensive thermodynamic properties to Material#709bobmyhill merged 12 commits intogeodynamics:mainfrom
bobmyhill merged 12 commits intogeodynamics:mainfrom
Conversation
Member
Author
|
Addresses #707 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BREAKING CHANGES
This pull request refactors the handling of extensive and molar properties, primarily by standardizing the use of
number_of_molesand providing clear separation between extensive and molar quantities.Major changes:
number_of_molesproperty toMaterial, with getter and setter, and refactored all relevant classes to use this standardized attribute. By default, number_of_moles is equal to 1 for all classes.n_molesattribute.internal_energy,volume,entropy, etc.) in the parentMaterialclass, which all multiply molar properties bynumber_of_moles.V,S,H,C_v,C_p) to reference extensive properties instead of molar ones. This is the only major user-facing break in behaviourphase_volumes,phase_masses,formula) to use extensive propertiescheck_eos_consistency()inburnman/tools/eos.pyto work directly with extensive propertiesSeparately, this PR also adds cleaner error messaging and try/except blocks for when properties are requested before
set_state()has been called.