Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix solvers failed on OOP problem #72

Merged
merged 3 commits into from
Sep 17, 2023
Merged

Conversation

ErikQQY
Copy link
Member

@ErikQQY ErikQQY commented Sep 17, 2023

using SimpleDiffEq
f(u,p,t) = 1.01*u
u0=1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
sol = solve(prob, SimpleTsit5(), dt=0.01)

would cause errors:

ERROR: MethodError: no method matching simpletsit5_init(::ODEFunction{false, SciMLBase.AutoSpecialize, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, ::Bool, ::Float64, ::Float64, ::Float64, ::SciMLBase.NullParameters)
An arithmetic operation was performed on a NullParameters object. This means no parameters were passed
into the AbstractSciMLProblem (e.x.: ODEProblem) but the parameters object `p` was used in an arithmeticexpression. Two common reasons for this issue are:

1. Forgetting to pass parameters into the problem constructor. For example, `ODEProblem(f,u0,tspan)` should
be `ODEProblem(f,u0,tspan,p)` in order to use parameters.

2. Using the wrong function signature. For example, with `ODEProblem`s the function signature is always
`f(du,u,p,t)` for the in-place form or `f(u,p,t)` for the out-of-place form. Note that the `p` argument
will always be in the function signature reguardless of if the problem is defined with parameters!

Closest candidates are:
  simpletsit5_init(::F, ::Bool, ::S, ::T, ::T, ::P) where {F, P, T, S<:(AbstractArray{T})}
   @ SimpleDiffEq D:\Julia\.julia\packages\SimpleDiffEq\tY7zU\src\tsit5\tsit5.jl:58

Signed-off-by: ErikQQY <[email protected]>
Signed-off-by: ErikQQY <[email protected]>
@ChrisRackauckas
Copy link
Member

Test fails. Make sure f is not defined in such a way that it has both dispatches. I'd just change its name to something like fscalar or so.

@ChrisRackauckas ChrisRackauckas merged commit 66a89e3 into SciML:master Sep 17, 2023
6 checks passed
@ErikQQY ErikQQY deleted the qqy/fix_u0 branch September 17, 2023 15:27
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.

2 participants