Backwards compatability support of the new return codes to Symbols will be deprecated

I’m very new to Julia so I might be misinterpreting what’s happening here.

When solving a stiff differential equation I am constantly getting “Backwards compatability support of the new return codes to Symbols will be deprecated with the Julia v1.9 release” (sic)

I just use: (the equation is complicated but I am not using symbols (?) )

ODEProblem(Bloch!,u0_i,tspan,p_i)
solve(prob, alg, saveat=time_save_step, dtmin=dtmin, maxiters=maxiters,reltol=reltol,abstol=abstol,force_dtmin=force_dtmin)

It directs me to: retcodes.jl

then

function Base.convert(::Type{ReturnCode.T}, retcode::Symbol)
    @warn "Backwards compatability support of the new return codes to Symbols will be deprecated with the Julia v1.9 release. Please see https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes for more information"

How shall I prepare my code to avoid this warning? or How can I avoid these warnings when I run the scripts and the code in REPL?

Thanks

There was a recent change from symbols to enums in return codes, see here: Change return codes to Enum · Issue #867 · SciML/DifferentialEquations.jl · GitHub

Are you checking the return code somewhere? Something like:

sol = solve(…)
if sol.retcode == :success
…
end

The new way of doing that would be:

sol = solve(…)
if sol.retcode == SciMLBase.Success
…
end

Hard to debug further without seeing the code, but the warning is definitely related to this. :slight_smile:

2 Likes

Thank you.

Actually, I am not checking anything, at least not explicitly. I believe DifferentialEquations is doing it. Does that make sense?

A snip of the code showing (a simplified version of ) the differential equations and the solver is shown below

using Plots; gr()
using LinearAlgebra
using Statistics
using DifferentialEquations, ODEInterfaceDiffEq

## SOLVER PARAMETERS [https://diffeq.sciml.ai/stable/basics/common_solver_opts/]
time_save_step=0.50e-9; # interval for saving each flight (unrelated to solver step size)
reltol=1e-10 ; # relative tolerance
abstol=1e-10 ; # absolute tolerance
maxiters=1000000000000 ;
dtmin=1e-23 ; # minimum time step
force_dtmin = true ;
alg = radau() ; # algorithm 


function Bloch!(du,u,p,t)
    # p[1]: v            u[1]: theta_e
    #                    u[2]: theta_n
    #                    u[3]: phi_e
    #                    u[4]: phi_n
  
    du[1] = -gammae*(Bn*sin(u[2])*sin(u[4]-u[3])  )
    du[2] = -gamman*(Be*sin(u[1])*sin(u[3]-u[4]) +) )  
    du[3] = -gammae*(getBzt(t) + Bn*cos(u[2]) - cot(u[1])*(Bn*sin(u[2])*cos(u[4]-u[3])  ) )
    du[4] = -gamman*(getBzt(t) + Be*cos(u[1]) - cot(u[2])*(Be*sin(u[1])*cos(u[3]-u[4]) ) )
  
end

prob = ODEProblem(Bloch!,[the0_list, thn0_list, phe0_list, phn0_list],tspan,[v]);
@time ssol = solve(prob, alg, saveat=time_save_step, dtmin=dtmin, maxiters=maxiters,reltol=reltol,abstol=abstol,force_dtmin=force_dtmin);
sol =  mapreduce(permutedims, vcat, ssol.u);

The warning appears when solve executes

Warning: Backwards compatability support of the new return codes to Symbols will be deprecated with the Julia v1.9 release. Please see SciMLSolutions · SciMLBase.jl for more information

Would be better if I wait for the new version of DifferentialEquations?

The code above doesn’t run. It has syntax errors (brackets in du[3] = …) and when removing those it still doesn’t run, because the definitions of the tspan, v and the initial states are missing.

When I minimize your example and keep all the options and the algorithm, there is no warning thrown:

using DifferentialEquations, ODEInterfaceDiffEq

## SOLVER PARAMETERS [https://diffeq.sciml.ai/stable/basics/common_solver_opts/]
time_save_step=0.50e-9; # interval for saving each flight (unrelated to solver step size)
reltol=1e-10 ; # relative tolerance
abstol=1e-10 ; # absolute tolerance
maxiters=1000000000000 ;
dtmin=1e-23 ; # minimum time step
force_dtmin = true ;
alg = radau() ; # algorithm 

u0 = rand(4)
tspan = (0.0, 1e-8)

function Bloch!(du,u,p,t)
    du .= -u
end

prob = ODEProblem(Bloch!,u0,tspan,nothing);
@time ssol = solve(prob, alg, saveat = time_save_step, dtmin = dtmin, maxiters = maxiters, reltol = reltol, abstol = abstol, force_dtmin = force_dtmin);

So, I guess the MWE above does either not hit the correct parts of the code or the warning isn’t triggered with the most current versions of DifferentialEquations.jl and ODEInterfaceDiffEq.jl; I used 7.6.0 and 3.12.0 in an otherwise clean environment.

Can you provide a working MWE that shows the above warning?

1 Like