Skip to content

Commit f789b52

Browse files
Merge pull request #3891 from AayushSabharwal/as/nlstep-scc
feat: add `SCCNonlinearProblem` target for nlstep
2 parents 50ea45d + ba4a460 commit f789b52

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/problems/odeproblem.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
t = nothing, eval_expression = false, eval_module = @__MODULE__, sparse = false,
44
steady_state = false, checkbounds = false, sparsity = false, analytic = nothing,
55
simplify = false, cse = true, initialization_data = nothing, expression = Val{false},
6-
check_compatibility = true, nlstep = false, nlstep_compile = true, kwargs...) where {iip, spec}
6+
check_compatibility = true, nlstep = false, nlstep_compile = true, nlstep_scc = false,
7+
kwargs...) where {iip, spec}
78
check_complete(sys, ODEFunction)
89
check_compatibility && check_compatible_system(ODEFunction, sys)
910

@@ -42,7 +43,7 @@
4243
_M = concrete_massmatrix(M; sparse, u0)
4344

4445
if nlstep
45-
ode_nlstep = generate_ODENLStepData(sys, u0, p, M, nlstep_compile)
46+
ode_nlstep = generate_ODENLStepData(sys, u0, p, M, nlstep_compile, nlstep_scc)
4647
else
4748
ode_nlstep = nothing
4849
end

src/systems/solver_nlprob.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
function generate_ODENLStepData(sys::System, u0, p, mm = calculate_massmatrix(sys), nlstep_compile::Bool = true)
1+
function generate_ODENLStepData(sys::System, u0, p, mm = calculate_massmatrix(sys),
2+
nlstep_compile::Bool = true, nlstep_scc::Bool = false)
23
nlsys, outer_tmp, inner_tmp = inner_nlsystem(sys, mm, nlstep_compile)
34
state = ProblemState(; u = u0, p)
45
op = Dict()
@@ -12,7 +13,11 @@ function generate_ODENLStepData(sys::System, u0, p, mm = calculate_massmatrix(sy
1213
haskey(op, v) && continue
1314
op[v] = getsym(sys, v)(state)
1415
end
15-
nlprob = NonlinearProblem(nlsys, op; build_initializeprob = false)
16+
nlprob = if nlstep_scc
17+
SCCNonlinearProblem(nlsys, op; build_initializeprob = false)
18+
else
19+
NonlinearProblem(nlsys, op; build_initializeprob = false)
20+
end
1621

1722
subsetidxs = [findfirst(isequal(y), unknowns(sys)) for y in unknowns(nlsys)]
1823
set_gamma_c = setsym(nlsys, (ODE_GAMMA..., ODE_C))

0 commit comments

Comments
 (0)