Skip to content

Commit d9782e5

Browse files
fix: fix jacobian generation for NonlinearSystem
1 parent aac3d1f commit d9782e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/systems/nonlinear/nonlinearsystem.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,10 @@ function generate_jacobian(
175175
sys::NonlinearSystem, vs = unknowns(sys), ps = full_parameters(sys);
176176
sparse = false, simplify = false, kwargs...)
177177
jac = calculate_jacobian(sys, sparse = sparse, simplify = simplify)
178-
pre = get_preprocess_constants(jac)
178+
pre, sol_states = get_substitutions_and_solved_unknowns(sys)
179179
p = reorder_parameters(sys, ps)
180-
return build_function(jac, vs, p...; postprocess_fbody = pre, kwargs...)
180+
return build_function(
181+
jac, vs, p...; postprocess_fbody = pre, states = sol_states, kwargs...)
181182
end
182183

183184
function calculate_hessian(sys::NonlinearSystem; sparse = false, simplify = false)

0 commit comments

Comments
 (0)