Move DAE init alg error message further down the dependency stack #2554
+11
−26
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.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Still working on #2513 ; this pull request attempts to address that issue in a non-breaking way, whereas #2514 solves it more elegantly but with a breaking change to the default initialization algorithm. (That will probably need to be rebased on this pull request once this works as desired.)
Attempted approach
BrownFullBasicInit
andShampineCollocationInit
both requireOrdinaryDiffEqNonlinearSolve
. The original implementation had an error message when the nonlinear solve is attempted ifODENLSolve
is not loaded, but that nonlinear solve happens in a method of_initialize_dae!
which is defined only inODENLSolve
, so the error message needs to be placed inODECore
. This attempt currently checks in theDefaultInit
method for_initialize_dae!
whetherODENLSolve
is loaded, and if it is, proceeds to use default algorithms as done previously. If not loaded, then an error is thrown.I don't feel like enough of an expert to say authoritatively what the best way is to check if
ODENLSolve
is loaded. From what I could find of discussions on Discourse, etc., it seems like the recommended way might be to doso that is what I have done here.
Two other approaches I turned up (but that seem brittle or discouraged) might be something along the lines of
or checking if
ODENLSolve
is inBase.loaded_modules
.