Skip to content

Commit 7f311e2

Browse files
fixup! feat: support parameter updates in initialize_dae!
1 parent e1c7ef0 commit 7f311e2

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ version = "6.87.0"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
8+
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
89
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
910
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
1011
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
@@ -76,6 +77,7 @@ TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"
7677

7778
[compat]
7879
ADTypes = "0.2, 1"
80+
Accessors = "0.1.36"
7981
Adapt = "3.0, 4"
8082
ArrayInterface = "7"
8183
DataStructures = "0.18"

lib/OrdinaryDiffEqNonlinearSolve/src/initialize_dae.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ function _initialize_dae!(integrator, prob::Union{ODEProblem, DAEProblem},
5252
else
5353
error("Unreachable reached. Report this error.")
5454
end
55-
if isdefined(prob.f, :initializeprobpmap) && prob.f.initializeprobpmap !== nothing
55+
if SciMLBase.has_initializeprobpmap(prob.f)
5656
integrator.p = prob.f.initializeprobpmap(prob, nlsol)
57+
sol = integrator.sol
58+
@reset sol.prob.p = integrator.p
59+
integrator.sol = sol
5760
end
5861

5962
if nlsol.retcode != ReturnCode.Success

src/OrdinaryDiffEq.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ import OrdinaryDiffEqCore: trivial_limiter!, CompositeAlgorithm, alg_order,
6363
export CompositeAlgorithm, ShampineCollocationInit, BrownFullBasicInit, NoInit
6464
AutoSwitch
6565

66+
using Accessors: @reset
67+
6668
import OrdinaryDiffEqDifferentiation
6769
using OrdinaryDiffEqDifferentiation: _alg_autodiff, resize_grad_config!, dolinsolve,
6870
wrapprecs, UJacobianWrapper, build_jac_config,

0 commit comments

Comments
 (0)