Skip to content

Commit

Permalink
Fix issue in EPRK integrator and add some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
michakraus committed Nov 7, 2023
1 parent b39479e commit 8aebc5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/integrators/rk/integrators_eprk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ end


# Compute Q stages of explicit partitioned Runge-Kutta methods.
function compute_stage_q!(solstep::SolutionStepPODE, problem::PODEProblem, method::EPRK, cache, i, jmax, t)
function compute_stage_q!(solstep::SolutionStepPODE, problem::AbstractProblemPODE, method::EPRK, cache, i, jmax, t)
# obtain cache
local Q = cache.Q
local P = cache.P
Expand All @@ -108,7 +108,7 @@ function compute_stage_q!(solstep::SolutionStepPODE, problem::PODEProblem, metho
end

# Compute P stages of explicit partitioned Runge-Kutta methods.
function compute_stage_p!(solstep::SolutionStepPODE, problem::PODEProblem, method::EPRK, cache, i, jmax, t)
function compute_stage_p!(solstep::SolutionStepPODE, problem::AbstractProblemPODE, method::EPRK, cache, i, jmax, t)
# obtain cache
local Q = cache.Q
local P = cache.P
Expand Down
14 changes: 14 additions & 0 deletions test/integrators/rk_integrators_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,31 @@ end
perr = relative_maximum_error(psol, pref)
@test perr.q < 5E-2
# @test perr.p < 1E-3
@test psol.q == integrate(hode, SymplecticEulerA()).q

psol = integrate(pode, SymplecticEulerB())
perr = relative_maximum_error(psol, pref)
@test perr.q < 5E-2
# @test perr.p < 1E-3
@test psol.q == integrate(hode, SymplecticEulerB()).q

psol = integrate(pode, LobattoIIIAIIIB(2))
perr = relative_maximum_error(psol, pref)
@test perr.q < 2E-4
# @test perr.p < 5E-4
@test psol.q == integrate(hode, LobattoIIIAIIIB(2)).q

psol = integrate(pode, LobattoIIIBIIIA(2))
perr = relative_maximum_error(psol, pref)
@test perr.q < 2E-4
# @test perr.p < 1E-3
@test psol.q == integrate(hode, LobattoIIIBIIIA(2)).q

psol = integrate(pode, RK4())
perr = relative_maximum_error(psol, pref)
@test perr.q < 2E-7
# @test perr.p < 2E-7
@test psol.q == integrate(hode, RK4()).q

end

Expand All @@ -207,24 +212,33 @@ end
# @test perr.p < 5E-4
@test psol.q == integrate(pode, PartitionedGauss(1)).q
@test psol.q == integrate(pode, ImplicitMidpoint()).q
@test psol.q == integrate(hode, Gauss(1)).q
@test psol.q == integrate(hode, PartitionedGauss(1)).q
@test psol.q == integrate(hode, ImplicitMidpoint()).q

psol = integrate(pode, Gauss(2))
perr = relative_maximum_error(psol, pref)
@test perr.q < 1E-7
# @test perr.p < 1E-7
@test psol.q == integrate(pode, PartitionedGauss(2)).q
@test psol.q == integrate(hode, Gauss(2)).q
@test psol.q == integrate(hode, PartitionedGauss(2)).q

psol = integrate(pode, Gauss(3))
perr = relative_maximum_error(psol, pref)
@test perr.q < 1E-11
# @test perr.p < 1E-11
@test psol.q == integrate(pode, PartitionedGauss(3)).q
@test psol.q == integrate(hode, Gauss(3)).q
@test psol.q == integrate(hode, PartitionedGauss(3)).q

psol = integrate(pode, Gauss(4))
perr = relative_maximum_error(psol, pref)
@test perr.q < 1E-15
# @test perr.p < 1E-15
@test psol.q == integrate(pode, PartitionedGauss(4)).q
@test psol.q == integrate(hode, Gauss(4)).q
@test psol.q == integrate(hode, PartitionedGauss(4)).q

end

Expand Down

0 comments on commit 8aebc5a

Please sign in to comment.