Skip to content

Commit 20e069e

Browse files
ranochabenegeetristanmontoya
authored
Update to Trixi.jl v0.13 (#105)
* Trixi.jl v0.13 compat * performance_counter has to be given as additional argument in constructor * add backend for compute_coefficients * add opt-in for automatic search in external sources * add max_abs_speed for ShallowWater3D * reference error values * coverage for max_abs_speed_naive --------- Co-authored-by: Benedict <[email protected]> Co-authored-by: Benedict Geihe <[email protected]> Co-authored-by: Tristan Montoya <[email protected]>
1 parent 1ed80c2 commit 20e069e

File tree

11 files changed

+120
-116
lines changed

11 files changed

+120
-116
lines changed

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, 0.12"
36+
Trixi = "0.13"
3737
julia = "1.9"

docs/make.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ end
1212
links = InterLinks("Trixi" => ("https://trixi-framework.github.io/TrixiDocumentation/stable/",
1313
"https://trixi-framework.github.io/TrixiDocumentation/stable/objects.inv"))
1414

15+
# Search for any unresolvable `@ref` reference in external sources
16+
fallbacks = ExternalFallbacks(; automatic = true)
17+
1518
# Define module-wide setups such that the respective modules are available in doctests
1619
DocMeta.setdocmeta!(TrixiAtmo, :DocTestSetup, :(using TrixiAtmo);
1720
recursive = true)
@@ -95,7 +98,7 @@ makedocs(;
9598
"Contributing" => "contributing.md",
9699
"Code of Conduct" => "code_of_conduct.md",
97100
"License" => "license.md"],
98-
plugins = [links],)
101+
plugins = [links, fallbacks],)
99102

100103
deploydocs(;
101104
repo = "github.com/trixi-framework/TrixiAtmo.jl",

src/equations/covariant_advection.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ end
110110
end
111111

112112
# Maximum contravariant wave speed with respect to specific basis vector
113-
@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr,
114-
orientation::Integer,
115-
equations::CovariantLinearAdvectionEquation2D)
113+
@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr,
114+
orientation::Integer,
115+
equations::CovariantLinearAdvectionEquation2D)
116116
vcon_ll = velocity_contravariant(u_ll, equations) # Contravariant components on left side
117117
vcon_rr = velocity_contravariant(u_rr, equations) # Contravariant components on right side
118118
return max(abs(vcon_ll[orientation]), abs(vcon_rr[orientation]))

src/equations/covariant_shallow_water.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ end
217217
end
218218

219219
# Maximum wave speed along the normal direction in reference space
220-
@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr,
221-
orientation,
222-
equations::AbstractCovariantShallowWaterEquations2D)
220+
@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr,
221+
orientation,
222+
equations::AbstractCovariantShallowWaterEquations2D)
223223
# Geometric variables
224224
Gcon_ll = metric_contravariant(aux_vars_ll, equations)
225225
Gcon_rr = metric_contravariant(aux_vars_rr, equations)

src/equations/shallow_water_3d.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,28 @@ end
407407
return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction)
408408
end
409409

410+
@inline function Trixi.max_abs_speed(u_ll, u_rr, normal_direction::AbstractVector,
411+
equations::ShallowWaterEquations3D)
412+
# Extract and compute the velocities in the normal direction
413+
v1_ll, v2_ll, v3_ll = velocity(u_ll, equations)
414+
v1_rr, v2_rr, v3_rr = velocity(u_rr, equations)
415+
v_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] +
416+
v3_ll * normal_direction[3]
417+
v_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] +
418+
v3_rr * normal_direction[3]
419+
420+
# Compute the wave celerity on the left and right
421+
h_ll = waterheight(u_ll, equations)
422+
h_rr = waterheight(u_rr, equations)
423+
424+
c_ll = sqrt(max(equations.gravity * h_ll, 0.0f0))
425+
c_rr = sqrt(max(equations.gravity * h_rr, 0.0f0))
426+
427+
# The normal velocities are already scaled by the norm
428+
norm_ = norm(normal_direction)
429+
return max(abs(v_ll) + c_ll * norm_, abs(v_rr) + c_rr * norm_)
430+
end
431+
410432
# Specialized `DissipationLocalLaxFriedrichs` to avoid spurious dissipation in the bottom topography
411433
@inline function (dissipation::DissipationLocalLaxFriedrichs)(u_ll, u_rr,
412434
orientation_or_normal_direction,

src/semidiscretization/semidiscretization_hyperbolic_2d_manifold_in_3d.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,28 @@ function Trixi.SemidiscretizationHyperbolic(mesh::P4estMesh{2},
1616
# `RealT` is used as real type for node locations etc.
1717
# while `uEltype` is used as element type of solutions etc.
1818
RealT = real(solver), uEltype = RealT,
19-
initial_cache = NamedTuple(),
2019
metric_terms = MetricTermsCrossProduct(),
2120
auxiliary_field = nothing)
2221
cache = (;
2322
Trixi.create_cache(mesh, equations, solver, RealT, metric_terms,
24-
auxiliary_field, uEltype)..., initial_cache...)
23+
auxiliary_field, uEltype)...)
2524
_boundary_conditions = Trixi.digest_boundary_conditions(boundary_conditions, mesh,
2625
solver,
2726
cache)
2827

28+
Trixi.check_periodicity_mesh_boundary_conditions(mesh, _boundary_conditions)
29+
30+
performance_counter = Trixi.PerformanceCounter()
31+
2932
SemidiscretizationHyperbolic{typeof(mesh), typeof(equations),
3033
typeof(initial_condition),
3134
typeof(_boundary_conditions), typeof(source_terms),
3235
typeof(solver), typeof(cache)}(mesh, equations,
3336
initial_condition,
3437
_boundary_conditions,
3538
source_terms, solver,
36-
cache)
39+
cache,
40+
performance_counter)
3741
end
3842

3943
# Constructor for SemidiscretizationHyperbolic for the covariant form. Requires
@@ -49,23 +53,27 @@ function Trixi.SemidiscretizationHyperbolic(mesh::P4estMesh{NDIMS, NDIMS_AMBIENT
4953
# `RealT` is used as real type for node locations etc.
5054
# while `uEltype` is used as element type of solutions etc.
5155
RealT = real(solver), uEltype = RealT,
52-
initial_cache = NamedTuple(),
5356
metric_terms = MetricTermsCovariantSphere(),
5457
auxiliary_field = nothing) where {NDIMS,
5558
NDIMS_AMBIENT}
5659
cache = (;
5760
Trixi.create_cache(mesh, equations, solver, RealT, metric_terms,
58-
auxiliary_field, uEltype)..., initial_cache...)
61+
auxiliary_field, uEltype)...)
5962
_boundary_conditions = Trixi.digest_boundary_conditions(boundary_conditions, mesh,
6063
solver,
6164
cache)
6265

66+
Trixi.check_periodicity_mesh_boundary_conditions(mesh, _boundary_conditions)
67+
68+
performance_counter = Trixi.PerformanceCounter()
69+
6370
SemidiscretizationHyperbolic{typeof(mesh), typeof(equations),
6471
typeof(initial_condition),
6572
typeof(_boundary_conditions), typeof(source_terms),
6673
typeof(solver), typeof(cache)}(mesh, equations,
6774
initial_condition,
6875
_boundary_conditions,
6976
source_terms, solver,
70-
cache)
77+
cache,
78+
performance_counter)
7179
end

src/solvers/dgsem_p4est/dg_2d_manifold_in_3d_covariant.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function Trixi.rhs!(du, u, t,
6666
end
6767

6868
# Compute coefficients for an initial condition that uses auxiliary variables
69-
function Trixi.compute_coefficients!(u, func, t, mesh::P4estMesh{2},
69+
function Trixi.compute_coefficients!(backend::Nothing, u, func, t, mesh::P4estMesh{2},
7070
equations::AbstractCovariantEquations{2}, dg::DG,
7171
cache)
7272
(; aux_node_vars) = cache.auxiliary_variables

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ OrdinaryDiffEq = "6.91"
1515
OrdinaryDiffEqLowStorageRK = "1.2"
1616
OrdinaryDiffEqSSPRK = "1.2"
1717
Test = "1"
18-
Trixi = "0.9.9, 0.10, 0.11, 0.12"
18+
Trixi = "0.13"
1919
TrixiTest = "0.1"

test/test_3d_shallow_water.jl

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir()
1111
@test_trixi_include(joinpath(EXAMPLES_DIR,
1212
"elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_correction.jl"),
1313
l2=[
14-
1.1385840313143962,
15-
464.82837506217066,
16-
469.1401783834081,
17-
311.3170683216476,
14+
1.1385840313142226,
15+
464.8283750621118,
16+
469.14017838339083,
17+
311.31706832161564,
1818
0.0
1919
],
2020
linf=[
21-
5.159323444366919,
22-
3303.7491913049016,
23-
3420.553600463765,
24-
3730.0452131916827,
21+
5.159323444358506,
22+
3303.749191315932,
23+
3420.5536004616565,
24+
3730.0452131952625,
2525
0.0
2626
],
2727
polydeg=3,
@@ -41,17 +41,17 @@ end
4141
@test_trixi_include(joinpath(EXAMPLES_DIR,
4242
"elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection.jl"),
4343
l2=[
44-
1.2715065248576713,
45-
598.683530367431,
46-
605.759403715426,
47-
460.96437160416355,
44+
1.271506524857498,
45+
598.6835303675092,
46+
605.7594037155094,
47+
460.9643716042415,
4848
0.0
4949
],
5050
linf=[
51-
4.238740469409095,
52-
5466.431268687156,
53-
5083.837234735748,
54-
3502.6899531778763,
51+
4.23874046947094,
52+
5466.431268695043,
53+
5083.837234738506,
54+
3502.6899531773233,
5555
0.0
5656
],
5757
polydeg=3,
@@ -71,17 +71,17 @@ end
7171
@test_trixi_include(joinpath(EXAMPLES_DIR,
7272
"elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection.jl"),
7373
l2=[
74-
0.2744086984644598,
75-
280.22833657858405,
76-
294.07258247717635,
77-
187.92205847355822,
74+
0.27440876588211627,
75+
280.22773491124406,
76+
294.071829622588,
77+
187.92193710627467,
7878
0.0
7979
],
8080
linf=[
81-
1.4332199421835412,
82-
1255.449038614228,
83-
1470.6155024602194,
84-
1249.3580783745856,
81+
1.4332269086135057,
82+
1255.4454482832807,
83+
1470.615003655199,
84+
1249.359787903988,
8585
0.0
8686
],
8787
surface_flux=(FluxPlusDissipation(flux_wintermeyer_etal,
@@ -116,26 +116,24 @@ end
116116
end
117117
end
118118

119-
@trixiatmo_testset "elixir_shallowwater_cartesian_geostrophic_balance" begin
119+
@trixiatmo_testset "elixir_shallowwater_cartesian_geostrophic_balance (naive)" begin
120120
@test_trixi_include(joinpath(EXAMPLES_DIR,
121121
"elixir_shallowwater_cartesian_geostrophic_balance.jl"),
122-
l2=[
123-
0.27676841776660416,
124-
103.39838614468358,
125-
103.39838614468256,
126-
47.517273183733906,
127-
0.0
128-
],
129-
linf=[
130-
1.2383681144717684,
122+
l2=[0.27676841776660904,
123+
103.39838614468599,
124+
103.39838614468121,
125+
47.51727318373426, 0.0],
126+
linf=[1.238368114471541,
131127
610.2955303677882,
132-
610.2955303680574,
133-
276.4494926100049,
134-
0.0
135-
],
128+
610.2955303679337,
129+
276.44949261002847,
130+
0.0],
136131
polydeg=3,
137132
cells_per_dimension=(5, 5),
138-
tspan=(0.0, 1.0 * SECONDS_PER_DAY))
133+
tspan=(0.0, 1.0 * SECONDS_PER_DAY),
134+
surface_flux=(FluxPlusDissipation(flux_wintermeyer_etal,
135+
DissipationLocalLaxFriedrichs(max_abs_speed_naive)),
136+
flux_nonconservative_wintermeyer_etal)) # use "naive" wave speed estimate for coverage
139137
# Ensure that we do not have excessive memory allocations
140138
# (e.g., from type instabilities)
141139
let
@@ -150,17 +148,17 @@ end
150148
@test_trixi_include(joinpath(EXAMPLES_DIR,
151149
"elixir_shallowwater_cartesian_isolated_mountain.jl"),
152150
l2=[
153-
13.189867835225384,
154-
4656.890929855556,
155-
4027.784683604144,
156-
6275.998709859527,
151+
13.189868962884406,
152+
4656.890871865292,
153+
4027.7846474475473,
154+
6275.998570998393,
157155
0.0
158156
],
159157
linf=[
160-
115.53215616900434,
161-
37970.28060001574,
162-
42646.814315962474,
163-
65362.28474927765,
158+
115.53214502067749,
159+
37970.29034857702,
160+
42646.8517588789,
161+
65362.34875198507,
164162
0.0
165163
],
166164
polydeg=3,

test/test_spherical_advection.jl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir()
1111
@test_trixi_include(joinpath(EXAMPLES_DIR,
1212
"elixir_shallowwater_cartesian_advection_cubed_sphere.jl"),
1313
l2=[
14-
0.796321633853675,
15-
20.317829852384286,
16-
8.810001095524816,
17-
20.317829852393054,
14+
0.796321633847963,
15+
20.317829852214242,
16+
8.810001095522356,
17+
20.317829852220424,
1818
0.0
1919
],
2020
linf=[
21-
10.872101731709677,
22-
289.6515963524798,
23-
95.1288712006542,
24-
289.65159635247255,
21+
10.872101732112924,
22+
289.6515963627462,
23+
95.1288711914458,
24+
289.65159636274984,
2525
0.0
2626
])
2727
# and small reference values
@@ -39,17 +39,17 @@ end
3939
@test_trixi_include(joinpath(EXAMPLES_DIR,
4040
"elixir_shallowwater_cartesian_advection_quad_icosahedron.jl"),
4141
l2=[
42-
0.45702277148735726,
43-
11.807355540175404,
44-
4.311881740745649,
45-
11.807355540181993,
42+
0.45702277148770143,
43+
11.807355540181147,
44+
4.311881740807178,
45+
11.807355540181314,
4646
0.0
4747
],
4848
linf=[
49-
13.591965583200476,
50-
364.76418895396273,
51-
93.69731833993228,
52-
364.76418895397,
49+
13.591965583195247,
50+
364.76418895378083,
51+
93.69731833987953,
52+
364.7641889537881,
5353
0.0
5454
])
5555
# and small reference values
@@ -67,17 +67,17 @@ end
6767
@test_trixi_include(joinpath(EXAMPLES_DIR,
6868
"elixir_shallowwater_cartesian_advection_cubed_sphere.jl"),
6969
l2=[
70-
0.8933429672952714,
71-
22.84887991902509,
72-
9.758850586757735,
73-
22.84887991902542,
70+
0.893342967293854,
71+
22.848879918993113,
72+
9.758850586740538,
73+
22.848879918993124,
7474
0.0
7575
],
7676
linf=[
77-
14.289456304624764,
78-
380.6958334067349,
79-
120.59259301602742,
80-
380.69583340674217,
77+
14.289456304585201,
78+
380.6958334056544,
79+
120.59259301568181,
80+
380.69583340557074,
8181
0.0
8282
], element_local_mapping=true)
8383
# and small reference values

0 commit comments

Comments
 (0)