Closed charleskawczynski closed 2 weeks ago
https://github.com/SciML/SciMLBase.jl/blob/master/src/solutions/ode_solutions.jl#L289
It's just ndims(u)
, and u
can't be a tuple and needs well-defined dimensions?
Yeah, I saw that, but it doesn't seem like u
should be a tuple (I don't have access to it in my example). Isn't prob.u0
supposed to be similar
to u
? From the MWE above, I'm printing out
@show prob.u0
@show eltype(prob.u0)
@show ndims(eltype(prob.u0))
and, right before I call solve
, I get:
prob.u0 = [0.0]
eltype(prob.u0) = Float64
ndims(eltype(prob.u0)) = 0
And yet I still run into
ERROR: LoadError: MethodError: no method matching ndims(::Type{Tuple{Float64, Float64}})
Closest candidates are:
ndims(::Type{Union{}}, Any...)
@ Base abstractarray.jl:276
ndims(::HDF5.Dataspace)
@ HDF5 ~/.julia/packages/HDF5/Z859u/src/dataspaces.jl:95
ndims(::Type{<:Ref})
@ Base refpointer.jl:96
...
Stacktrace:
[1] build_solution(prob::ODEProblem{…}, alg::IMEXAlgorithm{…}, t::Vector{…}, u::Vector{…}; timeseries_errors::Bool, dense::Bool, dense_errors::Bool, calculate_error::Bool, k::Nothing, alg_choice::Nothing, interp::SciMLBase.LinearInterpolation{…}, retcode::SciMLBase.ReturnCode.T, destats::Missing, stats::Nothing, resid::Nothing, original::Nothing, kwargs::@Kwargs{})
@ SciMLBase ~/.julia/packages/SciMLBase/roUH9/src/solutions/ode_solutions.jl:289
[2] build_solution(prob::ODEProblem{…}, alg::IMEXAlgorithm{…}, t::Vector{…}, u::Vector{…})
@ SciMLBase ~/.julia/packages/SciMLBase/roUH9/src/solutions/ode_solutions.jl:270
[3] __init(::ODEProblem{…}, ::IMEXAlgorithm{…}; dt::Float64, tstops::Tuple{}, saveat::Nothing, save_everystep::Bool, callback::Nothing, advance_to_tstop::Bool, save_func::var"#cur_avg_sol_and_err#650"{…}, dtchangeable::Bool, stepstop::Int64, kwargs::@Kwargs{})
@ ClimaTimeSteppers ~/Dropbox/Caltech/work/dev/CliMA/ClimaTimeSteppers.jl/src/integrators.jl:94
[4] __solve(::ODEProblem{…}, ::IMEXAlgorithm{…}; kwargs::@Kwargs{…})
@ ClimaTimeSteppers ~/Dropbox/Caltech/work/dev/CliMA/ClimaTimeSteppers.jl/src/integrators.jl:157
[5] solve_call(_prob::ODEProblem{…}, args::IMEXAlgorithm{…}; merge_callbacks::Bool, kwargshandle::KeywordArgError, kwargs::@Kwargs{…})
@ DiffEqBase ~/.julia/packages/DiffEqBase/PBhFc/src/solve.jl:612
[6] solve_up(prob::ODEProblem{…}, sensealg::Nothing, u0::Vector{…}, p::Nothing, args::IMEXAlgorithm{…}; kwargs::@Kwargs{…})
@ DiffEqBase ~/.julia/packages/DiffEqBase/PBhFc/src/solve.jl:1080
[7] solve(prob::ODEProblem{…}, args::IMEXAlgorithm{…}; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{…})
@ DiffEqBase ~/.julia/packages/DiffEqBase/PBhFc/src/solve.jl:1003
...
Ah, showing the error I see u::Vector{Tuple{Float64, Float64}}
. Hmm, this used to work.. That's unfortunate.
Actually, I thought the time range we pass in was a tuple, so it kind of looks like it got swapped with t
:
build_solution(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Nothing, ClimaODEFunction{Nothing, Nothing, Nothing, ODEFunction{true, SciMLBase.FullSpecialize, var"#1217#1221", UniformScaling{Bool}, Nothing, var"#1219#1223", Nothing, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, var"#1218#1222", Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, ClimaTimeSteppers.var"#18#27", ClimaTimeSteppers.var"#19#28", ClimaTimeSteppers.var"#20#29", ClimaTimeSteppers.var"#21#30"}, @Kwargs{}, SciMLBase.StandardODEProblem}, alg::IMEXAlgorithm{SSP, SSP22Heuns, IMEXTableau{ClimaTimeSteppers.SparseCoeffs{(2, 2), (true, false, true, true), SMatrix{2, 2, Int64, 4}}, ClimaTimeSteppers.SparseCoeffs{(2,), (false, false), SVector{2, Float64}}, ClimaTimeSteppers.SparseCoeffs{(2,), (true, false), SVector{2, Float64}}, ClimaTimeSteppers.SparseCoeffs{(2, 2), (true, false, true, true), SMatrix{2, 2, Int64, 4}}, ClimaTimeSteppers.SparseCoeffs{(2,), (false, false), SVector{2, Float64}}, ClimaTimeSteppers.SparseCoeffs{(2,), (true, false), SVector{2, Float64}}}, Nothing}, t::Vector{Float64}, u::Vector{Tuple{Float64, Float64}}; timeseries_errors::Bool, dense::Bool, dense_errors::Bool, calculate_error::Bool, k::Nothing, alg_choice::Nothing, interp::SciMLBase.LinearInterpolation{Vector{Float64}, Vector{Tuple{Float64, Float64}}}, retcode::SciMLBase.ReturnCode.T, destats::Missing, stats::Nothing, resid::Nothing, original::Nothing, kwargs::@Kwargs{})
Actually, I think it's somehow related to the save_func
kwarg we pass
Ok, yeah, I think we were using save_func
directly instead of a callback, and we needed to add tdir
to our integrator.
I'll close this once https://github.com/CliMA/ClimaTimeSteppers.jl/pull/296 merges.
Yeah, I think that was it
Describe the bug 🐞
We're seeing that the latest version of SciMLBase requires
ndims
to be defined. I've only just run into this issue. I fixed it in ClimaCore.jl, but this popped up in ClimaTimeSteppers.jl withExpected behavior
I expect that minor releases are non-breaking changes.
Minimal Reproducible Example 👇
Error & Stacktrace ⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.