Skip to content

Commit ee4deb9

Browse files
author
Brad Carman
committed
remake issue
1 parent e62e3ee commit ee4deb9

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/split_parameters.jl

+17-1
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,28 @@ eqs = [y ~ src.output.u
7474
@named sys = ODESystem(eqs, t, vars, []; systems = [int, src])
7575
s = complete(sys)
7676
sys = structural_simplify(sys)
77-
prob = ODEProblem(sys, [], (0.0, t_end), [s.src.data => x])
77+
prob = ODEProblem(sys, [], (0.0, t_end), [s.src.data => x]; tofloat=false)
7878
@test prob.p isa Tuple{Vector{Float64}, Vector{Int}, Vector{Vector{Float64}}}
7979
sol = solve(prob, ImplicitEuler());
8080
@test sol.retcode == ReturnCode.Success
8181
@test sol[y][end] == x[end]
8282

83+
#TODO: remake becomes more complicated now, how to improve?
84+
defs = ModelingToolkit.defaults(sys)
85+
defs[s.src.data] = 2x
86+
p′ = ModelingToolkit.varmap_to_vars(defs, parameters(sys); tofloat=false)
87+
p′, = ModelingToolkit.split_parameters_by_type(p′) #NOTE: we need to ensure this is called now before calling remake()
88+
prob′ = remake(prob; p=p′)
89+
sol = solve(prob′, ImplicitEuler());
90+
@test sol.retcode == ReturnCode.Success
91+
@test sol[y][end] == 2x[end]
92+
93+
prob′′ = remake(prob; p=[s.src.data => x])
94+
@test prob′′.p isa Tuple
95+
96+
97+
98+
8399
# ------------------------ Mixed Type Converted to float (default behavior)
84100

85101
vars = @variables y(t)=1 dy(t)=0 ddy(t)=0

0 commit comments

Comments
 (0)