IDAES / idaes-pse

The IDAES Process Systems Engineering Framework
https://idaes-pse.readthedocs.io/
Other
216 stars 232 forks source link

Add function to PETSc interface to return initial condition problem #1443

Open dallan-keylogic opened 3 months ago

dallan-keylogic commented 3 months ago

Fixes

Summary/Motivation:

When using the PETSc interface, a square initial condition problem is first solved (with either PETSc-snes or IPOPT) to make sure the initial condition is consistent before sending integrations problems to PETSc-TS. However, when you end up with degree of freedom problems or a degenerate problem, it's difficult to debug. As an expedient, I would edit the PETSc problem to return the problem in the middle of the context manager.

I've added a function to get this problem directly and modified the PETSc interface to use this function to get the initial condition problem to solve to ensure consistency.

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.
Robbybp commented 3 months ago

This looks really useful, thanks for making the change. I'll give it a review soon.

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 80.88235% with 13 lines in your changes missing coverage. Please review.

Project coverage is 76.36%. Comparing base (10b42e4) to head (6850cb2). Report is 1 commits behind head on main.

Files Patch % Lines
idaes/core/solvers/petsc.py 80.88% 7 Missing and 6 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1443 +/- ## ========================================== - Coverage 76.36% 76.36% -0.01% ========================================== Files 394 394 Lines 64953 64993 +40 Branches 14404 14412 +8 ========================================== + Hits 49601 49630 +29 - Misses 12793 12803 +10 - Partials 2559 2560 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

lbianchi-lbl commented 2 months ago

@Robbybp, just a friendly nag to review when (or if) you have some time.

dallan-keylogic commented 1 month ago

@Robbybp , could you please review this sometime soon? I'd really like it to make the August release.

ksbeattie commented 3 weeks ago

Progress not expected until end of Sept (per @dallan-keylogic)