Skip to content

Commit

Permalink
fixup! fixup! feat: support arbitrary systems in `generate_initialize…
Browse files Browse the repository at this point in the history
…system`
  • Loading branch information
AayushSabharwal committed Dec 3, 2024
1 parent 4c215b4 commit 98fe145
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/systems/nonlinear/initializesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ function generate_initializesystem(sys::AbstractSystem;
if has_iv(sys)
idxs_alge = .!idxs_diff
append!(eqs_ics, eqs[idxs_alge]) # start equation list with algebraic equations
end

if has_schedule(sys) && (schedule = get_schedule(sys); !isnothing(schedule))
# 2) process dummy derivatives and u0map into initialization system

# prepare map for dummy derivative substitution
eqs_diff = eqs[idxs_diff]
D = Differential(get_iv(sys))
diffmap = merge(
Dict(eq.lhs => eq.rhs for eq in eqs_diff),
Dict(D(eq.lhs) => D(eq.rhs) for eq in trueobs)
)
end

if has_schedule(sys) && (schedule = get_schedule(sys); !isnothing(schedule))
# 2) process dummy derivatives and u0map into initialization system
# prepare map for dummy derivative substitution
for x in filter(x -> !isnothing(x[1]), schedule.dummy_sub)
# set dummy derivatives to default_dd_guess unless specified
push!(defs, x[1] => get(guesses, x[1], default_dd_guess))
Expand Down

0 comments on commit 98fe145

Please sign in to comment.