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

**URL:** <https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [December 1, 2022, 1:27am UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071 "2022-12-01T01:27:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktitimbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ktitimbo/32/44265_2.png) [@ktitimbo](https://discourse.julialang.org/u/ktitimbo)\
**Post date:** [December 1, 2022, 1:27am UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071/1 "2022-12-01T01:27:01Z")

</div>

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 (?) )

```julia
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

```julia
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

---

<div class="post-metadata">

**Author:** ![vettert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vettert/32/30599_2.png) [@vettert](https://discourse.julialang.org/u/vettert)\
**Post date:** [December 1, 2022, 5:16am UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071/2 "2022-12-01T05:16:16Z")

</div>

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](https://github.com/SciML/DifferentialEquations.jl/issues/867)

Are you checking the return code somewhere? Something like:

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

```

The new way of doing that would be:

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

```

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

---

<div class="post-metadata">

**Author:** ![ktitimbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ktitimbo/32/44265_2.png) [@ktitimbo](https://discourse.julialang.org/u/ktitimbo)\
**Post date:** [December 1, 2022, 9:00am UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071/3 "2022-12-01T09:00:00Z")

</div>

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

```julia
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](https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes) for more information

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

---

<div class="post-metadata">

**Author:** ![vettert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vettert/32/30599_2.png) [@vettert](https://discourse.julialang.org/u/vettert)\
**Post date:** [December 14, 2022, 10:57am UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071/4 "2022-12-14T10:57:51Z")

</div>

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:

```julia
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?

---

<div class="post-metadata">

**Author:** ![ToddAnderson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/toddanderson/32/30826_2.png) [@ToddAnderson](https://discourse.julialang.org/u/ToddAnderson)\
**Post date:** [February 7, 2023, 8:30pm UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071/5 "2023-02-07T20:30:40Z")

</div>

I’m having a similar problem involving this warning message. I’m using a package that calls `solve` thousands of times during an operation, and seems to print the warning message to the console for every `solve` call. I can replicate the warning message using a [simple example from `DifferentialEquations.jl`](https://docs.sciml.ai/DiffEqDocs/stable/examples/classical_physics/):

```julia
using DifferentialEquations

#Half-life of Carbon-14 is 5,730 years.
C₁ = 5.730

#Setup
u₀ = 1.0
tspan = (0.0, 1.0)

#Define the problem
radioactivedecay(u,p,t) = -C₁*u

#Pass to solver
prob = ODEProblem(radioactivedecay,u₀,tspan)
sol = solve(prob,Tsit5());

julia> 

┌ Warning: 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
└ @ SciMLBase C:\Users\ander\.julia\packages\SciMLBase\QqtZA\src\retcodes.jl:355

```

and my actual use case, an [example from `LongwaveModePropagator.jl`](https://fgasdia.github.io/LongwaveModePropagator.jl/dev/generated/basic/#Propagating-the-fields:-HomogeneousWaveguide):

```julia
using LongwaveModePropagator
using LongwaveModePropagator: QE, ME

# vertical dipole transmitter at 24 kHz
tx = Transmitter(2.4e4)

# sample vertical electric field every 5 km out to 2000 km from tx
rx = GroundSampler(0:5e3:2000e3, Fields.Ez)

# vertical magnetic field
bfield = BField(50e-6, π/2, 0)

# daytime ionosphere
h = 75 # km
β = 0.35 # km⁻¹

electrons = Species(QE, ME, z->waitprofile(z, h, β), electroncollisionfrequency)

# "typical" earth ground 
ground = Ground(10,1e-4)

waveguide = HomogeneousWaveguide(bfield, electrons, ground)

# return the complex electric field, amplitude, and phase
E, a, p = propagate(waveguide, tx, rx);

```

(large number of warning messages omitted).

Since I’m not developing this package, I don’t want to spend too much time messing around with the internals. It looks like printing the warning messages to the console is severely impacting performance, however. Will using something like [`Suppressor.jl`](https://github.com/JuliaIO/Suppressor.jl) to prevent these warning messages from being printed help speed up the code, or do I need to find and alter whatever part of the code is checking the retcode?

---

<div class="post-metadata">

**Author:** ![yosinlpet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yosinlpet/32/46964_2.png) [@yosinlpet](https://discourse.julialang.org/u/yosinlpet)\
**Post date:** [February 16, 2023, 1:22pm UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071/6 "2023-02-16T13:22:56Z")

</div>

I’m in the same situation and a StackOverflowException is raised.

---

<div class="post-metadata">

**Author:** ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Post date:** [February 16, 2023, 2:46pm UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071/7 "2023-02-16T14:46:43Z")

</div>

For the carbon example I don’t get any warnings. I’m on the latest OrdinaryDiffEq: 6.44.0.

Have you tried updating your version of DifferentialEquations to the latest version?

---

<div class="post-metadata">

**Author:** ![ToddAnderson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/toddanderson/32/30826_2.png) [@ToddAnderson](https://discourse.julialang.org/u/ToddAnderson)\
**Post date:** [February 16, 2023, 8:22pm UTC](https://discourse.julialang.org/t/backwards-compatability-support-of-the-new-return-codes-to-symbols-will-be-deprecated/91071/8 "2023-02-16T20:22:18Z")

</div>

Hmm, I thought I had updated DifferentialEquations, but looks like my OrdinaryDiffEq was out of date (6.27.2). I updated both (to 7.7.0 and 6.44.0, respectively) and that solved it.

For anyone interested, Suppressor reduced runtime pre-update to about the same as post-update runtime. Just prepend `@suppress` to the line calling `solve()`.
