Fix preconditioner precs interface for v7 (#1601)#1606
Open
jitendravjh wants to merge 1 commit into
Open
Conversation
The precs interface changed in v7 from the 9-argument (W, du, u, p, t, newW, Plprev, Prprev, solverdata) to the 2-argument (newW, p) form, which broke every hand-written preconditioner builder in the benchmarks with a MethodError on the old signature. Migrate all builders to the new (newW, p) signature and return I (identity) instead of nothing for the right preconditioner, since the solver now applies it via ldiv! and nothing has no method. convert(AbstractMatrix, newW) materializes the passed WOperator to its underlying sparse matrix, so concrete_jac = true keeps working. Updated 12 builders across: - SimpleHandwrittenPDE/burgers_fdm_wpd.jmd (4) - SimpleHandwrittenPDE/allen_cahn_fdm_wpd.jmd (4) - StiffODE/Bruss.jmd (2) - Bio/BCR.jmd (1) - Bio/fceri_gamma2.jmd (1)
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 #1601. The
precsinterface changed in v7 from the 9-argument(W, du, u, p, t, newW, Plprev, Prprev, solverdata)to the 2-argument(newW, p), so the hand-written preconditioner builders in the benchmarks were failing with aMethodErroron the old signature.This migrates all of them to
(newW, p)and returnsIinstead ofnothingfor the right preconditioner, since the solver now applies it vialdiv!andnothinghas no method.convert(AbstractMatrix, newW)materializes the passedWOperatorto its sparse matrix, soconcrete_jac = truekeeps working.Updated 12 builders across
SimpleHandwrittenPDE/burgers_fdm_wpd.jmd,SimpleHandwrittenPDE/allen_cahn_fdm_wpd.jmd,StiffODE/Bruss.jmd,Bio/BCR.jmd, andBio/fceri_gamma2.jmd.Checked locally by running the affected builders on the real problems: the four SimpleHandwrittenPDE preconditioners solve the burgers problem with
KenCarp4, andKenCarp47solves with the ILU builder. The Bio problems use a sparse Jacobian, so theilu(convert(...))path is unchanged from before.