PETSc Overhaul for DAE Index Reduction - #1824
Open
dallan-keylogic wants to merge 48 commits into
Open
Conversation
…vated_disc_eqn_fix
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1824 +/- ##
==========================================
+ Coverage 77.56% 77.62% +0.05%
==========================================
Files 423 424 +1
Lines 67529 67809 +280
Branches 11420 11483 +63
==========================================
+ Hits 52379 52635 +256
- Misses 12531 12541 +10
- Partials 2619 2633 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dallan-keylogic
commented
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
#1399
#1347
Summary/Motivation:
After some experience with the original PETSc integrator, I've found some shortcomings:
Point 2 made handling index reduction, in which we regularly need to convert derivative variables into algebraic variables, rather difficult. This problem could be bypassed by adding dummy variables for the derivatives, then setting only a subset of them to equal actual
DerivativeVars, but that would require large modifications to existing unit models to add these dummy variables to result in a situation in which the user gets confused about which variable is actually aDerivativeVarand which is just a dummy.To address these issues, I decided to rework the PETSc interface into a class.
DerivativeVarobject's discretization equation. If that equation is deactivated, it treats it as an algebraic variable. This makes the process of index reduction easier.Changes proposed in this PR:
Notes for reviewers
refresh_modelif the model structure changes. Do we want to try to save the user from themselves by callingrefresh_modelevery time the user callsdae_by_time_elementunless the user specifies otherwise using a function argument or config option?Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: