Skip to content

Commit

Permalink
Fix append_similar! for FIRK nested methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikQQY committed Nov 12, 2024
1 parent 0537b1e commit 4997ba6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/BoundaryValueDiffEqAscher/test/ascher_basic_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ end
for alg in (Ascher1, Ascher2, Ascher3, Ascher4, Ascher5, Ascher6, Ascher7)]
for i in 1:2
for stage in (2, 3, 4, 5, 6, 7)
sol = solve(prob2Arr[i], SOLVERS[stage], dt = 0.01, abstol = 1e-1)
sol = solve(prob2Arr[i], SOLVERS[stage], dt = 0.01, adaptive = false)
@test SciMLBase.successful_retcode(sol)
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/BoundaryValueDiffEqAscher/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ const RETESTITEMS_NWORKER_THREADS = parse(Int,

ReTestItems.runtests(
BoundaryValueDiffEqAscher; tags = (GROUP == "all" ? nothing : [Symbol(GROUP)]),
nworkers = RETESTITEMS_NWORKERS, nworker_threads = RETESTITEMS_NWORKER_THREADS)
nworkers = RETESTITEMS_NWORKERS,
nworker_threads = RETESTITEMS_NWORKER_THREADS, testitem_timeout = 3 * 60 * 60)
10 changes: 9 additions & 1 deletion lib/BoundaryValueDiffEqFIRK/src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

function __append_similar!(x::AbstractVector{<:AbstractArray}, n, _, TU::FIRKTableau{false})
(; s) = TU
N = (n - 1) * (s + 1) + 1 - length(x)
Expand Down Expand Up @@ -28,3 +27,12 @@ function __append_similar!(x::AbstractVectorOfArray, n, M, TU::FIRKTableau{false
append!(x, VectorOfArray([similar(last(x)) for _ in 1:N]))
return x
end

function __append_similar!(x::AbstractVectorOfArray, n, M, TU::FIRKTableau{true})
(; s) = TU
N = n - length(x)
N == 0 && return x
N < 0 && throw(ArgumentError("Cannot append a negative number of elements"))
append!(x, VectorOfArray([similar(last(x)) for _ in 1:N]))
return x
end

0 comments on commit 4997ba6

Please sign in to comment.