Skip to content

Commit 1a987c4

Browse files
benegeeJoshuaLampertranocha
authored
Use testing macros from TrixiTest.jl (trixi-framework#2493)
* use all macros provided by TrixiTest * bump TrixiBase version * add import Trixi * replace test_nowarn_mod by trixi_test_nowarn * replace @test_nowarn_mod trixi_include by @test_trixi_include * unified use of EXAMPLES_DIR * fmt * temporarily swtich to branch of TrixiTest * lots of local usings * get sources right * compat for TrixiTest * use escaped version as in TrixiTest * switch to branch in CI * use reexported SVector * fix url * both test and main project? * no * fix * try deving * path keyword * without cache and buildpkg * yet another try * some fixes * next * fmt * fixes * Trixi.jl maxiters warning * fix * try 1.11 and sources * fix sources * fixes * fmt * ugly workaround for @unpack macro * Apply suggestions from code review Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com> * compat bound from TrixiBase.jl * yet another EXAMPLES_DIR * use native unpack syntax * adapt new test --------- Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
1 parent cec533a commit 1a987c4

File tree

64 files changed

+427
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+427
-550
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ StrideArrays = "0.1.29"
117117
StructArrays = "0.6.20, 0.7"
118118
SummationByPartsOperators = "0.5.52"
119119
T8code = "0.7.4"
120-
TimerOutputs = "0.5.23"
120+
TimerOutputs = "0.5.25"
121121
Triangulate = "2.2, 3"
122122
TriplotBase = "0.1"
123123
TriplotRecipes = "0.1"
124-
TrixiBase = "0.1.3"
124+
TrixiBase = "0.1.6"
125125
UUIDs = "1.6"
126126
julia = "1.10"

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ SparseConnectivityTracer = "1.0.1"
7070
SparseMatrixColorings = "0.4.21"
7171
StableRNGs = "1.0.2"
7272
Test = "1"
73-
TrixiTest = "0.1"
73+
TrixiTest = "0.1.4"

test/test_dgmulti_1d.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ end
9494
end
9595

9696
@trixi_testset "elixir_euler_flux_diff.jl (convergence)" begin
97+
using Trixi: convergence_test
9798
mean_convergence = convergence_test(@__MODULE__,
9899
joinpath(EXAMPLES_DIR,
99100
"elixir_euler_flux_diff.jl"), 3)
@@ -135,6 +136,7 @@ end
135136
end
136137

137138
@trixi_testset "elixir_euler_flux_diff.jl (FD SBP)" begin
139+
using Trixi: SummationByPartsOperators, derivative_operator
138140
global D = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),
139141
derivative_order = 1,
140142
accuracy_order = 4,
@@ -166,8 +168,7 @@ end
166168
end
167169

168170
@trixi_testset "elixir_euler_modified_sod.jl" begin
169-
@test_trixi_include(joinpath(examples_dir(), "dgmulti_1d",
170-
"elixir_euler_modified_sod.jl"),
171+
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_modified_sod.jl"),
171172
cells_per_dimension=(16,),
172173
l2=[0.26352391505659767, 0.4528974787813885, 0.9310255091126164],
173174
linf=[
@@ -208,6 +209,7 @@ end
208209
end
209210

210211
@trixi_testset "DGMulti with periodic SBP unit test" begin
212+
using Trixi: periodic_derivative_operator, DGMulti, Line, DGMultiMesh
211213
# see https://github.com/trixi-framework/Trixi.jl/pull/1013
212214
global D = periodic_derivative_operator(derivative_order = 1,
213215
accuracy_order = 4,

test/test_dgmulti_2d.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ end
316316
end
317317

318318
@trixi_testset "elixir_euler_weakform.jl (convergence)" begin
319+
using Trixi: convergence_test
319320
mean_convergence = convergence_test(@__MODULE__,
320321
joinpath(EXAMPLES_DIR,
321322
"elixir_euler_weakform.jl"), 2)
@@ -534,6 +535,7 @@ end
534535
end
535536

536537
@trixi_testset "elixir_euler_weakform.jl (FD SBP)" begin
538+
using Trixi: SummationByPartsOperators, derivative_operator
537539
global D = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),
538540
derivative_order = 1,
539541
accuracy_order = 4,
@@ -568,6 +570,7 @@ end
568570
end
569571

570572
@trixi_testset "elixir_euler_weakform.jl (FD SBP, EC)" begin
573+
using Trixi: SummationByPartsOperators, derivative_operator
571574
global D = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),
572575
derivative_order = 1,
573576
accuracy_order = 4,
@@ -650,6 +653,7 @@ end
650653
end
651654

652655
@trixi_testset "elixir_euler_fdsbp_periodic.jl (arbitrary reference and physical domains)" begin
656+
using Trixi: periodic_derivative_operator
653657
global D = periodic_derivative_operator(derivative_order = 1,
654658
accuracy_order = 4,
655659
xmin = -200.0,
@@ -682,6 +686,7 @@ end
682686
end
683687

684688
@trixi_testset "elixir_euler_fdsbp_periodic.jl (CGSEM)" begin
689+
using Trixi: SummationByPartsOperators
685690
D_local = SummationByPartsOperators.legendre_derivative_operator(xmin = 0.0,
686691
xmax = 1.0,
687692
N = 4)

test/test_dgmulti_3d.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using Trixi
55

66
include("test_trixi.jl")
77

8-
EXAMPLES_DIR = pkgdir(Trixi, "examples", "dgmulti_3d")
8+
EXAMPLES_DIR = joinpath(examples_dir(), "dgmulti_3d")
99

1010
# Start with a clean environment: remove Trixi.jl output directory if it exists
1111
outdir = "out"
@@ -282,6 +282,7 @@ end
282282
end
283283

284284
@trixi_testset "elixir_euler_weakform_periodic.jl (FD SBP)" begin
285+
using Trixi: SummationByPartsOperators, derivative_operator
285286
global D = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),
286287
derivative_order = 1,
287288
accuracy_order = 2,
@@ -316,6 +317,7 @@ end
316317
end
317318

318319
@trixi_testset "elixir_euler_weakform_periodic.jl (FD SBP, EC)" begin
320+
using Trixi: SummationByPartsOperators, derivative_operator
319321
global D = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),
320322
derivative_order = 1,
321323
accuracy_order = 2,

test/test_mpi.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ CI_ON_WINDOWS = (get(ENV, "GITHUB_ACTIONS", false) == "true") && Sys.iswindows()
3030
end # MPI
3131

3232
@trixi_testset "MPI supporting functionality" begin
33+
using Trixi: Trixi, ode_norm, SVector
3334
t = 0.5
3435
let u = 1.0
3536
@test ode_norm(u, t) Trixi.DiffEqBase.ODE_DEFAULT_NORM(u, t)

test/test_mpi_p4est_2d.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using Trixi
55

66
include("test_trixi.jl")
77

8-
const EXAMPLES_DIR = pkgdir(Trixi, "examples", "p4est_2d_dgsem")
8+
EXAMPLES_DIR = joinpath(examples_dir(), "p4est_2d_dgsem")
99

1010
@testset "P4estMesh MPI 2D" begin
1111
#! format: noindent
@@ -20,8 +20,8 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "p4est_2d_dgsem")
2020
linf=[6.627000273229378e-5])
2121

2222
@testset "error-based step size control" begin
23-
Trixi.mpi_isroot() && println("-"^100)
24-
Trixi.mpi_isroot() &&
23+
mpi_isroot() && println("-"^100)
24+
mpi_isroot() &&
2525
println("elixir_advection_basic.jl with error-based step size control")
2626

2727
# Use callbacks without stepsize_callback to test error-based step size control
@@ -30,7 +30,7 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "p4est_2d_dgsem")
3030
ode_default_options()..., callback = callbacks)
3131
summary_callback()
3232
errors = analysis_callback(sol)
33-
if Trixi.mpi_isroot()
33+
if mpi_isroot()
3434
@test errors.l2[3.3022040342579066e-5] rtol=1.0e-4
3535
@test errors.linf[0.00011787417954578494] rtol=1.0e-4
3636
end
@@ -180,7 +180,8 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "p4est_2d_dgsem")
180180

181181
# Test MPI-parallel handling of .inp meshes NOT generated by HOHQMesh
182182
@trixi_testset "elixir_euler_SD7003airfoil.jl" begin
183-
@test_trixi_include(joinpath(examples_dir(), "p4est_2d_dgsem",
183+
using Trixi: SemidiscretizationHyperbolic, AnalysisCallback
184+
@test_trixi_include(joinpath(EXAMPLES_DIR,
184185
"elixir_navierstokes_SD7003airfoil.jl"),
185186
semi=SemidiscretizationHyperbolic(mesh, equations,
186187
initial_condition, solver;

test/test_mpi_p4est_3d.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using Trixi
55

66
include("test_trixi.jl")
77

8-
const EXAMPLES_DIR = pkgdir(Trixi, "examples", "p4est_3d_dgsem")
8+
EXAMPLES_DIR = joinpath(examples_dir(), "p4est_3d_dgsem")
99

1010
@testset "P4estMesh MPI 3D" begin
1111
#! format: noindent
@@ -20,8 +20,8 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "p4est_3d_dgsem")
2020
linf=[0.0014537194925779984])
2121

2222
@testset "error-based step size control" begin
23-
Trixi.mpi_isroot() && println("-"^100)
24-
Trixi.mpi_isroot() &&
23+
mpi_isroot() && println("-"^100)
24+
mpi_isroot() &&
2525
println("elixir_advection_basic.jl with error-based step size control")
2626

2727
# Use callbacks without stepsize_callback to test error-based step size control
@@ -31,7 +31,7 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "p4est_3d_dgsem")
3131
ode_default_options()..., callback = callbacks)
3232
summary_callback()
3333
errors = analysis_callback(sol)
34-
if Trixi.mpi_isroot()
34+
if mpi_isroot()
3535
@test errors.l2[0.00016800412839949264] rtol=1.0e-4
3636
@test errors.linf[0.0014548839020096516] rtol=1.0e-4
3737
end

test/test_mpi_t8code_2d.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using Trixi
55

66
include("test_trixi.jl")
77

8-
const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_2d_dgsem")
8+
EXAMPLES_DIR = joinpath(examples_dir(), "t8code_2d_dgsem")
99

1010
@testset "T8codeMesh MPI 2D" begin
1111
#! format: noindent
@@ -20,8 +20,8 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_2d_dgsem")
2020
linf=[6.627000273229378e-5])
2121

2222
@testset "error-based step size control" begin
23-
Trixi.mpi_isroot() && println("-"^100)
24-
Trixi.mpi_isroot() &&
23+
mpi_isroot() && println("-"^100)
24+
mpi_isroot() &&
2525
println("elixir_advection_basic.jl with error-based step size control")
2626

2727
# Use callbacks without stepsize_callback to test error-based step size control
@@ -30,7 +30,7 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_2d_dgsem")
3030
ode_default_options()..., callback = callbacks)
3131
summary_callback()
3232
errors = analysis_callback(sol)
33-
if Trixi.mpi_isroot()
33+
if mpi_isroot()
3434
@test errors.l2[3.3022040342579066e-5] rtol=1.0e-4
3535
@test errors.linf[0.00011787417954578494] rtol=1.0e-4
3636
end

test/test_mpi_t8code_3d.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using Trixi
55

66
include("test_trixi.jl")
77

8-
const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_3d_dgsem")
8+
EXAMPLES_DIR = joinpath(examples_dir(), "t8code_3d_dgsem")
99

1010
@testset "T8codeMesh MPI 3D" begin
1111
#! format: noindent
@@ -20,8 +20,8 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_3d_dgsem")
2020
linf=[0.0014537194925779984])
2121

2222
@testset "error-based step size control" begin
23-
Trixi.mpi_isroot() && println("-"^100)
24-
Trixi.mpi_isroot() &&
23+
mpi_isroot() && println("-"^100)
24+
mpi_isroot() &&
2525
println("elixir_advection_basic.jl with error-based step size control")
2626

2727
# Use callbacks without stepsize_callback to test error-based step size control
@@ -31,7 +31,7 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_3d_dgsem")
3131
ode_default_options()..., callback = callbacks)
3232
summary_callback()
3333
errors = analysis_callback(sol)
34-
if Trixi.mpi_isroot()
34+
if mpi_isroot()
3535
@test errors.l2[0.00016800412839949264] rtol=1.0e-4
3636
@test errors.linf[0.0014548839020096516] rtol=1.0e-4
3737
end

0 commit comments

Comments
 (0)