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

ValueError from report_numerical_issues() #1522

Open
adam-a-a opened this issue Nov 5, 2024 · 4 comments
Open

ValueError from report_numerical_issues() #1522

adam-a-a opened this issue Nov 5, 2024 · 4 comments
Labels
bug Something isn't working diagnostics Priority:Normal Normal Priority Issue or PR

Comments

@adam-a-a
Copy link
Contributor

adam-a-a commented Nov 5, 2024

I am getting the following error when I try running report_numerical_issues() from the DiagnosticToolbox. I should note that this was working fine until I updated my WaterTAP environment--just haven't taken the time to identify potentially problematic dependencies.

Traceback (most recent call last):
  File "c:\redacted.py", line 450, in <module>
    dt.report_numerical_issues()
  File "C:\redacted\lib\site-packages\idaes\core\util\model_diagnostics.py", line 1501, in report_numerical_issues      
    warnings, next_steps = self._collect_numerical_warnings(jac=jac, nlp=nlp)
  File "C:\redacted\lib\site-packages\idaes\core\util\model_diagnostics.py", line 1246, in _collect_numerical_warnings  
    par_cons = check_parallel_jacobian(
  File "C:\redacted\lib\site-packages\idaes\core\util\model_diagnostics.py", line 3778, in check_parallel_jacobian      
    maxval = max(np.abs(vec.data))
ValueError: max() arg is an empty sequence

FYI @andrewlee94 @lbianchi-lbl

@adam-a-a adam-a-a added bug Something isn't working diagnostics labels Nov 5, 2024
@andrewlee94
Copy link
Member

@adam-a-a First thing, could you update your version of IDAES and see if the issue persists? From the line numbers it appears you version of IDAES is out-of-date (I suspect this will not fix the issue hwoever).

@lbianchi-lbl
Copy link
Contributor

lbianchi-lbl commented Nov 7, 2024

@lbianchi-lbl lbianchi-lbl added the Priority:Normal Normal Priority Issue or PR label Nov 7, 2024
@dallan-keylogic
Copy link
Contributor

@adam-a-a , do you have a file where you can replicate this? I could debug it live to figure out what the issue is.

@adam-a-a
Copy link
Contributor Author

adam-a-a commented Nov 7, 2024

@dallan-keylogic I'll have to dig that up, but I think I realize why this happened. The model I was working with failed before going through initialization because of DOF > 0, and I was subsequently running report_numerical_issues on an uninitialized model, where there were likely variables without initial values.

In the interim, I wonder if you want to run any old model, and before initializing, run dt.report_numerical_issues. I know that we aren't supposed to do this in the first place and really should initialize the model first before trying to report numerical issues. That said, maybe we want a more helpful exception to pop up if a user makes the same mistake that I did; e.g., "Consider initializing your model first as it seems that variables without initial values were passed in."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working diagnostics Priority:Normal Normal Priority Issue or PR
Projects
None yet
Development

No branches or pull requests

4 participants