Skip to content

Commit

Permalink
Improved formatting and updated reference solution for test
Browse files Browse the repository at this point in the history
  • Loading branch information
amrueda committed Oct 19, 2023
1 parent 64e9784 commit 05fcaaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/time_integration/methods_SSP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ end
function SimpleIntegratorSSPOptions(callback, tspan; maxiters = typemax(Int), kwargs...)
tstops_internal = BinaryHeap{eltype(tspan)}(FasterForward())
push!(tstops_internal, 2 * last(tspan))
SimpleIntegratorSSPOptions{typeof(callback), typeof(tstops_internal)}(callback, false, Inf, maxiters,
tstops_internal)
SimpleIntegratorSSPOptions{typeof(callback), typeof(tstops_internal)}(callback,
false, Inf,
maxiters,
tstops_internal)
end

# This struct is needed to fake https://github.com/SciML/OrdinaryDiffEq.jl/blob/0c2048a502101647ac35faabd80da8a5645beac7/src/integrators/type.jl#L77
Expand Down Expand Up @@ -96,7 +98,7 @@ Add
function add_tstop!(integrator::SimpleIntegratorSSP, t)
integrator.tdir * (t - integrator.t) < zero(integrator.t) &&
error("Tried to add a tstop that is behind the current time. This is strictly forbidden")
if length(integrator.opts.tstops) > 1
if length(integrator.opts.tstops) > 1
pop!(integrator.opts.tstops)
end
push!(integrator.opts.tstops, integrator.tdir * t)
Expand Down Expand Up @@ -134,7 +136,8 @@ function solve(ode::ODEProblem, alg = SimpleSSPRK33()::SimpleAlgorithmSSP;
integrator = SimpleIntegratorSSP(u, du, r0, t, tdir, dt, zero(dt), iter, ode.p,
(prob = ode,), ode.f, alg,
SimpleIntegratorSSPOptions(callback, ode.tspan;
kwargs...), false, true, false)
kwargs...),
false, true, false)

# resize container
resize!(integrator.p, nelements(integrator.p.solver, integrator.p.cache))
Expand Down Expand Up @@ -200,7 +203,7 @@ function solve!(integrator::SimpleIntegratorSSP)

integrator.iter += 1
integrator.t += integrator.dt

# handle callbacks
if callbacks isa CallbackSet
for cb in callbacks.discrete_callbacks
Expand Down
4 changes: 2 additions & 2 deletions test/test_tree_2d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_2d_dgsem")

@trixi_testset "elixir_euler_shockcapturing_subcell.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_shockcapturing_subcell.jl"),
l2 = [0.08508147906199143, 0.04510299017724501, 0.045103019801950375, 0.6930704343869766],
linf = [0.31123546471463326, 0.5616274869594462, 0.5619692712224448, 2.88670199345138])
l2 = [0.08508152653623638, 0.04510301725066843, 0.04510304668512745, 0.6930705064715306],
linf = [0.31136518019691406, 0.5617651935473419, 0.5621200790240503, 2.8866869108596056])
end

@trixi_testset "elixir_euler_blast_wave.jl" begin
Expand Down

0 comments on commit 05fcaaa

Please sign in to comment.