Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

ODEProblem gives "ArgumentError: reducing over an empty collection is not allowed" #187

@ianwilliamson

Description

@ianwilliamson

This package looks really nice and seems to have come a very long way since I last looked at it back in Jan/Feb. I am trying the following very simple test, based on the heat equation test script in the repo (which seems to use an outdated BC API):

using DiffEqOperators, OrdinaryDiffEq, PyPlot

N = 16
h = 2π/(N-1)
x = collect(0.0 : h : 2π)
u0 = sin.(x)

Dxx = CenteredDifference(2, 2, h, N)
Q = Dirichlet0BC(Float64)

L = Dxx * Q

eqn = ODEProblem(L, u0, (0.0, 1.0))
u = solve(eqn, Tsit5(), dense=false, tstops=0.0:0.01:1.0)

plt.figure()
plt.plot(u[:, end])

I get the following error:

ERROR: LoadError: ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
 [1] _empty_reduce_error() at ./reduce.jl:220
 [2] reduce_empty(::Function, ::Type) at ./reduce.jl:230
 [3] mapreduce_empty(::typeof(identity), ::Function, ::Type) at ./reduce.jl:255
 [4] _mapreduce(::typeof(identity), ::typeof(max), ::IndexLinear, ::Array{Any,1}) at ./reduce.jl:309
 [5] _mapreduce_dim at ./reducedim.jl:312 [inlined]
 [6] #mapreduce#555 at ./reducedim.jl:307 [inlined]
 [7] mapreduce at ./reducedim.jl:307 [inlined]
 [8] _maximum at ./reducedim.jl:657 [inlined]
 [9] _maximum(::Array{Any,1}, ::Colon) at ./reducedim.jl:656
 [10] #maximum#562 at ./reducedim.jl:652 [inlined]
 [11] maximum at ./reducedim.jl:652 [inlined]
 [12] numargs(::GhostDerivativeOperator{Float64,DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},RobinBC{Float64}}) at /Users/___/.julia/packages/DiffEqBase/Fs7ts/src/utils.jl:13
 [13] isinplace(::GhostDerivativeOperator{Float64,DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},RobinBC{Float64}}, ::Int64) at /Users/___/.julia/packages/DiffEqBase/Fs7ts/src/utils.jl:26
 [14] #ODEFunction#85(::Base.Iterators.Pairs{Symbol,Nothing,NTuple{8,Symbol},NamedTuple{(:analytic, :tgrad, :jac, :Wfact, :Wfact_t, :paramjac, :syms, :colorvec),NTuple{8,Nothing}}}, ::Type{ODEFunction}, ::GhostDerivativeOperator{Float64,DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},RobinBC{Float64}}) at /Users/___/.julia/packages/DiffEqBase/Fs7ts/src/diffeqfunction.jl:358
 [15] Type at ./none:0 [inlined]
 [16] convert at /Users/___/.julia/packages/DiffEqBase/Fs7ts/src/diffeqfunction.jl:940 [inlined]
 [17] #ODEProblem#214(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Type{ODEProblem}, ::GhostDerivativeOperator{Float64,DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},RobinBC{Float64}}, ::Array{Float64,1}, ::Tuple{Float64,Float64}, ::DiffEqBase.NullParameters) at /Users/___/.julia/packages/DiffEqBase/Fs7ts/src/problems/ode_problems.jl:78
 [18] Type at /Users/___/.julia/packages/DiffEqBase/Fs7ts/src/problems/ode_problems.jl:78 [inlined] (repeats 2 times)
 [19] top-level scope at /Users/___/drive/Code/test.jl:13
 [20] include at ./boot.jl:328 [inlined]
 [21] include_relative(::Module, ::String) at ./loading.jl:1094
 [22] include(::Module, ::String) at ./Base.jl:31
 [23] include(::String) at ./client.jl:431
 [24] top-level scope at REPL[4]:1
in expression starting at /Users/___/drive/Code/test.jl:13

Am I making a stupid mistake?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions