Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern of the matrix changed #165

Closed
DanielVandH opened this issue Jul 18, 2022 · 8 comments
Closed

Pattern of the matrix changed #165

DanielVandH opened this issue Jul 18, 2022 · 8 comments

Comments

@DanielVandH
Copy link
Member

DanielVandH commented Jul 18, 2022

This might be related to my previous issue in SciML/OrdinaryDiffEq.jl/#1701. . Again, hard to tell if this is directly a LinearSolve.jl issue or an OrdinaryDiffEq.jl issue. I keep getting random issues with "pattern of the matrix changed" errors. Consider the following example:

using DifferentialEquations, LinearAlgebra, SparseArrays

const N = 32
const xyd_brusselator = range(0, stop=1, length=N)
brusselator_f(x, y, t) = (((x - 0.3)^2 + (y - 0.6)^2) <= 0.1^2) * (t >= 1.1) * 5.0
limit(a, N) = a == N + 1 ? 1 : a == 0 ? N : a
function brusselator_2d_loop(du, u, p, t)
  A, B, alpha, dx = p
  alpha = alpha / dx^2
  @inbounds for I in CartesianIndices((N, N))
    i, j = Tuple(I)
    x, y = xyd_brusselator[I[1]], xyd_brusselator[I[2]]
    ip1, im1, jp1, jm1 = limit(i + 1, N), limit(i - 1, N), limit(j + 1, N), limit(j - 1, N)
    du[i, j, 1] = alpha * (u[im1, j, 1] + u[ip1, j, 1] + u[i, jp1, 1] + u[i, jm1, 1] - 4u[i, j, 1]) +
                  B + u[i, j, 1]^2 * u[i, j, 2] - (A + 1) * u[i, j, 1] + brusselator_f(x, y, t)
    du[i, j, 2] = alpha * (u[im1, j, 2] + u[ip1, j, 2] + u[i, jp1, 2] + u[i, jm1, 2] - 4u[i, j, 2]) +
                  A * u[i, j, 1] - u[i, j, 1]^2 * u[i, j, 2]
  end
  nothing
end
p = (3.4, 1.0, 10.0, step(xyd_brusselator))

function init_brusselator_2d(xyd)
  N = length(xyd)
  u = zeros(N, N, 2)
  for I in CartesianIndices((N, N))
    x = xyd[I[1]]
    y = xyd[I[2]]
    u[I, 1] = 22 * (y * (1 - y))^(3 / 2)
    u[I, 2] = 27 * (x * (1 - x))^(3 / 2)
  end
  u
end
u0 = init_brusselator_2d(xyd_brusselator)
prob_ode_brusselator_2d = ODEProblem(brusselator_2d_loop, u0, (0.0, 11.5), p)

using Symbolics
du0 = copy(u0)
jac_sparsity = Symbolics.jacobian_sparsity((du, u) -> brusselator_2d_loop(du, u, p, 0.0), du0, u0)

f = ODEFunction(brusselator_2d_loop; jac_prototype=float.(jac_sparsity))
prob_ode_brusselator_2d_sparse = ODEProblem(f, u0, (0.0, 11.5), p)

using LinearSolve
sol = solve(prob_ode_brusselator_2d_sparse, Rosenbrock23(linsolve=UMFPACKFactorization()))
ERROR: ArgumentError: pattern of the matrix changed
Stacktrace:
  [1] umferror
    @ C:\Users\licer\AppData\Local\Programs\Julia-1.8.0-rc1\share\julia\stdlib\v1.8\SuiteSparse\src\umfpack.jl:89 [inlined]
  [2] umfpack_numeric!(U::SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}; reuse_numeric::Bool)
    @ SuiteSparse.UMFPACK C:\Users\licer\AppData\Local\Programs\Julia-1.8.0-rc1\share\julia\stdlib\v1.8\SuiteSparse\src\umfpack.jl:388
  [3] lu!(F::SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}, S::SparseMatrixCSC{Float64, Int64}; check::Bool)
    @ SuiteSparse.UMFPACK C:\Users\licer\AppData\Local\Programs\Julia-1.8.0-rc1\share\julia\stdlib\v1.8\SuiteSparse\src\umfpack.jl:269
  [4] lu!
    @ C:\Users\licer\AppData\Local\Programs\Julia-1.8.0-rc1\share\julia\stdlib\v1.8\SuiteSparse\src\umfpack.jl:261 [inlined]
  [5] #solve#9
    @ C:\Users\licer\.julia\packages\LinearSolve\RWMOH\src\factorization.jl:268 [inlined]
  [6] #solve#5
    @ C:\Users\licer\.julia\packages\LinearSolve\RWMOH\src\common.jl:143 [inlined]
  [7] #dolinsolve#3
    @ C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\misc_utils.jl:105 [inlined]
  [8] perform_step!(integrator::OrdinaryDiffEq.ODEIntegrator{Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, true, Array{Float64, 3}, Nothing, Float64, NTuple{4, Float64}, Float64, Float64, Float64, Float64, Vector{Array{Float64, 3}}, ODESolution{Float64, 4, Vector{Array{Float64, 3}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Array{Float64, 3}}}, ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Array{Float64, 3}}, Vector{Float64}, Vector{Vector{Array{Float64, 3}}}, OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, 
Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, UMFPACKFactorization, SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Nothing}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, 
Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, 
Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, UMFPACKFactorization, SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Nothing}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Array{Float64, 3}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, 
OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, UMFPACKFactorization, SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Nothing}, repeat_step::Bool)
    @ OrdinaryDiffEq C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\perform_step\rosenbrock_perform_step.jl:151
  [9] perform_step!
    @ C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\perform_step\rosenbrock_perform_step.jl:123 [inlined]
 [10] solve!(integrator::OrdinaryDiffEq.ODEIntegrator{Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, true, Array{Float64, 3}, Nothing, Float64, NTuple{4, Float64}, Float64, Float64, Float64, Float64, Vector{Array{Float64, 3}}, ODESolution{Float64, 4, Vector{Array{Float64, 3}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Array{Float64, 3}}}, ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Array{Float64, 3}}, Vector{Float64}, Vector{Vector{Array{Float64, 3}}}, OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, UMFPACKFactorization, SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Nothing}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, UMFPACKFactorization, SuiteSparse.UMFPACK.UmfpackLU{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Nothing}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Array{Float64, 3}, Float64, Nothing, OrdinaryDiffEq.DefaultInit})
    @ OrdinaryDiffEq C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\solve.jl:477
 [11] __solve(::ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ OrdinaryDiffEq C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\solve.jl:5
 [12] __solve
    @ C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\solve.jl:1 [inlined]
 [13] #solve_call#28
    @ C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:437 [inlined]
 [14] solve_call(_prob::ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::Rosenbrock23{12, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing})
    @ DiffEqBase C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:407
 [15] solve_up(prob::ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, sensealg::Nothing, u0::Array{Float64, 3}, p::NTuple{4, Float64}, args::Rosenbrock23{0, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ DiffEqBase C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:780
 [16] solve_up
    @ C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:763 [inlined]
 [17] #solve#33
    @ C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:760 [inlined]
 [18] solve(prob::ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::Rosenbrock23{0, true, UMFPACKFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing})
    @ DiffEqBase C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:753
 [19] top-level scope
    @ c:\Users\licer\Documents\klu\ex.jl:45

Here's the st:

(klu) pkg> st
Status `C:\Users\licer\Documents\klu\Project.toml`
  [0c46a032] DifferentialEquations v7.2.0
  [7ed4a6bd] LinearSolve v1.23.0 `https://github.com/SciML/LinearSolve.jl.git#main`
  [0c5d862f] Symbolics v4.9.0
  [37e2e46d] LinearAlgebra
  [2f01184e] SparseArrays

This also happened on v1.22.2. (It's installed from main directly above since I couldn't seem to ] add the latest version without specifying it.)

You can also get a different error with KLUFactorization:

julia> sol = solve(prob_ode_brusselator_2d_sparse, Rosenbrock23(linsolve=KLUFactorization()))
ERROR: ArgumentError: The pattern of the original matrix must match the pattern of the refactor.
Stacktrace:
  [1] klu!(K::KLU.KLUFactorization{Float64, Int64}, S::SparseMatrixCSC{Float64, Int64})
    @ KLU C:\Users\licer\.julia\packages\KLU\JK7t1\src\KLU.jl:629
  [2] solve(cache::LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, KLUFactorization, KLU.KLUFactorization{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, alg::KLUFactorization; kwargs::Base.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:reltol,), Tuple{Float64}}})
    @ LinearSolve C:\Users\licer\.julia\packages\LinearSolve\RWMOH\src\factorization.jl:300
  [3] #solve#5
    @ C:\Users\licer\.julia\packages\LinearSolve\RWMOH\src\common.jl:143 [inlined]
  [4] #dolinsolve#3
    @ C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\misc_utils.jl:105 [inlined]
  [5] perform_step!(integrator::OrdinaryDiffEq.ODEIntegrator{Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, true, Array{Float64, 3}, Nothing, Float64, NTuple{4, Float64}, Float64, Float64, Float64, Float64, Vector{Array{Float64, 3}}, ODESolution{Float64, 4, Vector{Array{Float64, 3}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Array{Float64, 3}}}, ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Array{Float64, 3}}, Vector{Float64}, Vector{Vector{Array{Float64, 3}}}, OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, KLUFactorization, KLU.KLUFactorization{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), 
Val{:forward}, true, nothing}, Nothing}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, KLUFactorization, KLU.KLUFactorization{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 
3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Nothing}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Array{Float64, 3}, Float64, Nothing, OrdinaryDiffEq.DefaultInit}, cache::OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, KLUFactorization, KLU.KLUFactorization{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Nothing}, repeat_step::Bool)
    @ OrdinaryDiffEq C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\perform_step\rosenbrock_perform_step.jl:151
  [6] perform_step!
    @ C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\perform_step\rosenbrock_perform_step.jl:123 [inlined]
  [7] solve!(integrator::OrdinaryDiffEq.ODEIntegrator{Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, true, Array{Float64, 3}, Nothing, Float64, NTuple{4, Float64}, Float64, Float64, Float64, Float64, Vector{Array{Float64, 3}}, ODESolution{Float64, 4, Vector{Array{Float64, 3}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Array{Float64, 3}}}, ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, OrdinaryDiffEq.InterpolationData{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Array{Float64, 3}}, Vector{Float64}, Vector{Vector{Array{Float64, 3}}}, OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, 
Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, KLUFactorization, KLU.KLUFactorization{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}, Nothing}}, DiffEqBase.DEStats}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, 
SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, OrdinaryDiffEq.Rosenbrock23Cache{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, OrdinaryDiffEq.Rosenbrock23Tableau{Float64}, SciMLBase.TimeGradientWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Array{Float64, 3}, NTuple{4, Float64}}, SciMLBase.UJacobianWrapper{ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Float64, NTuple{4, Float64}}, LinearSolve.LinearCache{SparseMatrixCSC{Float64, Int64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, KLUFactorization, KLU.KLUFactorization{Float64, Int64}, LinearSolve.InvPreconditioner{Diagonal{Float64, Vector{Float64}}}, Diagonal{Float64, Vector{Float64}}, Float64}, SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 12}, 3}, Array{Float64, 3}, Vector{Vector{NTuple{12, Float64}}}, Vector{Int64}, SparseMatrixCSC{Float64, Int64}}, 
Array{ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEq.OrdinaryDiffEqTag, Float64}, Float64, 1}, 3}, Float64, Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, 
true, nothing}, Nothing}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(opnorm), Nothing, CallbackSet{Tuple{}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Tuple{}, Tuple{}}, Array{Float64, 3}, Float64, Nothing, OrdinaryDiffEq.DefaultInit})
    @ OrdinaryDiffEq C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\solve.jl:477
  [8] __solve(::ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, ::Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ OrdinaryDiffEq C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\solve.jl:5
  [9] __solve
    @ C:\Users\licer\.julia\packages\OrdinaryDiffEq\UG9Mz\src\solve.jl:1 [inlined]
 [10] #solve_call#28
    @ C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:437 [inlined]
 [11] solve_call(_prob::ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::Rosenbrock23{12, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing})
    @ DiffEqBase C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:407
 [15] solve(prob::ODEProblem{Array{Float64, 3}, Tuple{Float64, Float64}, true, NTuple{4, Float64}, ODEFunction{true, typeof(brusselator_2d_loop), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, SparseMatrixCSC{Float64, Int64}, SparseMatrixCSC{Float64, Int64}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, args::Rosenbrock23{0, true, KLUFactorization, typeof(OrdinaryDiffEq.DEFAULT_PRECS), Val{:forward}, true, nothing})
    @ DiffEqBase C:\Users\licer\.julia\packages\DiffEqBase\tp3vN\src\solve.jl:753
 [16] top-level scope
    @ c:\Users\licer\Documents\klu\ex.jl:48

I only seem to be getting this with Rosenbrock methods, e.g. I can get solutions for Rodas4P and TRBDF2. Maybe it's similar to SciML/DifferentialEquations.jl#492.

@ChrisRackauckas
Copy link
Member

I just fixed this in SciML/OrdinaryDiffEq.jl#1702. Try the newest OrdinaryDiffEq.jl. It seems like the sparsity patterns used to drop zeros here and there before, which is allowed by certain sparsity operations. But now we enabled the reuse of sparse factorizations, we had to get more strict about keeping sparsity patterns the same. This makes the change on 1702 required, and also leads to some nice performance gains.

@DanielVandH
Copy link
Member Author

Thanks for the quick response! Yep, works now - thanks.

@ChrisRackauckas
Copy link
Member

Yeah sorry about that. When I enabled the "reuse symbolic factorization under sparsity pattern" optimization, I was under the assumption that the solver actually was already doing that, and it did in most cases, but Bruss hit a case where the Jacobian had zeros and some broadcast operations then drop the zeros, and so a weird behavior (JuliaSparse/SparseArrays.jl#190) made that specific case change sparsity patterns, which I never knew until the optimizations that require exactly the same sparsity patterns complained 😅.

Anyways, hopefully this quick came out soon enough afterwards that it won't cause a hiccup in the system.

@ChrisRackauckas
Copy link
Member

The new timings on https://diffeq.sciml.ai/stable/tutorials/advanced_ode_example/ are 270ms by default on my computer, so faster than even choosing the right linear solver from before (sans preconditioners). So... hopefully it all works out. I think I got every case, and any case that is "bad" at least throws a safety error. So just let me know if you see the error again.

@j-fu
Copy link
Contributor

j-fu commented Aug 19, 2022

Matrix patterns may change for "natural" reasons, consider the porous medium equation

u_ t  - \Delta u^m =0

Outside of the support of the solution, only diagonal entries are created. The support widens during evolution, see e.g. here

This leads to more and more nonzeros in the matrix during evolution.

This seems to be the reason why my VoronoiFVM.jl example for using DifferentialEquations ceased to work... (so far it worked incredibly well, every time beating my simple implcit Euler implementation)...

@ChrisRackauckas
Copy link
Member

Then why not use KLUFactorization(reuse_symbolic=true) for that case? We can make it easier to detect this case, but it should always throw at least some kind of error or warning by default because it's a generally unsafe behavior.

@j-fu
Copy link
Contributor

j-fu commented Aug 20, 2022

... well indeed the symbolic factorization cannot kept in that case.
However I found a workaround for that purpose - I can re-init in set_A.

@ChrisRackauckas
Copy link
Member

We can follow up in #195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants