Skip to content

Commit 66f0a05

Browse files
Merge branch 'main' into tm/autodiff_metrics
2 parents f75bc4e + f20c736 commit 66f0a05

File tree

8 files changed

+89
-66
lines changed

8 files changed

+89
-66
lines changed

.github/workflows/SpellCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
- name: Checkout Actions Repository
1111
uses: actions/checkout@v4
1212
- name: Check spelling
13-
uses: crate-ci/[email protected].1
13+
uses: crate-ci/[email protected].2

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ Static = "0.8, 1"
3333
StaticArrayInterface = "1.5.1"
3434
StaticArrays = "1"
3535
StrideArrays = "0.1.28"
36-
Trixi = "0.9.9, 0.10, 0.11"
36+
Trixi = "0.9.9, 0.10, 0.11, 0.12"
3737
julia = "1.9"

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ end
1010
using TrixiAtmo
1111

1212
# Provide external links to the Trixi.jl docs (project root and inventory file)
13-
links = InterLinks("Trixi" => ("https://trixi-framework.github.io/Trixi.jl/stable/",
14-
"https://trixi-framework.github.io/Trixi.jl/stable/objects.inv"))
13+
links = InterLinks("Trixi" => ("https://trixi-framework.github.io/TrixiDocumentation/stable/",
14+
"https://trixi-framework.github.io/TrixiDocumentation/stable/objects.inv"))
1515

1616
DocMeta.setdocmeta!(TrixiAtmo, :DocTestSetup, :(using TrixiAtmo);
1717
recursive = true)

src/equations/shallow_water_3d.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This affects the implementation and use of these equations in various ways:
3737
* The flux values corresponding to the bottom topography must be zero.
3838
* The bottom topography values must be included when defining initial conditions, boundary conditions or
3939
source terms.
40-
* [`AnalysisCallback`](https://trixi-framework.github.io/Trixi.jl/stable/reference-trixi/#Trixi.AnalysisCallback) analyzes this variable.
40+
* [`AnalysisCallback`](https://trixi-framework.github.io/TrixiDocumentation/stable/reference-trixi/#Trixi.AnalysisCallback) analyzes this variable.
4141
* Trixi.jl's visualization tools will visualize the bottom topography by default.
4242
4343
References:
@@ -115,8 +115,9 @@ end
115115
end
116116

117117
"""
118-
flux_wintermeyer_etal(u_ll, u_rr, orientation_or_normal_direction,
119-
equations::ShallowWaterEquations2D)
118+
flux_wintermeyer_etal(u_ll, u_rr,
119+
normal_direction::AbstractVector,
120+
equations::ShallowWaterEquations3D)
120121
121122
Total energy conservative (mathematical entropy for shallow water equations) split form.
122123
When the bottom topography is nonzero this scheme will be well-balanced when used as a `volume_flux`.
@@ -160,8 +161,9 @@ Further details are available in Theorem 1 of the paper:
160161
end
161162

162163
"""
163-
flux_fjordholm_etal(u_ll, u_rr, orientation,
164-
equations::ShallowWaterEquations1D)
164+
flux_fjordholm_etal(u_ll, u_rr,
165+
normal_direction::AbstractVector,
166+
equations::ShallowWaterEquations3D)
165167
166168
Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography
167169
is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced.

test/Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ OrdinaryDiffEqLowStorageRK = "b0944070-b475-4768-8dec-fb6eb410534d"
55
OrdinaryDiffEqSSPRK = "669c94d9-1f4b-4b64-b377-1aa079aa2388"
66
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
77
Trixi = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
8+
TrixiTest = "0a316866-cbd0-4425-8bcb-08103b2c1f26"
89

910
[compat]
1011
NLsolve = "4.5.1"
1112
OrdinaryDiffEq = "6.91"
1213
OrdinaryDiffEqLowStorageRK = "1.2"
1314
OrdinaryDiffEqSSPRK = "1.2"
1415
Test = "1"
15-
Trixi = "0.9.9, 0.10, 0.11"
16+
Trixi = "0.9.9, 0.10, 0.11, 0.12"
17+
TrixiTest = "0.1"

test/runtests.jl

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,41 @@ using Test
44
# variable to determine the subset of tests to execute.
55
#
66
# We could do the same once we have a lot of tests
7-
const TRIXIATMO_TEST = get(ENV, "TRIXIATMO_TEST", "all")
8-
const TRIXIATMO_MPI_NPROCS = clamp(Sys.CPU_THREADS, 2, 3)
9-
const TRIXIATMO_NTHREADS = clamp(Sys.CPU_THREADS, 2, 3)
7+
const TRIXI_TEST = get(ENV, "TRIXI_TEST", "all")
8+
const TRIXI_MPI_NPROCS = clamp(Sys.CPU_THREADS, 2, 3)
9+
const TRIXI_NTHREADS = clamp(Sys.CPU_THREADS, 2, 3)
1010

1111
@time @testset verbose=true showtiming=true "TrixiAtmo.jl tests" begin
12-
@time if TRIXIATMO_TEST == "all" || TRIXIATMO_TEST == "trixi_consistency"
12+
@time if TRIXI_TEST == "all" || TRIXI_TEST == "trixi_consistency"
1313
include("test_trixi_consistency.jl")
1414
end
1515

16-
@time if TRIXIATMO_TEST == "all" || TRIXIATMO_TEST == "moist_euler"
16+
@time if TRIXI_TEST == "all" || TRIXI_TEST == "moist_euler"
1717
include("test_2d_moist_euler.jl")
1818
end
1919

20-
@time if TRIXIATMO_TEST == "all" || TRIXIATMO_TEST == "spherical_advection"
20+
@time if TRIXI_TEST == "all" || TRIXI_TEST == "spherical_advection"
2121
include("test_spherical_advection.jl")
2222
end
2323

24-
@time if TRIXIATMO_TEST == "all" || TRIXIATMO_TEST == "shallow_water_3d"
24+
@time if TRIXI_TEST == "all" || TRIXI_TEST == "shallow_water_3d"
2525
include("test_3d_shallow_water.jl")
2626
end
2727

28-
@time if TRIXIATMO_TEST == "all" || TRIXIATMO_TEST == "shallow_water_2d_covariant"
28+
@time if TRIXI_TEST == "all" || TRIXI_TEST == "shallow_water_2d_covariant"
2929
include("test_2d_shallow_water_covariant.jl")
3030
end
31+
32+
@time if TRIXI_TEST == "all" || TRIXI_TEST == "threaded"
33+
# Do a dummy `@test true`:
34+
# If the process errors out the testset would error out as well,
35+
# cf. https://github.com/JuliaParallel/MPI.jl/pull/391
36+
@test true
37+
38+
run(`$(Base.julia_cmd()) --threads=$TRIXI_NTHREADS --check-bounds=yes --code-coverage=none $(abspath("test_threaded.jl"))`)
39+
end
40+
41+
@time if TRIXI_TEST == "upstream"
42+
include("test_trixi_consistency.jl")
43+
end
3144
end

test/test_threaded.jl

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
module TestThreaded
2+
3+
using Test
4+
using TrixiAtmo
5+
6+
include("test_trixiatmo.jl") # TODO - This is a repetition from Trixi.jl
7+
8+
EXAMPLES_DIR = pkgdir(TrixiAtmo, "examples")
9+
10+
@testset "Threaded tests" begin
11+
#! format: noindent
12+
13+
@trixiatmo_testset "elixir_moist_euler_moist_bubble" begin
14+
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_moist_euler_moist_bubble.jl"),
15+
l2=[
16+
7.351043427240923e-6,
17+
1.1070342432069074e-7,
18+
0.0006974588377288118,
19+
1.715668353329522,
20+
8.831269143134121e-7,
21+
1.025579538944668e-6
22+
],
23+
linf=[
24+
8.055695643149896e-5,
25+
1.1985203677080201e-6,
26+
0.005897639251024437,
27+
19.24776030163048,
28+
1.0043133039065386e-5,
29+
1.1439046776775402e-5
30+
],
31+
polydeg=3,
32+
cells_per_dimension=(16, 8),
33+
tspan=(0.0, 0.1))
34+
# Ensure that we do not have excessive memory allocations
35+
# (e.g., from type instabilities)
36+
let
37+
t = sol.t[end]
38+
u_ode = sol.u[end]
39+
du_ode = similar(u_ode)
40+
@test (@allocated TrixiAtmo.Trixi.rhs!(du_ode, u_ode, semi, t)) < 2000
41+
end
42+
end
43+
end
44+
end # module

test/test_trixiatmo.jl

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Test: @test
2+
using TrixiTest: @trixi_test_nowarn
23
using Trixi: Trixi, examples_dir, trixi_include
34
import TrixiAtmo
45

@@ -125,55 +126,16 @@ end
125126

126127
# Modified version of `@test_nowarn` that prints the content of `stderr` when
127128
# it is not empty and ignores module replacements.
128-
macro test_nowarn_mod(expr, additional_ignore_content = String[])
129+
macro test_nowarn_mod(expr, additional_ignore_content = [])
129130
quote
130-
let fname = tempname()
131-
try
132-
ret = open(fname, "w") do f
133-
redirect_stderr(f) do
134-
$(esc(expr))
135-
end
136-
end
137-
stderr_content = read(fname, String)
138-
if !isempty(stderr_content)
139-
println("Content of `stderr`:\n", stderr_content)
140-
end
141-
142-
# Patterns matching the following ones will be ignored. Additional patterns
143-
# passed as arguments can also be regular expressions, so we just use the
144-
# type `Any` for `ignore_content`.
145-
ignore_content = Any[
146-
# We need to ignore steady state information reported by our callbacks
147-
r"┌ Info: Steady state tolerance reached\n│ steady_state_callback .+\n└ t = .+\n",
148-
# We also ignore our own compilation messages
149-
"[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.\n",
150-
# TODO: Upstream (PlotUtils). This should be removed again once the
151-
# deprecated stuff is fixed upstream.
152-
"WARNING: importing deprecated binding Colors.RGB1 into Plots.\n",
153-
"WARNING: importing deprecated binding Colors.RGB4 into Plots.\n",
154-
r"┌ Warning: Keyword argument letter not supported with Plots.+\n└ @ Plots.+\n",
155-
r"┌ Warning: `parse\(::Type, ::Coloarant\)` is deprecated.+\n│.+\n│.+\n└ @ Plots.+\n",
156-
# TODO: Silence warning introduced by Flux v0.13.13. Should be properly fixed.
157-
r"┌ Warning: Layer with Float32 parameters got Float64 input.+\n│.+\n│.+\n│.+\n└ @ Flux.+\n",
158-
# NOTE: These warnings arose from Julia 1.10 onwards
159-
r"WARNING: Method definition .* in module .* at .* overwritten .*.\n",
160-
# Warnings from third party packages
161-
r"┌ Warning: Problem status ALMOST_INFEASIBLE; solution may be inaccurate.\n└ @ Convex ~/.julia/packages/Convex/.*\n",
162-
r"┌ Warning: Problem status ALMOST_OPTIMAL; solution may be inaccurate.\n└ @ Convex ~/.julia/packages/Convex/.*\n"]
163-
append!(ignore_content, $additional_ignore_content)
164-
for pattern in ignore_content
165-
stderr_content = replace(stderr_content, pattern => "")
166-
end
167-
168-
# We also ignore simple module redefinitions for convenience. Thus, we
169-
# check whether every line of `stderr_content` is of the form of a
170-
# module replacement warning.
171-
@test occursin(r"^(WARNING: replacing module .+\.\n)*$", stderr_content)
172-
ret
173-
finally
174-
rm(fname, force = true)
175-
end
176-
end
131+
add_to_additional_ignore_content = [
132+
# We need to ignore steady state information reported by our callbacks
133+
r"┌ Info: Steady state tolerance reached\n│ steady_state_callback .+\n└ t = .+\n",
134+
# NOTE: These warnings arose from Julia 1.10 onwards
135+
r"WARNING: Method definition .* in module .* at .* overwritten .*.\n"
136+
]
137+
append!($additional_ignore_content, add_to_additional_ignore_content)
138+
@trixi_test_nowarn $(esc(expr)) $additional_ignore_content
177139
end
178140
end
179141

0 commit comments

Comments
 (0)