Fix get default scaling factor#1659
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## scaling_toolbox #1659 +/- ##
================================================
Coverage 77.09% 77.09%
================================================
Files 395 395
Lines 63171 63182 +11
Branches 10373 10380 +7
================================================
+ Hits 48702 48713 +11
Misses 12021 12021
Partials 2448 2448 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I think this might be running afoul of the create-on-demand properties---by using |
|
@dallan-keylogic the |
blnicho
left a comment
There was a problem hiding this comment.
@dallan-keylogic I have a few minor change requests but otherwise this looks fine
* error for unnamed expressions * pylint * default is warning=False * make sure expression walker doesn't emit warnings * fix get_default_scaling_factor * no build on demand * not every component has lock attribute creation context * rescue files from different branch * avoid duplicate code and add tests * remove unused variable * fix spelling * pylint * changes suggested from review --------- Co-authored-by: Bethany Nicholson <[email protected]>
Fixes
get_default_scaling_factorformerly looked forcomponent.local_namein thedefault_scaling_factorsdictionary. However, that caused problems for indexed variables, where the user could plausibly setdefault_scaling_factors[mole_frac_phase_comp[Liq, H2O]]and have it be ignored because of the space after the comma. This PR fixes that using the component finder. The implementation, which iterates over all entries in the dictionary, isn't particularly efficient, but we don't expect these dictionaries to be that long---we can always optimize later.We also have the shortcoming that both the keys
mole_frac_phase_comp[Liq, H2O]andmole_frac_phase_comp[Liq,H2O](without a space after the comma) can coexist in the same dictionary. The key that is encountered first will have its scaling factor returned. There should probably be some validation step that screens for duplicates. That can be addressed when we address #1648 item 3.Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: