From facd4c4b694fa3301d60a66635fd46d17409cf8b Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Fri, 3 Nov 2023 22:08:56 -0400 Subject: [PATCH] Propagate u0 function for BVPs --- Project.toml | 2 +- src/solve.jl | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0baa6eb75..3e156e483 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DiffEqBase" uuid = "2b5f629d-d688-5b77-993f-72d75c75574e" authors = ["Chris Rackauckas "] -version = "6.137.1" +version = "6.138.0" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" diff --git a/src/solve.jl b/src/solve.jl index d337f55cc..9ded42033 100644 --- a/src/solve.jl +++ b/src/solve.jl @@ -1251,6 +1251,28 @@ function get_concrete_u0(prob, isadapt, t0, kwargs) _u0 end +function get_concrete_u0(prob::BVProblem, isadapt, t0, kwargs) + if haskey(kwargs, :u0) + u0 = kwargs[:u0] + else + u0 = prob.u0 + end + + isadapt && eltype(u0) <: Integer && (u0 = float.(u0)) + + _u0 = handle_distribution_u0(u0) + + if isinplace(prob) && (_u0 isa Number || _u0 isa SArray) + throw(IncompatibleInitialConditionError()) + end + + if _u0 isa Tuple + throw(TupleStateError()) + end + + return _u0 +end + function get_concrete_du0(prob, isadapt, t0, kwargs) if eval_u0(prob.du0) du0 = prob.du0(prob.p, t0)