-
Notifications
You must be signed in to change notification settings - Fork 294
PETSc DAE Index Reduction Fix #1670
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
base: main
Are you sure you want to change the base?
PETSc DAE Index Reduction Fix #1670
Conversation
|
@blnicho says she should have time to look at this by early next week. |
…vated_disc_eqn_fix
| # TODO does moving this outside the context manager | ||
| # have any unexpected side effects? |
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.
@blnicho would you happen to know of any potential side effects?
| const_names.append(model.name + "." + s + "_pressure_balance") | ||
| const_names.append(model.name + "." + s + "_side_stream_pressure_balance") | ||
|
|
||
| # const_names.append(model.name + "." + s + "_material_holdup_constraint") |
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.
| # const_names.append(model.name + "." + s + "_material_holdup_constraint") |
| for stream in model.streams: | ||
| holdup_var = getattr(model, stream + "_material_holdup") | ||
| holdup_eqn = getattr(model, stream + "_material_holdup_constraint") | ||
| # calculate_variable_from_constraint(holdup_var, holdup_eqn) |
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.
| # calculate_variable_from_constraint(holdup_var, holdup_eqn) |
Summary/Motivation:
This PR is intended to allow PETSc to be used in problems where the DAE index has been reduced by deactivating some discretization equations and adding additional constraints. Frequently in IDAES models, we end up having to deactivate the discretization equations for a specific index, e.g.,
m.fs.unit.control_volume.material_accumulation_disc_eq[:, "Liq", "H2O"].deactivate(). This PR adds checks about whether the discretization equations for that index are active, then adds aDerivativeVarto the set of initial conditions to be fixed only if it is active.It also contains a workaround for Pyomo/pyomo#3734 .
Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: