Skip to content

Commit

Permalink
Merge pull request #959 from SciML/ap/bvp_initial_condition
Browse files Browse the repository at this point in the history
Propagate u0 function for BVPs
  • Loading branch information
ChrisRackauckas authored Nov 4, 2023
2 parents 3a27916 + facd4c4 commit 5d78d80
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DiffEqBase"
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
authors = ["Chris Rackauckas <[email protected]>"]
version = "6.137.1"
version = "6.138.0"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
22 changes: 22 additions & 0 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5d78d80

Please sign in to comment.