Skip to content

Commit

Permalink
Use BandedMatrices for jac_prototype with FiniteReservoirProblem
Browse files Browse the repository at this point in the history
  • Loading branch information
gerlero committed Sep 6, 2024
1 parent 7de7d18 commit 33a028b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "2.6.1"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -22,6 +23,7 @@ ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24"

[compat]
ArgCheck = "2"
BandedMatrices = "1"
DifferentiationInterface = "=0.5.5"
ForwardDiff = "0.10"
LinearAlgebra = "1"
Expand Down
1 change: 1 addition & 0 deletions src/Fronts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ using DifferentiationInterface: value_and_derivative,
value_derivative_and_second_derivative, AutoForwardDiff
using ArgCheck: @argcheck
using StaticArrays: @SVector, @SMatrix
using BandedMatrices: BandedMatrix
using RecursiveArrayTools: ArrayPartition
using PCHIPInterpolation: Interpolator, integrate
import NumericalIntegration
Expand Down
3 changes: 2 additions & 1 deletion src/finite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ function solve(prob::FiniteReservoirProblem{<:DiffusionEquation{1}},
end
end

f! = ODEFunction(f!)
f! = ODEFunction(f!,
jac_prototype = BandedMatrix{eltype(u)}(undef, (length(u), length(u)), (1, 2)))

steady_state = DiscreteCallback(
(u, t, integrator) -> all(u[(begin + 1):end] .≈ u[end]),
Expand Down

0 comments on commit 33a028b

Please sign in to comment.