Skip to content

Commit e3cba50

Browse files
fix: propagate initializeprobpmap and update_initializeprob! to DAEFunction
1 parent b991a62 commit e3cba50

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/systems/diffeqs/abstractodesystem.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ function DiffEqBase.DAEFunction{iip}(sys::AbstractODESystem, dvs = unknowns(sys)
498498
checkbounds = false,
499499
initializeprob = nothing,
500500
initializeprobmap = nothing,
501+
initializeprobpmap = nothing,
502+
update_initializeprob! = nothing,
501503
kwargs...) where {iip}
502504
if !iscomplete(sys)
503505
error("A completed system is required. Call `complete` or `structural_simplify` on the system before creating a `DAEFunction`")
@@ -551,7 +553,9 @@ function DiffEqBase.DAEFunction{iip}(sys::AbstractODESystem, dvs = unknowns(sys)
551553
jac_prototype = jac_prototype,
552554
observed = observedfun,
553555
initializeprob = initializeprob,
554-
initializeprobmap = initializeprobmap)
556+
initializeprobmap = initializeprobmap,
557+
initializeprobpmap = initializeprobpmap,
558+
update_initializeprob! = update_initializeprob!)
555559
end
556560

557561
function DiffEqBase.DDEFunction(sys::AbstractODESystem, args...; kwargs...)

test/initializationsystem.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,3 +947,18 @@ end
947947

948948
@test_nowarn remake(prob, p = prob.p)
949949
end
950+
951+
@test "DAEProblem initialization" begin
952+
@variables x(t) [guess = 1.0] y(t) [guess = 1.0]
953+
@parameters p = missing [guess = 1.0] q = missing [guess = 1.0]
954+
@mtkbuild sys = ODESystem([D(x) ~ p * y + q * t, x^3 + y^3 ~ 5], t; initialization_eqs = [p ^2 + q^3 ~ 3])
955+
956+
# FIXME: solve for du0
957+
prob = DAEProblem(sys, [D(x) => cbrt(4), D(y) => -1 / cbrt(4)], [x => 1.0], (0.0, 1.0), [p => 1.0])
958+
959+
integ = init(prob, DImplicitEuler())
960+
@test integ[x] 1.0
961+
@test integ[y] cbrt(4) rtol = 1e-6
962+
@test integ.ps[p] 1.0
963+
@test integ.ps[q] cbrt(2) rtol = 1e-6
964+
end

0 commit comments

Comments
 (0)