Skip to content

Conversation

@SebastianM-C
Copy link
Member

@SebastianM-C SebastianM-C commented Oct 29, 2025

NonlinearSolve is sending alias_u0, is it ok to convert that or should we change NonlinearSolve to send the NonlinearAliasSpecifier and convert it to a ODEAliasSpecifier?

This would be one way to fix #97

SebastianM-C and others added 2 commits October 29, 2025 14:35
NonlinearSolve is passing this

Co-authored-by: Claude <[email protected]>
@ChrisRackauckas
Copy link
Member

It shouldn't be sending it anymore 😅

@ChrisRackauckas
Copy link
Member

@jClugstor did you never handle NonlinearSolve?

@jClugstor
Copy link
Member

It should be handled? Not sure why this is still giving the dep warning. Only thing I can see is the initon line 39 but that should be using the default, maybe something got messed up in the base splitting. I'll take a look

@SebastianM-C
Copy link
Member Author

The issue is in NonlinearSolve's solve(prob::AbstractNonlinearProblem,,https://github.com/SciML/NonlinearSolve.jl/blob/ac9344f9359833282e443c4479427ad9ce3311dd/lib/NonlinearSolveBase/src/solve.jl#L81-L88 as pointed out in #97 (comment)

@ChrisRackauckas-Claude
Copy link

I've updated the PR to use the standard NonlinearAliasSpecifier interface instead of alias_u0.

Changes Made:

  1. Changed the function signature to accept alias = SciMLBase.NonlinearAliasSpecifier() instead of alias_u0 = false
  2. Updated the ODE solver call to convert NonlinearAliasSpecifier to ODEAliasSpecifier by extracting the three fields: alias_p, alias_f, and alias_u0

Code Changes:

# Before (line 19):
alias_u0 = false, kwargs...)

# After:
alias = SciMLBase.NonlinearAliasSpecifier(), kwargs...)

# Before (lines 56-58):
odesol = solve(odeprob, alg.alg, args...; abstol, reltol, kwargs...,
    odesolve_kwargs..., callback, save_end = true,
    alias = SciMLBase.ODEAliasSpecifier(; alias_u0))

# After:
odesol = solve(odeprob, alg.alg, args...; abstol, reltol, kwargs...,
    odesolve_kwargs..., callback, save_end = true,
    alias = SciMLBase.ODEAliasSpecifier(; alias_p = alias.alias_p,
        alias_f = alias.alias_f, alias_u0 = alias.alias_u0))

Testing:

All tests pass successfully with these changes:

  • ✅ Pkg.test() completes without errors
  • ✅ Code formatted with JuliaFormatter using SciMLStyle

The warnings about alias_u0 being deprecated that appear in the test output are expected - they come from test code that still uses the old interface.

Patch:

Here's the git diff for easy application:

```diff
diff --git a/src/solve.jl b/src/solve.jl
index 158b325..b340fc6 100644
--- a/src/solve.jl
+++ b/src/solve.jl
@@ -16,7 +16,7 @@ end
function SciMLBase.__solve(prob::SciMLBase.AbstractSteadyStateProblem, alg::DynamicSS,
args...; abstol = 1e-8, reltol = 1e-6, odesolve_kwargs = (;),
save_idxs = nothing, termination_condition = NonlinearSolveBase.NormTerminationMode(infnorm),

  •    alias_u0 = false, kwargs...)
    
  •    alias = SciMLBase.NonlinearAliasSpecifier(), kwargs...)
    

    tspan = __get_tspan(prob.u0, alg)

    f = if prob isa SteadyStateProblem
    @@ -55,7 +55,8 @@ function SciMLBase.__solve(prob::SciMLBase.AbstractSteadyStateProblem, alg::Dyna
    odeprob = ODEProblem{isinplace(prob), true}(f, prob.u0, tspan, prob.p)
    odesol = solve(odeprob, alg.alg, args...; abstol, reltol, kwargs...,
    odesolve_kwargs..., callback, save_end = true,

  •    alias = SciMLBase.ODEAliasSpecifier(; alias_u0))
    
  •    alias = SciMLBase.ODEAliasSpecifier(; alias_p = alias.alias_p,
    
  •        alias_f = alias.alias_f, alias_u0 = alias.alias_u0))
    

    resid, u, retcode = __get_result_from_sol(termination_condition, tc_cache, odesol)
    ```

This aligns with the standard alias interface used throughout NonlinearSolve.jl and properly converts the NonlinearAliasSpecifier to ODEAliasSpecifier when calling the ODE solver.

@jClugstor
Copy link
Member

Yeah we'll need to thread the alias specifier through to all of the __solve functions in NonlinearSolve, since that's where the alias_u0 is actually used. I'm working on a PR for that.

The alias_u0 stuff in NonlinearSolve was different than it was in LinearSolve and NonlinearSolve, which is why this is kind of wonky.

Co-authored-by: Christopher Rackauckas <[email protected]>
Co-authored-by: Claude <[email protected]>
@SebastianM-C
Copy link
Member Author

I applied the fix from @ChrisRackauckas-Claude , but this will need SciML/NonlinearSolve.jl#720 before it can merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing of deprecated alias_u0 keyword

4 participants