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 some bugs in the modular properties implementation #1425

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

andrewlee94
Copy link
Member

Fixes #1423, #1424

Summary/Motivation:

Two issues were recently raised identifying bugs in the modular properties code.

Changes proposed in this PR:

  • Correct how phase_equilibrium_list is created in generic_properties.py so that is a list (as expected) and not a dict.
  • Add catch in FTPx state initialization to handle cases with non-VLE phase equilibrium
  • Add regression checks for the above issues.

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@andrewlee94 andrewlee94 requested a review from bpaul4 as a code owner June 3, 2024 16:31
@andrewlee94 andrewlee94 self-assigned this Jun 3, 2024
@andrewlee94 andrewlee94 added bug Something isn't working user request Requests from external users Priority:High High Priority Issue or PR property packages Issues dealing with properties labels Jun 3, 2024
@andrewlee94 andrewlee94 requested a review from lbianchi-lbl as a code owner June 3, 2024 16:34
@@ -700,7 +700,7 @@ def build(self):
j,
) in self._phase_component_set:
# Component j is in both phases, in equilibrium
pe_dict["PE" + str(counter)] = {j: (pp[0], pp[1])}
pe_dict["PE" + str(counter)] = [j, (pp[0], pp[1])]
Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't expect these objects to be mutated, wouldn't it be better to have them as tuples?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is from deeper in the framework so now would not be the time to change this. That said, a tuple might make sense here.

Comment on lines +472 to +473
# Default is no initialization of VLE
vap_frac = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change because of PyLint?

Copy link
Member Author

Choose a reason for hiding this comment

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

No - this was from issue #1424. Later steps expect vap_frac to exist, so this is making sure it will exist no matter what course gets taken in the if/else block.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. I looked at the different branches of the inner if statement, but forgot it was nested inside an outer if statement.

Copy link
Contributor

@agarciadiego agarciadiego left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewlee94 andrewlee94 enabled auto-merge (squash) June 3, 2024 17:23
@andrewlee94 andrewlee94 added the CI:run-integration triggers_workflow: Integration label Jun 3, 2024
@idaes-build idaes-build removed the CI:run-integration triggers_workflow: Integration label Jun 3, 2024
@andrewlee94 andrewlee94 linked an issue Jun 3, 2024 that may be closed by this pull request
@bpaul4
Copy link
Contributor

bpaul4 commented Jun 3, 2024

LGTM, I manually retriggered the coverage upload tests which should remove the block.

@andrewlee94 andrewlee94 disabled auto-merge June 3, 2024 19:05
@andrewlee94 andrewlee94 merged commit 2ac6417 into IDAES:main Jun 3, 2024
65 of 89 checks passed
@andrewlee94 andrewlee94 deleted the issue_1424 branch June 3, 2024 19:06
lbianchi-lbl pushed a commit that referenced this pull request Jun 6, 2024
* Fixing bug in modular phase equilibrium list

* Add regression tests

* Fix unrelated typo

(cherry picked from commit 2ac6417)
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.79%. Comparing base (1c337b9) to head (e17d298).
Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1425      +/-   ##
==========================================
- Coverage   77.79%   77.79%   -0.01%     
==========================================
  Files         393      393              
  Lines       64797    64797              
  Branches    14390    14390              
==========================================
- Hits        50412    50410       -2     
- Misses      11795    11798       +3     
+ Partials     2590     2589       -1     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority:High High Priority Issue or PR property packages Issues dealing with properties user request Requests from external users
Projects
None yet
6 participants