-
Notifications
You must be signed in to change notification settings - Fork 59
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
Dewatering and thickener unit models BSM2 #1010
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1010 +/- ##
========================================
Coverage 95.81% 95.82%
========================================
Files 296 298 +2
Lines 28475 28583 +108
========================================
+ Hits 27284 27389 +105
- Misses 1191 1194 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - I will add the documentation under a separate PR.
"and underflow as outlets.".format(self.name) | ||
) | ||
|
||
self.p_dewat = Param( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would shoot for more elaborate naming schemes. My guess without referring back to the literature is that you went with matching symbols in the literature. While that seems reasonable for the popular ASM and ADM models, I wonder if it might be more useful to offer up our own names in these unit cases for improved clarity. This is a broad comment regarding any parameter/variable names, when I compare those names with the associated doc string and question their alignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we are following ASM and ADM convention for names of our property, reaction package, etc. following naming convention from BSM2 paper would avoid confusion for users specially if they are following the paper we added as references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough - the documentation will probably help things.
Co-authored-by: Adam Atia <[email protected]>
Co-authored-by: Adam Atia <[email protected]>
) | ||
def non_particulate_components(blk, t, i): | ||
return blk.split_fraction[t, "overflow", i] == 1 - blk.f_q_du[t] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, for both units, I'm aware that you didn't add initialize_build
and calcualte_scaling_factors
methods, likely because the separator handles those. I still wonder though if we should include them here anyway, even if, for example, we just have loggers setup for initialization and run super().calculate_scaling_factors()
. @andrewlee94 curious to hear your thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you inherit from another model or base class, then any methods you do not overload will use that of the parent. For initialization this might be OK as long as the additions in the new model are relatively simple. However, for scaling, the new model is adding new variables and constraints (otherwise it wouldn't be a new model), and the parent's scaling methods won't touch these leaving part of the model unscaled.
On a related note, be aware that IDAES plans to rebuild both initialization and scaling this year. The new scaling API is already in place if you want to start looking at it: https://idaes-pse.readthedocs.io/en/latest/reference_guides/initialization/index.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I figured we could technically get away with it since the Separator's initialization and calculate_scaling_factors are essentially being used here, but that it might just be good practice and make for better readability/consistency between models for [new] developers. Furthermore, there are probably some unscaled vars that are added here but simple enough that additional scaling doesn't seem necessary at this point. I think we could put a pin in it for now and revisit if issues arise when analyzing the BSM2 flowsheet later.
And thanks for the note on the new scaling API.
@pytest.mark.solver | ||
@pytest.mark.skipif(solver is None, reason="Solver not available") | ||
@pytest.mark.component | ||
def test_initialize(self, du): | ||
|
||
iscale.calculate_scaling_factors(du) | ||
initialization_tester(du) | ||
|
||
@pytest.mark.solver | ||
@pytest.mark.skipif(solver is None, reason="Solver not available") | ||
@pytest.mark.component | ||
def test_solve(self, du): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should typically be a test to check for badly scaled variables here. I checked, and a few will crop up. We can be lenient about it and make a note to revisit in our master issue, considering the whole effort here for the BSM2 flowsheet, or you could add the typical test to check for badly scaled vars and eliminate any that exist by adding scaling. Though the badly scaled vars are probably attributed to zero components, it's hard to say whether this will end up impacting model stability at the flowsheet level later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, through our off-GH discussion, you made it clear that the badly scaled vars stem from the lack of scaling on the ASM1 property model, which we have noted in our master issue (#934)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary/Motivation:
Unit model necessary for BSM2 flowsheet. Addresses point in Issue #934
Changes proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: