NonlinearSolveBase: accept verbose=nothing as default NonlinearVerbosity()#920
Closed
ChrisRackauckas-Claude wants to merge 1 commit into
Closed
Conversation
Three `solve` entry points (top-level `solve` at lines 50, 194, 495) already normalize `Bool` and `AbstractVerbosityPreset` values of the `verbose` kwarg into a `NonlinearVerbosity`. Extend the branch set to also accept `nothing`, normalizing it to `NonlinearVerbosity()` (the default). Motivation: wrapping `solve`s that forward a caller's `verbose` kwarg through to `NonlinearSolve` without owning the default — e.g. `DiffEqBase` ↔ `NonlinearSolve` bridges and `SteadyStateDiffEq`'s `SSRootfind` — may pass `nothing` to mean "inherit the default". Prior to this, `nothing` would skip both normalizing branches, land in downstream `verbose.display_level` / `verbose.convergence_failure` field accesses, and fail with `getfield(::Nothing, …)`. Bumps `NonlinearSolveBase` to 2.25.1. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Contributor
Author
|
Closing — making NonlinearSolveBase tolerant of |
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.
Summary
Three
solveentry points inlib/NonlinearSolveBase/src/solve.jl(top-levelsolveat lines 50, 194, 495) already normalizeBoolandAbstractVerbosityPresetvalues of theverbosekwarg into aNonlinearVerbosity. Extend the branch set to also acceptnothing, normalizing it toNonlinearVerbosity()(the default).Why
Wrapping
solves that forward a caller'sverbosekwarg through toNonlinearSolvewithout owning the default may passnothingto mean "inherit the default". Concrete call sites:DiffEqBase↔NonlinearSolvebridges used by stiff-ODE implicit solvers.SteadyStateDiffEq.SSRootfind.__solveforwards its kwargs directly toNonlinearSolve.solve(see Widen DiffEqBase compat to v7 (and tidy SciMLBase bound) SteadyStateDiffEq.jl#122 for the companion fix in theDynamicSSbranch, where the inner kwargs go to an ODE solve instead).Prior to this, a caller-forwarded
verbose = nothingwould skip both normalizing branches (Bool,AbstractVerbosityPreset), land in downstreamverbose.display_level/verbose.convergence_failurefield accesses, and fail with:Fix
One new
elseif verbose === nothingbranch persolveentry point, converting toNonlinearVerbosity().Version
Bumps
NonlinearSolveBaseto 2.25.1 (patch — additive, non-breaking).