Skip to content

Commit 2389d44

Browse files
SKopeczranocha
andauthored
Remove examples from runtests.jl and add additional tests (#89)
* Added tests for problems in PDSProblemLibrary * format * Separated test for PDS problem library into two tests (adaptive schemes and non-adaptive schemes) * Convergence tests for nonautonomous PDS and corresponding bug fixes * format * Skip test of MPRK43I(0.5,0.75) to solve prob_pds_stratreac * Tests for compatibility of PositiveIntegrators and OrdinaryDiffEq * Removed allocation tests for linear advection * Skip solution of prob_pds_stratreac with MPRK43I(0.5,0.75) completely * test plotting * Update test/runtests.jl Co-authored-by: Hendrik Ranocha <[email protected]> * Moved function definitions for testset 'Linear advection' out of the testset to avoid failing allocation tests * Added Plots package for plotting tests * Try to make allcoation tests in testset 'Linear advection' pass * Test equality of MPRK22(alpha) and SSPMPRK22(0,alpha) also for nonconservative PDS * Added comparision with correct derivative in 'Interpolation test (conservative)'. * Additional test to check the differen possibilities to define small_constant * Update test/runtests.jl Co-authored-by: Hendrik Ranocha <[email protected]> * Update test/runtests.jl Co-authored-by: Hendrik Ranocha <[email protected]> * Update test/runtests.jl Co-authored-by: Hendrik Ranocha <[email protected]> * Clearer variable names in testset 'Linear advection' * Meaningful function and variable names for the linear advection test * Added tests for exact solutions of RK schemes and MPE * Bug fix in 'Exact solutions (MPE)' test * Compat entry for Plots * update minimum version of Plots for Reexport compat * Apply suggestions from code review --------- Co-authored-by: Hendrik Ranocha <[email protected]>
1 parent 19790ee commit 2389d44

File tree

4 files changed

+548
-53
lines changed

4 files changed

+548
-53
lines changed

src/mprk.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,13 +1012,13 @@ end
10121012
# avoid division by zero due to zero Patankar weights
10131013
σ = add_small_constant(σ, small_constant)
10141014

1015-
P3 = f.p(u, p, t + c2 * dt)
1015+
P3 = f.p(u, p, t + c3 * dt)
10161016
Ptmp = b1 * P + b2 * P2 + b3 * P3
10171017
integrator.stats.nf += 1
10181018

10191019
# build linear system matrix
10201020
if f isa PDSFunction
1021-
d3 = f.d(u, p, t + c2 * dt) # evaluate nonconservative destruction terms
1021+
d3 = f.d(u, p, t + c3 * dt) # evaluate nonconservative destruction terms
10221022
dtmp = b1 * d + b2 * d2 + b3 * d3
10231023
rhs = uprev + dt * diag(Ptmp)
10241024
M = build_mprk_matrix(Ptmp, σ, dt, dtmp)

src/sspmprk.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ end
157157
# avoid division by zero due to zero Patankar weights
158158
σ = add_small_constant(σ, small_constant)
159159

160-
P2 = f.p(u, p, t + a21 * dt)
160+
P2 = f.p(u, p, t + b10 * dt)
161161
Ptmp = b20 * P + b21 * P2
162162
integrator.stats.nf += 1
163163

164164
# build linear system matrix and rhs
165165
if f isa PDSFunction
166-
d2 = f.d(u, p, t + a21 * dt) # evaluate nonconservative destruction terms
166+
d2 = f.d(u, p, t + b10 * dt) # evaluate nonconservative destruction terms
167167
dtmp = b20 * d + b21 * d2
168168
rhs = a20 * uprev + a21 * u + dt * diag(Ptmp)
169169
M = build_mprk_matrix(Ptmp, σ, dt, dtmp)
@@ -300,8 +300,8 @@ end
300300
end
301301
@.. broadcast=false σ=σ + small_constant
302302

303-
f.p(P2, u, p, t + a21 * dt) # evaluate production terms
304-
f.d(D2, u, p, t + a21 * dt) # evaluate nonconservative destruction terms
303+
f.p(P2, u, p, t + b10 * dt) # evaluate production terms
304+
f.d(D2, u, p, t + b10 * dt) # evaluate nonconservative destruction terms
305305
integrator.stats.nf += 1
306306

307307
@.. broadcast=false P2=b20 * P + b21 * P2
@@ -372,7 +372,7 @@ end
372372
end
373373
@.. broadcast=false σ=σ + small_constant
374374

375-
f.p(P2, u, p, t + a21 * dt) # evaluate production terms
375+
f.p(P2, u, p, t + b10 * dt) # evaluate production terms
376376
integrator.stats.nf += 1
377377

378378
@.. broadcast=false P2=b20 * P + b21 * P2

test/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
33
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
44
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
55
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
6+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
67
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
78
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
89
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
@@ -12,5 +13,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1213
Aqua = "0.7, 0.8"
1314
LinearSolve = "2.21"
1415
OrdinaryDiffEq = "6.59"
16+
Plots = "1.11.1"
1517
StaticArrays = "1.5"
1618
Statistics = "1"

0 commit comments

Comments
 (0)