Skip to content

Commit 8bf9b73

Browse files
authored
Merge pull request #1465 from SciML/myb/fix
Fix sparse jacobian from TearingState
2 parents 0e37590 + f24197f commit 8bf9b73

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/structural_transformation/utils.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ end
260260
function torn_system_jacobian_sparsity(sys)
261261
state = get_tearing_state(sys)
262262
state isa TearingState || return nothing
263-
s = structure(sys)
264263
graph = state.structure.graph
265264
fullvars = state.fullvars
266265

src/systems/abstractsystem.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,10 +751,10 @@ function Base.show(io::IO, ::MIME"text/plain", sys::AbstractSystem)
751751
end
752752
limited && print(io, "\n")
753753

754-
if has_torn_matching(sys)
754+
if has_torn_matching(sys) && has_tearing_state(sys)
755755
# If the system can take a torn matching, then we can initialize a tearing
756756
# state on it. Do so and get show the structure.
757-
state = get_or_construct_tearing_state(sys)
757+
state = get_tearing_state(sys)
758758
if state !== nothing
759759
Base.printstyled(io, "\nIncidence matrix:"; color=:magenta)
760760
show(io, incidence_matrix(state.structure.graph, Num(Sym{Real}(:×))))

src/systems/pde/pdesystem.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ end
7878
function Base.getproperty(x::PDESystem, sym::Symbol)
7979
if sym == :indvars
8080
return getfield(x, :ivs)
81-
depwarn("`sys.indvars` is deprecated, please use `get_ivs(sys)`", :getproperty,force=true)
81+
Base.depwarn("`sys.indvars` is deprecated, please use `get_ivs(sys)`", :getproperty,force=true)
8282

8383
elseif sym == :depvars
8484
return getfield(x, :dvs)
85-
depwarn("`sys.depvars` is deprecated, please use `get_dvs(sys)`", :getproperty,force=true)
85+
Base.depwarn("`sys.depvars` is deprecated, please use `get_dvs(sys)`", :getproperty,force=true)
8686

8787
else
8888
return getfield(x, sym)

test/components.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ eqs = [
6666
]
6767
@named sys′ = ODESystem(eqs, t)
6868
@named sys_inner_outer = compose(sys′, [ground, source, rc_comp])
69+
@test_nowarn show(IOBuffer(), MIME"text/plain"(), sys_inner_outer)
6970
expand_connections(sys_inner_outer, debug=true)
7071
sys_inner_outer = structural_simplify(sys_inner_outer)
7172
@test !isempty(ModelingToolkit.defaults(sys_inner_outer))
@@ -74,7 +75,7 @@ u0 = [
7475
rc_comp.capacitor.p.i => 0.0
7576
rc_comp.resistor.v => 0.0
7677
]
77-
prob = ODEProblem(sys_inner_outer, u0, (0, 10.0))
78+
prob = ODEProblem(sys_inner_outer, u0, (0, 10.0), sparse=true)
7879
sol_inner_outer = solve(prob, Rodas4())
7980
@test sol[capacitor.v] sol_inner_outer[rc_comp.capacitor.v]
8081

0 commit comments

Comments
 (0)