engines.py: NativeEOS inherits from PhreeqcEOS; eliminate redundant code#353
Merged
rkingsbury merged 4 commits intomainfrom Feb 14, 2026
Merged
engines.py: NativeEOS inherits from PhreeqcEOS; eliminate redundant code#353rkingsbury merged 4 commits intomainfrom
rkingsbury merged 4 commits intomainfrom
Conversation
Member
Author
|
(Apologies that the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #353 +/- ##
==========================================
+ Coverage 85.53% 86.27% +0.73%
==========================================
Files 14 14
Lines 1860 1821 -39
Branches 323 313 -10
==========================================
- Hits 1591 1571 -20
+ Misses 224 207 -17
+ Partials 45 43 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
This PR reorganizes
engines.py(following up #351 ) to eliminate an additional ~90 lines of duplicated code. Specifically, it changes the inheritance so thatNativeEOSinherits fromPhreeqcEOS, with the intention to change the inheritance toPhreeqc2026EOSin a future release.Phreeqc2026EOSinherits directly from the abstract baseEOS.This change allows the
equilibratemethod, which contains logic specific to the respective wrappers, to live within thePhreeqc2026EOSclass. It also allows PHREEQC-specific methods_setup_ppsoland_destroy_ppsolto do the same.After all this code has been moved around and duplicate functions removed,
NativeEOSonly has to implement customget_activity_coefficient,get_osmotic_coefficient, andget_solute_volume, which communicates more clearly to future developers what is different betweenNativeEOSand the underlying PHREEQC-based EOS.Note that a separate
__init__is still needed forNativeEOSbecause it uses a different default database (llnl.dat).So to summarize, the new inheritance structure is:
EOS(abstract base)IdealEOS(EOS)Phreeqc2026EOS(EOS)PhreeqcEOS(Phreeqc2026EOS)NativeEOS(PhreeqcEOS)<= to be changed to inherit fromPhreeqc2026in a future release