Skip to content

Remake does not respect initial conditions of unknowns determined by initialization equations #2841

@hersle

Description

@hersle

This example fails (but passes with the commented line uncommented):

using Test
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using DifferentialEquations

@variables x(t)
@named sys = ODESystem([D(x) ~ 0], t; initialization_eqs = [x ~ 1.0]) # test fails with this uncommented
#@named sys = ODESystem([D(x) ~ 0], t; defaults = [x => 1.0]) # test passes with this uncommented
ssys = structural_simplify(sys)

prob1 = ODEProblem(ssys, [], (0.0, 1.0), [])
prob2 = remake(prob1, u0 = [x => 2.0])
sol2 = solve(prob2)
@test sol2[x][begin] == 2.0

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions