Skip to content

Commit 574b0fd

Browse files
committed
test: remove unneeded initial conditions
with newer versions of MTK we no longer need to provides these, as initialization can find the appropriate initial conditions. If the extra u0s are provided, they lead to initialization failures.
1 parent fb9e3f2 commit 574b0fd

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

test/Blocks/sources.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ end
2525

2626
@testset "TimeVaryingFunction" begin
2727
f(t) = t^2 + 1
28-
vars = @variables y(t)=1 dy(t)=0 ddy(t)=0
28+
vars = @variables y(t) dy(t) ddy(t)
2929
@named src = TimeVaryingFunction(f)
3030
@named int = Integrator()
3131
@named iosys = ODESystem(

test/Thermal/demo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ using OrdinaryDiffEq: ReturnCode.Success
2020
@named model = ODESystem(connections, t,
2121
systems = [mass1, mass2, conduction, Tsensor1, Tsensor2])
2222
sys = structural_simplify(model)
23-
prob = ODEProblem(sys, [mass1.der_T => 1.0, mass2.der_T => 1.0], (0, 3.0))
23+
prob = ODEProblem(sys, [], (0, 3.0))
2424
sol = solve(prob, Tsit5())
2525
@test SciMLBase.successful_retcode(sol)
2626
end

test/Thermal/piston.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ using ModelingToolkitStandardLibrary.Blocks
3333

3434
@mtkbuild piston = Piston()
3535

36-
u0 = [piston.coolant.dT => 5.0
37-
piston.wall.Q_flow => 10.0]
38-
prob = ODEProblem(piston, u0, (0, 3.0))
36+
prob = ODEProblem(piston, [], (0, 3.0))
3937
sol = solve(prob)
4038

4139
# Heat-flow-rate is equal in magnitude

test/Thermal/thermal.jl

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ using OrdinaryDiffEq: ReturnCode.Success
2222
@named h1 = ODESystem(eqs, t, systems = [mass1, reltem_sensor, tem_src, th_conductor])
2323
sys = structural_simplify(h1)
2424

25-
u0 = [mass1.T => 2.0
26-
mass1.der_T => 1.0]
25+
u0 = [mass1.T => 2]
2726
prob = ODEProblem(sys, u0, (0, 2.0))
2827
sol = solve(prob, Tsit5())
2928

@@ -42,10 +41,7 @@ using OrdinaryDiffEq: ReturnCode.Success
4241
sys = structural_simplify(h2)
4342

4443
u0 = [mass1.T => 1.0
45-
mass2.T => 10.0
46-
final_T => 12
47-
mass1.der_T => 1.0
48-
mass2.der_T => 1.0]
44+
mass2.T => 10.0]
4945
prob = ODEProblem(sys, u0, (0, 3.0))
5046
sol = solve(prob, Tsit5())
5147

@@ -79,9 +75,7 @@ end
7975
th_resistor, flow_src, th_ground, th_conductor])
8076
sys = structural_simplify(h2)
8177

82-
u0 = [mass1.T => 10.0
83-
th_resistor.Q_flow => 1.0
84-
mass1.der_T => 1.0]
78+
u0 = [mass1.T => 10.0]
8579
prob = ODEProblem(sys, u0, (0, 3.0))
8680
sol = solve(prob, Tsit5())
8781

@@ -121,9 +115,7 @@ end
121115
])
122116
sys = structural_simplify(rad)
123117

124-
u0 = [base.Q_flow => 10
125-
dissipator.Q_flow => 10
126-
mass.T => T_gas]
118+
u0 = [mass.T => T_gas]
127119
prob = ODEProblem(sys, u0, (0, 3.0))
128120
sol = solve(prob, Rodas4())
129121

@@ -152,7 +144,6 @@ end
152144
sys = structural_simplify(coll)
153145

154146
u0 = [
155-
th_resistor.Q_flow => 1.0,
156147
mass.T => 0.0
157148
]
158149
prob = ODEProblem(sys, u0, (0, 3.0))

0 commit comments

Comments
 (0)