Skip to content

Commit 85924eb

Browse files
Unify boundary conditions (#126)
* unify boundary conditions * explicitly pass periodicity and periodic bc * require Trixi.jl v0.15 for docs * fix missing periodic boundary conditions * fix tests --------- Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
1 parent 836423c commit 85924eb

File tree

76 files changed

+267
-237
lines changed

Some content is hidden

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

76 files changed

+267
-237
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ Printf = "1"
1919
Roots = "2.1.6"
2020
Static = "1.1.1"
2121
StaticArrays = "1.9"
22-
Trixi = "0.14"
22+
Trixi = "0.15"
2323
julia = "1.10"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ HOHQMesh = "0.2"
2525
Literate = "2.20"
2626
OrdinaryDiffEqLowStorageRK = "1.3"
2727
OrdinaryDiffEqSSPRK = "1.2"
28-
Trixi = "0.14"
28+
Trixi = "0.15"
2929
Trixi2Vtk = "0.3.16"
3030
TrixiBottomTopography = "0.1"

docs/src/tutorials/elixir_shallowwater_monai_tsunami.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,10 @@ end;
255255
# are the default names provided by HOHQMesh. As per the problem definition,
256256
# three of the domain boundaries are walls and the incident wave maker boundary condition
257257
# implemented above is set at the `Left` domain
258-
boundary_condition = Dict(:Bottom => boundary_condition_slip_wall,
259-
:Top => boundary_condition_slip_wall,
260-
:Right => boundary_condition_slip_wall,
261-
:Left => boundary_condition_wave_maker);
258+
boundary_condition = (; Bottom = boundary_condition_slip_wall,
259+
Top = boundary_condition_slip_wall,
260+
Right = boundary_condition_slip_wall,
261+
Left = boundary_condition_wave_maker);
262262

263263
# For this application, we also need to model the bottom friction.
264264
# Thus, we create a new source term, which adds a Manning friction term to the momentum equations.

examples/dgmulti_1d/elixir_shallow_water_quasi_1d.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ volume_flux = (flux_chan_etal, flux_nonconservative_chan_etal)
1616
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
1717
# Thus, we exchanged in PR#2458 of Trixi.jl the default wave speed used in the LLF flux and dissipation operator to `max_abs_speed`.
1818
# To ensure that every example still runs we specify explicitly `DissipationLocalLaxFriedrichs(max_abs_speed_naive)`.
19-
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
19+
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
2020
# `StepsizeCallback` (CFL-Condition) and less diffusion.
2121
surface_flux = (FluxPlusDissipation(flux_chan_etal,
2222
DissipationLocalLaxFriedrichs(max_abs_speed_naive)),
@@ -31,7 +31,8 @@ mesh = DGMultiMesh(dg, cells_per_dimension,
3131
coordinates_min = (0.0,), coordinates_max = (sqrt(2),),
3232
periodicity = true)
3333
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg;
34-
source_terms = source_terms_convergence_test)
34+
source_terms = source_terms_convergence_test,
35+
boundary_conditions = boundary_condition_periodic)
3536

3637
###############################################################################
3738
# ODE solvers, callbacks etc.

examples/dgmulti_2d/elixir_shallowwater_source_terms.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
1515
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
1616
# Thus, we exchanged in PR#2458 of Trixi.jl the default wave speed used in the LLF flux to `max_abs_speed`.
1717
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
18-
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
18+
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
1919
# `StepsizeCallback` (CFL-Condition) and less diffusion.
2020
surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_fjordholm_etal)
2121
dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = SBP(),
@@ -28,7 +28,8 @@ mesh = DGMultiMesh(dg, cells_per_dimension,
2828
periodicity = true)
2929

3030
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg;
31-
source_terms = source_terms_convergence_test)
31+
source_terms = source_terms_convergence_test,
32+
boundary_conditions = boundary_condition_periodic)
3233

3334
###############################################################################
3435
# ODE solvers, callbacks etc.

examples/p4est_2d_dgsem/elixir_shallowwater_multilayer_blast_wet_dry_sc_subcell.jl

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

66
###############################################################################
7-
# Semidiscretization of the multilayer shallow water equations with a single layer and a bottom
7+
# Semidiscretization of the multilayer shallow water equations with a single layer and a bottom
88
# topography function for a blast wave test with a wet/dry front with discontinuous initial conditions.
99
# This example combines the subcell limiter with a velocity desingularization callback to ensure
1010
# robustness at wet/dry fronts.
@@ -36,10 +36,10 @@ end
3636

3737
initial_condition = initial_condition_blast_wave
3838

39-
boundary_condition = Dict(:x_neg => boundary_condition_slip_wall,
40-
:y_neg => boundary_condition_slip_wall,
41-
:x_pos => boundary_condition_slip_wall,
42-
:y_pos => boundary_condition_slip_wall)
39+
boundary_condition = (; x_neg = boundary_condition_slip_wall,
40+
y_neg = boundary_condition_slip_wall,
41+
x_pos = boundary_condition_slip_wall,
42+
y_pos = boundary_condition_slip_wall)
4343

4444
###############################################################################
4545
# Get the DG approximation space
@@ -66,7 +66,7 @@ solver = DGSEM(basis, surface_flux, volume_integral)
6666
# Get the P4estMesh
6767

6868
coordinates_min = (0.0, 0.0) # minimum coordinates (min(x), min(y))
69-
coordinates_max = (4.0, 4.0) # maximum coordinates (max(x), max(y))
69+
coordinates_max = (4.0, 4.0) # maximum coordinates (max(x), max(y))
7070

7171
trees_per_dimension = (1, 1)
7272

@@ -106,7 +106,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
106106

107107
###############################################################################
108108

109-
# Setup the stage callbacks
109+
# Setup the stage callbacks
110110
stage_limiter! = VelocityDesingularization()
111111
stage_callbacks = (SubcellLimiterIDPCorrection(), stage_limiter!)
112112

examples/p4est_2d_dgsem/elixir_shallowwater_multilayer_convergence_sc_subcell.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 3,
3939

4040
# create the semi discretization object
4141
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
42-
source_terms = source_terms_convergence_test)
42+
source_terms = source_terms_convergence_test,
43+
boundary_conditions = boundary_condition_periodic)
4344

4445
###############################################################################
4546
# ODE solvers, callbacks etc.

examples/p4est_2d_dgsem/elixir_shallowwater_multilayer_monai_flood_amr.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ H_from_wave_maker(t::RealT) = spline_interpolation(h_spline_struct, t)
111111
return flux, noncons_flux
112112
end
113113

114-
boundary_condition = Dict(:Bottom => boundary_condition_slip_wall,
115-
:Top => boundary_condition_slip_wall,
116-
:Right => boundary_condition_slip_wall,
117-
:Left => boundary_condition_wave_maker)
114+
boundary_condition = (; Bottom = boundary_condition_slip_wall,
115+
Top = boundary_condition_slip_wall,
116+
Right = boundary_condition_slip_wall,
117+
Left = boundary_condition_wave_maker)
118118

119119
# Manning friction source term
120120
@inline function source_terms_manning_friction(u, x, t,
@@ -147,7 +147,7 @@ volume_flux = (flux_ersing_etal, flux_nonconservative_ersing_etal)
147147
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
148148
# Thus, we exchanged in PR#2458 of Trixi.jl the default wave speed used in the LLF flux and dissipation operator to `max_abs_speed`.
149149
# To ensure that every example still runs we specify explicitly `DissipationLocalLaxFriedrichs(max_abs_speed_naive)`.
150-
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
150+
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
151151
# `StepsizeCallback` (CFL-Condition) and less diffusion.
152152
surface_flux = (FluxHydrostaticReconstruction(FluxPlusDissipation(flux_ersing_etal,
153153
DissipationLocalLaxFriedrichs(max_abs_speed_naive)),

examples/p4est_2d_dgsem/elixir_shallowwater_multilayer_perturbation_wet_dry_amr.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ end
4848
initial_condition = initial_condition_perturbation
4949

5050
# Wall BCs
51-
boundary_condition = Dict(:all => boundary_condition_slip_wall)
51+
boundary_condition = (; all = boundary_condition_slip_wall)
5252

5353
###############################################################################
5454
# Get the DG approximation space
@@ -60,7 +60,7 @@ volume_flux = (flux_ersing_etal, flux_nonconservative_ersing_etal)
6060
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
6161
# Thus, we exchanged in PR#2458 of Trixi.jl the default wave speed used in the LLF flux and dissipation operator to `max_abs_speed`.
6262
# To ensure that every example still runs we specify explicitly `DissipationLocalLaxFriedrichs(max_abs_speed_naive)`.
63-
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
63+
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
6464
# `StepsizeCallback` (CFL-Condition) and less diffusion.
6565
surface_flux = (FluxHydrostaticReconstruction(FluxPlusDissipation(flux_ersing_etal,
6666
DissipationLocalLaxFriedrichs(max_abs_speed_naive)),

examples/p4est_2d_dgsem/elixir_shallowwater_multilayer_three_mound_dam_break_amr.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x
8080
return flux, noncons_flux
8181
end
8282

83-
boundary_conditions = Dict(:Bottom => boundary_condition_slip_wall,
84-
:Top => boundary_condition_slip_wall,
85-
:Right => boundary_condition_outflow,
86-
:Left => boundary_condition_slip_wall)
83+
boundary_conditions = (; Bottom = boundary_condition_slip_wall,
84+
Top = boundary_condition_slip_wall,
85+
Right = boundary_condition_outflow,
86+
Left = boundary_condition_slip_wall)
8787

8888
###############################################################################
8989
# Get the DG approximation space
@@ -95,7 +95,7 @@ volume_flux = (flux_ersing_etal, flux_nonconservative_ersing_etal)
9595
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
9696
# Thus, we exchanged in PR#2458 of Trixi.jl the default wave speed used in the LLF flux and dissipation operator to `max_abs_speed`.
9797
# To ensure that every example still runs we specify explicitly `DissipationLocalLaxFriedrichs(max_abs_speed_naive)`.
98-
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
98+
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
9999
# `StepsizeCallback` (CFL-Condition) and less diffusion.
100100
surface_flux = (FluxHydrostaticReconstruction(FluxPlusDissipation(flux_ersing_etal,
101101
DissipationLocalLaxFriedrichs(max_abs_speed_naive)),

0 commit comments

Comments
 (0)