Skip to content

Commit 1ab6246

Browse files
committed
fix unassigned indexing
1 parent c651efe commit 1ab6246

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/structural_transformation/symbolics_tearing.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,10 @@ function generate_system_equations!(state::TearingState, neweqs, var_eq_matching
512512
# Non-solvable equations become algebraic equations.
513513
for ieq in eqs
514514
iv = eq_var_matching[ieq]
515-
var = fullvars[iv]
516515
eq = neweqs[ieq]
517516

518517
if is_solvable(ieq, iv) && isdervar(iv)
518+
var = fullvars[iv]
519519
isnothing(D) && throw(UnexpectedDifferentialError(equations(sys)[ieq]))
520520
order, lv = var_order(iv, diff_to_var)
521521
dx = D(simplify_shifts(fullvars[lv]))
@@ -530,14 +530,15 @@ function generate_system_equations!(state::TearingState, neweqs, var_eq_matching
530530
push!(diffeq_idxs, ieq)
531531
push!(diff_vars, diff_to_var[iv])
532532
elseif is_solvable(ieq, iv)
533+
var = fullvars[iv]
533534
neweq = make_solved_equation(var, eq, total_sub; simplify)
534535
!isnothing(neweq) && begin
535536
push!(solved_eqs, neweq)
536537
push!(solvedeq_idxs, ieq)
537538
push!(solved_vars, iv)
538539
end
539540
else
540-
neweq = make_algebraic_equation(var, eq, total_sub)
541+
neweq = make_algebraic_equation(eq, total_sub)
541542
push!(alge_eqs, neweq)
542543
push!(algeeq_idxs, ieq)
543544
end
@@ -572,7 +573,7 @@ function make_differential_equation(var, dx, eq, total_sub)
572573
total_sub; operator = ModelingToolkit.Shift))
573574
end
574575

575-
function make_algebraic_equation(var, eq, total_sub)
576+
function make_algebraic_equation(eq, total_sub)
576577
rhs = eq.rhs
577578
if !(eq.lhs isa Number && eq.lhs == 0)
578579
rhs = eq.rhs - eq.lhs

0 commit comments

Comments
 (0)