diff --git a/NEWS.md b/NEWS.md index bb02eeccb5b..a22dd7facf6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,18 +8,27 @@ for human readability. ## Changes when updating to v0.15 from v0.14.x #### Changed + +- Boundary conditions are now passed as a `NamedTuple` consistently across all mesh types, i.e., boundary conditions, which + were previously passed as a `Dict` for the `P4estMesh`, `T8codeMesh`, and `UnstructuredMesh2D` mesh types have to be converted to `NamedTuple`s. Also passing boundary conditions as a `Tuple` is no longer supported. This change also makes `boundary_condition_default` obsolete, which is why it was removed ([#2761]). +- The `TreeMesh`, `StructuredMesh` as well as the hypercube constructors of `P4estMesh` and `T8codeMesh` are now non-periodic by default, i.e., you need to + explicitly set the `periodicity` keyword argument to `true` to obtain periodic meshes. This change was made to be consistent with other mesh types and to avoid confusion ([#2770]). +- There are no default boundary conditions anymore in `SemidiscretizationHyperbolic` and `SemidiscretizationHyperbolicParabolic`. + Users now have to explicitly provide boundary conditions via the `boundary_conditions` keyword argument, which were periodic by default before ([#2770]). - Renamed `energy_internal` for `NonIdealCompressibleEulerEquations1D` to `energy_internal_specific` ([#2762]). This makes `energy_internal` for `NonIdealCompressibleEulerEquations1D` consistent with the rest of Trixi.jl, where `energy_internal` refers to the specific internal energy scaled by density. -- Changed `cons2prim(u, ::NonIdealCompressibleEulerEquations1D)` so that it returns `rho, v1, p`. Previously, `cons2prim` returned `V, v1, T`; this functionalityis now provided by the non-exported function `cons2thermo` ([#2769]). +- Changed `cons2prim(u, ::NonIdealCompressibleEulerEquations1D)` so that it returns `rho, v1, p`. Previously, `cons2prim` returned `V, v1, T`; this functionality is now provided by the non-exported function `cons2thermo` ([#2769]). - The variable name (printed to the screen and files) of the total energy in the compressible Euler equations has been changed from `rho_e` to `rho_e_total` to avoid confusion with the internal energy `rho_e_internal` ([#2778]). - `convergence_test` now returns the complete convergence orders and the full errors matrix. To obtain the mean convergence rates, use `Trixi.calc_mean_convergence` on the convergence orders ([#2753]). - The serial and parallel mesh types have been renamed from `SerialTreeMesh`, `ParallelTreeMesh`, `SerialP4estMesh`, `ParallelP4estMesh`, `SerialT8codeMesh`, and `ParallelT8codeMesh` to `TreeMeshSerial`, `TreeMeshParallel`, `P4estMeshSerial`, `P4estMeshParallel`, `T8codeMeshSerial`, and `T8codeMeshParallel`, respectively ([#2787]). #### Added + - Added `PengRobinson` equation of state ([#2769]). ## Changes in the v0.14 lifecycle #### Added + - Added `NonIdealCompressibleEulerEquations1D`, which allows users to specify a non-ideal equation of state. Currently `IdealGas` and `VanDerWaals` are supported ([#2739]). - Added the APEC (approximate pressure equilibrium preserving with conservation) fluxes of `flux_terashima_etal` and `flux_central_terashima_etal` from [Terashima, Ly, Ihme (2025)](https://doi.org/10.1016/j.jcp.2024.113701) ([#2756]). - Support for second-order finite volume subcell volume integral (`VolumeIntegralPureLGLFiniteVolumeO2`) and @@ -41,6 +50,7 @@ for human readability. ## Changes in the v0.13 lifecycle #### Added + - Initial 3D support for subcell limiting with `P4estMesh` was added ([#2582], [#2647], [#2688], [#2722]). In the new version, IDP positivity limiting for conservative variables (using the keyword `positivity_variables_cons` in `SubcellLimiterIDP()`) and nonlinear diff --git a/docs/literate/src/files/DGMulti_1.jl b/docs/literate/src/files/DGMulti_1.jl index 6ad08bc6b30..346235db864 100644 --- a/docs/literate/src/files/DGMulti_1.jl +++ b/docs/literate/src/files/DGMulti_1.jl @@ -172,8 +172,8 @@ meshIO = StartUpDG.triangulate_domain(StartUpDG.RectangularDomainWithHole()); mesh = DGMultiMesh(dg, meshIO, Dict(:outer_boundary => 1, :inner_boundary => 2)) #- boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :outer_boundary => boundary_condition_convergence_test, - :inner_boundary => boundary_condition_convergence_test) +boundary_conditions = (; outer_boundary = boundary_condition_convergence_test, + inner_boundary = boundary_condition_convergence_test) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, source_terms = source_terms, diff --git a/docs/literate/src/files/adaptive_mesh_refinement.jl b/docs/literate/src/files/adaptive_mesh_refinement.jl index 63748f4b18b..48f8aada262 100644 --- a/docs/literate/src/files/adaptive_mesh_refinement.jl +++ b/docs/literate/src/files/adaptive_mesh_refinement.jl @@ -117,9 +117,11 @@ coordinates_min = (-5.0, -5.0) coordinates_max = (5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 10.0) ode = semidiscretize(semi, tspan); diff --git a/docs/literate/src/files/adding_new_scalar_equations.jl b/docs/literate/src/files/adding_new_scalar_equations.jl index 963bc81069d..dcb93e4ed5e 100644 --- a/docs/literate/src/files/adding_new_scalar_equations.jl +++ b/docs/literate/src/files/adding_new_scalar_equations.jl @@ -42,11 +42,13 @@ initial_condition_sine(x, t, equation::CubicEquation) = SVector(sinpi(x[1])) mesh = TreeMesh(-1.0, 1.0, # min/max coordinates initial_refinement_level = 4, - n_cells_max = 10^4) + n_cells_max = 10^4, + periodicity = true) solver = DGSEM(3, flux_central) # set polynomial degree to 3 -semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver) +semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver; + boundary_conditions = boundary_condition_periodic) # We wrap the return value of the `initial_condition_sine` inside an `SVector` since that's the approach # used in Trixi.jl also for systems of equations. We need to index the spatial coordinate `x[1]`, @@ -103,7 +105,8 @@ plot!(sol) ## A larger final time: Nonclassical shocks develop (you can even increase the refinement to 12) semi = remake(semi, - mesh = TreeMesh(-1.0, 1.0, initial_refinement_level = 8, n_cells_max = 10^5)) + mesh = TreeMesh(-1.0, 1.0, initial_refinement_level = 8, n_cells_max = 10^5, + periodicity = true)) ode = semidiscretize(semi, (0.0, 0.5)) # set tspan to (0.0, 0.5) sol = solve(ode, SSPRK43(); ode_default_options()...) plot(sol) @@ -184,11 +187,13 @@ end mesh = TreeMesh(-1.0, 1.0, # min/max coordinates initial_refinement_level = 4, - n_cells_max = 10^4) + n_cells_max = 10^4, + periodicity = true) solver = DGSEM(3, flux_central) # set polynomial degree to 3 -semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver) +semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver; + boundary_conditions = boundary_condition_periodic) ## Create ODE problem with given time span tspan = (0.0, 0.1) @@ -206,7 +211,8 @@ plot!(sol) ## A larger final time: Nonclassical shocks develop (you can even increase the refinement to 12) semi = remake(semi, - mesh = TreeMesh(-1.0, 1.0, initial_refinement_level = 8, n_cells_max = 10^5)) + mesh = TreeMesh(-1.0, 1.0, initial_refinement_level = 8, n_cells_max = 10^5, + periodicity = true)) ode = semidiscretize(semi, (0.0, 0.5)) sol = solve(ode, SSPRK43(); ode_default_options()...) plot(sol) diff --git a/docs/literate/src/files/adding_nonconservative_equation.jl b/docs/literate/src/files/adding_nonconservative_equation.jl index fcea73489e8..1e857d68ca8 100644 --- a/docs/literate/src/files/adding_nonconservative_equation.jl +++ b/docs/literate/src/files/adding_nonconservative_equation.jl @@ -106,7 +106,7 @@ end ## Create a uniform mesh in 1D in the interval [-π, π] with periodic boundaries mesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates - initial_refinement_level = 4, n_cells_max = 10^4) + initial_refinement_level = 4, n_cells_max = 10^4, periodicity = true) ## Create a DGSEM solver with polynomials of degree `polydeg` ## Remember to pass a tuple of the form `(conservative_flux, nonconservative_flux)` @@ -117,7 +117,8 @@ solver = DGSEM(polydeg = 3, surface_flux = surface_flux, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) ## Setup the spatial semidiscretization containing all ingredients -semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver) +semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver; + boundary_conditions = boundary_condition_periodic) ## Create an ODE problem with given time span tspan = (0.0, 1.0) @@ -150,9 +151,10 @@ error_1 = analysis_callback(sol).l2 |> first # simulation again. mesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates - initial_refinement_level = 5, n_cells_max = 10^4) + initial_refinement_level = 5, n_cells_max = 10^4, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver) +semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan); @@ -254,7 +256,7 @@ end ## Create a uniform mesh in 1D in the interval [-π, π] with periodic boundaries mesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates - initial_refinement_level = 4, n_cells_max = 10^4) + initial_refinement_level = 4, n_cells_max = 10^4, periodicity = true) ## Create a DGSEM solver with polynomials of degree `polydeg` ## Remember to pass a tuple of the form `(conservative_flux, nonconservative_flux)` @@ -265,7 +267,8 @@ solver = DGSEM(polydeg = 3, surface_flux = surface_flux, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) ## Setup the spatial semidiscretization containing all ingredients -semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver) +semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver; + boundary_conditions = boundary_condition_periodic) ## Create an ODE problem with given time span tspan = (0.0, 1.0) diff --git a/docs/literate/src/files/behind_the_scenes_simulation_setup.jl b/docs/literate/src/files/behind_the_scenes_simulation_setup.jl index 11f4f71b1ae..46139645e6c 100644 --- a/docs/literate/src/files/behind_the_scenes_simulation_setup.jl +++ b/docs/literate/src/files/behind_the_scenes_simulation_setup.jl @@ -33,7 +33,8 @@ coarsening_patches = ((type = "box", coordinates_min = [0.0, -2.0], mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, n_cells_max = 30_000, - coarsening_patches = coarsening_patches) + coarsening_patches = coarsening_patches, + periodicity = true) # The created `TreeMesh` looks like the following: @@ -58,7 +59,8 @@ solver = DGSEM(polydeg = 3) # comes into play. semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) # The constructor for the `SemidiscretizationHyperbolic` object calls numerous sub-functions to # perform the necessary initialization steps. A brief description of the key sub-functions is diff --git a/docs/literate/src/files/custom_semidiscretization.jl b/docs/literate/src/files/custom_semidiscretization.jl index cbfd6b1d872..4f2ed2efcaf 100644 --- a/docs/literate/src/files/custom_semidiscretization.jl +++ b/docs/literate/src/files/custom_semidiscretization.jl @@ -87,6 +87,7 @@ end semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic, source_terms = source_terms_standard) # Now, we can create the `ODEProblem`, solve the resulting ODE diff --git a/docs/literate/src/files/differentiable_programming.jl b/docs/literate/src/files/differentiable_programming.jl index 5880e8ae16c..169ee9cb3d7 100644 --- a/docs/literate/src/files/differentiable_programming.jl +++ b/docs/literate/src/files/differentiable_programming.jl @@ -25,9 +25,11 @@ using Trixi, LinearAlgebra, Plots equations = CompressibleEulerEquations2D(1.4) solver = DGSEM(3, flux_central) -mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 2, n_cells_max = 10^5) +mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 2, n_cells_max = 10^5, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver; + boundary_conditions = boundary_condition_periodic) J = jacobian_ad_forward(semi); size(J) @@ -47,7 +49,8 @@ relative_maximum = maximum(real, λ) / maximum(abs, λ) # at the interfaces, the maximal real part of the eigenvalues increases. solver = DGSEM(3, flux_lax_friedrichs) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver; + boundary_conditions = boundary_condition_periodic) J = jacobian_ad_forward(semi) λ = eigvals(J) @@ -72,9 +75,11 @@ condition_number = cond(V) equations = CompressibleEulerEquations1D(1.4) solver = DGSEM(3, flux_central) -mesh = TreeMesh((-1.0,), (1.0,), initial_refinement_level = 6, n_cells_max = 10^5) +mesh = TreeMesh((-1.0,), (1.0,), initial_refinement_level = 6, n_cells_max = 10^5, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver; + boundary_conditions = boundary_condition_periodic) J = jacobian_ad_forward(semi) @@ -96,7 +101,8 @@ condition_number = cond(V) # If we add dissipation, the maximal real part is still approximately zero. solver = DGSEM(3, flux_lax_friedrichs) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver; + boundary_conditions = boundary_condition_periodic) J = jacobian_ad_forward(semi) λ = eigvals(J) @@ -172,12 +178,14 @@ function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerE return prim2cons(prim, equations) end -mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 2, n_cells_max = 10^5) +mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 2, n_cells_max = 10^5, + periodicity = true) solver = DGSEM(3, flux_lax_friedrichs, VolumeIntegralFluxDifferencing(flux_ranocha)) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_isentropic_vortex, - solver) + solver; + boundary_conditions = boundary_condition_periodic) u0_ode = Trixi.compute_coefficients(0.0, semi) size(u0_ode) @@ -221,14 +229,15 @@ using Trixi, OrdinaryDiffEqLowOrderRK, ForwardDiff, Plots function energy_at_final_time(k) # k is the wave number of the initial condition equations = LinearScalarAdvectionEquation2D(1.0, -0.3) mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 3, - n_cells_max = 10^4) + n_cells_max = 10^4, periodicity = true) solver = DGSEM(3, flux_lax_friedrichs) initial_condition = (x, t, equation) -> begin x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t) return SVector(sinpi(k * sum(x_trans))) end - semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - uEltype = typeof(k)) + semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + uEltype = typeof(k), + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 1.0)) sol = solve(ode, FRK65(), dt = 0.05, adaptive = false, save_everystep = false) return Trixi.integrate(energy_total, sol.u[end], semi) @@ -271,14 +280,15 @@ second_derivative = round(ForwardDiff.derivative(k -> Trixi.ForwardDiff.derivati function energy_at_final_time(k) # k is the wave number of the initial condition equations = LinearScalarAdvectionEquation2D(1.0, -0.3) mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 3, - n_cells_max = 10^4) + n_cells_max = 10^4, periodicity = true) solver = DGSEM(3, flux_lax_friedrichs) initial_condition = (x, t, equation) -> begin x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t) return SVector(sinpi(k * sum(x_trans))) end - semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - uEltype = typeof(k)) + semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + uEltype = typeof(k), + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 1.0)) sol = solve(ode, FRK65(), dt = 0.05, adaptive = false, save_everystep = false) return Trixi.integrate(energy_total, sol.u[end], semi) @@ -300,7 +310,8 @@ round(ForwardDiff.derivative(energy_at_final_time, k), sigdigits = 2) # The first step in this example creates some basic ingredients of our simulation. equations = LinearScalarAdvectionEquation2D(1.0, -0.3) -mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 3, n_cells_max = 10^4) +mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 3, n_cells_max = 10^4, + periodicity = true) solver = DGSEM(3, flux_lax_friedrichs); # These do not have internal caches storing intermediate values of the numerical @@ -324,8 +335,9 @@ end; # and speed up the computations, e.g. for numerical fluxes at interfaces. Thus, we # need to tell Trixi.jl to allow `ForwardDiff.Dual` numbers in these caches. That's what # the keyword argument `uEltype=typeof(k)` in -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - uEltype = typeof(k)); +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + uEltype = typeof(k), + boundary_conditions = boundary_condition_periodic) # does. This is basically the only part where you need to modify your standard Trixi.jl # code to enable automatic differentiation. From there on, the remaining steps @@ -353,12 +365,14 @@ using Trixi, OrdinaryDiffEqLowOrderRK, Measurements, Plots, LaTeXStrings equations = LinearScalarAdvectionEquation1D(1.0 ± 0.1) -mesh = TreeMesh((-1.0,), (1.0,), n_cells_max = 10^5, initial_refinement_level = 5) +mesh = TreeMesh((-1.0,), (1.0,), n_cells_max = 10^5, initial_refinement_level = 5, + periodicity = true) solver = DGSEM(3) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver, uEltype = Measurement{Float64}) + solver, uEltype = Measurement{Float64}, + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 1.5)) @@ -388,9 +402,11 @@ equations = CompressibleEulerEquations2D(1.4) solver = DGSEM(3, flux_central) -mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 2, n_cells_max = 10^5) +mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 2, n_cells_max = 10^5, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver; + boundary_conditions = boundary_condition_periodic) J_fd = jacobian_fd(semi) @@ -423,7 +439,8 @@ using Trixi advection_velocity = 1.0 equation = LinearScalarAdvectionEquation1D(advection_velocity) -mesh = TreeMesh((-1.0,), (1.0,), initial_refinement_level = 4, n_cells_max = 10^4) +mesh = TreeMesh((-1.0,), (1.0,), initial_refinement_level = 4, n_cells_max = 10^4, + periodicity = true) # We define the basic floating point type used for the actual simulation # and construct the solver: @@ -444,7 +461,8 @@ jac_eltype = jacobian_eltype(float_type, jac_detector) # Now we can construct the semidiscretization for sparsity detection with `jac_eltype` as the # datatype for the working arrays and helper datastructures. semi_jac_type = SemidiscretizationHyperbolic(mesh, equation, - initial_condition_convergence_test, solver, + initial_condition_convergence_test, solver; + boundary_conditions = boundary_condition_periodic, uEltype = jac_eltype) # Supply sparsity detection datatype here tspan = (0.0, 1.0) # Re-used later in `rhs!` evaluation @@ -475,7 +493,8 @@ coloring_vec = column_colors(coloring_result) # Now, set up the actual semidiscretization for the simulation. # The datatype is automatically retrieved from the solver (in this case `float_type = Float64`). semi_float_type = SemidiscretizationHyperbolic(mesh, equation, - initial_condition_convergence_test, solver) + initial_condition_convergence_test, solver; + boundary_conditions = boundary_condition_periodic) # Supply the sparse Jacobian prototype and the optional coloring vector. # Internally, an [`ODEFunction`](https://docs.sciml.ai/DiffEqDocs/stable/types/ode_types/#SciMLBase.ODEFunction) # with `jac_prototype = jac_prototype` and `colorvec = coloring_vec` is created. @@ -511,10 +530,12 @@ equations = LinearScalarAdvectionEquation2D(1.0, -0.3) solver = DGSEM(3, flux_lax_friedrichs) -mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 2, n_cells_max = 10^5) +mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 2, n_cells_max = 10^5, + periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) A, b = linear_structure(semi) @@ -535,7 +556,7 @@ relative_maximum = maximum(real, λ) / maximum(abs, λ) # Since the linear structure defines the action of the linear matrix-alike operator `A` # on a vector, Krylov-subspace based iterative solvers can be employed to efficiently solve -# the resulting linear system. +# the resulting linear system. # For instance, one may use the [Krylov.jl](https://github.com/JuliaSmoothOptimizers/Krylov.jl) package to solve # e.g. steady-stage problems, i.e., problems where ``\partial_t u(t) = 0``. # Note that the present problem does not possess an actual steady state. diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index 82772c08f49..980aea2a630 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -63,7 +63,8 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, + periodicity = true) # To approximate the solution of the defined model, we create a [`DGSEM`](@ref) solver. # The solution in each of the recently defined mesh elements will be approximated by a polynomial @@ -115,7 +116,8 @@ end # Now we collect all the information that is necessary to define a spatial discretization, semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; - source_terms = source_term_exp_sinpi) + source_terms = source_term_exp_sinpi, + boundary_conditions = boundary_condition_periodic) # which leaves us with an ODE problem in time with a span from `0.0` to `1.0`. # This approach is commonly referred to as the method of lines. diff --git a/docs/literate/src/files/hohqmesh_tutorial.jl b/docs/literate/src/files/hohqmesh_tutorial.jl index 46494cfefed..efea2b28466 100644 --- a/docs/literate/src/files/hohqmesh_tutorial.jl +++ b/docs/literate/src/files/hohqmesh_tutorial.jl @@ -326,14 +326,14 @@ initial_condition = uniform_flow_state ## boundary condition types boundary_condition_uniform_flow = BoundaryConditionDirichlet(uniform_flow_state) -## boundary condition dictionary -boundary_conditions = Dict(:Bottom => boundary_condition_uniform_flow, - :Top => boundary_condition_uniform_flow, - :Right => boundary_condition_uniform_flow, - :Left => boundary_condition_uniform_flow, - :LeftSlant => boundary_condition_slip_wall, - :RightSlant => boundary_condition_slip_wall, - :IceCream => boundary_condition_slip_wall); +## boundary conditions (NamedTuple) +boundary_conditions = (; Bottom = boundary_condition_uniform_flow, + Top = boundary_condition_uniform_flow, + Right = boundary_condition_uniform_flow, + Left = boundary_condition_uniform_flow, + LeftSlant = boundary_condition_slip_wall, + RightSlant = boundary_condition_slip_wall, + IceCream = boundary_condition_slip_wall); ## DGSEM solver. ## 1) polydeg must be >= the polynomial order set in the HOHQMesh control file to guarantee @@ -495,13 +495,13 @@ output = generate_mesh(control_file); # We can reuse much of the elixir file to setup the uniform flow over an ice cream cone from the # previous part of this tutorial. The only component of the elixir file that must be changed is the boundary condition -# dictionary because we now have a boundary named `OuterCircle` instead of four edges of a bounding box. +# `NamedTuple` because we now have a boundary named `OuterCircle` instead of four edges of a bounding box. -## boundary condition dictionary -boundary_conditions = Dict(:OuterCircle => boundary_condition_uniform_flow, - :LeftSlant => boundary_condition_slip_wall, - :RightSlant => boundary_condition_slip_wall, - :IceCream => boundary_condition_slip_wall); +## boundary conditions (NamedTuple) +boundary_conditions = (; OuterCircle = boundary_condition_uniform_flow, + LeftSlant = boundary_condition_slip_wall, + RightSlant = boundary_condition_slip_wall, + IceCream = boundary_condition_slip_wall); # Also, we must update the construction of the mesh from our new mesh file `ice_cream_curved_sides.mesh` that # is located in the `out` folder. diff --git a/docs/literate/src/files/p4est_from_gmsh.jl b/docs/literate/src/files/p4est_from_gmsh.jl index 3f85e7109c3..5cc0ddbc948 100644 --- a/docs/literate/src/files/p4est_from_gmsh.jl +++ b/docs/literate/src/files/p4est_from_gmsh.jl @@ -434,10 +434,10 @@ trixi_include(joinpath(examples_dir(), "p4est_2d_dgsem", # equations::CompressibleEulerEquations2D) # flux = Trixi.flux(u_inner, normal_direction, equations) # -# boundary_conditions = Dict(:PhysicalLine1 => boundary_condition_supersonic_inflow, # Left boundary -# :PhysicalLine2 => boundary_condition_supersonic_outflow, # Right boundary -# :PhysicalLine3 => boundary_condition_supersonic_outflow, # Top and bottom boundary -# :PhysicalLine4 => boundary_condition_slip_wall) # Airfoil +# boundary_conditions = (; PhysicalLine1 = boundary_condition_supersonic_inflow, # Left boundary +# PhysicalLine2 = boundary_condition_supersonic_outflow, # Right boundary +# PhysicalLine3 = boundary_condition_supersonic_outflow, # Top and bottom boundary +# PhysicalLine4 = boundary_condition_slip_wall) # Airfoil # # semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, # boundary_conditions = boundary_conditions) diff --git a/docs/literate/src/files/scalar_linear_advection_1d.jl b/docs/literate/src/files/scalar_linear_advection_1d.jl index bd1d6267b20..6b6ce6be59e 100644 --- a/docs/literate/src/files/scalar_linear_advection_1d.jl +++ b/docs/literate/src/files/scalar_linear_advection_1d.jl @@ -372,7 +372,8 @@ coordinates_min = -1.0 # minimum coordinate coordinates_max = 1.0 # maximum coordinate mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, # number of elements = 2^4 - n_cells_max = 30_000) # set maximum capacity of tree data structure (only needed for AMR) + n_cells_max = 30_000, # set maximum capacity of tree data structure (only needed for AMR) + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization. # In Trixi.jl, an initial condition has the following parameter structure and is of the type `SVector`. @@ -380,7 +381,8 @@ function initial_condition_sine_wave(x, t, equations) return SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t))) end -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver; + boundary_conditions = boundary_condition_periodic) # Again, combining all definitions and the function that calculates the right-hand side, we define the ODE and # solve it until `t=2` with OrdinaryDiffEq's `solve` function and the Runge-Kutta method `RDPK3SpFSAL49()`. @@ -502,14 +504,16 @@ coordinates_min = -1.0 # minimum coordinate coordinates_max = 1.0 # maximum coordinate mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, # number of elements = 2^4 - n_cells_max = 30_000) + n_cells_max = 30_000, + periodicity = true) ## create initial condition and semidiscretization function initial_condition_sine_wave(x, t, equations) return SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t))) end -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver; + boundary_conditions = boundary_condition_periodic) ## solve tspan = (0.0, 2.0) diff --git a/docs/literate/src/files/shock_capturing.jl b/docs/literate/src/files/shock_capturing.jl index b6c0285d0f3..54c5b2ccd0a 100644 --- a/docs/literate/src/files/shock_capturing.jl +++ b/docs/literate/src/files/shock_capturing.jl @@ -208,9 +208,11 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan); @@ -329,9 +331,11 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/docs/literate/src/files/structured_mesh_mapping.jl b/docs/literate/src/files/structured_mesh_mapping.jl index 00fd6475271..b78d14f4830 100644 --- a/docs/literate/src/files/structured_mesh_mapping.jl +++ b/docs/literate/src/files/structured_mesh_mapping.jl @@ -151,9 +151,10 @@ end # Instead of a tuple of boundary functions, the `mesh` now has the mapping as its parameter. cells_per_dimension = (16, 16) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan) diff --git a/docs/literate/src/files/subcell_shock_capturing.jl b/docs/literate/src/files/subcell_shock_capturing.jl index a562a7185f8..37115b2f340 100644 --- a/docs/literate/src/files/subcell_shock_capturing.jl +++ b/docs/literate/src/files/subcell_shock_capturing.jl @@ -179,9 +179,11 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 10_000) + n_cells_max = 10_000, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 2.0) ode = semidiscretize(semi, tspan) diff --git a/docs/src/meshes/p4est_mesh.md b/docs/src/meshes/p4est_mesh.md index bbf9458904c..a3c8f34172d 100644 --- a/docs/src/meshes/p4est_mesh.md +++ b/docs/src/meshes/p4est_mesh.md @@ -941,5 +941,4 @@ reinitialize_boundaries!(semi.boundary_conditions, cache) # Needs to be called a This code could then be placed in the [`resize!`](https://github.com/trixi-framework/Trixi.jl/blob/eaeb04113523500ed831e3ab459694f12f7a49ea/src/time_integration/methods_2N.jl#L251-L255) function of a corresponding multirate integrator to ensure load-balancing for simulations involving AMR. ### Boundary conditions -For [`P4estMesh`](@ref)es, boundary conditions are defined and stored in [dictionaries](https://docs.julialang.org/en/v1/base/collections/#Base.Dict) (see, for example, `examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl`). -If you want to apply the same boundary condition to all faces of the mesh, you can use the `boundary_condition_default(mesh, boundary_condition)` function, as demonstrated in `examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl` and `examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl`. +For [`P4estMesh`](@ref)es, boundary conditions must be defined using [named tuples](https://docs.julialang.org/en/v1/manual/functions/#Named-Tuples) (see, for example, `examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl`). diff --git a/docs/src/meshes/structured_mesh.md b/docs/src/meshes/structured_mesh.md index 7308a91956e..9d06e322db2 100644 --- a/docs/src/meshes/structured_mesh.md +++ b/docs/src/meshes/structured_mesh.md @@ -2,7 +2,7 @@ The [`StructuredMesh`](@ref) is a structured, curvilinear, conforming mesh type available for one-, two-, and three-dimensional simulations. -An application of the [`StructuredMesh`](@ref) using a user-defined mapping +An application of the [`StructuredMesh`](@ref) using a user-defined mapping is provided by [one of the tutorials](https://trixi-framework.github.io/TrixiDocumentation/stable/tutorials/structured_mesh_mapping/). Due to its curvilinear nature, (numerical) fluxes need to implement methods @@ -13,5 +13,4 @@ the re-use of existing functionality for the [`TreeMesh`](@ref) but is usually less efficient, cf. [PR #550](https://github.com/trixi-framework/Trixi.jl/pull/550). ### Boundary conditions -For [`StructuredMesh`](@ref)es, boundary conditions are defined and stored in [named tuples](https://docs.julialang.org/en/v1/manual/functions/#Named-Tuples) (see, for example, `examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl`). -If you want to apply the same boundary condition to all faces of the mesh, you can use the `boundary_condition_default(mesh, boundary_condition)` function, as demonstrated in `examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl`, `examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl` and `examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl`. +For [`StructuredMesh`](@ref)es, boundary conditions are defined and stored in [named tuples](https://docs.julialang.org/en/v1/manual/functions/#Named-Tuples) (see, for example, `examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl`). . diff --git a/docs/src/meshes/tree_mesh.md b/docs/src/meshes/tree_mesh.md index 77dc673f7e9..4c0c5e123e2 100644 --- a/docs/src/meshes/tree_mesh.md +++ b/docs/src/meshes/tree_mesh.md @@ -12,5 +12,4 @@ dispatching on the `orientation::Integer` as described in the ### Boundary conditions -For [`TreeMesh`](@ref)es, boundary conditions are defined and stored in [named tuples](https://docs.julialang.org/en/v1/manual/functions/#Named-Tuples) (see, for example, `examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl`). -If you want to apply the same boundary condition to all faces of the mesh, you can use the `boundary_condition_default(mesh, boundary_condition)` function, as demonstrated in `examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl`, `examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl` and `examples/tree_3d_dgsem/elixir_advection_extended.jl`. \ No newline at end of file +For [`TreeMesh`](@ref)es, boundary conditions are defined and stored in [named tuples](https://docs.julialang.org/en/v1/manual/functions/#Named-Tuples) (see, for example, `examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl`). diff --git a/docs/src/restart.md b/docs/src/restart.md index 1966ee562aa..6b237062b93 100644 --- a/docs/src/restart.md +++ b/docs/src/restart.md @@ -41,7 +41,8 @@ mesh = load_mesh(restart_filename) This is then needed for the semidiscretization: ```julia -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ``` We then define a new time span for the simulation that takes as starting @@ -70,7 +71,7 @@ you can reuse your [`SaveSolutionCallback`](@ref), but need to set save_solution.condition.save_initial_solution = false ``` -Before we compute the solution using +Before we compute the solution using [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) we need to set the integrator and its time step number, e.g.: diff --git a/docs/src/time_integration.md b/docs/src/time_integration.md index 269d7feb813..9ab753de205 100644 --- a/docs/src/time_integration.md +++ b/docs/src/time_integration.md @@ -101,7 +101,8 @@ cells_per_dimension = 100 coordinates_min = 0.0 coordinates_max = 1.0 mesh = StructuredMesh(cells_per_dimension, - coordinates_min, coordinates_max) + coordinates_min, coordinates_max, + periodicity = true) # Define the equation and initial condition advection_velocity = 1.0 @@ -113,9 +114,8 @@ initial_condition = initial_condition_convergence_test solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) # Define the semidiscretization -semi = SemidiscretizationHyperbolic(mesh, - equations, initial_condition, - solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, + solver; boundary_conditions = boundary_condition_periodic) ``` After that, we will define the necessary [callbacks](@ref callbacks-id) for the simulation. Callbacks are used to perform actions at specific points during the integration process. @@ -251,15 +251,15 @@ one can construct a discrete equivalent $H$ to (1) which is obtained by computin H(t) \coloneqq H\big(\boldsymbol U(t)\big) = \int_{\Omega} s \big(\boldsymbol U(t) \big) \, \text{d} \Omega ``` -For a suitable spatial discretization (2) entropy-conservative systems such as the Euler equations preserve the total entropy $H(t)$ over time, i.e., +For a suitable spatial discretization (2) entropy-conservative systems such as the Euler equations preserve the total entropy $H(t)$ over time, i.e., ```math -\frac{\text{d}}{\text{d} t} H \big(\boldsymbol U(t) \big ) -= -\left \langle \frac{\partial H(\boldsymbol U)}{\partial \boldsymbol U}, \frac{\text{d}}{\text{d} t} \boldsymbol U(t) \right \rangle +\frac{\text{d}}{\text{d} t} H \big(\boldsymbol U(t) \big ) += +\left \langle \frac{\partial H(\boldsymbol U)}{\partial \boldsymbol U}, \frac{\text{d}}{\text{d} t} \boldsymbol U(t) \right \rangle \overset{(2)}{=} \left \langle \frac{\partial H(\boldsymbol U)}{\partial \boldsymbol U}, \boldsymbol F\big(t, \boldsymbol U(t) \big) \right \rangle = 0 \tag{3} ``` -while entropy-stable discretiations of entropy-diffusive systems such as the Navier-Stokes equations ensure that the total entropy decays over time, i.e., +while entropy-stable discretiations of entropy-diffusive systems such as the Navier-Stokes equations ensure that the total entropy decays over time, i.e., ```math \left \langle \frac{\partial H(\boldsymbol U)}{\partial \boldsymbol U}, \boldsymbol F(t, \boldsymbol U) \right \rangle \leq 0 \tag{4} ``` @@ -268,12 +268,12 @@ while entropy-stable discretiations of entropy-diffusive systems such as the Nav Evolving the ordinary differential equation (ODE) for the entropy (2) with a Runge-Kutta scheme gives ```math -H_{n+1} = H_n + \Delta t \sum_{i=1}^S b_i \, \left\langle \frac{\partial +H_{n+1} = H_n + \Delta t \sum_{i=1}^S b_i \, \left\langle \frac{\partial H(\boldsymbol U_{n, i}) }{\partial \boldsymbol U}, \boldsymbol F(\boldsymbol U_{n, i}) \right\rangle \tag{5} ``` which preserves (3) and (4). -In practice, however, we evolve the conserved variables $\boldsymbol U$ which results in +In practice, however, we evolve the conserved variables $\boldsymbol U$ which results in ```math \boldsymbol U_{n+1} = \boldsymbol U_n + \Delta t \sum_{i=1}^S b_i \boldsymbol F(\boldsymbol U_{n, i}) ``` @@ -287,14 +287,14 @@ To resolve the difference $H(\boldsymbol U_{n+1}) - H_{n+1}$ Ketcheson, Ranocha - [Ranocha et al. (2020)](https://doi.org/10.1137/19M1263480): Relaxation Runge-Kutta methods: Fully discrete explicit entropy-stable schemes for the compressible Euler and Navier-Stokes equations - [Ranocha, Lóczi, and Ketcheson (2020)](https://doi.org/10.1007/s00211-020-01158-4): General relaxation methods for initial-value problems with application to multistep schemes -Almost miraculously, it suffices to introduce a single parameter $\gamma$ in the final update step of the Runge-Kutta method to ensure that the properties of the spatial discretization are preserved, i.e., +Almost miraculously, it suffices to introduce a single parameter $\gamma$ in the final update step of the Runge-Kutta method to ensure that the properties of the spatial discretization are preserved, i.e., ```math -H \big(\boldsymbol U_{n+1}( \gamma ) \big) -\overset{!}{=} -H(\boldsymbol U_n) + -\gamma \Delta t \sum_{i=1}^S b_i -\left \langle -\frac{\partial H(\boldsymbol U_{n, i})}{\partial \boldsymbol U_{n, i}}, \boldsymbol F(\boldsymbol U_{n, i}) +H \big(\boldsymbol U_{n+1}( \gamma ) \big) +\overset{!}{=} +H(\boldsymbol U_n) + +\gamma \Delta t \sum_{i=1}^S b_i +\left \langle +\frac{\partial H(\boldsymbol U_{n, i})}{\partial \boldsymbol U_{n, i}}, \boldsymbol F(\boldsymbol U_{n, i}) \right \rangle \tag{6} ``` diff --git a/docs/src/troubleshooting.md b/docs/src/troubleshooting.md index dd85bea3cd5..74f75f695e4 100644 --- a/docs/src/troubleshooting.md +++ b/docs/src/troubleshooting.md @@ -133,7 +133,8 @@ begin equations = LinearScalarAdvectionEquation2D(0.2, -0.7) mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), n_cells_max=10^5, initial_refinement_level=5) solver = DGSEM(3) - semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver; + boundary_conditions = boundary_condition_periodic) Trixi.print_timer(Trixi.timer()) end diff --git a/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl b/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl index 4b142a8896a..38a5b7100f0 100644 --- a/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl +++ b/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl @@ -35,8 +35,8 @@ initial_condition = initial_condition_convergence_test semi = SemidiscretizationHyperbolic(mesh, equations, - initial_condition, - dg) + initial_condition, dg; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 1.5) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_1d/elixir_burgers_gauss_shock_capturing.jl b/examples/dgmulti_1d/elixir_burgers_gauss_shock_capturing.jl index f42e0338801..d74ef4419f5 100644 --- a/examples/dgmulti_1d/elixir_burgers_gauss_shock_capturing.jl +++ b/examples/dgmulti_1d/elixir_burgers_gauss_shock_capturing.jl @@ -40,8 +40,8 @@ mesh = DGMultiMesh(dg, cells_per_dimension, semi = SemidiscretizationHyperbolic(mesh, equations, - initial_condition_convergence_test, - dg) + initial_condition_convergence_test, dg; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 2.0) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_1d/elixir_euler_fdsbp_periodic.jl b/examples/dgmulti_1d/elixir_euler_fdsbp_periodic.jl index e3a579e443e..e57150fce16 100644 --- a/examples/dgmulti_1d/elixir_euler_fdsbp_periodic.jl +++ b/examples/dgmulti_1d/elixir_euler_fdsbp_periodic.jl @@ -16,8 +16,9 @@ source_terms = source_terms_convergence_test mesh = DGMultiMesh(dg, coordinates_min = (-1.0,), coordinates_max = (1.0,)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, - source_terms = source_terms) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + source_terms = source_terms, + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 0.4) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_1d/elixir_euler_flux_diff.jl b/examples/dgmulti_1d/elixir_euler_flux_diff.jl index d6081be6770..1e390bd7afb 100644 --- a/examples/dgmulti_1d/elixir_euler_flux_diff.jl +++ b/examples/dgmulti_1d/elixir_euler_flux_diff.jl @@ -6,7 +6,7 @@ using Trixi # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -23,6 +23,7 @@ cells_per_dimension = (8,) mesh = DGMultiMesh(dg, cells_per_dimension, coordinates_min = (-1.0,), coordinates_max = (1.0,), periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic, source_terms = source_terms) tspan = (0.0, 1.1) diff --git a/examples/dgmulti_1d/elixir_euler_modified_sod.jl b/examples/dgmulti_1d/elixir_euler_modified_sod.jl index 7be2a76d9b6..f15f3bee5d7 100644 --- a/examples/dgmulti_1d/elixir_euler_modified_sod.jl +++ b/examples/dgmulti_1d/elixir_euler_modified_sod.jl @@ -39,7 +39,8 @@ initial_condition = initial_condition_modified_sod cells_per_dimension = (50,) mesh = DGMultiMesh(dg, cells_per_dimension, coordinates_min = (0.0,), coordinates_max = (1.0,), periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 0.2) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_1d/elixir_euler_quasi_1d.jl b/examples/dgmulti_1d/elixir_euler_quasi_1d.jl index 60e9411040f..d972d283f37 100644 --- a/examples/dgmulti_1d/elixir_euler_quasi_1d.jl +++ b/examples/dgmulti_1d/elixir_euler_quasi_1d.jl @@ -19,6 +19,7 @@ cells_per_dimension = (8,) mesh = DGMultiMesh(dg, cells_per_dimension, coordinates_min = (-1.0,), coordinates_max = (1.0,), periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic, source_terms = source_terms_convergence_test) ############################################################################### diff --git a/examples/dgmulti_1d/elixir_euler_shu_osher_gauss_shock_capturing.jl b/examples/dgmulti_1d/elixir_euler_shu_osher_gauss_shock_capturing.jl index 0d78708c9cc..5d342565cd2 100644 --- a/examples/dgmulti_1d/elixir_euler_shu_osher_gauss_shock_capturing.jl +++ b/examples/dgmulti_1d/elixir_euler_shu_osher_gauss_shock_capturing.jl @@ -52,7 +52,7 @@ dg = DGMulti(basis, volume_integral = volume_integral) boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :entire_boundary => boundary_condition) +boundary_conditions = (; entire_boundary = boundary_condition) ############################################################################### # setup the 1D mesh @@ -66,7 +66,7 @@ mesh = DGMultiMesh(dg, cells_per_dimension, # setup the semidiscretization and ODE problem semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, - dg, boundary_conditions = boundary_conditions) + dg; boundary_conditions = boundary_conditions) tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan) @@ -90,7 +90,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, save_solution) # ############################################################################### # # run the simulation -# We use a fixed time step here, as the wave speed estimate +# We use a fixed time step here, as the wave speed estimate # (which aims to bound the largest eigenvalues from above) # in the stepsize callback produced sometimes unphysical values sol = solve(ode, SSPRK43(), adaptive = false; diff --git a/examples/dgmulti_2d/elixir_advection_diffusion.jl b/examples/dgmulti_2d/elixir_advection_diffusion.jl index 3ab016567e0..8eed206f315 100644 --- a/examples/dgmulti_2d/elixir_advection_diffusion.jl +++ b/examples/dgmulti_2d/elixir_advection_diffusion.jl @@ -16,7 +16,7 @@ left(x, tol = 50 * eps()) = abs(x[1] + 1) < tol right(x, tol = 50 * eps()) = abs(x[1] - 1) < tol bottom(x, tol = 50 * eps()) = abs(x[2] + 1) < tol top(x, tol = 50 * eps()) = abs(x[2] - 1) < tol -is_on_boundary = Dict(:left => left, :right => right, :top => top, :bottom => bottom) +is_on_boundary = (; left = left, right = right, top = top, bottom = bottom) cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension; is_on_boundary) @@ -29,16 +29,16 @@ boundary_condition_zero = BoundaryConditionDirichlet((x, t, equations_parabolic) boundary_condition_neumann_zero = BoundaryConditionNeumann((x, t, equations_parabolic) -> SVector(0.0)) # define inviscid boundary conditions -boundary_conditions = (; :left => boundary_condition_left, - :bottom => boundary_condition_zero, - :top => boundary_condition_do_nothing, - :right => boundary_condition_do_nothing) +boundary_conditions = (; left = boundary_condition_left, + bottom = boundary_condition_zero, + top = boundary_condition_do_nothing, + right = boundary_condition_do_nothing) # define viscous boundary conditions -boundary_conditions_parabolic = (; :left => boundary_condition_left, - :bottom => boundary_condition_zero, - :top => boundary_condition_zero, - :right => boundary_condition_neumann_zero) +boundary_conditions_parabolic = (; left = boundary_condition_left, + bottom = boundary_condition_zero, + top = boundary_condition_zero, + right = boundary_condition_neumann_zero) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg; diff --git a/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl b/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl index 2e6996e6346..59ffbf181ea 100644 --- a/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl +++ b/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl @@ -35,8 +35,8 @@ right(x, tol = 50 * eps()) = abs(x[1]) < tol bottom(x, tol = 50 * eps()) = abs(x[2] + 0.5) < tol top(x, tol = 50 * eps()) = abs(x[2] - 0.5) < tol entire_boundary(x, tol = 50 * eps()) = true -is_on_boundary = Dict(:left => left, :right => right, :top => top, :bottom => bottom, - :entire_boundary => entire_boundary) +is_on_boundary = (; left = left, right = right, top = top, bottom = bottom, + entire_boundary = entire_boundary) cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension; @@ -48,13 +48,13 @@ mesh = DGMultiMesh(dg, cells_per_dimension; boundary_condition = BoundaryConditionDirichlet(initial_condition) # define inviscid boundary conditions, enforce "do nothing" boundary condition at the outflow -boundary_conditions = (; :left => boundary_condition, - :top => boundary_condition, - :bottom => boundary_condition, - :right => boundary_condition_do_nothing) +boundary_conditions = (; left = boundary_condition, + top = boundary_condition, + bottom = boundary_condition, + right = boundary_condition_do_nothing) # define viscous boundary conditions -boundary_conditions_parabolic = (; :entire_boundary => boundary_condition) +boundary_conditions_parabolic = (; entire_boundary = boundary_condition) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg; diff --git a/examples/dgmulti_2d/elixir_advection_diffusion_periodic.jl b/examples/dgmulti_2d/elixir_advection_diffusion_periodic.jl index f818329fcc3..83512abf3f0 100644 --- a/examples/dgmulti_2d/elixir_advection_diffusion_periodic.jl +++ b/examples/dgmulti_2d/elixir_advection_diffusion_periodic.jl @@ -16,7 +16,9 @@ initial_condition = initial_condition_sharp_gaussian cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, dg) + initial_condition, dg; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) tspan = (0.0, 0.1) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_2d/elixir_euler_bilinear.jl b/examples/dgmulti_2d/elixir_euler_bilinear.jl index 1efb71c9d5a..2c47d4367fe 100644 --- a/examples/dgmulti_2d/elixir_euler_bilinear.jl +++ b/examples/dgmulti_2d/elixir_euler_bilinear.jl @@ -12,7 +12,7 @@ source_terms = source_terms_convergence_test # example where we tag two separate boundary segments of the mesh top_boundary(x, tol = 50 * eps()) = abs(x[2] - 1) < tol rest_of_boundary(x, tol = 50 * eps()) = !top_boundary(x, tol) -is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary) +is_on_boundary = (; top = top_boundary, rest = rest_of_boundary) function mapping(xi, eta) x = xi + 0.1 * sin(pi * xi) * sin(pi * eta) @@ -30,8 +30,8 @@ end mesh = DGMultiMesh(dg, vertex_coordinates, EToV, is_on_boundary = is_on_boundary) boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :top => boundary_condition_convergence_test, - :rest => boundary_condition_convergence_test) +boundary_conditions = (; top = boundary_condition_convergence_test, + rest = boundary_condition_convergence_test) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, source_terms = source_terms, diff --git a/examples/dgmulti_2d/elixir_euler_brown_minion_vortex.jl b/examples/dgmulti_2d/elixir_euler_brown_minion_vortex.jl index 979134d224e..efb4bfc6832 100644 --- a/examples/dgmulti_2d/elixir_euler_brown_minion_vortex.jl +++ b/examples/dgmulti_2d/elixir_euler_brown_minion_vortex.jl @@ -6,7 +6,7 @@ using Trixi # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 4, element_type = Quad(), approximation_type = Polynomial(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), @@ -40,7 +40,8 @@ cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension, coordinates_min = (-0.5, -0.5), coordinates_max = (0.5, 0.5), periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_2d/elixir_euler_curved.jl b/examples/dgmulti_2d/elixir_euler_curved.jl index a9f43494e8b..85e441793dc 100644 --- a/examples/dgmulti_2d/elixir_euler_curved.jl +++ b/examples/dgmulti_2d/elixir_euler_curved.jl @@ -12,7 +12,7 @@ source_terms = source_terms_convergence_test # example where we tag two separate boundary segments of the mesh top_boundary(x, tol = 50 * eps()) = abs(x[2] - 1) < tol rest_of_boundary(x, tol = 50 * eps()) = !top_boundary(x, tol) -is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary) +is_on_boundary = (; top = top_boundary, rest = rest_of_boundary) function mapping(xi, eta) x = xi + 0.1 * sin(pi * xi) * sin(pi * eta) @@ -23,8 +23,8 @@ cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension, mapping, is_on_boundary = is_on_boundary) boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :top => boundary_condition_convergence_test, - :rest => boundary_condition_convergence_test) +boundary_conditions = (; top = boundary_condition_convergence_test, + rest = boundary_condition_convergence_test) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, source_terms = source_terms, diff --git a/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl b/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl index eda24e50339..c1c65df036a 100644 --- a/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl +++ b/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl @@ -16,8 +16,9 @@ source_terms = source_terms_convergence_test mesh = DGMultiMesh(dg, coordinates_min = (-1.0, -1.0), coordinates_max = (1.0, 1.0)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, - source_terms = source_terms) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + source_terms = source_terms, + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 0.4) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_2d/elixir_euler_hohqmesh.jl b/examples/dgmulti_2d/elixir_euler_hohqmesh.jl index b377f5a48b2..54a570f8d00 100644 --- a/examples/dgmulti_2d/elixir_euler_hohqmesh.jl +++ b/examples/dgmulti_2d/elixir_euler_hohqmesh.jl @@ -13,11 +13,11 @@ initial_condition = initial_condition_convergence_test source_terms = source_terms_convergence_test boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :Slant => boundary_condition_convergence_test, - :Bezier => boundary_condition_convergence_test, - :Right => boundary_condition_convergence_test, - :Bottom => boundary_condition_convergence_test, - :Top => boundary_condition_convergence_test) +boundary_conditions = (; Slant = boundary_condition_convergence_test, + Bezier = boundary_condition_convergence_test, + Right = boundary_condition_convergence_test, + Bottom = boundary_condition_convergence_test, + Top = boundary_condition_convergence_test) ############################################################################### # Get the DG approximation space @@ -27,7 +27,7 @@ boundary_conditions = (; :Slant => boundary_condition_convergence_test, # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 8, element_type = Quad(), approximation_type = SBP(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), diff --git a/examples/dgmulti_2d/elixir_euler_kelvin_helmholtz_instability.jl b/examples/dgmulti_2d/elixir_euler_kelvin_helmholtz_instability.jl index c0b75594df6..c947d82fa3e 100644 --- a/examples/dgmulti_2d/elixir_euler_kelvin_helmholtz_instability.jl +++ b/examples/dgmulti_2d/elixir_euler_kelvin_helmholtz_instability.jl @@ -6,7 +6,7 @@ using Trixi # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = SBP(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), @@ -42,7 +42,8 @@ initial_condition = initial_condition_kelvin_helmholtz_instability cells_per_dimension = (32, 32) mesh = DGMultiMesh(dg, cells_per_dimension; periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_2d/elixir_euler_laplace_diffusion.jl b/examples/dgmulti_2d/elixir_euler_laplace_diffusion.jl index 728293ad381..29912e7f417 100644 --- a/examples/dgmulti_2d/elixir_euler_laplace_diffusion.jl +++ b/examples/dgmulti_2d/elixir_euler_laplace_diffusion.jl @@ -6,7 +6,7 @@ using Trixi # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -24,7 +24,9 @@ mesh = DGMultiMesh(dg, cells_per_dimension, coordinates_min = (-1.0, -1.0), coordinates_max = (1.0, 1.0), periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, dg) + initial_condition, dg; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) tspan = (0.0, 1.1) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl b/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl index 849f70727ca..2611dfa1063 100644 --- a/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl +++ b/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl @@ -69,7 +69,7 @@ mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = (true, false)) initial_condition = initial_condition_rayleigh_taylor_instability -boundary_conditions = (; :entire_boundary => boundary_condition_slip_wall) +boundary_conditions = (; entire_boundary = boundary_condition_slip_wall) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; source_terms = source_terms_rayleigh_taylor_instability, diff --git a/examples/dgmulti_2d/elixir_euler_shockcapturing.jl b/examples/dgmulti_2d/elixir_euler_shockcapturing.jl index 0eae24b2618..124e53cd6ae 100644 --- a/examples/dgmulti_2d/elixir_euler_shockcapturing.jl +++ b/examples/dgmulti_2d/elixir_euler_shockcapturing.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_weak_blast_wave # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -36,7 +36,8 @@ dg = DGMulti(basis, cells_per_dimension = (8, 8) mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 0.15) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.jl b/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.jl index 1a1ceedf5b0..b2b45347952 100644 --- a/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.jl +++ b/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_weak_blast_wave # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -41,7 +41,8 @@ end cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension, mapping) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 0.15) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl b/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl index 3b813911ccc..d994cf3f881 100644 --- a/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl +++ b/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl @@ -17,8 +17,8 @@ meshIO = StartUpDG.triangulate_domain(StartUpDG.RectangularDomainWithHole()) mesh = DGMultiMesh(dg, meshIO, Dict(:outer_boundary => 1, :inner_boundary => 2)) boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :outer_boundary => boundary_condition_convergence_test, - :inner_boundary => boundary_condition_convergence_test) +boundary_conditions = (; outer_boundary = boundary_condition_convergence_test, + inner_boundary = boundary_condition_convergence_test) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, source_terms = source_terms, diff --git a/examples/dgmulti_2d/elixir_euler_weakform.jl b/examples/dgmulti_2d/elixir_euler_weakform.jl index 17989a2f609..7a6d6816670 100644 --- a/examples/dgmulti_2d/elixir_euler_weakform.jl +++ b/examples/dgmulti_2d/elixir_euler_weakform.jl @@ -12,14 +12,14 @@ source_terms = source_terms_convergence_test # example where we tag two separate boundary segments of the mesh top_boundary(x, tol = 50 * eps()) = abs(x[2] - 1) < tol rest_of_boundary(x, tol = 50 * eps()) = !top_boundary(x, tol) -is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary) +is_on_boundary = (; top = top_boundary, rest = rest_of_boundary) cells_per_dimension = (8, 8) mesh = DGMultiMesh(dg, cells_per_dimension, is_on_boundary = is_on_boundary) boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :top => boundary_condition_convergence_test, - :rest => boundary_condition_convergence_test) +boundary_conditions = (; top = boundary_condition_convergence_test, + rest = boundary_condition_convergence_test) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, source_terms = source_terms, diff --git a/examples/dgmulti_2d/elixir_euler_weakform_periodic.jl b/examples/dgmulti_2d/elixir_euler_weakform_periodic.jl index 92c0cc8b0ca..54f86ace0d2 100644 --- a/examples/dgmulti_2d/elixir_euler_weakform_periodic.jl +++ b/examples/dgmulti_2d/elixir_euler_weakform_periodic.jl @@ -11,8 +11,9 @@ source_terms = source_terms_convergence_test cells_per_dimension = (4, 4) mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, - source_terms = source_terms) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + source_terms = source_terms, + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 0.4) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl b/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl index 183a347c1e9..03421da20cf 100644 --- a/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl +++ b/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl @@ -33,7 +33,7 @@ initial_condition = initial_condition_perturbation # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) @@ -46,7 +46,7 @@ x_neg(x, tol = 50 * eps()) = abs(x[1] + 1) < tol x_pos(x, tol = 50 * eps()) = abs(x[1] - 1) < tol y_neg(x, tol = 50 * eps()) = abs(x[2] + 1) < tol y_pos(x, tol = 50 * eps()) = abs(x[2] - 1) < tol -is_on_boundary = Dict(:x_neg => x_neg, :x_pos => x_pos, :y_neg => y_neg, :y_pos => y_pos) +is_on_boundary = (; x_neg = x_neg, x_pos = x_pos, y_neg = y_neg, y_pos = y_pos) cells_per_dimension = (16, 16) mesh = DGMultiMesh(solver, cells_per_dimension; periodicity = (false, false), diff --git a/examples/dgmulti_2d/elixir_mhd_weak_blast_wave.jl b/examples/dgmulti_2d/elixir_mhd_weak_blast_wave.jl index f4e635e45e0..b8d61b89a2d 100644 --- a/examples/dgmulti_2d/elixir_mhd_weak_blast_wave.jl +++ b/examples/dgmulti_2d/elixir_mhd_weak_blast_wave.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_weak_blast_wave # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) @@ -25,7 +25,8 @@ cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension, coordinates_min = (-2.0, -2.0), coordinates_max = (2.0, 2.0), periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/dgmulti_2d/elixir_mhd_weak_blast_wave_SBP.jl b/examples/dgmulti_2d/elixir_mhd_weak_blast_wave_SBP.jl index 639adaeaac9..b2edb2d3a1b 100644 --- a/examples/dgmulti_2d/elixir_mhd_weak_blast_wave_SBP.jl +++ b/examples/dgmulti_2d/elixir_mhd_weak_blast_wave_SBP.jl @@ -17,7 +17,7 @@ initial_condition = initial_condition_weak_blast_wave # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) @@ -28,7 +28,8 @@ dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = SBP(), mesh = DGMultiMesh(dg, cells_per_dimension, coordinates_min = (-2.0, -2.0), coordinates_max = (2.0, 2.0), periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/dgmulti_2d/elixir_navierstokes_convergence.jl b/examples/dgmulti_2d/elixir_navierstokes_convergence.jl index 1da9ee88dd3..63e4285d6b9 100644 --- a/examples/dgmulti_2d/elixir_navierstokes_convergence.jl +++ b/examples/dgmulti_2d/elixir_navierstokes_convergence.jl @@ -21,14 +21,14 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 3, element_type = Tri(), approximation_type = Polynomial(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), volume_integral = VolumeIntegralWeakForm()) top_bottom(x, tol = 50 * eps()) = abs(abs(x[2]) - 1) < tol -is_on_boundary = Dict(:top_bottom => top_bottom) +is_on_boundary = (; top_bottom = top_bottom) cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension; periodicity = (true, false), is_on_boundary) @@ -196,10 +196,10 @@ boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_to heat_bc_top_bottom) # define inviscid boundary conditions -boundary_conditions = (; :top_bottom => boundary_condition_slip_wall) +boundary_conditions = (; top_bottom = boundary_condition_slip_wall) # define viscous boundary conditions -boundary_conditions_parabolic = (; :top_bottom => boundary_condition_top_bottom) +boundary_conditions_parabolic = (; top_bottom = boundary_condition_top_bottom) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg; diff --git a/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl b/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl index b6a3329fb7b..a4ca0c60791 100644 --- a/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl +++ b/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl @@ -21,14 +21,14 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 3, element_type = Tri(), approximation_type = Polynomial(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), volume_integral = VolumeIntegralWeakForm()) top_bottom(x, tol = 50 * eps()) = abs(abs(x[2]) - 1) < tol -is_on_boundary = Dict(:top_bottom => top_bottom) +is_on_boundary = (; top_bottom = top_bottom) function mapping(xi, eta) x = xi + 0.1 * sin(pi * xi) * sin(pi * eta) @@ -204,10 +204,10 @@ boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_to heat_bc_top_bottom) # define inviscid boundary conditions -boundary_conditions = (; :top_bottom => boundary_condition_slip_wall) +boundary_conditions = (; top_bottom = boundary_condition_slip_wall) # define viscous boundary conditions -boundary_conditions_parabolic = (; :top_bottom => boundary_condition_top_bottom) +boundary_conditions_parabolic = (; top_bottom = boundary_condition_top_bottom) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg; diff --git a/examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl b/examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl index f9ea111fc21..38c8234b839 100644 --- a/examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl +++ b/examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl @@ -18,7 +18,7 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu, # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = GaussSBP(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), @@ -26,7 +26,7 @@ dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = GaussSBP() top(x, tol = 50 * eps()) = abs(x[2] - 1) < tol rest_of_boundary(x, tol = 50 * eps()) = !top(x, tol) -is_on_boundary = Dict(:top => top, :rest_of_boundary => rest_of_boundary) +is_on_boundary = (; top = top, rest_of_boundary = rest_of_boundary) cells_per_dimension = (16, 16) mesh = DGMultiMesh(dg, cells_per_dimension; is_on_boundary) @@ -48,12 +48,12 @@ boundary_condition_lid = BoundaryConditionNavierStokesWall(velocity_bc_lid, heat boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity, heat_bc) # define inviscid boundary conditions -boundary_conditions = (; :top => boundary_condition_slip_wall, - :rest_of_boundary => boundary_condition_slip_wall) +boundary_conditions = (; top = boundary_condition_slip_wall, + rest_of_boundary = boundary_condition_slip_wall) # define viscous boundary conditions -boundary_conditions_parabolic = (; :top => boundary_condition_lid, - :rest_of_boundary => boundary_condition_cavity) +boundary_conditions_parabolic = (; top = boundary_condition_lid, + rest_of_boundary = boundary_condition_cavity) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg; diff --git a/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl b/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl index ea773277680..2f40c5b1c1a 100644 --- a/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl +++ b/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl @@ -23,7 +23,7 @@ mesh = DGMultiMesh(dg, coordinates_max = (1.0, 1.0, 1.0), periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; boundary_conditions = boundary_condition_periodic) ############################################################################### diff --git a/examples/dgmulti_3d/elixir_euler_curved.jl b/examples/dgmulti_3d/elixir_euler_curved.jl index a8eeb7f3cbf..23345564a27 100644 --- a/examples/dgmulti_3d/elixir_euler_curved.jl +++ b/examples/dgmulti_3d/elixir_euler_curved.jl @@ -12,7 +12,7 @@ source_terms = source_terms_convergence_test # example where we tag two separate boundary segments of the mesh top_boundary(x, tol = 50 * eps()) = abs(x[2] - 1) < tol rest_of_boundary(x, tol = 50 * eps()) = !top_boundary(x, tol) -is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary) +is_on_boundary = (; top = top_boundary, rest = rest_of_boundary) function mapping(xi, eta, zeta) x = xi + 0.1 * sin(pi * xi) * sin(pi * eta) @@ -24,8 +24,8 @@ cells_per_dimension = (4, 4, 4) mesh = DGMultiMesh(dg, cells_per_dimension, mapping, is_on_boundary = is_on_boundary) boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :top => boundary_condition_convergence_test, - :rest => boundary_condition_convergence_test) +boundary_conditions = (; top = boundary_condition_convergence_test, + rest = boundary_condition_convergence_test) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, source_terms = source_terms, diff --git a/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl b/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl index 44b3753cd76..27a834de78a 100644 --- a/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl +++ b/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl @@ -15,7 +15,7 @@ volume_flux = flux_ranocha # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGMulti(element_type = Hex(), approximation_type = periodic_derivative_operator(derivative_order = 1, @@ -29,6 +29,7 @@ mesh = DGMultiMesh(solver, coordinates_min = (-1.0, -1.0, -1.0), coordinates_max = (1.0, 1.0, 1.0)) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic, source_terms = source_terms) ############################################################################### diff --git a/examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl b/examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl index a3502e896c7..ea15cecdb73 100644 --- a/examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl +++ b/examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl @@ -36,7 +36,7 @@ volume_flux = flux_ranocha # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) solver = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = Polynomial(), @@ -48,7 +48,8 @@ mesh = DGMultiMesh(solver, cells_per_dimension, coordinates_min = (-pi, -pi, -pi), coordinates_max = (pi, pi, pi), periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/dgmulti_3d/elixir_euler_weakform.jl b/examples/dgmulti_3d/elixir_euler_weakform.jl index b7e749151f4..d9427a26b25 100644 --- a/examples/dgmulti_3d/elixir_euler_weakform.jl +++ b/examples/dgmulti_3d/elixir_euler_weakform.jl @@ -12,14 +12,14 @@ source_terms = source_terms_convergence_test # example where we tag two separate boundary segments of the mesh top_boundary(x, tol = 50 * eps()) = abs(x[2] - 1) < tol rest_of_boundary(x, tol = 50 * eps()) = !top_boundary(x, tol) -is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary) +is_on_boundary = (; top = top_boundary, rest = rest_of_boundary) cells_per_dimension = (4, 4, 4) mesh = DGMultiMesh(dg, cells_per_dimension, is_on_boundary = is_on_boundary) boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (; :top => boundary_condition_convergence_test, - :rest => boundary_condition_convergence_test) +boundary_conditions = (; top = boundary_condition_convergence_test, + rest = boundary_condition_convergence_test) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, source_terms = source_terms, diff --git a/examples/dgmulti_3d/elixir_euler_weakform_periodic.jl b/examples/dgmulti_3d/elixir_euler_weakform_periodic.jl index 107535bf29f..794fd8b894c 100644 --- a/examples/dgmulti_3d/elixir_euler_weakform_periodic.jl +++ b/examples/dgmulti_3d/elixir_euler_weakform_periodic.jl @@ -12,8 +12,9 @@ source_terms = source_terms_convergence_test cells_per_dimension = (4, 4, 4) mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg, - source_terms = source_terms) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; + source_terms = source_terms, + boundary_conditions = boundary_condition_periodic) tspan = (0.0, 0.1) ode = semidiscretize(semi, tspan) diff --git a/examples/dgmulti_3d/elixir_navierstokes_convergence.jl b/examples/dgmulti_3d/elixir_navierstokes_convergence.jl index 8c5b8b09268..9adb48efa0a 100644 --- a/examples/dgmulti_3d/elixir_navierstokes_convergence.jl +++ b/examples/dgmulti_3d/elixir_navierstokes_convergence.jl @@ -19,14 +19,14 @@ equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = Polynomial(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), volume_integral = VolumeIntegralWeakForm()) top_bottom(x, tol = 50 * eps()) = abs(abs(x[2]) - 1) < tol -is_on_boundary = Dict(:top_bottom => top_bottom) +is_on_boundary = (; top_bottom = top_bottom) cells_per_dimension = (8, 8, 8) mesh = DGMultiMesh(dg, cells_per_dimension; periodicity = (true, false, true), @@ -239,10 +239,10 @@ boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_to heat_bc_top_bottom) # define inviscid boundary conditions -boundary_conditions = (; :top_bottom => boundary_condition_slip_wall) +boundary_conditions = (; top_bottom = boundary_condition_slip_wall) # define viscous boundary conditions -boundary_conditions_parabolic = (; :top_bottom => boundary_condition_top_bottom) +boundary_conditions_parabolic = (; top_bottom = boundary_condition_top_bottom) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg; diff --git a/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl b/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl index 3e5df891c72..96469770bd1 100644 --- a/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl +++ b/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl @@ -19,14 +19,14 @@ equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = Polynomial(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), volume_integral = VolumeIntegralWeakForm()) top_bottom(x, tol = 50 * eps()) = abs(abs(x[2]) - 1) < tol -is_on_boundary = Dict(:top_bottom => top_bottom) +is_on_boundary = (; top_bottom = top_bottom) function mapping(xi, eta, zeta) x = xi + 0.1 * sin(pi * xi) * sin(pi * eta) @@ -247,10 +247,10 @@ boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_to heat_bc_top_bottom) # define inviscid boundary conditions -boundary_conditions = (; :top_bottom => boundary_condition_slip_wall) +boundary_conditions = (; top_bottom = boundary_condition_slip_wall) # define viscous boundary conditions -boundary_conditions_parabolic = (; :top_bottom => boundary_condition_top_bottom) +boundary_conditions_parabolic = (; top_bottom = boundary_condition_top_bottom) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg; diff --git a/examples/dgmulti_3d/elixir_navierstokes_taylor_green_vortex.jl b/examples/dgmulti_3d/elixir_navierstokes_taylor_green_vortex.jl index f38547638a5..d39d1276810 100644 --- a/examples/dgmulti_3d/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/dgmulti_3d/elixir_navierstokes_taylor_green_vortex.jl @@ -42,7 +42,7 @@ initial_condition = initial_condition_taylor_green_vortex # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. dg = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = GaussSBP(), surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)), @@ -56,7 +56,9 @@ mesh = DGMultiMesh(dg, cells_per_dimension; periodicity = (true, true, true)) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, dg) + initial_condition, dg; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl index eb9069aaa87..ee30c2001dd 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -95,9 +95,11 @@ trees_per_dimension = (1, 1) mesh = P4estMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 4) + initial_refinement_level = 4, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_amr_unstructured_flag.jl b/examples/p4est_2d_dgsem/elixir_advection_amr_unstructured_flag.jl index c955e5dda22..d2b901934a5 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_amr_unstructured_flag.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_amr_unstructured_flag.jl @@ -10,7 +10,7 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity) initial_condition = initial_condition_gauss boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) @@ -36,7 +36,7 @@ mesh = P4estMesh{2}(mesh_file, polydeg = 3, mapping = mapping_flag, initial_refinement_level = 1) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_advection_basic.jl b/examples/p4est_2d_dgsem/elixir_advection_basic.jl index 4ff646365aa..bd4388deeb7 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_basic.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_basic.jl @@ -21,11 +21,13 @@ trees_per_dimension = (8, 8) # Create P4estMesh with 8 x 8 trees and 16 x 16 elements mesh = P4estMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 1) + initial_refinement_level = 1, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_basic_gpu.jl b/examples/p4est_2d_dgsem/elixir_advection_basic_gpu.jl index 6f9e8e56986..4553d4823ed 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_basic_gpu.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_basic_gpu.jl @@ -21,11 +21,13 @@ trees_per_dimension = (8, 8) # Create P4estMesh with 8 x 8 trees and 16 x 16 elements mesh = P4estMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 1) + initial_refinement_level = 1, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl index 59e0633c7af..68b71a834ff 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_amr.jl @@ -40,19 +40,12 @@ function initial_condition_eriksson_johnson(x, t, equations) end initial_condition = initial_condition_eriksson_johnson -boundary_conditions = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition), - :y_neg => BoundaryConditionDirichlet(initial_condition), - :y_pos => BoundaryConditionDirichlet(initial_condition), - :x_pos => boundary_condition_do_nothing) - -# Assign a single boundary condition to all boundaries -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions_parabolic = boundary_condition_default(mesh, boundary_condition) -# Alternatively, you can use -# boundary_conditions_parabolic = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition), -# :x_pos => BoundaryConditionDirichlet(initial_condition), -# :y_neg => BoundaryConditionDirichlet(initial_condition), -# :y_pos => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition), + y_neg = BoundaryConditionDirichlet(initial_condition), + y_pos = BoundaryConditionDirichlet(initial_condition), + x_pos = boundary_condition_do_nothing) + +boundary_conditions_parabolic = BoundaryConditionDirichlet(initial_condition) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolicParabolic(mesh, diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl index ad3b683de58..a0733077d6d 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl @@ -28,15 +28,15 @@ function initial_condition_eriksson_johnson(x, t, equations) end initial_condition = initial_condition_eriksson_johnson -boundary_conditions = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition), - :y_neg => BoundaryConditionDirichlet(initial_condition), - :y_pos => BoundaryConditionDirichlet(initial_condition), - :x_pos => boundary_condition_do_nothing) +boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition), + y_neg = BoundaryConditionDirichlet(initial_condition), + y_pos = BoundaryConditionDirichlet(initial_condition), + x_pos = boundary_condition_do_nothing) -boundary_conditions_parabolic = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition), - :x_pos => BoundaryConditionDirichlet(initial_condition), - :y_neg => BoundaryConditionDirichlet(initial_condition), - :y_pos => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions_parabolic = (; x_neg = BoundaryConditionDirichlet(initial_condition), + x_pos = BoundaryConditionDirichlet(initial_condition), + y_neg = BoundaryConditionDirichlet(initial_condition), + y_pos = BoundaryConditionDirichlet(initial_condition)) # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) @@ -56,7 +56,7 @@ mesh = P4estMesh(trees_per_dimension, # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver, + initial_condition, solver; boundary_conditions = (boundary_conditions, boundary_conditions_parabolic)) diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic.jl index ab831b26d3d..07da3f8b31e 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic.jl @@ -48,7 +48,9 @@ mesh = P4estMesh(trees_per_dimension, # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_amr.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_amr.jl index 581b44007f1..3710c73ff59 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_amr.jl @@ -18,7 +18,8 @@ coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y)) trees_per_dimension = (4, 4) mesh = P4estMesh(trees_per_dimension, polydeg = 3, initial_refinement_level = 1, - coordinates_min = coordinates_min, coordinates_max = coordinates_max) + coordinates_min = coordinates_min, coordinates_max = coordinates_max, + periodicity = true) # Define initial condition function initial_condition_diffusive_convergence_test(x, t, @@ -40,7 +41,9 @@ initial_condition = initial_condition_diffusive_convergence_test # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_curved.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_curved.jl index 83ca105246c..4d2a3edfafd 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_curved.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_curved.jl @@ -53,7 +53,9 @@ mesh = P4estMesh(trees_per_dimension, # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_extended.jl b/examples/p4est_2d_dgsem/elixir_advection_extended.jl index ef9cf6150d0..10c158e2d94 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_extended.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_extended.jl @@ -9,12 +9,12 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity) initial_condition = initial_condition_convergence_test -# BCs must be passed as Dict boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:x_neg => boundary_condition, - :x_pos => boundary_condition, - :y_neg => boundary_condition, - :y_pos => boundary_condition) +# Boundary conditions as a NamedTuple +boundary_conditions = (; x_neg = boundary_condition, + x_pos = boundary_condition, + y_neg = boundary_condition, + y_pos = boundary_condition) # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) @@ -31,7 +31,7 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 3, periodicity = false) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_advection_meshview.jl b/examples/p4est_2d_dgsem/elixir_advection_meshview.jl index f113b5dde57..0ad6e6e18e8 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_meshview.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_meshview.jl @@ -19,7 +19,8 @@ trees_per_dimension = (8, 8) # Create parent P4estMesh with 8 x 8 trees and 8 x 8 elements parent_mesh = P4estMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, - coordinates_max = coordinates_max) + coordinates_max = coordinates_max, + periodicity = true) # Define the mesh view covering the whole parent mesh. cell_ids = collect(1:Trixi.ncells(parent_mesh)) @@ -27,7 +28,8 @@ mesh = P4estMeshView(parent_mesh, cell_ids) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_nonconforming_flag.jl b/examples/p4est_2d_dgsem/elixir_advection_nonconforming_flag.jl index fb092936788..135d21d1dee 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_nonconforming_flag.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_nonconforming_flag.jl @@ -22,6 +22,7 @@ f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s)) trees_per_dimension = (3, 2) mesh = P4estMesh(trees_per_dimension, polydeg = 3, faces = (f1, f2, f3, f4), + periodicity = true, initial_refinement_level = 1) # Refine bottom left quadrant of each tree to level 4 @@ -45,7 +46,8 @@ Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_advection_restart.jl b/examples/p4est_2d_dgsem/elixir_advection_restart.jl index 0dbbb6c3d14..c9d3a836833 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_restart.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_restart.jl @@ -19,7 +19,7 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file)) restart_filename = joinpath("out", restart_file) mesh = load_mesh(restart_filename) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) tspan = (load_time(restart_filename), 2.0) diff --git a/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl b/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl index 2f110f8f409..d931f7d08b1 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_restart_amr.jl @@ -19,7 +19,7 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file)) restart_filename = joinpath("out", restart_file) mesh = load_mesh(restart_filename) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) tspan = (load_time(restart_filename), 2.0) diff --git a/examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl b/examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl index d95cfdd194e..5ee159447cd 100644 --- a/examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl +++ b/examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl @@ -10,7 +10,7 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) @@ -35,7 +35,7 @@ mesh = P4estMesh{2}(mesh_file, polydeg = 3, initial_refinement_level = 2) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_NACA0012airfoil_mach085.jl b/examples/p4est_2d_dgsem/elixir_euler_NACA0012airfoil_mach085.jl index ae1548ec657..94db4ecda09 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_NACA0012airfoil_mach085.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_NACA0012airfoil_mach085.jl @@ -32,7 +32,7 @@ volume_flux = flux_ranocha_turbo # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) @@ -67,14 +67,14 @@ mesh = P4estMesh{2}(mesh_file) return flux_hll(u_inner, u_boundary, normal_direction, equations) end -boundary_conditions = Dict(:Left => boundary_condition_subsonic_constant, - :Right => boundary_condition_subsonic_constant, - :Top => boundary_condition_subsonic_constant, - :Bottom => boundary_condition_subsonic_constant, - :AirfoilBottom => boundary_condition_slip_wall, - :AirfoilTop => boundary_condition_slip_wall) +boundary_conditions = (; Left = boundary_condition_subsonic_constant, + Right = boundary_condition_subsonic_constant, + Top = boundary_condition_subsonic_constant, + Bottom = boundary_condition_subsonic_constant, + AirfoilBottom = boundary_condition_slip_wall, + AirfoilTop = boundary_condition_slip_wall) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_NACA6412airfoil_mach2.jl b/examples/p4est_2d_dgsem/elixir_euler_NACA6412airfoil_mach2.jl index a16922c3b9b..8f9a43ca795 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_NACA6412airfoil_mach2.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_NACA6412airfoil_mach2.jl @@ -49,7 +49,7 @@ polydeg = 3 # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -79,12 +79,12 @@ boundary_symbols = [:PhysicalLine1, :PhysicalLine2, :PhysicalLine3, :PhysicalLin mesh = P4estMesh{2}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols) -boundary_conditions = Dict(:PhysicalLine1 => boundary_condition_supersonic_inflow, # Left boundary - :PhysicalLine2 => boundary_condition_supersonic_outflow, # Right boundary - :PhysicalLine3 => boundary_condition_supersonic_outflow, # Top and bottom boundary - :PhysicalLine4 => boundary_condition_slip_wall) # Airfoil +boundary_conditions = (; PhysicalLine1 = boundary_condition_supersonic_inflow, # Left boundary + PhysicalLine2 = boundary_condition_supersonic_outflow, # Right boundary + PhysicalLine3 = boundary_condition_supersonic_outflow, # Top and bottom boundary + PhysicalLine4 = boundary_condition_slip_wall) # Airfoil -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) tspan = (0.0, 5.0) diff --git a/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl index 87e425cb62c..f3215fe82ae 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl @@ -39,7 +39,7 @@ initial_condition = initial_condition_blast_wave # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -60,8 +60,9 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/a075f8 mesh = P4estMesh{2}(mesh_file, polydeg = 3, initial_refinement_level = 1) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition))) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = (; + all = BoundaryConditionDirichlet(initial_condition))) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_euler_cylinder_bowshock_mach3.jl b/examples/p4est_2d_dgsem/elixir_euler_cylinder_bowshock_mach3.jl index b404beb6c16..f5209784278 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_cylinder_bowshock_mach3.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_cylinder_bowshock_mach3.jl @@ -32,10 +32,10 @@ using OrdinaryDiffEqSSPRK # _ * s # n * | # e * | -# g Shock . -# | * . +# g Shock . +# | * . # | * . <- x_pos -# | * . +# | * . # | * . (Cylinder) # |_______y_neg_______. function mapping_cylinder_shock_fitted(xi_, eta_, @@ -95,10 +95,10 @@ end end # For physical significance of boundary conditions, see sketch at `mapping_cylinder_shock_fitted` -boundary_conditions = Dict(:x_neg => boundary_condition_supersonic_inflow, # Supersonic inflow - :y_neg => boundary_condition_slip_wall, # Induce symmetry by slip wall - :y_pos => boundary_condition_do_nothing, # Free outflow - :x_pos => boundary_condition_slip_wall) # Cylinder +boundary_conditions = (; x_neg = boundary_condition_supersonic_inflow, # Supersonic inflow + y_neg = boundary_condition_slip_wall, # Induce symmetry by slip wall + y_pos = boundary_condition_do_nothing, # Free outflow + x_pos = boundary_condition_slip_wall) # Cylinder ############################################################################### # Equations, mesh and solver @@ -142,8 +142,7 @@ mesh = P4estMesh(trees_per_dimension, solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, volume_integral = volume_integral) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_mach3_flow, - solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_mach3_flow, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_density_wave_tracers.jl b/examples/p4est_2d_dgsem/elixir_euler_density_wave_tracers.jl index d489cecb33d..0f4093fb24b 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_density_wave_tracers.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_density_wave_tracers.jl @@ -17,9 +17,11 @@ coordinates_max = (1.0, 1.0) trees_per_dimension = (4, 4) mesh = P4estMesh(trees_per_dimension, polydeg = 3, - coordinates_min = coordinates_min, coordinates_max = coordinates_max) + coordinates_min = coordinates_min, coordinates_max = coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl index 1234f49539f..16beb52d750 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl @@ -75,10 +75,10 @@ end return flux end -boundary_conditions = Dict(:Bottom => boundary_condition_mixed_dirichlet_wall, - :Top => boundary_condition_inflow, - :Right => boundary_condition_outflow, - :Left => boundary_condition_inflow) +boundary_conditions = (; Bottom = boundary_condition_mixed_dirichlet_wall, + Top = boundary_condition_inflow, + Right = boundary_condition_outflow, + Left = boundary_condition_inflow) volume_flux = flux_ranocha # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of @@ -86,7 +86,7 @@ volume_flux = flux_ranocha # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) @@ -109,7 +109,7 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = P4estMesh{2}(mesh_file) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl index e7571cf20ed..9a29cac9f88 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl @@ -78,12 +78,12 @@ boundary_condition_inflow = BoundaryConditionDirichlet(initial_condition_mach3_f return flux end -boundary_conditions = Dict(:Bottom => boundary_condition_slip_wall, - :Step_Front => boundary_condition_slip_wall, - :Step_Top => boundary_condition_slip_wall, - :Top => boundary_condition_slip_wall, - :Right => boundary_condition_outflow, - :Left => boundary_condition_inflow) +boundary_conditions = (; Bottom = boundary_condition_slip_wall, + Step_Front = boundary_condition_slip_wall, + Step_Top = boundary_condition_slip_wall, + Top = boundary_condition_slip_wall, + Right = boundary_condition_outflow, + Left = boundary_condition_inflow) volume_flux = flux_ranocha # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of @@ -91,7 +91,7 @@ volume_flux = flux_ranocha # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) @@ -114,7 +114,7 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = P4estMesh{2}(mesh_file) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_free_stream.jl b/examples/p4est_2d_dgsem/elixir_euler_free_stream.jl index 5f8c1989c66..32847c4de50 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_free_stream.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_free_stream.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_constant # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -61,8 +61,9 @@ refine_fn_c = @cfunction(refine_fn, Cint, Ptr{Trixi.p4est_quadrant_t})) Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition))) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = (; + all = BoundaryConditionDirichlet(initial_condition))) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_euler_free_stream_hybrid_mesh.jl b/examples/p4est_2d_dgsem/elixir_euler_free_stream_hybrid_mesh.jl index 10f52f0382e..dd8a74e27f5 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_free_stream_hybrid_mesh.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_free_stream_hybrid_mesh.jl @@ -14,7 +14,7 @@ initial_condition = initial_condition_constant # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -27,9 +27,9 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/DanielDoehring/84 # Refine the given mesh twice mesh = P4estMesh{2}(mesh_file, initial_refinement_level = 2) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = - Dict(:all => BoundaryConditionDirichlet(initial_condition))) + (; all = BoundaryConditionDirichlet(initial_condition))) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl b/examples/p4est_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl index 18635b82bdc..8a5f04c414a 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl @@ -117,8 +117,8 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 1, return flux(u_surface, normal_direction, equations) end -boundary_conditions = Dict(:y_neg => boundary_condition_subsonic, - :y_pos => BoundaryConditionDirichlet(initial_condition_rayleigh_taylor_instability)) +boundary_conditions = (; y_neg = boundary_condition_subsonic, + y_pos = BoundaryConditionDirichlet(initial_condition_rayleigh_taylor_instability)) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms = source_terms_rayleigh_taylor_instability, diff --git a/examples/p4est_2d_dgsem/elixir_euler_sedov.jl b/examples/p4est_2d_dgsem/elixir_euler_sedov.jl index 1efd338564d..8915232cf97 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_sedov.jl @@ -72,7 +72,8 @@ mesh = P4estMesh(trees_per_dimension, coordinates_min = coordinates_min, coordinates_max = coordinates_max, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl b/examples/p4est_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl index 7aed517d9ac..c5b522e257a 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl @@ -71,7 +71,8 @@ mesh = P4estMesh(trees_per_dimension, coordinates_min = coordinates_min, coordinates_max = coordinates_max, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl b/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl index efd1bd14ec5..8e89ad430ec 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl @@ -35,7 +35,8 @@ mesh = P4estMesh(trees_per_dimension, coordinates_min = coordinates_min, coordinates_max = coordinates_max, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec_float32.jl b/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec_float32.jl index e37e8d4643e..2123d99f525 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec_float32.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec_float32.jl @@ -35,7 +35,8 @@ mesh = P4estMesh(trees_per_dimension, coordinates_min = coordinates_min, coordinates_max = coordinates_max, periodicity = true, RealT = Float32) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl b/examples/p4est_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl index fb9a7b8c80c..e5caca5f998 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl @@ -10,16 +10,16 @@ initial_condition = initial_condition_convergence_test source_terms = source_terms_convergence_test -# BCs must be passed as Dict +# Boundary conditions are specified as a NamedTuple boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition,) # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of # `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`. # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) diff --git a/examples/p4est_2d_dgsem/elixir_euler_subsonic_constant.jl b/examples/p4est_2d_dgsem/elixir_euler_subsonic_constant.jl index 9f431220198..41d08f0027c 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_subsonic_constant.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_subsonic_constant.jl @@ -64,10 +64,10 @@ initial_condition = initial_condition_subsonic return flux(u_surface, normal_direction, equations) end -boundary_conditions = Dict(:x_neg => boundary_condition_outflow_general, - :x_pos => boundary_condition_outflow_general, - :y_neg => boundary_condition_outflow_general, - :y_pos => boundary_condition_outflow_general) +boundary_conditions = (; x_neg = boundary_condition_outflow_general, + x_pos = boundary_condition_outflow_general, + y_neg = boundary_condition_outflow_general, + y_pos = boundary_condition_outflow_general) coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) @@ -79,7 +79,7 @@ mesh = P4estMesh(trees_per_dimension, polydeg = polydeg, initial_refinement_level = 3, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_subsonic_cylinder.jl b/examples/p4est_2d_dgsem/elixir_euler_subsonic_cylinder.jl index 253cb0bf3a7..331404eb21b 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_subsonic_cylinder.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_subsonic_cylinder.jl @@ -26,7 +26,7 @@ volume_flux = flux_ranocha_turbo # FluxRotated(flux_chandrashekar) can also be u # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) @@ -71,10 +71,10 @@ mesh = P4estMesh(cells_per_dimension, mapping = mapping2cylinder, polydeg = poly return surface_flux_function(u_inner, u_boundary, normal_direction, equations) end -boundary_conditions = Dict(:x_neg => boundary_condition_slip_wall, - :x_pos => boundary_condition_subsonic_constant) +boundary_conditions = (; x_neg = boundary_condition_slip_wall, + x_pos = boundary_condition_subsonic_constant) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl b/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl index a03e2b083b6..735889a23ed 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl @@ -54,11 +54,11 @@ end return flux(u_inner, normal_direction, equations) end -boundary_conditions = Dict(:Bottom => boundary_condition_slip_wall, - :Circle => boundary_condition_slip_wall, - :Top => boundary_condition_slip_wall, - :Right => boundary_condition_outflow, - :Left => boundary_condition_supersonic_inflow) +boundary_conditions = (; Bottom = boundary_condition_slip_wall, + Circle = boundary_condition_slip_wall, + Top = boundary_condition_slip_wall, + Right = boundary_condition_outflow, + Left = boundary_condition_supersonic_inflow) volume_flux = flux_ranocha_turbo # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of @@ -66,7 +66,7 @@ volume_flux = flux_ranocha_turbo # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) @@ -89,7 +89,7 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = P4estMesh{2}(mesh_file) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder_scO2.jl b/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder_scO2.jl index db0ba5e2704..21a90529a0d 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder_scO2.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder_scO2.jl @@ -52,11 +52,11 @@ end return flux(u_inner, normal_direction, equations) end -boundary_conditions = Dict(:Bottom => boundary_condition_slip_wall, - :Circle => boundary_condition_slip_wall, - :Top => boundary_condition_slip_wall, - :Right => boundary_condition_outflow, - :Left => boundary_condition_supersonic_inflow) +boundary_conditions = (; Bottom = boundary_condition_slip_wall, + Circle = boundary_condition_slip_wall, + Top = boundary_condition_slip_wall, + Right = boundary_condition_outflow, + Left = boundary_condition_supersonic_inflow) volume_flux = flux_ranocha_turbo surface_flux = flux_lax_friedrichs @@ -82,7 +82,7 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = P4estMesh{2}(mesh_file) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder_sc_subcell.jl b/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder_sc_subcell.jl index a7dfeffa510..ddba0fb4117 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder_sc_subcell.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder_sc_subcell.jl @@ -89,11 +89,11 @@ end u_inner[4]) end -boundary_conditions = Dict(:Bottom => boundary_condition_slip_wall, - :Circle => boundary_condition_slip_wall, - :Top => boundary_condition_slip_wall, - :Right => boundary_condition_outflow, - :Left => boundary_condition_supersonic_inflow) +boundary_conditions = (; Bottom = boundary_condition_slip_wall, + Circle = boundary_condition_slip_wall, + Top = boundary_condition_slip_wall, + Right = boundary_condition_outflow, + Left = boundary_condition_supersonic_inflow) volume_flux = flux_ranocha_turbo # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of @@ -101,7 +101,7 @@ volume_flux = flux_ranocha_turbo # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) polydeg = 3 @@ -124,7 +124,7 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = P4estMesh{2}(mesh_file) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl index 9579153eb93..9d4cde10718 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl @@ -24,13 +24,13 @@ end initial_condition = uniform_flow_state boundary_condition_uniform_flow = BoundaryConditionDirichlet(uniform_flow_state) -boundary_conditions = Dict(:Body => boundary_condition_uniform_flow, - :Button1 => boundary_condition_slip_wall, - :Button2 => boundary_condition_slip_wall, - :Eye1 => boundary_condition_slip_wall, - :Eye2 => boundary_condition_slip_wall, - :Smile => boundary_condition_slip_wall, - :Bowtie => boundary_condition_slip_wall) +boundary_conditions = (; Body = boundary_condition_uniform_flow, + Button1 = boundary_condition_slip_wall, + Button2 = boundary_condition_slip_wall, + Eye1 = boundary_condition_slip_wall, + Eye2 = boundary_condition_slip_wall, + Smile = boundary_condition_slip_wall, + Bowtie = boundary_condition_slip_wall) volume_flux = flux_ranocha # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of @@ -38,7 +38,7 @@ volume_flux = flux_ranocha # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 5, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) @@ -49,7 +49,7 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = P4estMesh{2}(mesh_file) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_euler_weak_blast_wave_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_weak_blast_wave_amr.jl index 24f54ec69f7..279ea5239d9 100644 --- a/examples/p4est_2d_dgsem/elixir_euler_weak_blast_wave_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_euler_weak_blast_wave_amr.jl @@ -73,7 +73,8 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 4, mapping = mapping_twist, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_eulergravity_convergence.jl b/examples/p4est_2d_dgsem/elixir_eulergravity_convergence.jl index b128f245195..a0d2cd53e2a 100644 --- a/examples/p4est_2d_dgsem/elixir_eulergravity_convergence.jl +++ b/examples/p4est_2d_dgsem/elixir_eulergravity_convergence.jl @@ -17,11 +17,13 @@ coordinates_max = (2.0, 2.0) trees_per_dimension = (1, 1) mesh = P4estMesh(trees_per_dimension, polydeg = 1, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 2) + initial_refinement_level = 2, + periodicity = true) semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, - solver_euler, - source_terms = source_terms_eoc_test_coupled_euler_gravity) + solver_euler; + source_terms = source_terms_eoc_test_coupled_euler_gravity, + boundary_conditions = boundary_condition_periodic) ############################################################################### # semidiscretization of the hyperbolic diffusion equations @@ -32,13 +34,14 @@ equations_gravity = HyperbolicDiffusionEquations2D() # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver_gravity = DGSEM(polydeg, FluxLaxFriedrichs(max_abs_speed_naive)) semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, - solver_gravity, - source_terms = source_terms_harmonic) + solver_gravity; + source_terms = source_terms_harmonic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # combining both semidiscretizations for Euler + self-gravity diff --git a/examples/p4est_2d_dgsem/elixir_eulermulti_shock.jl b/examples/p4est_2d_dgsem/elixir_eulermulti_shock.jl index 53564b28c4a..1072400dcc9 100644 --- a/examples/p4est_2d_dgsem/elixir_eulermulti_shock.jl +++ b/examples/p4est_2d_dgsem/elixir_eulermulti_shock.jl @@ -78,10 +78,10 @@ function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, return flux(u_inner, normal_direction, equations) end -boundary_conditions = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition), - :x_pos => boundary_condition_outflow) +boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition), + x_pos = boundary_condition_outflow) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_linearizedeuler_gaussian_source.jl b/examples/p4est_2d_dgsem/elixir_linearizedeuler_gaussian_source.jl index 47a0bcc782d..386cfb1a922 100644 --- a/examples/p4est_2d_dgsem/elixir_linearizedeuler_gaussian_source.jl +++ b/examples/p4est_2d_dgsem/elixir_linearizedeuler_gaussian_source.jl @@ -50,8 +50,9 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 1, periodicity = true, initial_refinement_level = 2) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_gauss) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_gauss, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl index d4f3a1c0cda..fb6f3424d06 100644 --- a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -24,7 +24,8 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl index af857f5dfaf..14443cd36bc 100644 --- a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl +++ b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl @@ -46,7 +46,8 @@ refine_fn_c = @cfunction(refine_fn, Cint, Ptr{Trixi.p4est_quadrant_t})) Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl b/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl index c3c54aa24b6..d95ca4fc7fd 100644 --- a/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl @@ -48,7 +48,7 @@ initial_condition = initial_condition_rotor # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) @@ -83,9 +83,9 @@ mesh = P4estMesh{2}(mesh_file, initial_refinement_level = 1) boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_mhd_rotor_cfl_ramp.jl b/examples/p4est_2d_dgsem/elixir_mhd_rotor_cfl_ramp.jl index 1d7da07578f..f7673eabf03 100644 --- a/examples/p4est_2d_dgsem/elixir_mhd_rotor_cfl_ramp.jl +++ b/examples/p4est_2d_dgsem/elixir_mhd_rotor_cfl_ramp.jl @@ -48,7 +48,7 @@ initial_condition = initial_condition_rotor # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) @@ -83,9 +83,9 @@ mesh = P4estMesh{2}(mesh_file, initial_refinement_level = 1) boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_NACA0012airfoil_mach08.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_NACA0012airfoil_mach08.jl index 01364e8ca4e..a86d8f2958c 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_NACA0012airfoil_mach08.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_NACA0012airfoil_mach08.jl @@ -51,7 +51,7 @@ initial_condition = initial_condition_mach08_flow # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) @@ -76,12 +76,12 @@ mesh = P4estMesh{2}(mesh_file, initial_refinement_level = 1) return flux_hll(u_inner, u_boundary, normal_direction, equations) end -boundary_conditions = Dict(:Left => boundary_condition_subsonic_constant, - :Right => boundary_condition_subsonic_constant, - :Top => boundary_condition_subsonic_constant, - :Bottom => boundary_condition_subsonic_constant, - :AirfoilBottom => boundary_condition_slip_wall, - :AirfoilTop => boundary_condition_slip_wall) +boundary_conditions = (; Left = boundary_condition_subsonic_constant, + Right = boundary_condition_subsonic_constant, + Top = boundary_condition_subsonic_constant, + Bottom = boundary_condition_subsonic_constant, + AirfoilBottom = boundary_condition_slip_wall, + AirfoilTop = boundary_condition_slip_wall) velocity_airfoil = NoSlip((x, t, equations_parabolic) -> SVector(0.0, 0.0)) @@ -104,12 +104,12 @@ heat_bc_square = Adiabatic((x, t, equations_parabolic) -> 0.0) boundary_condition_square = BoundaryConditionNavierStokesWall(velocity_bc_square, heat_bc_square) -boundary_conditions_parabolic = Dict(:Left => boundary_condition_square, - :Right => boundary_condition_square, - :Top => boundary_condition_square, - :Bottom => boundary_condition_square, - :AirfoilBottom => boundary_conditions_airfoil, - :AirfoilTop => boundary_conditions_airfoil) +boundary_conditions_parabolic = (; Left = boundary_condition_square, + Right = boundary_condition_square, + Top = boundary_condition_square, + Bottom = boundary_condition_square, + AirfoilBottom = boundary_conditions_airfoil, + AirfoilTop = boundary_conditions_airfoil) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_NACA0012airfoil_mach085_restart.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_NACA0012airfoil_mach085_restart.jl index 7d986af29c2..1988189ed66 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_NACA0012airfoil_mach085_restart.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_NACA0012airfoil_mach085_restart.jl @@ -1,7 +1,7 @@ using Trixi ############################################################################### -# This example shows that one can restart a hyperbolic-parabolic simulation from +# This example shows that one can restart a hyperbolic-parabolic simulation from # a purely hyperbolic simulation/restart file. base_elixir = "elixir_euler_NACA0012airfoil_mach085.jl" @@ -29,19 +29,19 @@ boundary_condition_airfoil = BoundaryConditionNavierStokesWall(velocity_bc_airfo boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition) -boundary_conditions_hyp = Dict(:Left => boundary_condition_free_stream, - :Right => boundary_condition_free_stream, - :Top => boundary_condition_free_stream, - :Bottom => boundary_condition_free_stream, - :AirfoilBottom => boundary_condition_slip_wall, - :AirfoilTop => boundary_condition_slip_wall) - -boundary_conditions_para = Dict(:Left => boundary_condition_free_stream, - :Right => boundary_condition_free_stream, - :Top => boundary_condition_free_stream, - :Bottom => boundary_condition_free_stream, - :AirfoilBottom => boundary_condition_airfoil, - :AirfoilTop => boundary_condition_airfoil) +boundary_conditions_hyp = (; Left = boundary_condition_free_stream, + Right = boundary_condition_free_stream, + Top = boundary_condition_free_stream, + Bottom = boundary_condition_free_stream, + AirfoilBottom = boundary_condition_slip_wall, + AirfoilTop = boundary_condition_slip_wall) + +boundary_conditions_para = (; Left = boundary_condition_free_stream, + Right = boundary_condition_free_stream, + Top = boundary_condition_free_stream, + Bottom = boundary_condition_free_stream, + AirfoilBottom = boundary_condition_airfoil, + AirfoilTop = boundary_condition_airfoil) restart_file = "restart_000000584.h5" restart_filename = joinpath("out", restart_file) diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_SD7003airfoil.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_SD7003airfoil.jl index bc8f7e8fccb..61639098390 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_SD7003airfoil.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_SD7003airfoil.jl @@ -64,11 +64,11 @@ velocity_bc_airfoil = NoSlip((x, t, equations) -> SVector(0.0, 0.0)) heat_bc = Adiabatic((x, t, equations) -> 0.0) boundary_condition_airfoil = BoundaryConditionNavierStokesWall(velocity_bc_airfoil, heat_bc) -boundary_conditions_hyp = Dict(:FarField => boundary_condition_free_stream, - :Airfoil => boundary_condition_slip_wall) +boundary_conditions_hyp = (; FarField = boundary_condition_free_stream, + Airfoil = boundary_condition_slip_wall) -boundary_conditions_para = Dict(:FarField => boundary_condition_free_stream, - :Airfoil => boundary_condition_airfoil) +boundary_conditions_para = (; FarField = boundary_condition_free_stream, + Airfoil = boundary_condition_airfoil) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_blast_reflective.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_blast_reflective.jl index a8af5a263e3..e5c50b058be 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_blast_reflective.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_blast_reflective.jl @@ -50,10 +50,10 @@ solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, volume_integral = volume_integral) # Realize reflective walls via slip walls which permit only tangential velocity -boundary_conditions = Dict(:x_neg => boundary_condition_slip_wall, - :y_neg => boundary_condition_slip_wall, - :y_pos => boundary_condition_slip_wall, - :x_pos => boundary_condition_slip_wall) +boundary_conditions = (; x_neg = boundary_condition_slip_wall, + y_neg = boundary_condition_slip_wall, + y_pos = boundary_condition_slip_wall, + x_pos = boundary_condition_slip_wall) # The "Slip" boundary condition rotates all velocities into tangential direction # and thus acts as a reflective wall here. @@ -61,10 +61,10 @@ velocity_bc = Slip() heat_bc = Adiabatic((x, t, equations_parabolic) -> zero(eltype(x))) boundary_conditions_visc = BoundaryConditionNavierStokesWall(velocity_bc, heat_bc) -boundary_conditions_parabolic = Dict(:x_neg => boundary_conditions_visc, - :x_pos => boundary_conditions_visc, - :y_neg => boundary_conditions_visc, - :y_pos => boundary_conditions_visc) +boundary_conditions_parabolic = (; x_neg = boundary_conditions_visc, + x_pos = boundary_conditions_visc, + y_neg = boundary_conditions_visc, + y_pos = boundary_conditions_visc) ############################################################################### diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl index 2e69ca790c2..11ae50eec90 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl @@ -19,7 +19,7 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -196,12 +196,12 @@ boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_to heat_bc_top_bottom) # define inviscid boundary conditions -boundary_conditions = Dict(:y_neg => boundary_condition_slip_wall, - :y_pos => boundary_condition_slip_wall) +boundary_conditions = (; y_neg = boundary_condition_slip_wall, + y_pos = boundary_condition_slip_wall) # define viscous boundary conditions -boundary_conditions_parabolic = Dict(:y_neg => boundary_condition_top_bottom, - :y_pos => boundary_condition_top_bottom) +boundary_conditions_parabolic = (; y_neg = boundary_condition_top_bottom, + y_pos = boundary_condition_top_bottom) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl index 9405d016ddb..a5025116087 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl @@ -19,7 +19,7 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -198,16 +198,16 @@ boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_to boundary_condition_left_right = BoundaryConditionDirichlet(initial_condition_navier_stokes_convergence_test) # define inviscid boundary conditions -boundary_conditions = Dict(:x_neg => boundary_condition_left_right, - :x_pos => boundary_condition_left_right, - :y_neg => boundary_condition_slip_wall, - :y_pos => boundary_condition_slip_wall) +boundary_conditions = (; x_neg = boundary_condition_left_right, + x_pos = boundary_condition_left_right, + y_neg = boundary_condition_slip_wall, + y_pos = boundary_condition_slip_wall) # define viscous boundary conditions -boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_left_right, - :x_pos => boundary_condition_left_right, - :y_neg => boundary_condition_top_bottom, - :y_pos => boundary_condition_top_bottom) +boundary_conditions_parabolic = (; x_neg = boundary_condition_left_right, + x_pos = boundary_condition_left_right, + y_neg = boundary_condition_top_bottom, + y_pos = boundary_condition_top_bottom) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_couette_flow.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_couette_flow.jl index bb2828f39ef..3edb8aef537 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_couette_flow.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_couette_flow.jl @@ -56,11 +56,11 @@ function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x end ### Hyperbolic boundary conditions ### -bs_hyperbolic = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition), # Weakly enforced inflow BC - :x_pos => boundary_condition_outflow, # Free outflow/extended domain - # Top/Bottom of channel: Walls - :y_neg => boundary_condition_slip_wall, - :y_pos => boundary_condition_slip_wall) +bs_hyperbolic = (; x_neg = BoundaryConditionDirichlet(initial_condition), # Weakly enforced inflow BC + x_pos = boundary_condition_outflow, # Free outflow/extended domain + # Top/Bottom of channel: Walls + y_neg = boundary_condition_slip_wall, + y_pos = boundary_condition_slip_wall) ### Parabolic boundary conditions ### @@ -96,15 +96,15 @@ end return flux_inner end -bcs_parabolic = Dict(:x_neg => bc_parabolic_top_left, - :x_pos => boundary_condition_copy, - :y_neg => boundary_condition_bottom, - :y_pos => bc_parabolic_top_left) +bcs_parabolic = (; x_neg = bc_parabolic_top_left, + x_pos = boundary_condition_copy, + y_neg = boundary_condition_bottom, + y_pos = bc_parabolic_top_left) solver = DGSEM(polydeg = 3, surface_flux = flux_hll) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver, + initial_condition, solver; boundary_conditions = (bs_hyperbolic, bcs_parabolic)) diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_freestream_ldg.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_freestream_ldg.jl index 62db2875e7d..a5280d1a3e8 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_freestream_ldg.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_freestream_ldg.jl @@ -51,7 +51,7 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/a075f8 # Map the unstructured mesh with the mapping above mesh = P4estMesh{2}(mesh_file, mapping = mapping, polydeg = polydeg) -boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; all = BoundaryConditionDirichlet(initial_condition)) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_freestream_symmetry.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_freestream_symmetry.jl index 05855fdf5d3..c97d4c5ac12 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_freestream_symmetry.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_freestream_symmetry.jl @@ -32,8 +32,8 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 1, coordinates_min = coordinates_min, coordinates_max = coordinates_max, periodicity = (false, true)) -boundary_conditions = Dict(:x_neg => boundary_condition_slip_wall, - :x_pos => boundary_condition_slip_wall) +boundary_conditions = (; x_neg = boundary_condition_slip_wall, + x_pos = boundary_condition_slip_wall) # The "Slip" boundary condition rotates all velocities into tangential direction # and thus acts as a symmetry plane. @@ -42,8 +42,8 @@ heat_bc = Adiabatic((x, t, equations_parabolic) -> zero(eltype(x))) boundary_condition_y = BoundaryConditionNavierStokesWall(velocity_bc, heat_bc) -boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_y, - :x_pos => boundary_condition_y) +boundary_conditions_parabolic = (; x_neg = boundary_condition_y, + x_pos = boundary_condition_y) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl index 85042f0f456..1c0839a81a6 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl @@ -18,7 +18,7 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu, # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -48,15 +48,15 @@ heat_bc = Adiabatic((x, t, equations_parabolic) -> 0.0) boundary_condition_lid = BoundaryConditionNavierStokesWall(velocity_bc_lid, heat_bc) boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity, heat_bc) -boundary_conditions = Dict(:x_neg => boundary_condition_slip_wall, - :y_neg => boundary_condition_slip_wall, - :y_pos => boundary_condition_slip_wall, - :x_pos => boundary_condition_slip_wall) +boundary_conditions = (; x_neg = boundary_condition_slip_wall, + y_neg = boundary_condition_slip_wall, + y_pos = boundary_condition_slip_wall, + x_pos = boundary_condition_slip_wall) -boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_cavity, - :y_neg => boundary_condition_cavity, - :y_pos => boundary_condition_lid, - :x_pos => boundary_condition_cavity) +boundary_conditions_parabolic = (; x_neg = boundary_condition_cavity, + y_neg = boundary_condition_cavity, + y_pos = boundary_condition_lid, + x_pos = boundary_condition_cavity) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), @@ -75,7 +75,7 @@ summary_callback = SummaryCallback() alive_callback = AliveCallback(alive_interval = 100) analysis_interval = 100 analysis_callback = AnalysisCallback(semi, interval = analysis_interval) -callbacks = CallbackSet(summary_callback, alive_callback) +callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback) ############################################################################### # run the simulation diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity_amr.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity_amr.jl index 3b787039708..3b16e731ffd 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity_amr.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity_amr.jl @@ -18,7 +18,7 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu, # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -48,15 +48,15 @@ heat_bc = Adiabatic((x, t, equations_parabolic) -> 0.0) boundary_condition_lid = BoundaryConditionNavierStokesWall(velocity_bc_lid, heat_bc) boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity, heat_bc) -boundary_conditions = Dict(:x_neg => boundary_condition_slip_wall, - :y_neg => boundary_condition_slip_wall, - :y_pos => boundary_condition_slip_wall, - :x_pos => boundary_condition_slip_wall) +boundary_conditions = (; x_neg = boundary_condition_slip_wall, + y_neg = boundary_condition_slip_wall, + y_pos = boundary_condition_slip_wall, + x_pos = boundary_condition_slip_wall) -boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_cavity, - :y_neg => boundary_condition_cavity, - :y_pos => boundary_condition_lid, - :x_pos => boundary_condition_cavity) +boundary_conditions_parabolic = (; x_neg = boundary_condition_cavity, + y_neg = boundary_condition_cavity, + y_pos = boundary_condition_lid, + x_pos = boundary_condition_cavity) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_poiseuille_flow.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_poiseuille_flow.jl index ddbb48ddf51..55ad57d0167 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_poiseuille_flow.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_poiseuille_flow.jl @@ -58,11 +58,11 @@ function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x end ### Hyperbolic boundary conditions ### -bs_hyperbolic = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition), # Weakly enforced inflow BC - :x_pos => boundary_condition_outflow, # Free outflow/extended domain - # Top/Bottom of channel: Walls - :y_neg => boundary_condition_slip_wall, - :y_pos => boundary_condition_slip_wall) +bs_hyperbolic = (; x_neg = BoundaryConditionDirichlet(initial_condition), # Weakly enforced inflow BC + x_pos = boundary_condition_outflow, # Free outflow/extended domain + # Top/Bottom of channel: Walls + y_neg = boundary_condition_slip_wall, + y_pos = boundary_condition_slip_wall) ### Parabolic boundary conditions ### @@ -96,16 +96,16 @@ end return flux_inner end -bcs_parabolic = Dict(:x_neg => bc_parabolic_inflow, - :x_pos => boundary_condition_copy, - # Top/Bottom of channel: Walls - :y_neg => boundary_condition_wall, - :y_pos => boundary_condition_wall) +bcs_parabolic = (; x_neg = bc_parabolic_inflow, + x_pos = boundary_condition_copy, + # Top/Bottom of channel: Walls + y_neg = boundary_condition_wall, + y_pos = boundary_condition_wall) solver = DGSEM(polydeg = 3, surface_flux = flux_hll) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver, + initial_condition, solver; boundary_conditions = (bs_hyperbolic, bcs_parabolic)) diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_viscous_shock.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_viscous_shock.jl index 42e2e259d04..9c6c980dfcf 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_viscous_shock.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_viscous_shock.jl @@ -123,8 +123,8 @@ function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x return flux(u_inner, normal_direction, equations) end -boundary_conditions = Dict(:x_neg => boundary_condition_inflow, - :x_pos => boundary_condition_outflow) +boundary_conditions = (; x_neg = boundary_condition_inflow, + x_pos = boundary_condition_outflow) ### Viscous boundary conditions ### # For the viscous BCs, we use the known analytical solution @@ -140,8 +140,8 @@ end boundary_condition_parabolic = BoundaryConditionNavierStokesWall(velocity_bc, heat_bc) -boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_parabolic, - :x_pos => boundary_condition_parabolic) +boundary_conditions_parabolic = (; x_neg = boundary_condition_parabolic, + x_pos = boundary_condition_parabolic) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_viscous_shock_newton_krylov.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_viscous_shock_newton_krylov.jl index c9f5e074f3c..3977a3f6230 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_viscous_shock_newton_krylov.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_viscous_shock_newton_krylov.jl @@ -118,8 +118,8 @@ function boundary_condition_inflow(u_inner, normal_direction::AbstractVector, x, return flux(u_cons, normal_direction, equations) end -boundary_conditions = Dict(:x_neg => boundary_condition_inflow, - :x_pos => boundary_condition_do_nothing) +boundary_conditions = (; x_neg = boundary_condition_inflow, + x_pos = boundary_condition_do_nothing) ### Viscous boundary conditions ### # For the viscous BCs, we use the known analytical solution @@ -135,8 +135,8 @@ end boundary_condition_parabolic = BoundaryConditionNavierStokesWall(velocity_bc, heat_bc) -boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_parabolic, - :x_pos => boundary_condition_parabolic) +boundary_conditions_parabolic = (; x_neg = boundary_condition_parabolic, + x_pos = boundary_condition_parabolic) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_vortex_street.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_vortex_street.jl index 4bf9d0c3ec4..c206202af03 100644 --- a/examples/p4est_2d_dgsem/elixir_navierstokes_vortex_street.jl +++ b/examples/p4est_2d_dgsem/elixir_navierstokes_vortex_street.jl @@ -53,14 +53,14 @@ bc_freestream = BoundaryConditionDirichlet(initial_condition) # Since this mesh is been generated using the symmetry feature of # HOHQMesh.jl (https://trixi-framework.github.io/HOHQMesh.jl/stable/tutorials/symmetric_mesh/) # the mirrored boundaries are named with a "_R" suffix. -boundary_conditions = Dict(:Circle => boundary_condition_slip_wall, # top half of the cylinder - :Circle_R => boundary_condition_slip_wall, # bottom half of the cylinder - :Top => bc_freestream, - :Top_R => bc_freestream, # aka bottom - :Right => bc_freestream, - :Right_R => bc_freestream, - :Left => bc_freestream, - :Left_R => bc_freestream) +boundary_conditions = (; Circle = boundary_condition_slip_wall, # top half of the cylinder + Circle_R = boundary_condition_slip_wall, # bottom half of the cylinder + Top = bc_freestream, + Top_R = bc_freestream, # aka bottom + Right = bc_freestream, + Right_R = bc_freestream, + Left = bc_freestream, + Left_R = bc_freestream) # Parabolic boundary conditions velocity_bc_free = NoSlip((x, t, equations) -> SVector(v_in, 0)) @@ -73,19 +73,19 @@ heat_bc_cylinder = Adiabatic((x, t, equations) -> 0) boundary_condition_cylinder = BoundaryConditionNavierStokesWall(velocity_bc_cylinder, heat_bc_cylinder) -boundary_conditions_para = Dict(:Circle => boundary_condition_cylinder, # top half of the cylinder - :Circle_R => boundary_condition_cylinder, # bottom half of the cylinder - :Top => boundary_condition_free, - :Top_R => boundary_condition_free, # aka bottom - :Right => boundary_condition_free, - :Right_R => boundary_condition_free, - :Left => boundary_condition_free, - :Left_R => boundary_condition_free) +boundary_conditions_para = (; Circle = boundary_condition_cylinder, # top half of the cylinder + Circle_R = boundary_condition_cylinder, # bottom half of the cylinder + Top = boundary_condition_free, + Top_R = boundary_condition_free, # aka bottom + Right = boundary_condition_free, + :Right_R => boundary_condition_free, + :Left => boundary_condition_free, + :Left_R => boundary_condition_free) # Standard DGSEM sufficient here solver = DGSEM(polydeg = 3, surface_flux = flux_hll) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver, + initial_condition, solver; boundary_conditions = (boundary_conditions, boundary_conditions_para)) @@ -105,7 +105,7 @@ alive_callback = AliveCallback(analysis_interval = analysis_interval) # Add `:vorticity` to `extra_node_variables` tuple ... extra_node_variables = (:vorticity,) -# ... and specify the function `get_node_variable` for this symbol, +# ... and specify the function `get_node_variable` for this symbol, # with first argument matching the symbol (turned into a type via `Val`) for dispatching. # Note that for parabolic(-extended) equations, `equations_parabolic` and `cache_parabolic` # must be declared as the last two arguments of the function to match the expected signature. diff --git a/examples/p4est_3d_dgsem/elixir_advection_amr.jl b/examples/p4est_3d_dgsem/elixir_advection_amr.jl index 94b987d53b5..f10f393baea 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_amr.jl @@ -22,9 +22,11 @@ trees_per_dimension = (1, 1, 1) # See https://doi.org/10.1007/s10915-018-00897-9, Section 6. mesh = P4estMesh(trees_per_dimension, polydeg = 1, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 4) + initial_refinement_level = 4, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_advection_amr_unstructured_curved.jl b/examples/p4est_3d_dgsem/elixir_advection_amr_unstructured_curved.jl index b6abd450f34..d83f7405c85 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_amr_unstructured_curved.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_amr_unstructured_curved.jl @@ -15,7 +15,7 @@ solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs) initial_condition = initial_condition_gauss boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) # Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping. # The mapping will be interpolated at tree level, and then refined without changing @@ -55,7 +55,7 @@ mesh = P4estMesh{3}(mesh_file, polydeg = 2, mapping = mapping, initial_refinement_level = 1) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_advection_basic.jl b/examples/p4est_3d_dgsem/elixir_advection_basic.jl index 59ec1274ab5..80f4016cfcd 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_basic.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_basic.jl @@ -20,11 +20,13 @@ coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z)) trees_per_dimension = (4, 4, 4) mesh = P4estMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 1) + initial_refinement_level = 1, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_advection_cubed_sphere.jl b/examples/p4est_3d_dgsem/elixir_advection_cubed_sphere.jl index ec2f1f8f5f6..89b11201bf4 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_cubed_sphere.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_cubed_sphere.jl @@ -13,8 +13,8 @@ solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:inside => boundary_condition, - :outside => boundary_condition) +boundary_conditions = (; inside = boundary_condition, + outside = boundary_condition) trees_per_face_dim = 5 # number of trees in the first two local dimensions of each face sphere_layers = 3 # number of trees in the third local dimension of each face @@ -25,7 +25,7 @@ mesh = P4estMeshCubedSphere(trees_per_face_dim, sphere_layers, polydeg = 3) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl b/examples/p4est_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl index 3157ad4e345..0005b08aaa3 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl @@ -53,8 +53,7 @@ function initial_condition_eriksson_johnson(x, t, equations) end initial_condition = initial_condition_eriksson_johnson -boundary_conditions = boundary_condition_default(mesh, - BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), diff --git a/examples/p4est_3d_dgsem/elixir_advection_nonconforming.jl b/examples/p4est_3d_dgsem/elixir_advection_nonconforming.jl index f540f289c2d..e0c859e51cb 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_nonconforming.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_nonconforming.jl @@ -19,7 +19,8 @@ trees_per_dimension = (1, 1, 1) # See https://doi.org/10.1007/s10915-018-00897-9, Section 6. mesh = P4estMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 2) + initial_refinement_level = 2, + periodicity = true) # Refine bottom left quadrant of each tree to level 3 function refine_fn(p8est, which_tree, quadrant) @@ -43,7 +44,8 @@ Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_advection_restart.jl b/examples/p4est_3d_dgsem/elixir_advection_restart.jl index 230f7483aeb..205adc2afa0 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_restart.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_restart.jl @@ -18,7 +18,8 @@ restart_filename = joinpath("out", "restart_000000010.h5") mesh = load_mesh(restart_filename) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) tspan = (load_time(restart_filename), 2.0) dt = load_dt(restart_filename) diff --git a/examples/p4est_3d_dgsem/elixir_advection_unstructured_curved.jl b/examples/p4est_3d_dgsem/elixir_advection_unstructured_curved.jl index 958c6cbb9c1..dd5c69f9216 100644 --- a/examples/p4est_3d_dgsem/elixir_advection_unstructured_curved.jl +++ b/examples/p4est_3d_dgsem/elixir_advection_unstructured_curved.jl @@ -13,7 +13,7 @@ solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) # Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping. # The mapping will be interpolated at tree level, and then refined without changing @@ -52,7 +52,7 @@ mesh = P4estMesh{3}(mesh_file, polydeg = 3, initial_refinement_level = 2) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_euler_ONERA_M6_wing.jl b/examples/p4est_3d_dgsem/elixir_euler_ONERA_M6_wing.jl index 0753a8071e4..ff0b1b36880 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_ONERA_M6_wing.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_ONERA_M6_wing.jl @@ -9,12 +9,12 @@ equations = CompressibleEulerEquations3D(1.4) ### Inviscid transonic flow over the ONERA M6 wing ### # See for reference -# +# # https://www.grc.nasa.gov/www/wind/valid/m6wing/m6wing.html # https://www.grc.nasa.gov/www/wind/valid/m6wing/m6wing01/m6wing01.html # # which are test cases for the viscous flow. -# +# # A tutorial for the invscid case can be found for the SU2 Code (https://github.com/su2code/SU2): # https://su2code.github.io/tutorials/Inviscid_ONERAM6/ @@ -37,7 +37,7 @@ end bc_farfield = BoundaryConditionDirichlet(initial_condition) -# Ensure that rho and p are the same across symmetry line and allow only +# Ensure that rho and p are the same across symmetry line and allow only # tangential velocity. # Somewhat naive implementation of `boundary_condition_slip_wall`. # Used here to avoid confusion between wing (body) and symmetry plane. @@ -70,7 +70,7 @@ basis = LobattoLegendreBasis(polydeg) # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -84,7 +84,7 @@ solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, # This is a sanitized mesh obtained from the original mesh available at # https://www.grc.nasa.gov/www/wind/valid/m6wing/m6wing01/m6wing01.html # -# which has been merged into a single gmsh mesh file by the HiSA team, +# which has been merged into a single gmsh mesh file by the HiSA team, # see the case description (for the viscous case, but the mesh is the same) # https://hisa.gitlab.io/archive/nparc/oneraM6/notes/oneraM6.html # @@ -100,10 +100,10 @@ mesh_file = Trixi.download("https://github.com/DanielDoehring/AerodynamicMeshes/ boundary_symbols = [:Symmetry, :FarField, :BottomWing, :TopWing] mesh = P4estMesh{3}(mesh_file; polydeg = polydeg, boundary_symbols = boundary_symbols) -boundary_conditions = Dict(:Symmetry => bc_symmetry, # Could use `boundary_condition_slip_wall` here as well - :FarField => bc_farfield, - :BottomWing => boundary_condition_slip_wall, - :TopWing => boundary_condition_slip_wall) +boundary_conditions = (; Symmetry = bc_symmetry, # Could use `boundary_condition_slip_wall` here as well + FarField = bc_farfield, + BottomWing = boundary_condition_slip_wall, + TopWing = boundary_condition_slip_wall) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) diff --git a/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl b/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl index 57f8569aff2..daa758d1f9b 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl @@ -217,8 +217,8 @@ end initial_condition = initial_condition_baroclinic_instability -boundary_conditions = Dict(:inside => boundary_condition_slip_wall, - :outside => boundary_condition_slip_wall) +boundary_conditions = (; inside = boundary_condition_slip_wall, + outside = boundary_condition_slip_wall) # This is a good estimate for the speed of sound in this example. # Other values between 300 and 400 should work as well. diff --git a/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl b/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl index e7da07e4e41..ed93bae6e8c 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl @@ -76,8 +76,8 @@ end initial_condition = initial_condition_circular_wind -boundary_conditions = Dict(:inside => boundary_condition_slip_wall, - :outside => boundary_condition_slip_wall) +boundary_conditions = (; inside = boundary_condition_slip_wall, + outside = boundary_condition_slip_wall) # The speed of sound in this example is 374 m/s. surface_flux = FluxLMARS(374) diff --git a/examples/p4est_3d_dgsem/elixir_euler_ec.jl b/examples/p4est_3d_dgsem/elixir_euler_ec.jl index 11dfeeb92f1..63e1b695698 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_ec.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_ec.jl @@ -8,7 +8,7 @@ equations = CompressibleEulerEquations3D(5 / 3) initial_condition = initial_condition_weak_blast_wave -boundary_conditions = Dict(:all => boundary_condition_slip_wall) +boundary_conditions = (; all = boundary_condition_slip_wall) # Get the DG approximation space @@ -52,7 +52,7 @@ mesh = P4estMesh{3}(mesh_file, polydeg = 5, # create the semidiscretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_euler_free_stream.jl b/examples/p4est_3d_dgsem/elixir_euler_free_stream.jl index 9db4563eb0a..fcb3e6285ea 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_free_stream.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_free_stream.jl @@ -8,7 +8,7 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_constant -boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; all = BoundaryConditionDirichlet(initial_condition)) # Solver with polydeg=4 to ensure free stream preservation (FSP) on non-conforming meshes. # The polydeg of the solver must be at least twice as big as the polydeg of the mesh. @@ -19,7 +19,7 @@ boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition) # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 4, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -80,7 +80,7 @@ refine_fn_c = @cfunction(refine_fn, Cint, Ptr{Trixi.p8est_quadrant_t})) Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries.jl b/examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries.jl index f748448abca..2c171b9e382 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries.jl @@ -14,7 +14,7 @@ polydeg = 3 # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = polydeg, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -31,10 +31,10 @@ boundary_symbols = [:PhysicalSurface1, :PhysicalSurface2] mesh = P4estMesh{3}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols) -boundary_conditions = Dict(:PhysicalSurface1 => BoundaryConditionDirichlet(initial_condition), - :PhysicalSurface2 => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; PhysicalSurface1 = BoundaryConditionDirichlet(initial_condition), + PhysicalSurface2 = BoundaryConditionDirichlet(initial_condition)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries_float32.jl b/examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries_float32.jl index a311223d6fb..94ee0893bf4 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries_float32.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries_float32.jl @@ -17,7 +17,7 @@ polydeg = 3 # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = polydeg, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), RealT = Float32) @@ -36,10 +36,10 @@ boundary_symbols = [:PhysicalSurface1, :PhysicalSurface2] mesh = P4estMesh{3}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols, RealT = Float32) -boundary_conditions = Dict(:PhysicalSurface1 => BoundaryConditionDirichlet(initial_condition), - :PhysicalSurface2 => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; PhysicalSurface1 = BoundaryConditionDirichlet(initial_condition), + PhysicalSurface2 = BoundaryConditionDirichlet(initial_condition)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded.jl b/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded.jl index f5b590aa9bb..2e160926e76 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded.jl @@ -8,14 +8,14 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_constant -boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; all = BoundaryConditionDirichlet(initial_condition)) # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of # `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`. # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -67,7 +67,7 @@ refine_fn_c = @cfunction(refine_fn, Cint, Ptr{Trixi.p8est_quadrant_t})) Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded_fvO2.jl b/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded_fvO2.jl index 20dd6650362..c3d02448fea 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded_fvO2.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded_fvO2.jl @@ -8,7 +8,7 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_constant -boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; all = BoundaryConditionDirichlet(initial_condition)) polydeg = 3 # governs in this case only the number of subcells basis = LobattoLegendreBasis(polydeg) @@ -49,7 +49,7 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/b8df00 mesh = P4estMesh{3}(mesh_file, polydeg = polydeg, mapping = mapping) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_euler_free_stream_hybrid_mesh.jl b/examples/p4est_3d_dgsem/elixir_euler_free_stream_hybrid_mesh.jl index 021772ebd8b..1b58986b431 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_free_stream_hybrid_mesh.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_free_stream_hybrid_mesh.jl @@ -20,8 +20,8 @@ mesh_file = target_mesh_file # Refine the given mesh twice mesh = P4estMesh{3}(mesh_file, initial_refinement_level = 2) -boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +boundary_conditions = (; all = BoundaryConditionDirichlet(initial_condition)) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_euler_sedov.jl b/examples/p4est_3d_dgsem/elixir_euler_sedov.jl index b152d575960..3cf45efd432 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_sedov.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_sedov.jl @@ -73,7 +73,8 @@ mesh = P4estMesh(trees_per_dimension, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_euler_sedov_sc_subcell.jl b/examples/p4est_3d_dgsem/elixir_euler_sedov_sc_subcell.jl index 721688fc6d2..572b0e0de20 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_sedov_sc_subcell.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_sedov_sc_subcell.jl @@ -62,7 +62,8 @@ mesh = P4estMesh(trees_per_dimension, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_earth.jl b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_earth.jl index 136ef92b4e8..1e05f46b39d 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_earth.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_earth.jl @@ -65,8 +65,8 @@ end initial_condition = initial_condition_convergence_test_sphere boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:inside => boundary_condition, - :outside => boundary_condition) +boundary_conditions = (; inside = boundary_condition, + outside = boundary_condition) surface_flux = FluxHLL(min_max_speed_naive) # Note that a free stream is not preserved if N < 2 * N_geo, where N is the diff --git a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl index 9e5858f4675..a243da71362 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl @@ -9,7 +9,7 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) # Solver with polydeg=4 to ensure free stream preservation (FSP) on non-conforming meshes. # The polydeg of the solver must be at least twice as big as the polydeg of the mesh. @@ -20,7 +20,7 @@ boundary_conditions = Dict(:all => boundary_condition) # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 4, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) diff --git a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl index 2903df96c97..0dc5db7ffed 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -28,15 +28,14 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 1, periodicity = false, initial_refinement_level = 1) # Assign a single boundary condition to all boundaries -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = boundary_condition_default(mesh, boundary_condition) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) # Alternatively, you can use -# boundary_conditions = Dict(:x_neg => boundary_condition, -# :x_pos => boundary_condition, -# :y_neg => boundary_condition, -# :y_pos => boundary_condition, -# :z_neg => boundary_condition, -# :z_pos => boundary_condition) +# boundary_conditions = (; x_neg = boundary_condition, +# x_pos = boundary_condition, +# y_neg = boundary_condition, +# y_pos = boundary_condition, +# z_neg = boundary_condition, +# z_pos = boundary_condition) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, source_terms = source_terms_convergence_test, diff --git a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic_hohqmesh.jl b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic_hohqmesh.jl index 119f3b1eb7d..1000bab69ef 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic_hohqmesh.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic_hohqmesh.jl @@ -9,17 +9,17 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:Bottom => boundary_condition, - :Top => boundary_condition, - :Circle => boundary_condition, - :Cut => boundary_condition) +boundary_conditions = (; Bottom = boundary_condition, + Top = boundary_condition, + Circle = boundary_condition, + Cut = boundary_condition) # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of # `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`. # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 4, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) diff --git a/examples/p4est_3d_dgsem/elixir_euler_tandem_spheres.jl b/examples/p4est_3d_dgsem/elixir_euler_tandem_spheres.jl index 13313caac24..73c11c410a9 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_tandem_spheres.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_tandem_spheres.jl @@ -7,12 +7,12 @@ using OrdinaryDiffEqLowStorageRK gamma = 1.4 equations = CompressibleEulerEquations3D(gamma) -# Simulation setup roughly based on testcase CS1 (Tandem Spheres) from the +# Simulation setup roughly based on testcase CS1 (Tandem Spheres) from the # 5th International Workshop on High-Order CFD Methods. # For description see: # https://how5.cenaero.be/content/cs1-tandem-spheres-re3900 -# This is a simplified inviscid version of the testcase, mainly -# designed to test the import of second-order (curved) elements in 3D. +# This is a simplified inviscid version of the testcase, mainly +# designed to test the import of second-order (curved) elements in 3D. D = 1 # Sphere diameter, follows from mesh U() = 0.1 @@ -46,7 +46,7 @@ solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, volume_integral = volume_integral) # Mesh taken from https://acdl.mit.edu/HOW5/CS1_TandemSpheres/pointwise/gmsh/ -# and converted to Abaqus .inp format using Gmsh after adding +# and converted to Abaqus .inp format using Gmsh after adding # # $PhysicalNames # 4 @@ -65,16 +65,16 @@ mesh_file = Trixi.download("https://rwth-aachen.sciebo.de/s/pioS9PmdSWnLc8D/down boundary_symbols = [:FrontSphere, :BackSphere, :FarField] mesh = P4estMesh{3}(mesh_file; boundary_symbols = boundary_symbols) -boundary_conditions = Dict(:FrontSphere => boundary_condition_slip_wall, - :BackSphere => boundary_condition_slip_wall, - :FarField => bc_farfield) +boundary_conditions = (; FrontSphere = boundary_condition_slip_wall, + BackSphere = boundary_condition_slip_wall, + FarField = bc_farfield) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) t_star_end = 1.0 # 100 recommended in testcase description -t_end = t_star_end * D / U() # convert `t_star` to unit-equipped time +t_end = t_star_end * D / U() # convert `t_star` to unit-equipped time tspan = (0.0, t_end) ode = semidiscretize(semi, tspan) diff --git a/examples/p4est_3d_dgsem/elixir_euler_weak_blast_wave_amr.jl b/examples/p4est_3d_dgsem/elixir_euler_weak_blast_wave_amr.jl index 20a08b383c3..aac1d61585a 100644 --- a/examples/p4est_3d_dgsem/elixir_euler_weak_blast_wave_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_euler_weak_blast_wave_amr.jl @@ -77,7 +77,8 @@ mesh = P4estMesh(trees_per_dimension, periodicity = true) # Create the semidiscretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_linearizedeuler_convergence.jl b/examples/p4est_3d_dgsem/elixir_linearizedeuler_convergence.jl index 10455de6d16..7fdf2db1fdb 100644 --- a/examples/p4est_3d_dgsem/elixir_linearizedeuler_convergence.jl +++ b/examples/p4est_3d_dgsem/elixir_linearizedeuler_convergence.jl @@ -21,10 +21,12 @@ trees_per_dimension = (4, 4, 4) mesh = P4estMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 0) + initial_refinement_level = 0, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_er.jl b/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_er.jl index 96b53bf98dd..27c360710b9 100644 --- a/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_er.jl +++ b/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_er.jl @@ -5,7 +5,7 @@ using Trixi equations = IdealGlmMhdEquations3D(5 / 3) -# Volume flux stabilizes the simulation - in contrast to standard DGSEM with +# Volume flux stabilizes the simulation - in contrast to standard DGSEM with # `surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)` only which crashes. # To turn this into a convergence test, use a flux with some dissipation, e.g. # `flux_lax_friedrichs` or `flux_hll`. @@ -19,10 +19,12 @@ coordinates_max = (1.0, 1.0, 1.0) trees_per_dimension = (2, 2, 2) mesh = P4estMesh(trees_per_dimension, polydeg = 1, initial_refinement_level = 1, - coordinates_min = coordinates_min, coordinates_max = coordinates_max) + coordinates_min = coordinates_min, coordinates_max = coordinates_max, + periodicity = true) initial_condition = initial_condition_convergence_test -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl b/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl index 598c13a2a87..9825380228d 100644 --- a/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl +++ b/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl @@ -45,7 +45,8 @@ refine_fn_c = @cfunction(refine_fn, Cint, Ptr{Trixi.p8est_quadrant_t})) Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonperiodic.jl b/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonperiodic.jl index d9d6f2829d9..300a9a3f673 100644 --- a/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonperiodic.jl +++ b/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonperiodic.jl @@ -9,12 +9,12 @@ equations = IdealGlmMhdEquations3D(5 / 3) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:x_neg => boundary_condition, - :x_pos => boundary_condition, - :y_neg => boundary_condition, - :y_pos => boundary_condition, - :z_neg => boundary_condition, - :z_pos => boundary_condition) +boundary_conditions = (; x_neg = boundary_condition, + x_pos = boundary_condition, + y_neg = boundary_condition, + y_pos = boundary_condition, + z_neg = boundary_condition, + z_pos = boundary_condition) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) solver = DGSEM(polydeg = 3, @@ -32,7 +32,7 @@ mesh = P4estMesh(trees_per_dimension, coordinates_min = coordinates_min, coordinates_max = coordinates_max, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/p4est_3d_dgsem/elixir_mhd_amr_entropy_bounded.jl b/examples/p4est_3d_dgsem/elixir_mhd_amr_entropy_bounded.jl index 982d8cc581a..463b442badd 100644 --- a/examples/p4est_3d_dgsem/elixir_mhd_amr_entropy_bounded.jl +++ b/examples/p4est_3d_dgsem/elixir_mhd_amr_entropy_bounded.jl @@ -85,7 +85,8 @@ mesh = P4estMesh(trees_per_dimension, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl index f782ec6f142..6428317beb8 100644 --- a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl @@ -93,7 +93,8 @@ mesh = P4estMesh(trees_per_dimension, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_subcell.jl b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_subcell.jl index 8c15733ab8b..84f3a4cbaba 100644 --- a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_subcell.jl +++ b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_subcell.jl @@ -82,7 +82,8 @@ mesh = P4estMesh(trees_per_dimension, initial_refinement_level = 2, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_mhdmultiion_ec.jl b/examples/p4est_3d_dgsem/elixir_mhdmultiion_ec.jl index c591530b110..4d374fd8f66 100644 --- a/examples/p4est_3d_dgsem/elixir_mhdmultiion_ec.jl +++ b/examples/p4est_3d_dgsem/elixir_mhdmultiion_ec.jl @@ -61,7 +61,8 @@ mesh = P4estMesh(trees_per_dimension, # The multi-ion GLM-MHD equations require the inclusion of source_terms_lorentz # whenever multiple ion species are present semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_lorentz) + source_terms = source_terms_lorentz, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl index 60773aeb865..eddc172590b 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl @@ -45,7 +45,7 @@ initial_condition = initial_condition_3d_blast_wave # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -73,7 +73,9 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 3, periodicity = (true, true, true), initial_refinement_level = 1) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl index 4e29fecc17a..27ccde81b66 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl @@ -19,7 +19,7 @@ equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -240,12 +240,12 @@ boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_to heat_bc_top_bottom) # define inviscid boundary conditions -boundary_conditions = Dict(:y_neg => boundary_condition_slip_wall, - :y_pos => boundary_condition_slip_wall) +boundary_conditions = (; y_neg = boundary_condition_slip_wall, + y_pos = boundary_condition_slip_wall) # define viscous boundary conditions -boundary_conditions_parabolic = Dict(:y_neg => boundary_condition_top_bottom, - :y_pos => boundary_condition_top_bottom) +boundary_conditions_parabolic = (; y_neg = boundary_condition_top_bottom, + y_pos = boundary_condition_top_bottom) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_crm.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_crm.jl index 6e4caddf3c4..20b35d40b8d 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_crm.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_crm.jl @@ -75,13 +75,13 @@ boundary_symbols = [:SYMMETRY, mesh = P4estMesh{3}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols) -boundary_conditions_hyp = Dict(:SYMMETRY => boundary_condition_slip_wall, # slip wall allows for tangential velocity => Sufficient for symmetry - :FARFIELD => bc_farfield, - :OUTFLOW => bc_farfield, # We also use farfield for "outflow" boundary - :WING => boundary_condition_slip_wall, - :FUSELAGE => boundary_condition_slip_wall, - :WING_UP => boundary_condition_slip_wall, - :WING_LO => boundary_condition_slip_wall) +boundary_conditions_hyp = (; SYMMETRY = boundary_condition_slip_wall, # slip wall allows for tangential velocity => Sufficient for symmetry + FARFIELD = bc_farfield, + OUTFLOW = bc_farfield, # We also use farfield for "outflow" boundary + WING = boundary_condition_slip_wall, + FUSELAGE = boundary_condition_slip_wall, + WING_UP = boundary_condition_slip_wall, + WING_LO = boundary_condition_slip_wall) velocity_bc_plane = NoSlip((x, t, equations) -> SVector(0.0, 0.0, 0.0)) heat_bc = Adiabatic((x, t, equations) -> 0.0) @@ -91,13 +91,13 @@ bc_body = BoundaryConditionNavierStokesWall(velocity_bc_plane, heat_bc) # and thus acts as a symmetry plane. bc_symmetry_plane = BoundaryConditionNavierStokesWall(Slip(), heat_bc) -boundary_conditions_para = Dict(:SYMMETRY => bc_symmetry_plane, - :FARFIELD => bc_farfield, - :OUTFLOW => bc_farfield, # We also use farfield for "outflow" boundary - :WING => bc_body, - :FUSELAGE => bc_body, - :WING_UP => bc_body, - :WING_LO => bc_body) +boundary_conditions_para = (; SYMMETRY = bc_symmetry_plane, + FARFIELD = bc_farfield, + OUTFLOW = bc_farfield, # We also use farfield for "outflow" boundary + WING = bc_body, + FUSELAGE = bc_body, + WING_UP = bc_body, + WING_LO = bc_body) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_freestream_boundaries.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_freestream_boundaries.jl index 8cc4a122d6d..51d19f5302e 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_freestream_boundaries.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_freestream_boundaries.jl @@ -40,8 +40,8 @@ boundary_symbols = [:PhysicalSurface1, :PhysicalSurface2] mesh = P4estMesh{3}(mesh_file, polydeg = polydeg, initial_refinement_level = 0, boundary_symbols = boundary_symbols) -boundary_conditions = Dict(:PhysicalSurface1 => BoundaryConditionDirichlet(initial_condition), - :PhysicalSurface2 => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; PhysicalSurface1 = BoundaryConditionDirichlet(initial_condition), + PhysicalSurface2 = BoundaryConditionDirichlet(initial_condition)) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index 8a8dc1f8582..ae6f6f31aa1 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -49,7 +49,9 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 3, periodicity = (true, true, true), initial_refinement_level = 2) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl index a5daea7e143..54e13e0b6a0 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl @@ -46,7 +46,7 @@ volume_flux = flux_ranocha # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) @@ -61,7 +61,9 @@ mesh = P4estMesh(trees_per_dimension, polydeg = 3, periodicity = (true, true, true), initial_refinement_level = 0) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_viscous_shock.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_viscous_shock.jl index a068a2dc856..0f50e6d0e5e 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_viscous_shock.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_viscous_shock.jl @@ -123,8 +123,8 @@ function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x return flux(u_inner, normal_direction, equations) end -boundary_conditions = Dict(:x_neg => boundary_condition_inflow, - :x_pos => boundary_condition_outflow) +boundary_conditions = (; x_neg = boundary_condition_inflow, + x_pos = boundary_condition_outflow) ### Viscous boundary conditions ### # For the viscous BCs, we use the known analytical solution @@ -140,8 +140,8 @@ end boundary_condition_parabolic = BoundaryConditionNavierStokesWall(velocity_bc, heat_bc) -boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_parabolic, - :x_pos => boundary_condition_parabolic) +boundary_conditions_parabolic = (; x_neg = boundary_condition_parabolic, + x_pos = boundary_condition_parabolic) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_viscous_shock_dirichlet_bc.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_viscous_shock_dirichlet_bc.jl index e933e7b3cda..d1983eda32a 100644 --- a/examples/p4est_3d_dgsem/elixir_navierstokes_viscous_shock_dirichlet_bc.jl +++ b/examples/p4est_3d_dgsem/elixir_navierstokes_viscous_shock_dirichlet_bc.jl @@ -119,15 +119,15 @@ function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x return flux(u_inner, normal_direction, equations) end -boundary_conditions = Dict(:x_neg => boundary_condition_inflow, - :x_pos => boundary_condition_outflow) +boundary_conditions = (; x_neg = boundary_condition_inflow, + x_pos = boundary_condition_outflow) ### Viscous boundary conditions ### # For the viscous BCs, we use the known analytical solution boundary_condition_parabolic_dirichlet = BoundaryConditionDirichlet(initial_condition) -boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_parabolic_dirichlet, - :x_pos => boundary_condition_parabolic_dirichlet) +boundary_conditions_parabolic = (; x_neg = boundary_condition_parabolic_dirichlet, + x_pos = boundary_condition_parabolic_dirichlet) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver; diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_euler_convergence.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_euler_convergence.jl index 7523feee662..9c2cadd0ca0 100644 --- a/examples/paper_self_gravitating_gas_dynamics/elixir_euler_convergence.jl +++ b/examples/paper_self_gravitating_gas_dynamics/elixir_euler_convergence.jl @@ -13,10 +13,11 @@ coordinates_min = (0.0, 0.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_eoc_test_euler) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_eoc_test_euler, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_convergence.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_convergence.jl index d8a9b29f514..6ed923ef1d4 100644 --- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_convergence.jl +++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_convergence.jl @@ -15,11 +15,12 @@ coordinates_min = (0.0, 0.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, - solver_euler, - source_terms = source_terms_eoc_test_coupled_euler_gravity) + solver_euler; + source_terms = source_terms_eoc_test_coupled_euler_gravity, + boundary_conditions = boundary_condition_periodic) ############################################################################### # semidiscretization of the hyperbolic diffusion equations @@ -30,13 +31,14 @@ equations_gravity = HyperbolicDiffusionEquations2D() # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver_gravity = DGSEM(polydeg, FluxLaxFriedrichs(max_abs_speed_naive)) semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, - solver_gravity, - source_terms = source_terms_harmonic) + solver_gravity; + source_terms = source_terms_harmonic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # combining both semidiscretizations for Euler + self-gravity diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl index a45d208ed2f..7b81508ca26 100644 --- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl +++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl @@ -71,10 +71,11 @@ coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, - solver_euler) + solver_euler; + boundary_conditions = boundary_condition_periodic) ############################################################################### # semidiscretization of the hyperbolic diffusion equations @@ -85,13 +86,14 @@ equations_gravity = HyperbolicDiffusionEquations2D() # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver_gravity = DGSEM(polydeg, FluxLaxFriedrichs(max_abs_speed_naive)) semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, solver_gravity, - source_terms = source_terms_harmonic) + source_terms = source_terms_harmonic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # combining both semidiscretizations for Euler + self-gravity diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_hypdiff_convergence.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_hypdiff_convergence.jl index 319bcb26dae..ac158a6fdd4 100644 --- a/examples/paper_self_gravitating_gas_dynamics/elixir_hypdiff_convergence.jl +++ b/examples/paper_self_gravitating_gas_dynamics/elixir_hypdiff_convergence.jl @@ -8,7 +8,7 @@ equations = HyperbolicDiffusionEquations2D() initial_condition = initial_condition_poisson_nonperiodic # 1 => -x, 2 => +x, 3 => -y, 4 => +y as usual for orientations -boundary_conditions = (x_neg = boundary_condition_poisson_nonperiodic, +boundary_conditions = (; x_neg = boundary_condition_poisson_nonperiodic, x_pos = boundary_condition_poisson_nonperiodic, y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) diff --git a/examples/special_elixirs/elixir_euler_ad.jl b/examples/special_elixirs/elixir_euler_ad.jl index b0740335303..bdd2700cee1 100644 --- a/examples/special_elixirs/elixir_euler_ad.jl +++ b/examples/special_elixirs/elixir_euler_ad.jl @@ -5,14 +5,14 @@ using Trixi, LinearAlgebra, ForwardDiff equations = CompressibleEulerEquations2D(1.4) mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), - initial_refinement_level = 2, n_cells_max = 10^5) + initial_refinement_level = 2, n_cells_max = 10^5, periodicity = true) # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of # `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`. # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha)) @@ -59,7 +59,8 @@ function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerE return prim2cons(prim, equations) end semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_isentropic_vortex, - solver) + solver; + boundary_conditions = boundary_condition_periodic) u0_ode = compute_coefficients(0.0, semi) diff --git a/examples/structured_1d_dgsem/elixir_advection_basic.jl b/examples/structured_1d_dgsem/elixir_advection_basic.jl index fb944951269..5686c816b4b 100644 --- a/examples/structured_1d_dgsem/elixir_advection_basic.jl +++ b/examples/structured_1d_dgsem/elixir_advection_basic.jl @@ -18,11 +18,13 @@ coordinates_max = (1.0,) # maximum coordinate cells_per_dimension = (16,) # Create curved mesh with 16 cells -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_advection_float128.jl b/examples/structured_1d_dgsem/elixir_advection_float128.jl index 272760bad2b..21681d75d14 100644 --- a/examples/structured_1d_dgsem/elixir_advection_float128.jl +++ b/examples/structured_1d_dgsem/elixir_advection_float128.jl @@ -21,10 +21,12 @@ coordinates_max = (one(RealT),) cells_per_dimension = (1,) # `StructuredMesh` infers datatype from coordinates -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_advection_nonperiodic.jl b/examples/structured_1d_dgsem/elixir_advection_nonperiodic.jl index 41ded4264ee..74c8fa87432 100644 --- a/examples/structured_1d_dgsem/elixir_advection_nonperiodic.jl +++ b/examples/structured_1d_dgsem/elixir_advection_nonperiodic.jl @@ -18,8 +18,7 @@ mesh = StructuredMesh((16,), coordinates_min, coordinates_max, periodicity = fal semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, - solver, - boundary_conditions = boundary_conditions) + solver; boundary_conditions = boundary_conditions) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_advection_nonuniform.jl b/examples/structured_1d_dgsem/elixir_advection_nonuniform.jl index 121e54a6e01..5658eecbc34 100644 --- a/examples/structured_1d_dgsem/elixir_advection_nonuniform.jl +++ b/examples/structured_1d_dgsem/elixir_advection_nonuniform.jl @@ -14,10 +14,11 @@ cells_per_dimension = (24,) # This mapping converts [-1, 1] to [1, 9] with a non-uniform distribution of cells mapping(xi) = (xi + 2)^2 -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl b/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl index 5fd11dfb6d0..31e319ad254 100644 --- a/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl +++ b/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl @@ -69,7 +69,8 @@ mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_burgers_perk3.jl b/examples/structured_1d_dgsem/elixir_burgers_perk3.jl index 03816636fd0..2dab5ef5da8 100644 --- a/examples/structured_1d_dgsem/elixir_burgers_perk3.jl +++ b/examples/structured_1d_dgsem/elixir_burgers_perk3.jl @@ -22,10 +22,12 @@ coordinates_min = (0.0,) # minimum coordinate coordinates_max = (1.0,) # maximum coordinate cells_per_dimension = (64,) -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_euler_convergence_nonuniform.jl b/examples/structured_1d_dgsem/elixir_euler_convergence_nonuniform.jl index 5a778132f47..cd1f043999f 100644 --- a/examples/structured_1d_dgsem/elixir_euler_convergence_nonuniform.jl +++ b/examples/structured_1d_dgsem/elixir_euler_convergence_nonuniform.jl @@ -17,10 +17,11 @@ cells_per_dimension = (8,) # This mapping converts [-1, 1] to [0, 2] with a non-uniform distribution of cells mapping(xi) = ((xi + 2)^2 - 1) / 4 -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_euler_sedov.jl b/examples/structured_1d_dgsem/elixir_euler_sedov.jl index d6933a42dfc..ec2337bb17b 100644 --- a/examples/structured_1d_dgsem/elixir_euler_sedov.jl +++ b/examples/structured_1d_dgsem/elixir_euler_sedov.jl @@ -63,7 +63,8 @@ coordinates_max = (2.0,) mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_euler_shu_osher_nonuniform_fvO2.jl b/examples/structured_1d_dgsem/elixir_euler_shu_osher_nonuniform_fvO2.jl index a3185f1a4ff..ba27056026e 100644 --- a/examples/structured_1d_dgsem/elixir_euler_shu_osher_nonuniform_fvO2.jl +++ b/examples/structured_1d_dgsem/elixir_euler_shu_osher_nonuniform_fvO2.jl @@ -60,10 +60,9 @@ end cells_per_dimension = (128,) mesh = StructuredMesh(cells_per_dimension, refined_mapping, periodicity = false) -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = boundary_condition_default(mesh, boundary_condition) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_1d_dgsem/elixir_euler_source_terms.jl b/examples/structured_1d_dgsem/elixir_euler_source_terms.jl index 07a089245bf..eec55c49ab9 100644 --- a/examples/structured_1d_dgsem/elixir_euler_source_terms.jl +++ b/examples/structured_1d_dgsem/elixir_euler_source_terms.jl @@ -19,7 +19,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 4, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -27,10 +27,12 @@ coordinates_min = (0.0,) coordinates_max = (2.0,) cells_per_dimension = (16,) -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl index 11fc7ca6074..47d50b98411 100644 --- a/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl +++ b/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl @@ -15,7 +15,7 @@ source_terms = source_terms_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -27,13 +27,12 @@ mesh = StructuredMesh((16,), (f1, f2), periodicity = false) # 2*ndims == 2 directions or you can pass a tuple containing BCs for # each direction # Assign a single boundary condition to all boundaries -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = boundary_condition_default(mesh, boundary_condition) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) # Alternatively, you can use -# boundary_conditions = (x_neg = boundary_condition, +# boundary_conditions = (; x_neg = boundary_condition, # x_pos = boundary_condition) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms = source_terms, boundary_conditions = boundary_conditions) diff --git a/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl b/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl index eb2e58ef46e..8881df26944 100644 --- a/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl +++ b/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl @@ -11,10 +11,9 @@ initial_condition = initial_condition_convergence_test source_terms = source_terms_convergence_test # you can either use a single function to impose the BCs weakly in all -# 2*ndims == 2 directions or you can pass a tuple containing BCs for -# each direction (first one being `x_neg`, second `x_pos`) +# 2*ndims == 2 directions or you can pass a named tuple containing BCs boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (boundary_condition, boundary_condition) +boundary_conditions = (; x_neg = boundary_condition, x_pos = boundary_condition) polydeg = 8 # Governs in this case only the number of subcells basis = LobattoLegendreBasis(polydeg) @@ -33,7 +32,7 @@ cells_per_dimension = (8,) mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms = source_terms, boundary_conditions = boundary_conditions) diff --git a/examples/structured_1d_dgsem/elixir_euler_weak_blast_er.jl b/examples/structured_1d_dgsem/elixir_euler_weak_blast_er.jl index 224ea34b2ab..1e20d57ba1c 100644 --- a/examples/structured_1d_dgsem/elixir_euler_weak_blast_er.jl +++ b/examples/structured_1d_dgsem/elixir_euler_weak_blast_er.jl @@ -5,7 +5,7 @@ using Trixi equations = CompressibleEulerEquations1D(1.4) -# Volume flux stabilizes the simulation - in contrast to standard DGSEM with +# Volume flux stabilizes the simulation - in contrast to standard DGSEM with # `surface_flux = flux_ranocha` only which crashes. solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha, volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha)) @@ -13,10 +13,12 @@ solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha, coordinates_min = -2.0 coordinates_max = 2.0 cells_per_dimension = 32 -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) initial_condition = initial_condition_weak_blast_wave -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_linearizedeuler_characteristic_system.jl b/examples/structured_1d_dgsem/elixir_linearizedeuler_characteristic_system.jl index a854ce5c3bc..183e10d441c 100644 --- a/examples/structured_1d_dgsem/elixir_linearizedeuler_characteristic_system.jl +++ b/examples/structured_1d_dgsem/elixir_linearizedeuler_characteristic_system.jl @@ -16,7 +16,8 @@ coordinates_min = (0.0,) # minimum coordinate coordinates_max = (1.0,) # maximum coordinate cells_per_dimension = (64,) -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) # For eigensystem of the linearized Euler equations see e.g. # https://www.nas.nasa.gov/assets/nas/pdf/ams/2018/introtocfd/Intro2CFD_Lecture1_Pulliam_Euler_WaveEQ.pdf @@ -78,7 +79,8 @@ end initial_condition = initial_condition_char_vars -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_1d_dgsem/elixir_traffic_flow_lwr_greenlight.jl b/examples/structured_1d_dgsem/elixir_traffic_flow_lwr_greenlight.jl index 45d1f2cde3c..9feaaf75a52 100644 --- a/examples/structured_1d_dgsem/elixir_traffic_flow_lwr_greenlight.jl +++ b/examples/structured_1d_dgsem/elixir_traffic_flow_lwr_greenlight.jl @@ -42,12 +42,12 @@ function boundary_condition_outflow(u_inner, orientation, normal_direction, x, t return flux(u_inner, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_inflow, +boundary_conditions = (; x_neg = boundary_condition_inflow, x_pos = boundary_condition_outflow) initial_condition = initial_condition_greenlight -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_advection_basic.jl b/examples/structured_2d_dgsem/elixir_advection_basic.jl index 594a5c801b0..86fcc709a4e 100644 --- a/examples/structured_2d_dgsem/elixir_advection_basic.jl +++ b/examples/structured_2d_dgsem/elixir_advection_basic.jl @@ -19,11 +19,13 @@ coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y)) cells_per_dimension = (16, 16) # Create curved mesh with 16 x 16 elements -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_advection_coupled.jl b/examples/structured_2d_dgsem/elixir_advection_coupled.jl index f714dc92fec..7b51a1fcd75 100644 --- a/examples/structured_2d_dgsem/elixir_advection_coupled.jl +++ b/examples/structured_2d_dgsem/elixir_advection_coupled.jl @@ -72,8 +72,9 @@ boundary_conditions_y_pos1 = BoundaryConditionCoupled(3, (:i_forward, :begin), F # A semidiscretization collects data structures and functions for the spatial discretization semi1 = SemidiscretizationHyperbolic(mesh1, equations, initial_condition_convergence_test, - solver, - boundary_conditions = (x_neg = boundary_conditions_x_neg1, + solver; + boundary_conditions = (; + x_neg = boundary_conditions_x_neg1, x_pos = boundary_conditions_x_pos1, y_neg = boundary_conditions_y_neg1, y_pos = boundary_conditions_y_pos1)) @@ -104,8 +105,9 @@ boundary_conditions_y_pos2 = BoundaryConditionCoupled(4, (:i_forward, :begin), F # A semidiscretization collects data structures and functions for the spatial discretization semi2 = SemidiscretizationHyperbolic(mesh2, equations, initial_condition_convergence_test, - solver, - boundary_conditions = (x_neg = boundary_conditions_x_neg2, + solver; + boundary_conditions = (; + x_neg = boundary_conditions_x_neg2, x_pos = boundary_conditions_x_pos2, y_neg = boundary_conditions_y_neg2, y_pos = boundary_conditions_y_pos2)) @@ -136,8 +138,9 @@ boundary_conditions_y_pos3 = BoundaryConditionCoupled(1, (:i_forward, :begin), F # A semidiscretization collects data structures and functions for the spatial discretization semi3 = SemidiscretizationHyperbolic(mesh3, equations, initial_condition_convergence_test, - solver, - boundary_conditions = (x_neg = boundary_conditions_x_neg3, + solver; + boundary_conditions = (; + x_neg = boundary_conditions_x_neg3, x_pos = boundary_conditions_x_pos3, y_neg = boundary_conditions_y_neg3, y_pos = boundary_conditions_y_pos3)) @@ -168,8 +171,9 @@ boundary_conditions_y_pos4 = BoundaryConditionCoupled(2, (:i_forward, :begin), F # A semidiscretization collects data structures and functions for the spatial discretization semi4 = SemidiscretizationHyperbolic(mesh4, equations, initial_condition_convergence_test, - solver, - boundary_conditions = (x_neg = boundary_conditions_x_neg4, + solver; + boundary_conditions = (; + x_neg = boundary_conditions_x_neg4, x_pos = boundary_conditions_x_pos4, y_neg = boundary_conditions_y_neg4, y_pos = boundary_conditions_y_pos4)) diff --git a/examples/structured_2d_dgsem/elixir_advection_extended.jl b/examples/structured_2d_dgsem/elixir_advection_extended.jl index f59e492f0c0..81f73879ac4 100644 --- a/examples/structured_2d_dgsem/elixir_advection_extended.jl +++ b/examples/structured_2d_dgsem/elixir_advection_extended.jl @@ -12,8 +12,6 @@ initial_condition = initial_condition_convergence_test # you can either use a single function to impose the BCs weakly in all # 1*ndims == 2 directions or you can pass a tuple containing BCs for # each direction -# Note: "boundary_condition_periodic" indicates that it is a periodic boundary and can be omitted on -# fully periodic domains. Here, however, it is included to allow easy override during testing boundary_conditions = boundary_condition_periodic # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux @@ -26,10 +24,11 @@ coordinates_max = (0.5, 5.3) # maximum coordinates (max(x), max(y)) cells_per_dimension = (19, 37) # Create curved mesh with 19 x 37 elements -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_advection_float32.jl b/examples/structured_2d_dgsem/elixir_advection_float32.jl index b8b786a206f..4887166d52c 100644 --- a/examples/structured_2d_dgsem/elixir_advection_float32.jl +++ b/examples/structured_2d_dgsem/elixir_advection_float32.jl @@ -19,11 +19,13 @@ coordinates_max = (1.0f0, 1.0f0) # maximum coordinates (max(x), max(y)) cells_per_dimension = (16, 16) # Create curved mesh with 16 x 16 elements -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_advection_free_stream.jl b/examples/structured_2d_dgsem/elixir_advection_free_stream.jl index a62bb9c02e2..f6a9f89da82 100644 --- a/examples/structured_2d_dgsem/elixir_advection_free_stream.jl +++ b/examples/structured_2d_dgsem/elixir_advection_free_stream.jl @@ -30,10 +30,11 @@ end cells_per_dimension = (16, 16) # Create curved mesh with 16 x 16 elements -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_advection_meshview.jl b/examples/structured_2d_dgsem/elixir_advection_meshview.jl index e7072d1ac79..6e74d8eab7f 100644 --- a/examples/structured_2d_dgsem/elixir_advection_meshview.jl +++ b/examples/structured_2d_dgsem/elixir_advection_meshview.jl @@ -41,7 +41,8 @@ coordinates_max = (1.0, 1.0) cells_per_dimension = (16, 16) # Create parent mesh with 16 x 16 elements -parent_mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +parent_mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) # Create the two mesh views, each of which takes half of the parent mesh. mesh1 = StructuredMeshView(parent_mesh; indices_min = (1, 1), indices_max = (8, 16)) @@ -72,11 +73,9 @@ boundary_conditions2 = ( # A semidiscretization collects data structures and functions for the spatial discretization semi1 = SemidiscretizationHyperbolic(mesh1, equations, initial_condition_convergence_test, - solver, - boundary_conditions = boundary_conditions1) + solver; boundary_conditions = boundary_conditions1) semi2 = SemidiscretizationHyperbolic(mesh2, equations, initial_condition_convergence_test, - solver, - boundary_conditions = boundary_conditions2) + solver; boundary_conditions = boundary_conditions2) semi = SemidiscretizationCoupled(semi1, semi2) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_advection_nonperiodic.jl b/examples/structured_2d_dgsem/elixir_advection_nonperiodic.jl index 1a37c77b787..0ccbdb3106a 100644 --- a/examples/structured_2d_dgsem/elixir_advection_nonperiodic.jl +++ b/examples/structured_2d_dgsem/elixir_advection_nonperiodic.jl @@ -18,7 +18,7 @@ coordinates_min = (-5.0, -5.0) coordinates_max = (5.0, 5.0) mesh = StructuredMesh((16, 16), coordinates_min, coordinates_max, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_advection_parallelogram.jl b/examples/structured_2d_dgsem/elixir_advection_parallelogram.jl index b5ebc555d20..e9e3d39a04a 100644 --- a/examples/structured_2d_dgsem/elixir_advection_parallelogram.jl +++ b/examples/structured_2d_dgsem/elixir_advection_parallelogram.jl @@ -52,7 +52,8 @@ mesh = StructuredMesh(cells_per_dimension, mapping; periodicity = (true, true)) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_parallelogram, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_advection_restart.jl b/examples/structured_2d_dgsem/elixir_advection_restart.jl index 325df6bc7c6..622b9de8a57 100644 --- a/examples/structured_2d_dgsem/elixir_advection_restart.jl +++ b/examples/structured_2d_dgsem/elixir_advection_restart.jl @@ -19,7 +19,8 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file)) restart_filename = joinpath("out", restart_file) mesh = load_mesh(restart_filename) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) tspan = (load_time(restart_filename), 2.0) dt = load_dt(restart_filename) diff --git a/examples/structured_2d_dgsem/elixir_advection_rotated.jl b/examples/structured_2d_dgsem/elixir_advection_rotated.jl index 34322841494..2309e31a5a5 100644 --- a/examples/structured_2d_dgsem/elixir_advection_rotated.jl +++ b/examples/structured_2d_dgsem/elixir_advection_rotated.jl @@ -77,10 +77,11 @@ mapping(xi, eta) = T * SVector(xi, eta) cells_per_dimension = (16, 16) # Create curved mesh with 16 x 16 elements -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_advection_waving_flag.jl b/examples/structured_2d_dgsem/elixir_advection_waving_flag.jl index 0d549fca988..3016cb0adf4 100644 --- a/examples/structured_2d_dgsem/elixir_advection_waving_flag.jl +++ b/examples/structured_2d_dgsem/elixir_advection_waving_flag.jl @@ -22,10 +22,11 @@ f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s)) cells_per_dimension = (16, 16) # Create curved mesh with 16 x 16 elements -mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4)) +mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4), periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_euler_convergence_implicit_sparse_jacobian.jl b/examples/structured_2d_dgsem/elixir_euler_convergence_implicit_sparse_jacobian.jl index fd821029f33..5f06a78aa42 100644 --- a/examples/structured_2d_dgsem/elixir_euler_convergence_implicit_sparse_jacobian.jl +++ b/examples/structured_2d_dgsem/elixir_euler_convergence_implicit_sparse_jacobian.jl @@ -6,7 +6,7 @@ using OrdinaryDiffEqSDIRK, ADTypes ############################################################################### ### solver and equations ### -# For sparsity detection we can only use `flux_lax_friedrichs` at the moment since this is +# For sparsity detection we can only use `flux_lax_friedrichs` at the moment since this is # `if`-clause free (although it contains `min` and `max` operations). # The sparsity pattern, however, should be the same for other (two-point) fluxes as well. surface_flux = flux_lax_friedrichs @@ -33,7 +33,7 @@ function mapping(xi_, eta_) return SVector(x, y) end cells_per_dimension = (16, 16) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) ############################################################################### ### semidiscretization for sparsity detection ### @@ -46,8 +46,9 @@ jac_eltype = jacobian_eltype(real(solver), jac_detector) # Semidiscretization for sparsity pattern detection semi_jac_type = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver, + solver; source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic, uEltype = jac_eltype) # Need to supply Jacobian element type tspan = (0.0, 5.0) # Re-used for wrapping `rhs` below @@ -81,8 +82,9 @@ coloring_vec = column_colors(coloring_result) # Must be called 'semi' in order for the convergence test to run successfully semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver, - source_terms = source_terms_convergence_test) + solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) # Supply Jacobian prototype and coloring vector to the semidiscretization ode_jac_sparse = semidiscretize(semi, tspan, diff --git a/examples/structured_2d_dgsem/elixir_euler_ec.jl b/examples/structured_2d_dgsem/elixir_euler_ec.jl index 88603d03138..bec07a594b9 100644 --- a/examples/structured_2d_dgsem/elixir_euler_ec.jl +++ b/examples/structured_2d_dgsem/elixir_euler_ec.jl @@ -36,12 +36,13 @@ end cells_per_dimension = (16, 16) # Create curved mesh with 16 x 16 elements -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_euler_free_stream.jl b/examples/structured_2d_dgsem/elixir_euler_free_stream.jl index 1ac5b09090a..1429f813d87 100644 --- a/examples/structured_2d_dgsem/elixir_euler_free_stream.jl +++ b/examples/structured_2d_dgsem/elixir_euler_free_stream.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_constant # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -34,9 +34,10 @@ end cells_per_dimension = (16, 16) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl b/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl index d6acb8485cf..981bf61c4db 100644 --- a/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl +++ b/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl @@ -71,19 +71,20 @@ mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = false) initial_condition = initial_condition_rayleigh_taylor_instability # Assign a single boundary condition to all boundaries -boundary_conditions = boundary_condition_default(mesh, boundary_condition_slip_wall) +boundary_conditions = boundary_condition_slip_wall # Alternatively, you can use -# boundary_conditions = (x_neg = boundary_condition_slip_wall, +# boundary_conditions = (; +# x_neg = boundary_condition_slip_wall, # x_pos = boundary_condition_slip_wall, # y_neg = boundary_condition_slip_wall, # y_pos = boundary_condition_slip_wall) # # Alternative setup: left/right periodic BCs and Dirichlet BCs on the top/bottom. -# boundary_conditions = ( -# x_neg=boundary_condition_periodic, -# x_pos=boundary_condition_periodic, -# y_neg=BoundaryConditionDirichlet(initial_condition), -# y_pos=BoundaryConditionDirichlet(initial_condition), +# boundary_conditions = (; +# x_neg = boundary_condition_periodic, +# x_pos = boundary_condition_periodic, +# y_neg = BoundaryConditionDirichlet(initial_condition), +# y_pos = BoundaryConditionDirichlet(initial_condition), # ) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; diff --git a/examples/structured_2d_dgsem/elixir_euler_sedov.jl b/examples/structured_2d_dgsem/elixir_euler_sedov.jl index 5b8d5ee9c5e..57eb96592f7 100644 --- a/examples/structured_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/structured_2d_dgsem/elixir_euler_sedov.jl @@ -76,7 +76,8 @@ cells_per_dimension = (16, 16) mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # create the semidiscretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl b/examples/structured_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl index 26197c74359..b3d2a4608ad 100644 --- a/examples/structured_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl +++ b/examples/structured_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl @@ -37,7 +37,7 @@ end initial_condition = initial_condition_sedov_blast_wave boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (x_neg = boundary_condition, +boundary_conditions = (; x_neg = boundary_condition, x_pos = boundary_condition, y_neg = boundary_condition, y_pos = boundary_condition) @@ -83,7 +83,7 @@ end cells_per_dimension = (16, 16) mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms.jl index 32e27c376e0..89791fe6b63 100644 --- a/examples/structured_2d_dgsem/elixir_euler_source_terms.jl +++ b/examples/structured_2d_dgsem/elixir_euler_source_terms.jl @@ -16,7 +16,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -25,10 +25,12 @@ coordinates_max = (2.0, 2.0) cells_per_dimension = (16, 16) -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl index b573d3a0a21..01ae7ddfe57 100644 --- a/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl +++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl @@ -11,7 +11,7 @@ initial_condition = initial_condition_convergence_test # you can either use a single function to impose the BCs weakly in all # 2*ndims == 4 directions or you can pass a tuple containing BCs for each direction boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (x_neg = boundary_condition, +boundary_conditions = (; x_neg = boundary_condition, x_pos = boundary_condition, y_neg = boundary_condition, y_pos = boundary_condition) @@ -21,7 +21,7 @@ boundary_conditions = (x_neg = boundary_condition, # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl index 087d48fd167..88688f03ae0 100644 --- a/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl +++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl @@ -10,7 +10,7 @@ initial_condition = initial_condition_convergence_test source_terms = source_terms_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = (x_neg = boundary_condition, +boundary_conditions = (; x_neg = boundary_condition, x_pos = boundary_condition, y_neg = boundary_condition, y_pos = boundary_condition) diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_parallelogram.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_parallelogram.jl index ed154dcec91..2704d4dbbb0 100644 --- a/examples/structured_2d_dgsem/elixir_euler_source_terms_parallelogram.jl +++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_parallelogram.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -28,10 +28,11 @@ mapping(xi, eta) = SVector(xi + eta, eta) cells_per_dimension = (16, 16) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_rotated.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_rotated.jl index c99e2fd984b..d4e5c7087ef 100644 --- a/examples/structured_2d_dgsem/elixir_euler_source_terms_rotated.jl +++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_rotated.jl @@ -98,10 +98,11 @@ mapping(xi, eta) = T * SVector(xi, eta) cells_per_dimension = (16, 16) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_source_terms, solver, - source_terms = initial_condition_source_terms) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_source_terms, solver; + source_terms = initial_condition_source_terms, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_waving_flag.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_waving_flag.jl index 2ed65505eb7..f0c2898d364 100644 --- a/examples/structured_2d_dgsem/elixir_euler_source_terms_waving_flag.jl +++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_waving_flag.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -26,10 +26,11 @@ f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s)) cells_per_dimension = (16, 16) -mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4)) +mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4), periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_euler_vortex_perk4.jl b/examples/structured_2d_dgsem/elixir_euler_vortex_perk4.jl index 7e8f4aab88d..7e15e8fc249 100644 --- a/examples/structured_2d_dgsem/elixir_euler_vortex_perk4.jl +++ b/examples/structured_2d_dgsem/elixir_euler_vortex_perk4.jl @@ -29,7 +29,7 @@ function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerE S = convert(RealT, 13.5) # Radius of vortex R = convert(RealT, 1.5) - # Free-stream Mach + # Free-stream Mach M = convert(RealT, 0.4) # Base flow v1 = 1 @@ -67,9 +67,11 @@ coordinates_min = (-edge_length() / 2, -edge_length() / 2) coordinates_max = (edge_length() / 2, edge_length() / 2) cells_per_dimension = (32, 32) -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, tspan) diff --git a/examples/structured_2d_dgsem/elixir_euler_warm_bubble.jl b/examples/structured_2d_dgsem/elixir_euler_warm_bubble.jl index d9a11830f87..3d87d6905bc 100644 --- a/examples/structured_2d_dgsem/elixir_euler_warm_bubble.jl +++ b/examples/structured_2d_dgsem/elixir_euler_warm_bubble.jl @@ -79,7 +79,7 @@ warm_bubble_setup = WarmBubbleSetup() equations = CompressibleEulerEquations2D(warm_bubble_setup.gamma) -boundary_conditions = (x_neg = boundary_condition_periodic, +boundary_conditions = (; x_neg = boundary_condition_periodic, x_pos = boundary_condition_periodic, y_neg = boundary_condition_slip_wall, y_pos = boundary_condition_slip_wall) diff --git a/examples/structured_2d_dgsem/elixir_eulermulti_blastwave_ec.jl b/examples/structured_2d_dgsem/elixir_eulermulti_blastwave_ec.jl index 32014ce6705..7a207916445 100644 --- a/examples/structured_2d_dgsem/elixir_eulermulti_blastwave_ec.jl +++ b/examples/structured_2d_dgsem/elixir_eulermulti_blastwave_ec.jl @@ -18,7 +18,7 @@ coordinates_max = (2.0, 2.0) mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition_slip_wall) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_eulermulti_convergence_ec.jl b/examples/structured_2d_dgsem/elixir_eulermulti_convergence_ec.jl index 2bbedaba2bf..e732ec314d5 100644 --- a/examples/structured_2d_dgsem/elixir_eulermulti_convergence_ec.jl +++ b/examples/structured_2d_dgsem/elixir_eulermulti_convergence_ec.jl @@ -15,10 +15,12 @@ solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha, cells_per_dimension = (16, 16) coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_eulerpolytropic_convergence.jl b/examples/structured_2d_dgsem/elixir_eulerpolytropic_convergence.jl index c5317d08781..74de18619c6 100644 --- a/examples/structured_2d_dgsem/elixir_eulerpolytropic_convergence.jl +++ b/examples/structured_2d_dgsem/elixir_eulerpolytropic_convergence.jl @@ -21,10 +21,12 @@ cells_per_dimension = (4, 4) mesh = StructuredMesh(cells_per_dimension, coordinates_min, - coordinates_max) + coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_eulerpolytropic_ec.jl b/examples/structured_2d_dgsem/elixir_eulerpolytropic_ec.jl index 11f2797708a..725ce93975a 100644 --- a/examples/structured_2d_dgsem/elixir_eulerpolytropic_ec.jl +++ b/examples/structured_2d_dgsem/elixir_eulerpolytropic_ec.jl @@ -38,12 +38,13 @@ end cells_per_dimension = (16, 16) # Create curved mesh with 16 x 16 elements -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_eulerpolytropic_isothermal_wave.jl b/examples/structured_2d_dgsem/elixir_eulerpolytropic_isothermal_wave.jl index 08e4a82cf4b..ee87389bfda 100644 --- a/examples/structured_2d_dgsem/elixir_eulerpolytropic_isothermal_wave.jl +++ b/examples/structured_2d_dgsem/elixir_eulerpolytropic_isothermal_wave.jl @@ -31,16 +31,17 @@ coordinates_max = (2.0, 1.0) cells_per_dimension = (64, 32) -boundary_conditions = (x_neg = boundary_condition_periodic, +boundary_conditions = (; x_neg = boundary_condition_periodic, x_pos = boundary_condition_periodic, y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) mesh = StructuredMesh(cells_per_dimension, coordinates_min, - coordinates_max) + coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_eulerpolytropic_wave.jl b/examples/structured_2d_dgsem/elixir_eulerpolytropic_wave.jl index b14e3b20500..0f3257d94cd 100644 --- a/examples/structured_2d_dgsem/elixir_eulerpolytropic_wave.jl +++ b/examples/structured_2d_dgsem/elixir_eulerpolytropic_wave.jl @@ -31,16 +31,17 @@ coordinates_max = (2.0, 1.0) cells_per_dimension = (64, 32) -boundary_conditions = (x_neg = boundary_condition_periodic, +boundary_conditions = (; x_neg = boundary_condition_periodic, x_pos = boundary_condition_periodic, y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) mesh = StructuredMesh(cells_per_dimension, coordinates_min, - coordinates_max) + coordinates_max, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl b/examples/structured_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl index 7f9da75e0ca..3660939b4ca 100644 --- a/examples/structured_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl +++ b/examples/structured_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl @@ -39,7 +39,7 @@ cells_per_dimension = (8, 8) mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions, source_terms = source_terms_harmonic) diff --git a/examples/structured_2d_dgsem/elixir_hypdiff_nonperiodic.jl b/examples/structured_2d_dgsem/elixir_hypdiff_nonperiodic.jl index b30b9479a25..0efe4e88a55 100644 --- a/examples/structured_2d_dgsem/elixir_hypdiff_nonperiodic.jl +++ b/examples/structured_2d_dgsem/elixir_hypdiff_nonperiodic.jl @@ -9,7 +9,7 @@ initial_condition = initial_condition_poisson_nonperiodic solver = DGSEM(polydeg = 6, surface_flux = flux_lax_friedrichs) -boundary_conditions = (x_neg = boundary_condition_poisson_nonperiodic, +boundary_conditions = (; x_neg = boundary_condition_poisson_nonperiodic, x_pos = boundary_condition_poisson_nonperiodic, y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) diff --git a/examples/structured_2d_dgsem/elixir_lbm_lid_driven_cavity.jl b/examples/structured_2d_dgsem/elixir_lbm_lid_driven_cavity.jl index adc1ff16b55..6ce09e9adde 100644 --- a/examples/structured_2d_dgsem/elixir_lbm_lid_driven_cavity.jl +++ b/examples/structured_2d_dgsem/elixir_lbm_lid_driven_cavity.jl @@ -61,7 +61,7 @@ function boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, # Calculate boundary flux (u_inner is "left" of boundary, u_boundary is "right" of boundary) return surface_flux_function(u_inner, u_boundary, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_noslip_wall, +boundary_conditions = (; x_neg = boundary_condition_noslip_wall, x_pos = boundary_condition_noslip_wall, y_neg = boundary_condition_noslip_wall, y_pos = boundary_condition_lid_driven_cavity) @@ -89,7 +89,7 @@ mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl index 6286f007bc5..336de1e6b69 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -16,7 +16,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_central, flux_nonconservative_powell) @@ -43,10 +43,11 @@ function mapping(xi_, eta_) end cells_per_dimension = (4, 4) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_mhd_coupled.jl b/examples/structured_2d_dgsem/elixir_mhd_coupled.jl index 3465de1723b..e887cd241b8 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_coupled.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_coupled.jl @@ -63,7 +63,7 @@ boundary_conditions1 = (x_neg = BoundaryConditionCoupled(2, (:end, :i_forward), y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) -semi1 = SemidiscretizationHyperbolic(mesh1, equations, initial_condition1, solver, +semi1 = SemidiscretizationHyperbolic(mesh1, equations, initial_condition1, solver; boundary_conditions = boundary_conditions1) ########### @@ -86,7 +86,7 @@ boundary_conditions2 = (x_neg = BoundaryConditionCoupled(1, (:end, :i_forward), y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) -semi2 = SemidiscretizationHyperbolic(mesh2, equations, initial_condition2, solver, +semi2 = SemidiscretizationHyperbolic(mesh2, equations, initial_condition2, solver; boundary_conditions = boundary_conditions2) # Create a semidiscretization that bundles all the semidiscretizations. diff --git a/examples/structured_2d_dgsem/elixir_mhd_ec.jl b/examples/structured_2d_dgsem/elixir_mhd_ec.jl index 7b614eda5a0..20b2c76fbe4 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_ec.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_ec.jl @@ -51,10 +51,11 @@ end # Create curved mesh with 8 x 8 elements cells_per_dimension = (8, 8) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_mhd_ec_shockcapturing.jl b/examples/structured_2d_dgsem/elixir_mhd_ec_shockcapturing.jl index 91dde9755e9..306703e4392 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_ec_shockcapturing.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_ec_shockcapturing.jl @@ -35,7 +35,8 @@ cells_per_dimension = (16, 16) mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_2d_dgsem/elixir_mhd_onion.jl b/examples/structured_2d_dgsem/elixir_mhd_onion.jl index 065f60dc863..c2def544007 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_onion.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_onion.jl @@ -38,19 +38,19 @@ mesh = StructuredMesh(cells_per_dimension, # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) solver = DGSEM(polydeg = 3, surface_flux = surface_flux, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) -boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition), +boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition), x_pos = BoundaryConditionDirichlet(initial_condition), y_neg = BoundaryConditionDirichlet(initial_condition), y_pos = BoundaryConditionDirichlet(initial_condition)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_2d_dgsem/elixir_mhd_orszag_tang_sc_subcell.jl b/examples/structured_2d_dgsem/elixir_mhd_orszag_tang_sc_subcell.jl index 0fbfc1e21ab..e8293d7e1a8 100644 --- a/examples/structured_2d_dgsem/elixir_mhd_orszag_tang_sc_subcell.jl +++ b/examples/structured_2d_dgsem/elixir_mhd_orszag_tang_sc_subcell.jl @@ -67,7 +67,8 @@ cells_per_dimension = (32, 32) mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_advection_basic.jl b/examples/structured_3d_dgsem/elixir_advection_basic.jl index a727a463d37..4a702cfa43d 100644 --- a/examples/structured_3d_dgsem/elixir_advection_basic.jl +++ b/examples/structured_3d_dgsem/elixir_advection_basic.jl @@ -18,11 +18,13 @@ coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z)) cells_per_dimension = (8, 8, 8) # Create curved mesh with 8 x 8 x 8 elements -mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_advection_free_stream.jl b/examples/structured_3d_dgsem/elixir_advection_free_stream.jl index d691e711715..21da71ab8b7 100644 --- a/examples/structured_3d_dgsem/elixir_advection_free_stream.jl +++ b/examples/structured_3d_dgsem/elixir_advection_free_stream.jl @@ -38,10 +38,11 @@ end cells_per_dimension = (8, 8, 8) # Create curved mesh with 8 x 8 x 8 elements -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_constant, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_constant, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_advection_nonperiodic_curved.jl b/examples/structured_3d_dgsem/elixir_advection_nonperiodic_curved.jl index 001898c7c02..f63dd0bac6a 100644 --- a/examples/structured_3d_dgsem/elixir_advection_nonperiodic_curved.jl +++ b/examples/structured_3d_dgsem/elixir_advection_nonperiodic_curved.jl @@ -40,7 +40,7 @@ end cells_per_dimension = (8, 8, 8) mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/structured_3d_dgsem/elixir_advection_restart.jl b/examples/structured_3d_dgsem/elixir_advection_restart.jl index 42a1f0e2fb1..cae61f33e03 100644 --- a/examples/structured_3d_dgsem/elixir_advection_restart.jl +++ b/examples/structured_3d_dgsem/elixir_advection_restart.jl @@ -18,7 +18,8 @@ restart_filename = joinpath("out", "restart_000000010.h5") mesh = load_mesh(restart_filename) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) tspan = (load_time(restart_filename), 2.0) dt = load_dt(restart_filename) diff --git a/examples/structured_3d_dgsem/elixir_euler_ec.jl b/examples/structured_3d_dgsem/elixir_euler_ec.jl index 15b1c8da8d8..2b91aeddde5 100644 --- a/examples/structured_3d_dgsem/elixir_euler_ec.jl +++ b/examples/structured_3d_dgsem/elixir_euler_ec.jl @@ -45,12 +45,13 @@ end cells_per_dimension = (4, 4, 4) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_euler_free_stream.jl b/examples/structured_3d_dgsem/elixir_euler_free_stream.jl index cfd415a2523..25d41691746 100644 --- a/examples/structured_3d_dgsem/elixir_euler_free_stream.jl +++ b/examples/structured_3d_dgsem/elixir_euler_free_stream.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_constant # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -45,9 +45,10 @@ end cells_per_dimension = (4, 4, 4) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_euler_sedov.jl b/examples/structured_3d_dgsem/elixir_euler_sedov.jl index 02fe57a63f2..dd5ebc413a2 100644 --- a/examples/structured_3d_dgsem/elixir_euler_sedov.jl +++ b/examples/structured_3d_dgsem/elixir_euler_sedov.jl @@ -79,7 +79,8 @@ cells_per_dimension = (4, 4, 4) mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_euler_source_terms.jl b/examples/structured_3d_dgsem/elixir_euler_source_terms.jl index f9e8dc5e3f9..b7245b685c6 100644 --- a/examples/structured_3d_dgsem/elixir_euler_source_terms.jl +++ b/examples/structured_3d_dgsem/elixir_euler_source_terms.jl @@ -16,7 +16,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -32,10 +32,11 @@ f6(s, t) = SVector(s + 1.0, t + 1.0, 2.0) cells_per_dimension = (4, 4, 4) -mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4, f5, f6)) +mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4, f5, f6), periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl b/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl index b4be67074eb..61e4336a971 100644 --- a/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl +++ b/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -50,10 +50,9 @@ mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = false) # you can either use a single function to impose the BCs weakly in all # 2*ndims == 6 directions or you can pass a tuple containing BCs for each direction # Assign a single boundary condition to all boundaries -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = boundary_condition_default(mesh, boundary_condition) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) # Alternatively, you can use -# boundary_conditions = (x_neg = boundary_condition, +# boundary_conditions = (; x_neg = boundary_condition, # x_pos = boundary_condition, # y_neg = boundary_condition, # y_pos = boundary_condition, diff --git a/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl b/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl index 32a9905ae13..a54effde618 100644 --- a/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl +++ b/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl @@ -27,8 +27,7 @@ cells_per_dimension = (2, 2, 2) mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity = false) -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = boundary_condition_default(mesh, boundary_condition) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, source_terms = source_terms, diff --git a/examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl b/examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl index 6b42b3d0c32..e5261616a26 100644 --- a/examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl @@ -30,10 +30,11 @@ function mapping(xi, eta, zeta) end cells_per_dimension = (4, 4, 4) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_mhd_ec.jl b/examples/structured_3d_dgsem/elixir_mhd_ec.jl index d2a68445749..7e594053fb5 100644 --- a/examples/structured_3d_dgsem/elixir_mhd_ec.jl +++ b/examples/structured_3d_dgsem/elixir_mhd_ec.jl @@ -41,10 +41,11 @@ function mapping(xi_, eta_, zeta_) end cells_per_dimension = (4, 4, 4) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/structured_3d_dgsem/elixir_mhd_ec_shockcapturing.jl b/examples/structured_3d_dgsem/elixir_mhd_ec_shockcapturing.jl index b562a497bbd..2b43e177e99 100644 --- a/examples/structured_3d_dgsem/elixir_mhd_ec_shockcapturing.jl +++ b/examples/structured_3d_dgsem/elixir_mhd_ec_shockcapturing.jl @@ -52,10 +52,11 @@ function mapping(xi_, eta_, zeta_) end cells_per_dimension = (8, 8, 8) -mesh = StructuredMesh(cells_per_dimension, mapping) +mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl index 2f95985c7ba..49c791a0497 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -97,9 +97,11 @@ trees_per_dimension = (1, 1) mesh = T8codeMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 1) + initial_refinement_level = 1, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_advection_amr_unstructured_flag.jl b/examples/t8code_2d_dgsem/elixir_advection_amr_unstructured_flag.jl index 25ad12f40d3..e87621cac1a 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_amr_unstructured_flag.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_amr_unstructured_flag.jl @@ -10,7 +10,7 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity) initial_condition = initial_condition_gauss boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition,) solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) @@ -37,7 +37,7 @@ mesh = T8codeMesh(mesh_file, 2; mapping = mapping_flag, polydeg = 3, initial_refinement_level = 1) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_2d_dgsem/elixir_advection_basic.jl b/examples/t8code_2d_dgsem/elixir_advection_basic.jl index b444d5590f1..c2dc25443e5 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_basic.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_basic.jl @@ -20,11 +20,13 @@ trees_per_dimension = (8, 8) mesh = T8codeMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 1) + initial_refinement_level = 1, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_advection_extended.jl b/examples/t8code_2d_dgsem/elixir_advection_extended.jl index e3955226fdd..05d9fb15b0e 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_extended.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_extended.jl @@ -9,12 +9,12 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity) initial_condition = initial_condition_convergence_test -# BCs must be passed as Dict +# Boundary conditions are specified as a NamedTuple boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:x_neg => boundary_condition, - :x_pos => boundary_condition, - :y_neg => boundary_condition, - :y_pos => boundary_condition) +boundary_conditions = (; x_neg = boundary_condition, + x_pos = boundary_condition, + y_neg = boundary_condition, + y_pos = boundary_condition) # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) @@ -31,7 +31,7 @@ mesh = T8codeMesh(trees_per_dimension, polydeg = 3, periodicity = false) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_2d_dgsem/elixir_advection_nonconforming_flag.jl b/examples/t8code_2d_dgsem/elixir_advection_nonconforming_flag.jl index 42174c44401..c10a504eeed 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_nonconforming_flag.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_nonconforming_flag.jl @@ -54,7 +54,8 @@ Trixi.adapt!(mesh, adapt_callback) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_advection_restart.jl b/examples/t8code_2d_dgsem/elixir_advection_restart.jl index 0dbbb6c3d14..c9d3a836833 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_restart.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_restart.jl @@ -19,7 +19,7 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file)) restart_filename = joinpath("out", restart_file) mesh = load_mesh(restart_filename) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) tspan = (load_time(restart_filename), 2.0) diff --git a/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl b/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl index caa25d41595..635e337459e 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_restart_amr.jl @@ -19,7 +19,7 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file)) restart_filename = joinpath("out", restart_file) mesh = load_mesh(restart_filename) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) tspan = (load_time(restart_filename), 2.0) diff --git a/examples/t8code_2d_dgsem/elixir_advection_unstructured_flag.jl b/examples/t8code_2d_dgsem/elixir_advection_unstructured_flag.jl index dc27f626911..ed7a9e446fe 100644 --- a/examples/t8code_2d_dgsem/elixir_advection_unstructured_flag.jl +++ b/examples/t8code_2d_dgsem/elixir_advection_unstructured_flag.jl @@ -10,7 +10,7 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition,) # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux. solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) @@ -35,7 +35,7 @@ mesh = T8codeMesh(mesh_file, 2; initial_refinement_level = 2) # A semidiscretization collects data structures and functions for the spatial discretization. -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_2d_dgsem/elixir_euler_free_stream.jl b/examples/t8code_2d_dgsem/elixir_euler_free_stream.jl index b204c25a756..9c5dfe61f53 100644 --- a/examples/t8code_2d_dgsem/elixir_euler_free_stream.jl +++ b/examples/t8code_2d_dgsem/elixir_euler_free_stream.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_constant # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -63,8 +63,9 @@ end Trixi.adapt!(mesh, adapt_callback) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition))) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = (; + all = BoundaryConditionDirichlet(initial_condition),)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_euler_sedov.jl b/examples/t8code_2d_dgsem/elixir_euler_sedov.jl index 8653a0a30ed..09baac14ceb 100644 --- a/examples/t8code_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/t8code_2d_dgsem/elixir_euler_sedov.jl @@ -72,7 +72,8 @@ mesh = T8codeMesh(trees_per_dimension, polydeg = 4, coordinates_min = coordinates_min, coordinates_max = coordinates_max, initial_refinement_level = 2, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_euler_shockcapturing_ec.jl b/examples/t8code_2d_dgsem/elixir_euler_shockcapturing_ec.jl index c74c59cd112..f625333b575 100644 --- a/examples/t8code_2d_dgsem/elixir_euler_shockcapturing_ec.jl +++ b/examples/t8code_2d_dgsem/elixir_euler_shockcapturing_ec.jl @@ -35,7 +35,8 @@ mesh = T8codeMesh(trees_per_dimension, polydeg = 4, coordinates_min = coordinates_min, coordinates_max = coordinates_max, initial_refinement_level = 2, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl b/examples/t8code_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl index 604857ff8e4..f151561c9b2 100644 --- a/examples/t8code_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl +++ b/examples/t8code_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl @@ -10,16 +10,15 @@ initial_condition = initial_condition_convergence_test source_terms = source_terms_convergence_test -# BCs must be passed as Dict boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition,) # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of # `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`. # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) diff --git a/examples/t8code_2d_dgsem/elixir_euler_weak_blast_wave_amr.jl b/examples/t8code_2d_dgsem/elixir_euler_weak_blast_wave_amr.jl index 9f68158bdc5..12e5ab03aba 100644 --- a/examples/t8code_2d_dgsem/elixir_euler_weak_blast_wave_amr.jl +++ b/examples/t8code_2d_dgsem/elixir_euler_weak_blast_wave_amr.jl @@ -71,7 +71,8 @@ mesh = T8codeMesh(trees_per_dimension, polydeg = 4, mapping = mapping_twist, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_eulergravity_convergence.jl b/examples/t8code_2d_dgsem/elixir_eulergravity_convergence.jl index 3fe0386a897..64695fdb1f1 100644 --- a/examples/t8code_2d_dgsem/elixir_eulergravity_convergence.jl +++ b/examples/t8code_2d_dgsem/elixir_eulergravity_convergence.jl @@ -18,11 +18,13 @@ trees_per_dimension = (1, 1) mesh = T8codeMesh(trees_per_dimension, polydeg = 1, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 2) + initial_refinement_level = 2, + periodicity = true) semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, - solver_euler, - source_terms = source_terms_eoc_test_coupled_euler_gravity) + solver_euler; + source_terms = source_terms_eoc_test_coupled_euler_gravity, + boundary_conditions = boundary_condition_periodic) ############################################################################### # semidiscretization of the hyperbolic diffusion equations @@ -33,13 +35,14 @@ equations_gravity = HyperbolicDiffusionEquations2D() # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver_gravity = DGSEM(polydeg, FluxLaxFriedrichs(max_abs_speed_naive)) semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, - solver_gravity, - source_terms = source_terms_harmonic) + solver_gravity; + source_terms = source_terms_harmonic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # combining both semidiscretizations for Euler + self-gravity diff --git a/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl index a86c557162b..64f9f9a5910 100644 --- a/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -24,7 +24,8 @@ mesh = T8codeMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl b/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl index 65d2abc3862..02e0326bf21 100644 --- a/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/t8code_2d_dgsem/elixir_mhd_rotor.jl @@ -48,7 +48,7 @@ initial_condition = initial_condition_rotor # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) @@ -82,9 +82,9 @@ mesh = T8codeMesh(mesh_file, 2; polydeg = 4, initial_refinement_level = 1) boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition,) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_3d_dgsem/elixir_advection_amr.jl b/examples/t8code_3d_dgsem/elixir_advection_amr.jl index 40754e29439..cc99fba951e 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_amr.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_amr.jl @@ -22,9 +22,11 @@ trees_per_dimension = (1, 1, 1) # See https://doi.org/10.1007/s10915-018-00897-9, Section 6. mesh = T8codeMesh(trees_per_dimension, polydeg = 1, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 4) + initial_refinement_level = 4, + periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_3d_dgsem/elixir_advection_amr_unstructured_curved.jl b/examples/t8code_3d_dgsem/elixir_advection_amr_unstructured_curved.jl index ef4d27281b5..a8de773ebb3 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_amr_unstructured_curved.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_amr_unstructured_curved.jl @@ -15,7 +15,7 @@ solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs) initial_condition = initial_condition_gauss boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) # Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping. # The mapping will be interpolated at tree level, and then refined without changing @@ -54,7 +54,7 @@ mesh = T8codeMesh(mesh_file, 3; polydeg = 2, mapping = mapping, initial_refinement_level = 1) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_3d_dgsem/elixir_advection_basic.jl b/examples/t8code_3d_dgsem/elixir_advection_basic.jl index ae785f3113d..ff315d6192d 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_basic.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_basic.jl @@ -20,11 +20,13 @@ coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z)) trees_per_dimension = (4, 4, 4) mesh = T8codeMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 1) + initial_refinement_level = 1, + periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_3d_dgsem/elixir_advection_cubed_sphere.jl b/examples/t8code_3d_dgsem/elixir_advection_cubed_sphere.jl index 8786f2d631b..7603bffb868 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_cubed_sphere.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_cubed_sphere.jl @@ -13,8 +13,8 @@ solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:inside => boundary_condition, - :outside => boundary_condition) +boundary_conditions = (; inside = boundary_condition, + outside = boundary_condition) trees_per_face_dimension = 5 # Number of trees per patch in longitudinal and latitudinal direction layers = 3 # Number of layers of the shell @@ -25,7 +25,7 @@ mesh = Trixi.T8codeMeshCubedSphere(trees_per_face_dimension, layers, polydeg = 3) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_3d_dgsem/elixir_advection_nonconforming.jl b/examples/t8code_3d_dgsem/elixir_advection_nonconforming.jl index 24808dc4bca..76743cb2cf1 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_nonconforming.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_nonconforming.jl @@ -19,7 +19,8 @@ trees_per_dimension = (1, 1, 1) # See https://doi.org/10.1007/s10915-018-00897-9, Section 6. mesh = T8codeMesh(trees_per_dimension, polydeg = 3, coordinates_min = coordinates_min, coordinates_max = coordinates_max, - initial_refinement_level = 2) + initial_refinement_level = 2, + periodicity = true) # Note: This is actually a `p8est_quadrant_t` which is much bigger than the # following struct. But we only need the first four fields for our purpose. @@ -50,7 +51,8 @@ Trixi.adapt!(mesh, adapt_callback) # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_3d_dgsem/elixir_advection_restart.jl b/examples/t8code_3d_dgsem/elixir_advection_restart.jl index 230f7483aeb..205adc2afa0 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_restart.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_restart.jl @@ -18,7 +18,8 @@ restart_filename = joinpath("out", "restart_000000010.h5") mesh = load_mesh(restart_filename) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) tspan = (load_time(restart_filename), 2.0) dt = load_dt(restart_filename) diff --git a/examples/t8code_3d_dgsem/elixir_advection_unstructured_curved.jl b/examples/t8code_3d_dgsem/elixir_advection_unstructured_curved.jl index d33e9e44646..cc7a7df5148 100644 --- a/examples/t8code_3d_dgsem/elixir_advection_unstructured_curved.jl +++ b/examples/t8code_3d_dgsem/elixir_advection_unstructured_curved.jl @@ -13,7 +13,7 @@ solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) # Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping. # The mapping will be interpolated at tree level, and then refined without changing @@ -52,7 +52,7 @@ mesh = T8codeMesh(mesh_file, 3; polydeg = 3, initial_refinement_level = 2) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_3d_dgsem/elixir_euler_baroclinic_instability.jl b/examples/t8code_3d_dgsem/elixir_euler_baroclinic_instability.jl index c99526758e8..1e2cc40f092 100644 --- a/examples/t8code_3d_dgsem/elixir_euler_baroclinic_instability.jl +++ b/examples/t8code_3d_dgsem/elixir_euler_baroclinic_instability.jl @@ -217,8 +217,8 @@ end initial_condition = initial_condition_baroclinic_instability -boundary_conditions = Dict(:inside => boundary_condition_slip_wall, - :outside => boundary_condition_slip_wall) +boundary_conditions = (; inside = boundary_condition_slip_wall, + outside = boundary_condition_slip_wall) # This is a good estimate for the speed of sound in this example. # Other values between 300 and 400 should work as well. diff --git a/examples/t8code_3d_dgsem/elixir_euler_ec.jl b/examples/t8code_3d_dgsem/elixir_euler_ec.jl index 13414222bff..e535d0b48a1 100644 --- a/examples/t8code_3d_dgsem/elixir_euler_ec.jl +++ b/examples/t8code_3d_dgsem/elixir_euler_ec.jl @@ -8,7 +8,7 @@ equations = CompressibleEulerEquations3D(5 / 3) initial_condition = initial_condition_weak_blast_wave -boundary_conditions = Dict(:all => boundary_condition_slip_wall) +boundary_conditions = (; all = boundary_condition_slip_wall) # Get the DG approximation space @@ -51,7 +51,7 @@ mesh = T8codeMesh(mesh_file, 3; polydeg = 5, mapping = mapping) # Create the semidiscretization object. -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### @@ -70,7 +70,7 @@ alive_callback = AliveCallback(analysis_interval = analysis_interval) # Add `:thermodynamic_entropy` to `extra_node_variables` tuple ... extra_node_variables = (:thermodynamic_entropy,) -# ... and specify the function `get_node_variable` for this symbol, +# ... and specify the function `get_node_variable` for this symbol, # with first argument matching the symbol (turned into a type via `Val`) for dispatching. function Trixi.get_node_variable(::Val{:thermodynamic_entropy}, u, mesh, equations, dg, cache) diff --git a/examples/t8code_3d_dgsem/elixir_euler_free_stream.jl b/examples/t8code_3d_dgsem/elixir_euler_free_stream.jl index 3e298dbdd8b..9915c006779 100644 --- a/examples/t8code_3d_dgsem/elixir_euler_free_stream.jl +++ b/examples/t8code_3d_dgsem/elixir_euler_free_stream.jl @@ -8,7 +8,7 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_constant -boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; all = BoundaryConditionDirichlet(initial_condition)) # Solver with polydeg=4 to ensure free stream preservation (FSP) on non-conforming meshes. # The polydeg of the solver must be at least twice as big as the polydeg of the mesh. @@ -19,7 +19,7 @@ boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition) # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 4, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -86,7 +86,7 @@ end Trixi.adapt!(mesh, adapt_callback) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_3d_dgsem/elixir_euler_free_stream_extruded.jl b/examples/t8code_3d_dgsem/elixir_euler_free_stream_extruded.jl index 7ac798326d2..ffd398ea803 100644 --- a/examples/t8code_3d_dgsem/elixir_euler_free_stream_extruded.jl +++ b/examples/t8code_3d_dgsem/elixir_euler_free_stream_extruded.jl @@ -8,14 +8,14 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_constant -boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; all = BoundaryConditionDirichlet(initial_condition)) # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of # `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`. # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -73,7 +73,7 @@ end Trixi.adapt!(mesh, adapt_callback) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/t8code_3d_dgsem/elixir_euler_sedov.jl b/examples/t8code_3d_dgsem/elixir_euler_sedov.jl index 2c085ae505c..0dd8243ca7a 100644 --- a/examples/t8code_3d_dgsem/elixir_euler_sedov.jl +++ b/examples/t8code_3d_dgsem/elixir_euler_sedov.jl @@ -72,7 +72,8 @@ mesh = T8codeMesh(trees_per_dimension, polydeg = 4, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/t8code_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl b/examples/t8code_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl index be61cdecf4b..152213618ba 100644 --- a/examples/t8code_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl +++ b/examples/t8code_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl @@ -9,7 +9,7 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:all => boundary_condition) +boundary_conditions = (; all = boundary_condition) # Solver with polydeg=4 to ensure free stream preservation (FSP) on non-conforming meshes. # The polydeg of the solver must be at least twice as big as the polydeg of the mesh. @@ -20,7 +20,7 @@ boundary_conditions = Dict(:all => boundary_condition) # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 4, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) diff --git a/examples/t8code_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/t8code_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl index 36101d088a6..8cfff0901e4 100644 --- a/examples/t8code_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl +++ b/examples/t8code_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl @@ -9,19 +9,19 @@ equations = CompressibleEulerEquations3D(1.4) initial_condition = initial_condition_convergence_test boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:x_neg => boundary_condition, - :x_pos => boundary_condition, - :y_neg => boundary_condition, - :y_pos => boundary_condition, - :z_neg => boundary_condition, - :z_pos => boundary_condition) +boundary_conditions = (; x_neg = boundary_condition, + x_pos = boundary_condition, + y_neg = boundary_condition, + y_pos = boundary_condition, + z_neg = boundary_condition, + z_pos = boundary_condition) # Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of # `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`. # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) diff --git a/examples/t8code_3d_dgsem/elixir_euler_weak_blast_wave_amr.jl b/examples/t8code_3d_dgsem/elixir_euler_weak_blast_wave_amr.jl index 03b6dac3fb4..8a9c1060722 100644 --- a/examples/t8code_3d_dgsem/elixir_euler_weak_blast_wave_amr.jl +++ b/examples/t8code_3d_dgsem/elixir_euler_weak_blast_wave_amr.jl @@ -75,7 +75,8 @@ mesh = T8codeMesh(trees_per_dimension, periodicity = true) # Create the semidiscretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_amr.jl b/examples/tree_1d_dgsem/elixir_advection_amr.jl index 9286626b7ea..82a3f67703b 100644 --- a/examples/tree_1d_dgsem/elixir_advection_amr.jl +++ b/examples/tree_1d_dgsem/elixir_advection_amr.jl @@ -15,9 +15,10 @@ coordinates_min = (-5.0,) coordinates_max = (5.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_amr_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_advection_amr_nonperiodic.jl index 46f771bbab3..66ed00fa7ea 100644 --- a/examples/tree_1d_dgsem/elixir_advection_amr_nonperiodic.jl +++ b/examples/tree_1d_dgsem/elixir_advection_amr_nonperiodic.jl @@ -21,8 +21,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, - solver, - boundary_conditions = boundary_conditions) + solver; boundary_conditions = boundary_conditions) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_basic.jl b/examples/tree_1d_dgsem/elixir_advection_basic.jl index e25a5817ab0..2e98b89cd75 100644 --- a/examples/tree_1d_dgsem/elixir_advection_basic.jl +++ b/examples/tree_1d_dgsem/elixir_advection_basic.jl @@ -16,11 +16,12 @@ coordinates_max = 1.0 # maximum coordinate # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_convergence_fvO2.jl b/examples/tree_1d_dgsem/elixir_advection_convergence_fvO2.jl index 2832a1f9ce6..193915bbd48 100644 --- a/examples/tree_1d_dgsem/elixir_advection_convergence_fvO2.jl +++ b/examples/tree_1d_dgsem/elixir_advection_convergence_fvO2.jl @@ -22,10 +22,11 @@ coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_diffusion_cfl.jl b/examples/tree_1d_dgsem/elixir_advection_diffusion_cfl.jl index 127087d5a4f..d06efc92334 100644 --- a/examples/tree_1d_dgsem/elixir_advection_diffusion_cfl.jl +++ b/examples/tree_1d_dgsem/elixir_advection_diffusion_cfl.jl @@ -18,7 +18,7 @@ coordinates_max = convert(Float64, pi) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure) + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure) function x_trans_periodic(x, domain_length = SVector(2 * pi), center = SVector(0.0)) x_normalized = x .- center @@ -45,7 +45,9 @@ end initial_condition = initial_condition_diffusive_convergence_test semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl b/examples/tree_1d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl index a99c39ef5fb..dfa4963d17c 100644 --- a/examples/tree_1d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl +++ b/examples/tree_1d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl @@ -18,7 +18,7 @@ coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) function initial_condition_diffusive_convergence_test(x, t, equation::LinearScalarAdvectionEquation1D) @@ -48,7 +48,9 @@ jac_eltype = jacobian_eltype(real(solver), jac_detector) semi_jac_type = SemidiscretizationHyperbolicParabolic(mesh, (equations_hyperbolic, equations_parabolic), - initial_condition, solver, + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic), uEltype = jac_eltype) tspan = (0.0, 1.5) # Re-used for wrapping `rhs_parabolic!` below @@ -92,7 +94,9 @@ coloring_vec_parabolic = column_colors(coloring_result) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations_hyperbolic, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) # Supply Jacobian prototype and coloring vector to the semidiscretization ode = semidiscretize(semi, tspan, diff --git a/examples/tree_1d_dgsem/elixir_advection_doublefloat.jl b/examples/tree_1d_dgsem/elixir_advection_doublefloat.jl index 4c27ae06241..7ca07a0e43e 100644 --- a/examples/tree_1d_dgsem/elixir_advection_doublefloat.jl +++ b/examples/tree_1d_dgsem/elixir_advection_doublefloat.jl @@ -24,10 +24,11 @@ coordinates_max = one(RealT) # maximum coordinate mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, n_cells_max = 30_000, - RealT = RealT) + RealT = RealT, periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_extended.jl b/examples/tree_1d_dgsem/elixir_advection_extended.jl index 8df04c72334..df92a9bc60e 100644 --- a/examples/tree_1d_dgsem/elixir_advection_extended.jl +++ b/examples/tree_1d_dgsem/elixir_advection_extended.jl @@ -13,8 +13,6 @@ initial_condition = initial_condition_convergence_test # you can either use a single function to impose the BCs weakly in all # 1*ndims == 2 directions or you can pass a tuple containing BCs for # each direction -# Note: "boundary_condition_periodic" indicates that it is a periodic boundary and can be omitted on -# fully periodic domains. Here, however, it is included to allow easy override during testing boundary_conditions = boundary_condition_periodic # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux @@ -30,7 +28,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_advection_finite_volume.jl b/examples/tree_1d_dgsem/elixir_advection_finite_volume.jl index 5242793ab9b..092eaf195c6 100644 --- a/examples/tree_1d_dgsem/elixir_advection_finite_volume.jl +++ b/examples/tree_1d_dgsem/elixir_advection_finite_volume.jl @@ -17,11 +17,12 @@ coordinates_max = 1.0 # maximum coordinate # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_perk2.jl b/examples/tree_1d_dgsem/elixir_advection_perk2.jl index a6b1a3f1606..2628757ebdf 100644 --- a/examples/tree_1d_dgsem/elixir_advection_perk2.jl +++ b/examples/tree_1d_dgsem/elixir_advection_perk2.jl @@ -18,11 +18,12 @@ coordinates_max = 1.0 # maximum coordinate # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_advection_perk2_optimal_cfl.jl b/examples/tree_1d_dgsem/elixir_advection_perk2_optimal_cfl.jl index 862440e26dc..2eb87a11793 100644 --- a/examples/tree_1d_dgsem/elixir_advection_perk2_optimal_cfl.jl +++ b/examples/tree_1d_dgsem/elixir_advection_perk2_optimal_cfl.jl @@ -18,11 +18,12 @@ coordinates_max = 1.0 # maximum coordinate # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_burgers_basic.jl b/examples/tree_1d_dgsem/elixir_burgers_basic.jl index cd845171d77..a951229d2c4 100644 --- a/examples/tree_1d_dgsem/elixir_burgers_basic.jl +++ b/examples/tree_1d_dgsem/elixir_burgers_basic.jl @@ -14,10 +14,11 @@ coordinates_min = 0.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_burgers_linear_stability.jl b/examples/tree_1d_dgsem/elixir_burgers_linear_stability.jl index de50f5cc5bd..974f13339ff 100644 --- a/examples/tree_1d_dgsem/elixir_burgers_linear_stability.jl +++ b/examples/tree_1d_dgsem/elixir_burgers_linear_stability.jl @@ -20,10 +20,11 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_linear_stability, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_burgers_rarefaction.jl b/examples/tree_1d_dgsem/elixir_burgers_rarefaction.jl index 00539dc8137..e6dc39fde7d 100644 --- a/examples/tree_1d_dgsem/elixir_burgers_rarefaction.jl +++ b/examples/tree_1d_dgsem/elixir_burgers_rarefaction.jl @@ -52,12 +52,12 @@ function boundary_condition_outflow(u_inner, orientation, direction, x, t, return flux(u_inner, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_inflow, +boundary_conditions = (; x_neg = boundary_condition_inflow, x_pos = boundary_condition_outflow) initial_condition = initial_condition_rarefaction -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_burgers_shock.jl b/examples/tree_1d_dgsem/elixir_burgers_shock.jl index 24f569201d7..6f9b06477f4 100644 --- a/examples/tree_1d_dgsem/elixir_burgers_shock.jl +++ b/examples/tree_1d_dgsem/elixir_burgers_shock.jl @@ -52,12 +52,12 @@ function boundary_condition_outflow(u_inner, orientation, direction, x, t, return flux(u_inner, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_inflow, +boundary_conditions = (; x_neg = boundary_condition_inflow, x_pos = boundary_condition_outflow) initial_condition = initial_condition_shock -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_diffusion_ldg_newton_krylov.jl b/examples/tree_1d_dgsem/elixir_diffusion_ldg_newton_krylov.jl index 8d20593bc0e..8fc08add88a 100644 --- a/examples/tree_1d_dgsem/elixir_diffusion_ldg_newton_krylov.jl +++ b/examples/tree_1d_dgsem/elixir_diffusion_ldg_newton_krylov.jl @@ -20,7 +20,7 @@ coordinates_max = convert(Float64, pi) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) function initial_condition_pure_diffusion_1d_convergence_test(x, t, equation) @@ -36,7 +36,9 @@ initial_condition = initial_condition_pure_diffusion_1d_convergence_test solver_parabolic = ViscousFormulationLocalDG() semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, - solver; solver_parabolic) + solver; solver_parabolic, + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_blast_wave.jl b/examples/tree_1d_dgsem/elixir_euler_blast_wave.jl index abd12230166..c4bf1dd9d1a 100644 --- a/examples/tree_1d_dgsem/elixir_euler_blast_wave.jl +++ b/examples/tree_1d_dgsem/elixir_euler_blast_wave.jl @@ -60,9 +60,10 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl b/examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl index 23b67eeb2c7..dd9cd3f287b 100644 --- a/examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl +++ b/examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl @@ -44,9 +44,10 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl b/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl index f18780e3fae..9eb2aaeabb0 100644 --- a/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl +++ b/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl @@ -16,10 +16,11 @@ coordinates_min = 0.0 coordinates_max = 2.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fvO2.jl b/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fvO2.jl index d29c0e6165a..f8149bf0888 100644 --- a/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fvO2.jl +++ b/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fvO2.jl @@ -23,10 +23,11 @@ coordinates_min = 0.0 coordinates_max = 2.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_density_wave.jl b/examples/tree_1d_dgsem/elixir_euler_density_wave.jl index ab773c29d80..0cdf477fbd8 100644 --- a/examples/tree_1d_dgsem/elixir_euler_density_wave.jl +++ b/examples/tree_1d_dgsem/elixir_euler_density_wave.jl @@ -13,9 +13,10 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_density_wave_tracers.jl b/examples/tree_1d_dgsem/elixir_euler_density_wave_tracers.jl index 2ff409de704..e0d55b70909 100644 --- a/examples/tree_1d_dgsem/elixir_euler_density_wave_tracers.jl +++ b/examples/tree_1d_dgsem/elixir_euler_density_wave_tracers.jl @@ -26,9 +26,10 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_ec.jl b/examples/tree_1d_dgsem/elixir_euler_ec.jl index df0f673622e..e6ea645c071 100644 --- a/examples/tree_1d_dgsem/elixir_euler_ec.jl +++ b/examples/tree_1d_dgsem/elixir_euler_ec.jl @@ -15,9 +15,10 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_laplace_diffusion.jl b/examples/tree_1d_dgsem/elixir_euler_laplace_diffusion.jl index 5a71bad41ad..eadd7988f74 100644 --- a/examples/tree_1d_dgsem/elixir_euler_laplace_diffusion.jl +++ b/examples/tree_1d_dgsem/elixir_euler_laplace_diffusion.jl @@ -17,10 +17,12 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_nonideal_density_wave.jl b/examples/tree_1d_dgsem/elixir_euler_nonideal_density_wave.jl index e5705232c06..91b4d2c5865 100644 --- a/examples/tree_1d_dgsem/elixir_euler_nonideal_density_wave.jl +++ b/examples/tree_1d_dgsem/elixir_euler_nonideal_density_wave.jl @@ -48,9 +48,10 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_positivity.jl b/examples/tree_1d_dgsem/elixir_euler_positivity.jl index 7605def322e..8c3d60c17b8 100644 --- a/examples/tree_1d_dgsem/elixir_euler_positivity.jl +++ b/examples/tree_1d_dgsem/elixir_euler_positivity.jl @@ -60,9 +60,10 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_quasi_1d_discontinuous.jl b/examples/tree_1d_dgsem/elixir_euler_quasi_1d_discontinuous.jl index 4a21237ae0b..ef813efeccd 100644 --- a/examples/tree_1d_dgsem/elixir_euler_quasi_1d_discontinuous.jl +++ b/examples/tree_1d_dgsem/elixir_euler_quasi_1d_discontinuous.jl @@ -54,9 +54,10 @@ coordinates_min = (-1.0,) coordinates_max = (1.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_quasi_1d_ec.jl b/examples/tree_1d_dgsem/elixir_euler_quasi_1d_ec.jl index 5d7ec3c92c6..838ce67209d 100644 --- a/examples/tree_1d_dgsem/elixir_euler_quasi_1d_ec.jl +++ b/examples/tree_1d_dgsem/elixir_euler_quasi_1d_ec.jl @@ -35,9 +35,10 @@ coordinates_min = (-1.0,) coordinates_max = (1.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_quasi_1d_source_terms.jl b/examples/tree_1d_dgsem/elixir_euler_quasi_1d_source_terms.jl index 53c27fc7a5d..8d5c656ba30 100644 --- a/examples/tree_1d_dgsem/elixir_euler_quasi_1d_source_terms.jl +++ b/examples/tree_1d_dgsem/elixir_euler_quasi_1d_source_terms.jl @@ -19,10 +19,11 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_quasi_1d_source_terms_dirichlet.jl b/examples/tree_1d_dgsem/elixir_euler_quasi_1d_source_terms_dirichlet.jl index 321d41d72f0..fd6b0cb068a 100644 --- a/examples/tree_1d_dgsem/elixir_euler_quasi_1d_source_terms_dirichlet.jl +++ b/examples/tree_1d_dgsem/elixir_euler_quasi_1d_source_terms_dirichlet.jl @@ -24,7 +24,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition, source_terms = source_terms_convergence_test) diff --git a/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave.jl index 8947c8be8b3..d86f670bba8 100644 --- a/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave.jl +++ b/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave.jl @@ -61,9 +61,10 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave_pure_fv.jl b/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave_pure_fv.jl index d575bdeeecc..9b0cf838ab5 100644 --- a/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave_pure_fv.jl +++ b/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave_pure_fv.jl @@ -45,9 +45,10 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 7, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl b/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl index 304537f306c..6ed60f563d8 100644 --- a/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl +++ b/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl @@ -32,9 +32,10 @@ coordinates_min = -2.0 coordinates_max = 2.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_shu_osher.jl b/examples/tree_1d_dgsem/elixir_euler_shu_osher.jl index 7a54ee3c3f7..e532be9e9f0 100644 --- a/examples/tree_1d_dgsem/elixir_euler_shu_osher.jl +++ b/examples/tree_1d_dgsem/elixir_euler_shu_osher.jl @@ -53,10 +53,9 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = boundary_condition_default(mesh, boundary_condition) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_euler_source_terms.jl b/examples/tree_1d_dgsem/elixir_euler_source_terms.jl index 5738fb918cb..13d8621b518 100644 --- a/examples/tree_1d_dgsem/elixir_euler_source_terms.jl +++ b/examples/tree_1d_dgsem/elixir_euler_source_terms.jl @@ -16,7 +16,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 4, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -24,10 +24,11 @@ coordinates_min = 0.0 coordinates_max = 2.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl index 667c9d76690..f867c470aa3 100644 --- a/examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl +++ b/examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -25,14 +25,10 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = false) # you can either use a single function to impose the BCs weakly in all -# 2*ndims == 2 directions or you can pass a tuple containing BCs for +# 2*ndims == 2 directions or you can pass a named tuple containing BCs for # each direction # Assign a single boundary condition to all boundaries -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = boundary_condition_default(mesh, boundary_condition) -# Alternatively, you can use -# boundary_conditions = (x_neg = boundary_condition, -# x_pos = boundary_condition) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, source_terms = source_terms_convergence_test, diff --git a/examples/tree_1d_dgsem/elixir_eulergravity_convergence.jl b/examples/tree_1d_dgsem/elixir_eulergravity_convergence.jl index 5b2788c65a7..1c8184bc2be 100644 --- a/examples/tree_1d_dgsem/elixir_eulergravity_convergence.jl +++ b/examples/tree_1d_dgsem/elixir_eulergravity_convergence.jl @@ -15,10 +15,11 @@ coordinates_min = 0.0 coordinates_max = 2.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, - solver_euler) + solver_euler; + boundary_conditions = boundary_condition_periodic) ############################################################################### # semidiscretization of the hyperbolic diffusion equations @@ -29,13 +30,14 @@ equations_gravity = HyperbolicDiffusionEquations1D() # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver_gravity = DGSEM(polydeg, FluxLaxFriedrichs(max_abs_speed_naive)) semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, - solver_gravity, - source_terms = source_terms_harmonic) + solver_gravity; + source_terms = source_terms_harmonic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # combining both semidiscretizations for Euler + self-gravity diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_convergence_ec.jl b/examples/tree_1d_dgsem/elixir_eulermulti_convergence_ec.jl index 155c8c2fa50..f43fb1eeb53 100644 --- a/examples/tree_1d_dgsem/elixir_eulermulti_convergence_ec.jl +++ b/examples/tree_1d_dgsem/elixir_eulermulti_convergence_ec.jl @@ -16,10 +16,11 @@ coordinates_min = (-1.0,) coordinates_max = (1.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_convergence_es.jl b/examples/tree_1d_dgsem/elixir_eulermulti_convergence_es.jl index 3af86f4fcc8..a6c4616ccc0 100644 --- a/examples/tree_1d_dgsem/elixir_eulermulti_convergence_es.jl +++ b/examples/tree_1d_dgsem/elixir_eulermulti_convergence_es.jl @@ -14,7 +14,7 @@ volume_flux = flux_ranocha # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) @@ -23,10 +23,11 @@ coordinates_min = (-1.0,) coordinates_max = (1.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_ec.jl b/examples/tree_1d_dgsem/elixir_eulermulti_ec.jl index fb902f6a1cc..8c0db18698b 100644 --- a/examples/tree_1d_dgsem/elixir_eulermulti_ec.jl +++ b/examples/tree_1d_dgsem/elixir_eulermulti_ec.jl @@ -16,9 +16,10 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_es.jl b/examples/tree_1d_dgsem/elixir_eulermulti_es.jl index 500c73e3e1a..f3bc85cf44f 100644 --- a/examples/tree_1d_dgsem/elixir_eulermulti_es.jl +++ b/examples/tree_1d_dgsem/elixir_eulermulti_es.jl @@ -23,9 +23,10 @@ coordinates_min = (-2.0,) coordinates_max = (2.0,) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_two_interacting_blast_waves.jl b/examples/tree_1d_dgsem/elixir_eulermulti_two_interacting_blast_waves.jl index 1083b0d3425..a980b682b53 100644 --- a/examples/tree_1d_dgsem/elixir_eulermulti_two_interacting_blast_waves.jl +++ b/examples/tree_1d_dgsem/elixir_eulermulti_two_interacting_blast_waves.jl @@ -82,7 +82,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl index ae6a9e28b80..15e714d329a 100644 --- a/examples/tree_1d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl +++ b/examples/tree_1d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl @@ -42,7 +42,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions, source_terms = source_terms_harmonic) diff --git a/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl index d0f06b3a718..645c1139598 100644 --- a/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl +++ b/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl @@ -19,7 +19,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions, source_terms = source_terms_poisson_nonperiodic) diff --git a/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic_perk4.jl b/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic_perk4.jl index 3a5c5caca82..8b1f668b289 100644 --- a/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic_perk4.jl +++ b/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic_perk4.jl @@ -22,7 +22,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions, source_terms = source_terms_poisson_nonperiodic) diff --git a/examples/tree_1d_dgsem/elixir_linearelasticity_convergence.jl b/examples/tree_1d_dgsem/elixir_linearelasticity_convergence.jl index 0c7795c7af0..71a58bc4408 100644 --- a/examples/tree_1d_dgsem/elixir_linearelasticity_convergence.jl +++ b/examples/tree_1d_dgsem/elixir_linearelasticity_convergence.jl @@ -16,11 +16,12 @@ coordinate_max = 1.0 mesh = TreeMesh(coordinate_min, coordinate_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) initial_condition = initial_condition_convergence_test -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_linearelasticity_impact.jl b/examples/tree_1d_dgsem/elixir_linearelasticity_impact.jl index 24bd8b8f0c2..190bc11dcbc 100644 --- a/examples/tree_1d_dgsem/elixir_linearelasticity_impact.jl +++ b/examples/tree_1d_dgsem/elixir_linearelasticity_impact.jl @@ -53,7 +53,7 @@ function initial_condition_gaussian_impact(x, t, equations::LinearElasticityEqua # Smooth rectangle using tanh transitions # Left edge: transition from 0 to 1 at x = -width/2 left_transition = 0.5 * (1 + tanh((x[1] + impact_width() / 2) / edge_smoothing)) - # Right edge: transition from 1 to 0 at x = +width/2 + # Right edge: transition from 1 to 0 at x = +width/2 right_transition = 0.5 * (1 - tanh((x[1] - impact_width() / 2) / edge_smoothing)) # Combine both transitions to create smooth rectangle @@ -68,12 +68,12 @@ end boundary_condition_dirichlet = BoundaryConditionDirichlet(initial_condition_gaussian_impact) -boundary_conditions = (x_neg = boundary_condition_dirichlet, +boundary_conditions = (; x_neg = boundary_condition_dirichlet, x_pos = boundary_condition_dirichlet) initial_condition = initial_condition_gaussian_impact -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_linearizedeuler_convergence.jl b/examples/tree_1d_dgsem/elixir_linearizedeuler_convergence.jl index cb027bfa8cc..d5cad223aab 100644 --- a/examples/tree_1d_dgsem/elixir_linearizedeuler_convergence.jl +++ b/examples/tree_1d_dgsem/elixir_linearizedeuler_convergence.jl @@ -18,10 +18,11 @@ coordinates_max = (1.0) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_linearizedeuler_gauss_wall.jl b/examples/tree_1d_dgsem/elixir_linearizedeuler_gauss_wall.jl index a7844b5ce0a..7ed7ea0ec07 100644 --- a/examples/tree_1d_dgsem/elixir_linearizedeuler_gauss_wall.jl +++ b/examples/tree_1d_dgsem/elixir_linearizedeuler_gauss_wall.jl @@ -28,7 +28,7 @@ end initial_condition = initial_condition_gauss_wall # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition_wall) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_maxwell_E_excitation.jl b/examples/tree_1d_dgsem/elixir_maxwell_E_excitation.jl index e29bd57dfb3..ae421a85285 100644 --- a/examples/tree_1d_dgsem/elixir_maxwell_E_excitation.jl +++ b/examples/tree_1d_dgsem/elixir_maxwell_E_excitation.jl @@ -14,7 +14,7 @@ coordinates_max = 1.0 # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # Excite the electric field which causes a standing wave. # The solution is an undamped exchange between electric and magnetic energy. @@ -28,7 +28,8 @@ function initial_condition_E_excitation(x, t, equations::MaxwellEquations1D) end initial_condition = initial_condition_E_excitation -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_maxwell_convergence.jl b/examples/tree_1d_dgsem/elixir_maxwell_convergence.jl index 212761542e0..fb9f2de2f8c 100644 --- a/examples/tree_1d_dgsem/elixir_maxwell_convergence.jl +++ b/examples/tree_1d_dgsem/elixir_maxwell_convergence.jl @@ -14,10 +14,11 @@ coordinates_max = 1.0 # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl b/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl index f55656e5645..d373f42b9e7 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl @@ -23,9 +23,10 @@ coordinates_min = 0.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl index 2c563114bf1..0392419c715 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl @@ -53,7 +53,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube_mod_positivity.jl b/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube_mod_positivity.jl index bbff41d950a..a577f5762b0 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube_mod_positivity.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube_mod_positivity.jl @@ -54,7 +54,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_mhd_ec.jl b/examples/tree_1d_dgsem/elixir_mhd_ec.jl index 35651743a16..f01fe1e8145 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_ec.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_ec.jl @@ -16,9 +16,10 @@ coordinates_min = 0.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl index 8dc216f585a..0a50aa23e04 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl @@ -60,7 +60,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl index 893dd1dbcd2..da38c7f6976 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl @@ -83,7 +83,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_mhd_torrilhon_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_torrilhon_shock_tube.jl index be80bf681ea..5d4a61a4ce2 100644 --- a/examples/tree_1d_dgsem/elixir_mhd_torrilhon_shock_tube.jl +++ b/examples/tree_1d_dgsem/elixir_mhd_torrilhon_shock_tube.jl @@ -59,7 +59,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_mhdmulti_briowu_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhdmulti_briowu_shock_tube.jl index b5f776b808b..35061932bc6 100644 --- a/examples/tree_1d_dgsem/elixir_mhdmulti_briowu_shock_tube.jl +++ b/examples/tree_1d_dgsem/elixir_mhdmulti_briowu_shock_tube.jl @@ -75,7 +75,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_dgsem/elixir_mhdmulti_convergence.jl b/examples/tree_1d_dgsem/elixir_mhdmulti_convergence.jl index 2ac008e60b4..f7eca148666 100644 --- a/examples/tree_1d_dgsem/elixir_mhdmulti_convergence.jl +++ b/examples/tree_1d_dgsem/elixir_mhdmulti_convergence.jl @@ -24,9 +24,10 @@ coordinates_min = 0.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_mhdmulti_ec.jl b/examples/tree_1d_dgsem/elixir_mhdmulti_ec.jl index 324ecde48f6..038a3c0f4eb 100644 --- a/examples/tree_1d_dgsem/elixir_mhdmulti_ec.jl +++ b/examples/tree_1d_dgsem/elixir_mhdmulti_ec.jl @@ -16,9 +16,10 @@ coordinates_min = 0.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_mhdmulti_es.jl b/examples/tree_1d_dgsem/elixir_mhdmulti_es.jl index fff1f0f32c0..b2992373341 100644 --- a/examples/tree_1d_dgsem/elixir_mhdmulti_es.jl +++ b/examples/tree_1d_dgsem/elixir_mhdmulti_es.jl @@ -23,9 +23,10 @@ coordinates_min = 0.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic.jl index 9bda0288d15..4136140c380 100644 --- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic.jl +++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic.jl @@ -104,11 +104,13 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver, - source_terms = source_terms_navier_stokes_convergence_test) + initial_condition, solver; + source_terms = source_terms_navier_stokes_convergence_test, + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic_cfl.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic_cfl.jl index f757f18aaf5..ea61ce8c547 100644 --- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic_cfl.jl +++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic_cfl.jl @@ -103,11 +103,13 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver, - source_terms = source_terms_navier_stokes_convergence_test) + initial_condition, solver; + source_terms = source_terms_navier_stokes_convergence_test, + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_traffic_flow_lwr_convergence.jl b/examples/tree_1d_dgsem/elixir_traffic_flow_lwr_convergence.jl index 97d0e5013aa..1407aa2630a 100644 --- a/examples/tree_1d_dgsem/elixir_traffic_flow_lwr_convergence.jl +++ b/examples/tree_1d_dgsem/elixir_traffic_flow_lwr_convergence.jl @@ -14,14 +14,15 @@ coordinates_max = 2.0 # maximum coordinate # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) ############################################################################### # Specify non-periodic boundary conditions initial_condition = initial_condition_convergence_test -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_dgsem/elixir_traffic_flow_lwr_trafficjam.jl b/examples/tree_1d_dgsem/elixir_traffic_flow_lwr_trafficjam.jl index 5a26fd9283b..c87a5574d01 100644 --- a/examples/tree_1d_dgsem/elixir_traffic_flow_lwr_trafficjam.jl +++ b/examples/tree_1d_dgsem/elixir_traffic_flow_lwr_trafficjam.jl @@ -41,12 +41,12 @@ function boundary_condition_inflow(u_inner, orientation, direction, x, t, return flux(u_inner, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_outflow, +boundary_conditions = (; x_neg = boundary_condition_outflow, x_pos = boundary_condition_inflow) initial_condition = initial_condition_traffic_jam -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_1d_fdsbp/elixir_advection_upwind.jl b/examples/tree_1d_fdsbp/elixir_advection_upwind.jl index a21a93f004f..63754a37055 100644 --- a/examples/tree_1d_fdsbp/elixir_advection_upwind.jl +++ b/examples/tree_1d_fdsbp/elixir_advection_upwind.jl @@ -30,7 +30,8 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sin, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sin, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_fdsbp/elixir_advection_upwind_periodic.jl b/examples/tree_1d_fdsbp/elixir_advection_upwind_periodic.jl index 7fc5a126a24..7ec8ab613b7 100644 --- a/examples/tree_1d_fdsbp/elixir_advection_upwind_periodic.jl +++ b/examples/tree_1d_fdsbp/elixir_advection_upwind_periodic.jl @@ -29,7 +29,8 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sin, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sin, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_fdsbp/elixir_burgers_basic.jl b/examples/tree_1d_fdsbp/elixir_burgers_basic.jl index 4edbd8d566f..6ac90e7b905 100644 --- a/examples/tree_1d_fdsbp/elixir_burgers_basic.jl +++ b/examples/tree_1d_fdsbp/elixir_burgers_basic.jl @@ -25,10 +25,11 @@ coordinates_min = 0.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_fdsbp/elixir_burgers_linear_stability.jl b/examples/tree_1d_fdsbp/elixir_burgers_linear_stability.jl index 339f62afcea..f0f083a168f 100644 --- a/examples/tree_1d_fdsbp/elixir_burgers_linear_stability.jl +++ b/examples/tree_1d_fdsbp/elixir_burgers_linear_stability.jl @@ -28,10 +28,11 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_linear_stability, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_fdsbp/elixir_euler_convergence.jl b/examples/tree_1d_fdsbp/elixir_euler_convergence.jl index 50243bc6112..e42be2b2523 100644 --- a/examples/tree_1d_fdsbp/elixir_euler_convergence.jl +++ b/examples/tree_1d_fdsbp/elixir_euler_convergence.jl @@ -25,10 +25,11 @@ coordinates_min = 0.0 coordinates_max = 2.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 1, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_1d_fdsbp/elixir_euler_density_wave.jl b/examples/tree_1d_fdsbp/elixir_euler_density_wave.jl index 72cc90039f5..9e043eda372 100644 --- a/examples/tree_1d_fdsbp/elixir_euler_density_wave.jl +++ b/examples/tree_1d_fdsbp/elixir_euler_density_wave.jl @@ -24,9 +24,10 @@ coordinates_min = -1.0 coordinates_max = 1.0 mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_acoustics_convergence.jl b/examples/tree_2d_dgsem/elixir_acoustics_convergence.jl index d20841a187b..868272071dc 100644 --- a/examples/tree_2d_dgsem/elixir_acoustics_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_acoustics_convergence.jl @@ -16,7 +16,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -26,11 +26,12 @@ coordinates_max = (2.0, 2.0) # maximum coordinates (max(x), max(y)) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_acoustics_gauss.jl b/examples/tree_2d_dgsem/elixir_acoustics_gauss.jl index 6725df1cfa9..56887395865 100644 --- a/examples/tree_2d_dgsem/elixir_acoustics_gauss.jl +++ b/examples/tree_2d_dgsem/elixir_acoustics_gauss.jl @@ -26,10 +26,11 @@ coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y)) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_gauss, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_gauss, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl b/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl index a858e647cb5..4dec2b8c456 100644 --- a/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl +++ b/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl @@ -45,7 +45,7 @@ end initial_condition = initial_condition_gauss_wall # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition_wall) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl b/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl index f98a8a34d6f..174aab25a71 100644 --- a/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl +++ b/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl @@ -36,7 +36,7 @@ initial_condition = initial_condition_constant # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -46,11 +46,12 @@ coordinates_max = (3.0, 3.0) # maximum coordinates (max(x), max(y)) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_gauss) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_gauss, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_acoustics_monopole.jl b/examples/tree_2d_dgsem/elixir_acoustics_monopole.jl index 8282131e722..0823012351c 100644 --- a/examples/tree_2d_dgsem/elixir_acoustics_monopole.jl +++ b/examples/tree_2d_dgsem/elixir_acoustics_monopole.jl @@ -14,7 +14,7 @@ equations = AcousticPerturbationEquations2D(v_mean_global = (0.0, 0.0), c_mean_g # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -109,7 +109,7 @@ function boundary_condition_zero(u_inner, orientation, direction, x, t, return flux end -boundary_conditions = (x_neg = boundary_condition_zero, +boundary_conditions = (; x_neg = boundary_condition_zero, x_pos = boundary_condition_zero, y_neg = boundary_condition_monopole, y_pos = boundary_condition_zero) @@ -121,7 +121,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = false) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_advection_amr.jl b/examples/tree_2d_dgsem/elixir_advection_amr.jl index 6f103101d19..985a43daa11 100644 --- a/examples/tree_2d_dgsem/elixir_advection_amr.jl +++ b/examples/tree_2d_dgsem/elixir_advection_amr.jl @@ -14,9 +14,10 @@ coordinates_min = (-5.0, -5.0) coordinates_max = (5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_coarsen_twice.jl b/examples/tree_2d_dgsem/elixir_advection_amr_coarsen_twice.jl index 2fa62d9af1f..fbd45a68036 100644 --- a/examples/tree_2d_dgsem/elixir_advection_amr_coarsen_twice.jl +++ b/examples/tree_2d_dgsem/elixir_advection_amr_coarsen_twice.jl @@ -51,9 +51,10 @@ coordinates_min = (-5.0, -5.0) coordinates_max = (5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_advection_amr_nonperiodic.jl index 046b9cdbe90..eef6fe90b2d 100644 --- a/examples/tree_2d_dgsem/elixir_advection_amr_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_advection_amr_nonperiodic.jl @@ -22,7 +22,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_refine_twice.jl b/examples/tree_2d_dgsem/elixir_advection_amr_refine_twice.jl index 81352b16c08..e323456f17b 100644 --- a/examples/tree_2d_dgsem/elixir_advection_amr_refine_twice.jl +++ b/examples/tree_2d_dgsem/elixir_advection_amr_refine_twice.jl @@ -51,9 +51,10 @@ coordinates_min = (-5.0, -5.0) coordinates_max = (5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl index f7f574939c9..3c03e62c422 100644 --- a/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl +++ b/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl @@ -88,9 +88,10 @@ coordinates_min = (-5.0, -5.0) coordinates_max = (5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl b/examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl index f6a44153b95..8e0cf01e96b 100644 --- a/examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl +++ b/examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl @@ -24,9 +24,10 @@ coordinates_min = (-5.0, -5.0) coordinates_max = (5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_basic.jl b/examples/tree_2d_dgsem/elixir_advection_basic.jl index c893dcb9a6e..590f075083b 100644 --- a/examples/tree_2d_dgsem/elixir_advection_basic.jl +++ b/examples/tree_2d_dgsem/elixir_advection_basic.jl @@ -16,11 +16,12 @@ coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y)) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_callbacks.jl b/examples/tree_2d_dgsem/elixir_advection_callbacks.jl index 2873b3be509..51048b4bcee 100644 --- a/examples/tree_2d_dgsem/elixir_advection_callbacks.jl +++ b/examples/tree_2d_dgsem/elixir_advection_callbacks.jl @@ -106,9 +106,10 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_diffusion_amr.jl b/examples/tree_2d_dgsem/elixir_advection_diffusion_amr.jl index 3c348aa2aa6..b4277434129 100644 --- a/examples/tree_2d_dgsem/elixir_advection_diffusion_amr.jl +++ b/examples/tree_2d_dgsem/elixir_advection_diffusion_amr.jl @@ -16,7 +16,7 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 80_000) + n_cells_max = 80_000, periodicity = true) # Define initial condition function initial_condition_diffusive_convergence_test(x, t, diff --git a/examples/tree_2d_dgsem/elixir_advection_diffusion_imex_operator.jl b/examples/tree_2d_dgsem/elixir_advection_diffusion_imex_operator.jl index bfa1e0073a2..614cd0e94d8 100644 --- a/examples/tree_2d_dgsem/elixir_advection_diffusion_imex_operator.jl +++ b/examples/tree_2d_dgsem/elixir_advection_diffusion_imex_operator.jl @@ -39,7 +39,9 @@ initial_condition = initial_condition_diffusive_convergence_test semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE setup diff --git a/examples/tree_2d_dgsem/elixir_advection_extended.jl b/examples/tree_2d_dgsem/elixir_advection_extended.jl index c308c10951f..d7541e204b5 100644 --- a/examples/tree_2d_dgsem/elixir_advection_extended.jl +++ b/examples/tree_2d_dgsem/elixir_advection_extended.jl @@ -12,8 +12,6 @@ initial_condition = initial_condition_convergence_test # you can either use a single function to impose the BCs weakly in all # 1*ndims == 2 directions or you can pass a tuple containing BCs for # each direction -# Note: "boundary_condition_periodic" indicates that it is a periodic boundary and can be omitted on -# fully periodic domains. Here, however, it is included to allow easy override during testing boundary_conditions = boundary_condition_periodic # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux @@ -29,7 +27,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_advection_implicit_sparse_jacobian.jl b/examples/tree_2d_dgsem/elixir_advection_implicit_sparse_jacobian.jl index e2996ec7580..abf68d33908 100644 --- a/examples/tree_2d_dgsem/elixir_advection_implicit_sparse_jacobian.jl +++ b/examples/tree_2d_dgsem/elixir_advection_implicit_sparse_jacobian.jl @@ -16,7 +16,7 @@ coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) ############################################################################### ### semidiscretization for sparsity detection ### @@ -28,7 +28,8 @@ jac_eltype = jacobian_eltype(real(solver), jac_detector) # Semidiscretization for sparsity pattern detection semi_jac_type = SemidiscretizationHyperbolic(mesh, equation, - initial_condition_convergence_test, solver, + initial_condition_convergence_test, solver; + boundary_conditions = boundary_condition_periodic, uEltype = jac_eltype) # Need to supply Jacobian element type tspan = (0.0, 1.0) # Re-used for wrapping `rhs` below @@ -61,7 +62,8 @@ coloring_vec = column_colors(coloring_result) # Semidiscretization for actual simulation. `eEltype` is here retrieved from `solver` semi_float_type = SemidiscretizationHyperbolic(mesh, equation, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) # Supply Jacobian prototype and coloring vector to the semidiscretization ode_jac_sparse = semidiscretize(semi_float_type, tspan, diff --git a/examples/tree_2d_dgsem/elixir_advection_mortar.jl b/examples/tree_2d_dgsem/elixir_advection_mortar.jl index 067a4bfd4ef..3c8c031e339 100644 --- a/examples/tree_2d_dgsem/elixir_advection_mortar.jl +++ b/examples/tree_2d_dgsem/elixir_advection_mortar.jl @@ -17,9 +17,10 @@ refinement_patches = ((type = "box", coordinates_min = (0.0, -1.0), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, refinement_patches = refinement_patches, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_restart.jl b/examples/tree_2d_dgsem/elixir_advection_restart.jl index 25de4fbd968..792eb9219bc 100644 --- a/examples/tree_2d_dgsem/elixir_advection_restart.jl +++ b/examples/tree_2d_dgsem/elixir_advection_restart.jl @@ -19,7 +19,8 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, base_elixir), alg = alg, restart_filename = joinpath("out", "restart_000000040.h5") mesh = load_mesh(restart_filename) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) tspan = (load_time(restart_filename), 10.0) dt = load_dt(restart_filename) diff --git a/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl b/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl index d42e994bb48..41b66c2f9cc 100644 --- a/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl +++ b/examples/tree_2d_dgsem/elixir_advection_restart_amr.jl @@ -18,7 +18,8 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_extended.jl"), a restart_filename = joinpath("out", "restart_000000040.h5") mesh = load_mesh(restart_filename) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) tspan = (load_time(restart_filename), 5.0) dt = load_dt(restart_filename) diff --git a/examples/tree_2d_dgsem/elixir_advection_timeintegration.jl b/examples/tree_2d_dgsem/elixir_advection_timeintegration.jl index ffc42629e43..3be57a06404 100644 --- a/examples/tree_2d_dgsem/elixir_advection_timeintegration.jl +++ b/examples/tree_2d_dgsem/elixir_advection_timeintegration.jl @@ -13,9 +13,10 @@ coordinates_min = (-5.0, -5.0) coordinates_max = (5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_advection_timeintegration_adaptive.jl b/examples/tree_2d_dgsem/elixir_advection_timeintegration_adaptive.jl index fc8eea693cb..db64cf6edea 100644 --- a/examples/tree_2d_dgsem/elixir_advection_timeintegration_adaptive.jl +++ b/examples/tree_2d_dgsem/elixir_advection_timeintegration_adaptive.jl @@ -12,8 +12,6 @@ initial_condition = initial_condition_convergence_test # you can either use a single function to impose the BCs weakly in all # 1*ndims == 2 directions or you can pass a tuple containing BCs for # each direction -# Note: "boundary_condition_periodic" indicates that it is a periodic boundary and can be omitted on -# fully periodic domains. Here, however, it is included to allow easy override during testing boundary_conditions = boundary_condition_periodic # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux @@ -29,7 +27,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl b/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl index 7367bb914bc..2ad7e799964 100644 --- a/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl @@ -30,7 +30,7 @@ function initial_condition_astro_jet(x, t, equations::CompressibleEulerEquations end initial_condition = initial_condition_astro_jet -boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_astro_jet), +boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition_astro_jet), x_pos = BoundaryConditionDirichlet(initial_condition_astro_jet), y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) @@ -40,7 +40,7 @@ boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_astr # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) # HLLC needs more shock capturing (alpha_max) volume_flux = flux_ranocha # works with Chandrashekar flux as well @@ -66,7 +66,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, periodicity = (false, true), n_cells_max = 100_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr_scO2.jl b/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr_scO2.jl index d381337d655..bd4fdd4417f 100644 --- a/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr_scO2.jl +++ b/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr_scO2.jl @@ -31,7 +31,7 @@ function initial_condition_astro_jet(x, t, equations::CompressibleEulerEquations end initial_condition = initial_condition_astro_jet -boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_astro_jet), +boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition_astro_jet), x_pos = BoundaryConditionDirichlet(initial_condition_astro_jet), y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) @@ -61,7 +61,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 8, periodicity = (false, true), n_cells_max = 100_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl index d903e406b98..298fdd08e2a 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl @@ -59,9 +59,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl index 752b1c6e714..1e59d963e90 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl @@ -59,9 +59,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl index 87a30263139..aeaf8cfa19f 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl @@ -44,9 +44,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl index b187fc708cb..fcf058547e4 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell_nonperiodic.jl @@ -65,7 +65,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl index 9d08daf4bd8..c8d6bc14d49 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl @@ -81,9 +81,10 @@ coordinates_max = (20.0, 20.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl b/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl index 783219f7c83..8f2aef6dad6 100644 --- a/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl +++ b/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl @@ -85,9 +85,10 @@ refinement_patches = ((type = "box", coordinates_min = (-40.0, -5.0), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, refinement_patches = refinement_patches, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl b/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl index 2077df56846..e105ffa9b4d 100644 --- a/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl +++ b/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl @@ -33,7 +33,8 @@ function initial_condition_colliding_flow_astro(x, t, end initial_condition = initial_condition_colliding_flow_astro -boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), +boundary_conditions = (; + x_neg = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), x_pos = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) @@ -43,7 +44,7 @@ boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_coll # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) # HLLC needs more shock capturing (alpha_max) volume_flux = flux_ranocha # works with Chandrashekar flux as well @@ -80,7 +81,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, refinement_patches = refinement_patches, periodicity = (false, true), n_cells_max = 100_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl b/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl index 8c61b972110..a1205f58fd8 100644 --- a/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl @@ -33,7 +33,8 @@ function initial_condition_colliding_flow_astro(x, t, end initial_condition = initial_condition_colliding_flow_astro -boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), +boundary_conditions = (; + x_neg = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), x_pos = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) @@ -43,7 +44,7 @@ boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_coll # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) # HLLC needs more shock capturing (alpha_max) volume_flux = flux_ranocha # works with Chandrashekar flux as well @@ -68,7 +69,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, periodicity = (false, true), n_cells_max = 100_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr_entropy_bounded.jl b/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr_entropy_bounded.jl index 4eba2b62374..dfd774d8c03 100644 --- a/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr_entropy_bounded.jl +++ b/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr_entropy_bounded.jl @@ -33,7 +33,8 @@ function initial_condition_colliding_flow_astro(x, t, end initial_condition = initial_condition_colliding_flow_astro -boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), +boundary_conditions = (; + x_neg = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), x_pos = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro), y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) @@ -43,7 +44,7 @@ boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_coll # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) # HLLC needs more shock capturing (alpha_max) volume_flux = flux_ranocha # works with Chandrashekar flux as well @@ -80,7 +81,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, refinement_patches = refinement_patches, periodicity = (false, true), n_cells_max = 100_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fv.jl b/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fv.jl index 22c20bd3e02..074c9da81a1 100644 --- a/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fv.jl +++ b/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fv.jl @@ -18,10 +18,11 @@ coordinates_min = (0.0, 0.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fvO2.jl b/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fvO2.jl index 26ab55ad812..d880753cf23 100644 --- a/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fvO2.jl +++ b/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fvO2.jl @@ -22,10 +22,11 @@ coordinates_min = (0.0, 0.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_density_wave.jl b/examples/tree_2d_dgsem/elixir_euler_density_wave.jl index 4b895ebed4f..c90c60488bb 100644 --- a/examples/tree_2d_dgsem/elixir_euler_density_wave.jl +++ b/examples/tree_2d_dgsem/elixir_euler_density_wave.jl @@ -13,9 +13,10 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_density_wave_tracers.jl b/examples/tree_2d_dgsem/elixir_euler_density_wave_tracers.jl index 71a9ee6a6fd..27bde50bd7c 100644 --- a/examples/tree_2d_dgsem/elixir_euler_density_wave_tracers.jl +++ b/examples/tree_2d_dgsem/elixir_euler_density_wave_tracers.jl @@ -16,9 +16,10 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_ec.jl b/examples/tree_2d_dgsem/elixir_euler_ec.jl index ba37bedd525..95951a1aa56 100644 --- a/examples/tree_2d_dgsem/elixir_euler_ec.jl +++ b/examples/tree_2d_dgsem/elixir_euler_ec.jl @@ -18,7 +18,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition_periodic) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability.jl index 28ee9ca2b6e..de4da3171ca 100644 --- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability.jl +++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability.jl @@ -56,8 +56,9 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 100_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) + n_cells_max = 100_000, periodicity = true) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl index 5a287b33e4b..053080bf077 100644 --- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl @@ -56,9 +56,10 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl index cefc2c685ce..31fd1ba1b47 100644 --- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl +++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl @@ -100,9 +100,10 @@ coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl index 5d47dec8f96..bf3b6450799 100644 --- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl @@ -54,8 +54,9 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 100_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) + n_cells_max = 100_000, periodicity = true) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_positivity.jl b/examples/tree_2d_dgsem/elixir_euler_positivity.jl index a64b35a4c73..730f0497bc3 100644 --- a/examples/tree_2d_dgsem/elixir_euler_positivity.jl +++ b/examples/tree_2d_dgsem/elixir_euler_positivity.jl @@ -62,9 +62,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_riemannproblem_quadrants_amr.jl b/examples/tree_2d_dgsem/elixir_euler_riemannproblem_quadrants_amr.jl index 3c898ae9d50..c60d6d9d357 100644 --- a/examples/tree_2d_dgsem/elixir_euler_riemannproblem_quadrants_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_riemannproblem_quadrants_amr.jl @@ -6,11 +6,11 @@ using Trixi equations = CompressibleEulerEquations2D(1.4) -# Variant of the 4-quadrant Riemann problem considered in +# Variant of the 4-quadrant Riemann problem considered in # - Carsten W. Schulz-Rinne: # Classification of the Riemann Problem for Two-Dimensional Gas Dynamics # https://doi.org/10.1137/0524006 -# and +# and # - Carsten W. Schulz-Rinne, James P. Collins, and Harland M. Glaz # Numerical Solution of the Riemann Problem for Two-Dimensional Gas Dynamics # https://doi.org/10.1137/0914082 @@ -54,12 +54,12 @@ initial_condition = initial_condition_rp end # The flow is subsonic at all boundaries. -# For small enough simulation times, the solution remains at the initial condition +# For small enough simulation times, the solution remains at the initial condition # *along the boundaries* of quadrants 2, 3, and 4. # In quadrants 2 and 4 there are non-zero velocity components (v1 in quadrant 2, v2 in quadrant 4) # normal to the boundary, which is troublesome for the `boundary_condition_do_nothing`. # Thus, the `boundary_condition_subsonic` are used instead. -boundary_conditions = (x_neg = boundary_condition_subsonic, +boundary_conditions = (; x_neg = boundary_condition_subsonic, x_pos = boundary_condition_do_nothing, y_neg = boundary_condition_subsonic, y_pos = boundary_condition_do_nothing) @@ -94,13 +94,13 @@ solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, # Specialized function for computing coefficients of `func`, # here the discontinuous `initial_condition_rp`. # -# Shift the outer (i.e., ±1 on the reference element) nodes passed to the +# Shift the outer (i.e., ±1 on the reference element) nodes passed to the # `func` inwards by the smallest amount possible, i.e., [-1 + ϵ, +1 - ϵ]. # This avoids steep gradients in elements if a discontinuity is right at a cell boundary, -# i.e., if the jump location `x_jump` is at the position of an interface which is shared by +# i.e., if the jump location `x_jump` is at the position of an interface which is shared by # the nodes x_{e-1}^{(i)} = x_{e}^{(1)}. # -# In particular, this results in the typically desired behaviour for +# In particular, this results in the typically desired behaviour for # initial conditions of the form # { u_1, if x <= x_jump # u(x, t) = { diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl index b0658b638a0..0dfe2eeafbb 100644 --- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl @@ -62,9 +62,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl index fd655dc43bc..80ee2254e79 100644 --- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl @@ -64,9 +64,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl b/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl index ed12ca28753..d8a11901ae7 100644 --- a/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl +++ b/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl @@ -32,9 +32,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl index 181b51a1b7a..2201efdae56 100644 --- a/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl @@ -56,9 +56,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_source_terms.jl b/examples/tree_2d_dgsem/elixir_euler_source_terms.jl index 6f7f030fc47..6009ff9b3da 100644 --- a/examples/tree_2d_dgsem/elixir_euler_source_terms.jl +++ b/examples/tree_2d_dgsem/elixir_euler_source_terms.jl @@ -12,7 +12,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -20,10 +20,11 @@ coordinates_min = (0.0, 0.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_source_terms_amr_refine_coarsen.jl b/examples/tree_2d_dgsem/elixir_euler_source_terms_amr_refine_coarsen.jl index 06fa6f0a6bd..cef7c80eb16 100644 --- a/examples/tree_2d_dgsem/elixir_euler_source_terms_amr_refine_coarsen.jl +++ b/examples/tree_2d_dgsem/elixir_euler_source_terms_amr_refine_coarsen.jl @@ -57,7 +57,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -65,10 +65,11 @@ coordinates_min = (0.0, 0.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl index 343b6789a2b..d3befb8320b 100644 --- a/examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -27,13 +27,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, # you can either use a single function to impose the BCs weakly in all # 2*ndims == 4 directions or you can pass a tuple containing BCs for each direction # Assign a single boundary condition to all boundaries -boundary_condition = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = boundary_condition_default(mesh, boundary_condition) -# Alternatively, you can use -# boundary_conditions = (x_neg = boundary_condition, -# x_pos = boundary_condition, -# y_neg = boundary_condition, -# y_pos = boundary_condition) +boundary_conditions = BoundaryConditionDirichlet(initial_condition) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, source_terms = source_terms_convergence_test, diff --git a/examples/tree_2d_dgsem/elixir_euler_subsonic_constant.jl b/examples/tree_2d_dgsem/elixir_euler_subsonic_constant.jl index f40ce8a9c1e..af53f5e1109 100644 --- a/examples/tree_2d_dgsem/elixir_euler_subsonic_constant.jl +++ b/examples/tree_2d_dgsem/elixir_euler_subsonic_constant.jl @@ -47,7 +47,7 @@ initial_condition = initial_condition_subsonic return flux(u_surface, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_outflow_general, +boundary_conditions = (; x_neg = boundary_condition_outflow_general, x_pos = boundary_condition_outflow_general, y_neg = boundary_condition_outflow_general, y_pos = boundary_condition_outflow_general) @@ -69,7 +69,7 @@ volume_integral = VolumeIntegralWeakForm() solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, volume_integral = volume_integral) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex.jl b/examples/tree_2d_dgsem/elixir_euler_vortex.jl index 9ce4bf71832..0580375b83f 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex.jl @@ -62,9 +62,10 @@ coordinates_min = (-10.0, -10.0) coordinates_max = (10.0, 10.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl index f5523d4aad5..37acf7cc21a 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl @@ -127,9 +127,10 @@ coordinates_min = (-10.0, -10.0) coordinates_max = (10.0, 10.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_er.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_er.jl index 0eff63e43c2..91efe3d0dfc 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex_er.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex_er.jl @@ -68,9 +68,10 @@ coordinates_min = (-EdgeLength / 2, -EdgeLength / 2) coordinates_max = (EdgeLength / 2, EdgeLength / 2) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar.jl index 36f2050962c..f52a58c5161 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar.jl @@ -65,9 +65,10 @@ refinement_patches = ((type = "box", coordinates_min = (0.0, -10.0), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, refinement_patches = refinement_patches, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_shockcapturing.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_shockcapturing.jl index f32ce4d663b..2d714bc6fce 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_shockcapturing.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_shockcapturing.jl @@ -79,9 +79,10 @@ refinement_patches = ((type = "box", coordinates_min = (0.0, -10.0), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, refinement_patches = refinement_patches, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl index 7e9ed2ac9e4..7c28aaa389d 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl @@ -68,9 +68,10 @@ refinement_patches = ((type = "box", coordinates_min = (0.0, -10.0), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, refinement_patches = refinement_patches, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_shockcapturing.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_shockcapturing.jl index fb83f56810b..82d69080953 100644 --- a/examples/tree_2d_dgsem/elixir_euler_vortex_shockcapturing.jl +++ b/examples/tree_2d_dgsem/elixir_euler_vortex_shockcapturing.jl @@ -76,9 +76,10 @@ coordinates_min = (-10.0, -10.0) coordinates_max = (10.0, 10.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_euler_warm_bubble.jl b/examples/tree_2d_dgsem/elixir_euler_warm_bubble.jl index fac4cbf4239..1dba62ee08f 100644 --- a/examples/tree_2d_dgsem/elixir_euler_warm_bubble.jl +++ b/examples/tree_2d_dgsem/elixir_euler_warm_bubble.jl @@ -80,7 +80,7 @@ warm_bubble_setup = WarmBubbleSetup() equations = CompressibleEulerEquations2D(warm_bubble_setup.gamma) -boundary_conditions = (x_neg = boundary_condition_periodic, +boundary_conditions = (; x_neg = boundary_condition_periodic, x_pos = boundary_condition_periodic, y_neg = boundary_condition_slip_wall, y_pos = boundary_condition_slip_wall) diff --git a/examples/tree_2d_dgsem/elixir_euleracoustics_co-rotating_vortex_pair.jl b/examples/tree_2d_dgsem/elixir_euleracoustics_co-rotating_vortex_pair.jl index 9c182b35fef..feb40c74c18 100644 --- a/examples/tree_2d_dgsem/elixir_euleracoustics_co-rotating_vortex_pair.jl +++ b/examples/tree_2d_dgsem/elixir_euleracoustics_co-rotating_vortex_pair.jl @@ -264,7 +264,7 @@ boundary_condition_euler = VortexPairSetup.BoundaryCondition(rho, (gamma - 1)) semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition_euler, - solver, + solver; boundary_conditions = boundary_condition_euler, source_terms = sponge_layer_euler) @@ -309,7 +309,7 @@ end semi_acoustics = SemidiscretizationHyperbolic(mesh, equations_acoustics, initial_condition_constant, - solver, + solver; boundary_conditions = boundary_condition_zero, source_terms = sponge_layer_acoustics) diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_convergence_ec.jl b/examples/tree_2d_dgsem/elixir_eulermulti_convergence_ec.jl index 0c10edd5104..75b923ce5c4 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_convergence_ec.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_convergence_ec.jl @@ -16,10 +16,11 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_convergence_es.jl b/examples/tree_2d_dgsem/elixir_eulermulti_convergence_es.jl index be76bc709a0..93937b9d71c 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_convergence_es.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_convergence_es.jl @@ -14,7 +14,7 @@ volume_flux = flux_ranocha # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) @@ -23,10 +23,11 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_ec.jl b/examples/tree_2d_dgsem/elixir_eulermulti_ec.jl index 5c31b711054..826150a0089 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_ec.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_ec.jl @@ -19,7 +19,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition_periodic) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_es.jl b/examples/tree_2d_dgsem/elixir_eulermulti_es.jl index 8cc0048515d..d1858b1442e 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_es.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_es.jl @@ -23,9 +23,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl index d884f6bfe72..c4a89de617a 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl @@ -106,9 +106,10 @@ coordinates_min = (-2.25, -2.225) coordinates_max = (2.20, 2.225) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 1_000_000) + n_cells_max = 1_000_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl index 094a8db57e2..86948848c49 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl @@ -105,9 +105,10 @@ coordinates_min = (-2.25, -2.225) coordinates_max = (2.20, 2.225) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 1_000_000) + n_cells_max = 1_000_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl index e1ee83f574a..f69b480212e 100644 --- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl +++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl @@ -106,9 +106,10 @@ coordinates_min = (-2.25, -2.225) coordinates_max = (2.20, 2.225) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 1_000_000) + n_cells_max = 1_000_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_eulerpolytropic_convergence.jl b/examples/tree_2d_dgsem/elixir_eulerpolytropic_convergence.jl index 110bc266088..4034d8d230a 100644 --- a/examples/tree_2d_dgsem/elixir_eulerpolytropic_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_eulerpolytropic_convergence.jl @@ -23,8 +23,9 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = true, n_cells_max = 30_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_hypdiff_godunov.jl b/examples/tree_2d_dgsem/elixir_hypdiff_godunov.jl index fc51f11d705..a9b285d718d 100644 --- a/examples/tree_2d_dgsem/elixir_hypdiff_godunov.jl +++ b/examples/tree_2d_dgsem/elixir_hypdiff_godunov.jl @@ -49,10 +49,11 @@ coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_poisson_periodic) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_poisson_periodic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl index 84fc1bb9fc0..5f1b843174e 100644 --- a/examples/tree_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl @@ -41,7 +41,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions, source_terms = source_terms_harmonic) diff --git a/examples/tree_2d_dgsem/elixir_hypdiff_lax_friedrichs.jl b/examples/tree_2d_dgsem/elixir_hypdiff_lax_friedrichs.jl index 7050c8247d4..e6c736807bf 100644 --- a/examples/tree_2d_dgsem/elixir_hypdiff_lax_friedrichs.jl +++ b/examples/tree_2d_dgsem/elixir_hypdiff_lax_friedrichs.jl @@ -46,10 +46,11 @@ coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_poisson_periodic) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_poisson_periodic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl index 021ff3461bf..c60812e0993 100644 --- a/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl +++ b/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl @@ -8,7 +8,7 @@ equations = HyperbolicDiffusionEquations2D() initial_condition = initial_condition_poisson_nonperiodic # 1 => -x, 2 => +x, 3 => -y, 4 => +y as usual for orientations -boundary_conditions = (x_neg = boundary_condition_poisson_nonperiodic, +boundary_conditions = (; x_neg = boundary_condition_poisson_nonperiodic, x_pos = boundary_condition_poisson_nonperiodic, y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) @@ -22,7 +22,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = (false, true)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions, source_terms = source_terms_poisson_nonperiodic) diff --git a/examples/tree_2d_dgsem/elixir_kpp.jl b/examples/tree_2d_dgsem/elixir_kpp.jl index d4f4f524d5c..aefa2348737 100644 --- a/examples/tree_2d_dgsem/elixir_kpp.jl +++ b/examples/tree_2d_dgsem/elixir_kpp.jl @@ -103,7 +103,8 @@ mesh = TreeMesh(coordinates_min, coordinates_max, ############################################################################### # Create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_kpp, solver) +semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_kpp, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # Set up adaptive mesh refinement diff --git a/examples/tree_2d_dgsem/elixir_lbm_constant.jl b/examples/tree_2d_dgsem/elixir_lbm_constant.jl index 689c8f60bf2..164b65612a9 100644 --- a/examples/tree_2d_dgsem/elixir_lbm_constant.jl +++ b/examples/tree_2d_dgsem/elixir_lbm_constant.jl @@ -14,9 +14,10 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_lbm_couette.jl b/examples/tree_2d_dgsem/elixir_lbm_couette.jl index c6556273a75..e7cb3faae76 100644 --- a/examples/tree_2d_dgsem/elixir_lbm_couette.jl +++ b/examples/tree_2d_dgsem/elixir_lbm_couette.jl @@ -72,8 +72,9 @@ function boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, # Calculate boundary flux (u_inner is "left" of boundary, u_boundary is "right" of boundary) return surface_flux_function(u_inner, u_boundary, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_periodic, - x_pos = boundary_condition_periodic, +# We can either pass periodic boundary conditions in x direction or not, +# but we need to pass non-periodic boundary conditions in y-direction +boundary_conditions = (; y_neg = boundary_condition_noslip_wall, y_pos = boundary_condition_couette) @@ -86,7 +87,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = (true, false), n_cells_max = 10_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_lbm_lid_driven_cavity.jl b/examples/tree_2d_dgsem/elixir_lbm_lid_driven_cavity.jl index 72774610882..446c0691440 100644 --- a/examples/tree_2d_dgsem/elixir_lbm_lid_driven_cavity.jl +++ b/examples/tree_2d_dgsem/elixir_lbm_lid_driven_cavity.jl @@ -61,7 +61,7 @@ function boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, # Calculate boundary flux (u_inner is "left" of boundary, u_boundary is "right" of boundary) return surface_flux_function(u_inner, u_boundary, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_noslip_wall, +boundary_conditions = (; x_neg = boundary_condition_noslip_wall, x_pos = boundary_condition_noslip_wall, y_neg = boundary_condition_noslip_wall, y_pos = boundary_condition_lid_driven_cavity) @@ -75,7 +75,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = false, n_cells_max = 10_000) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_linearizedeuler_convergence.jl b/examples/tree_2d_dgsem/elixir_linearizedeuler_convergence.jl index 6643e295706..ccb451fb114 100644 --- a/examples/tree_2d_dgsem/elixir_linearizedeuler_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_linearizedeuler_convergence.jl @@ -18,10 +18,11 @@ coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y)) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl b/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl index 3871da7c5f4..85dcf5e3cd3 100644 --- a/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl +++ b/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl @@ -28,7 +28,7 @@ end initial_condition = initial_condition_gauss_wall # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition_wall) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl index 0d7bf6198d3..b94cc1df071 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -23,9 +23,10 @@ coordinates_min = (0.0, 0.0) coordinates_max = (sqrt(2.0), sqrt(2.0)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_dirichlet.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_dirichlet.jl index 3308622c8a8..6fed496f9ba 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_dirichlet.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_dirichlet.jl @@ -35,7 +35,7 @@ boundary_conditions = (; y_neg = BoundaryConditionDirichlet(initial_condition_convergence_test), y_pos = BoundaryConditionDirichlet(initial_condition_convergence_test)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl index c58891c7272..55e81928723 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl @@ -21,9 +21,10 @@ refinement_patches = ((type = "box", coordinates_min = 0.25 .* coordinates_max, mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, refinement_patches = refinement_patches, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl b/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl index 3f65907d1de..f788a2a26a2 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl @@ -63,9 +63,10 @@ coordinates_min = (-0.5, -0.5) coordinates_max = (0.5, 0.5) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhd_ec.jl b/examples/tree_2d_dgsem/elixir_mhd_ec.jl index 8947da5ee35..7fb6da1abdd 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_ec.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_ec.jl @@ -17,9 +17,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhd_ec_float32.jl b/examples/tree_2d_dgsem/elixir_mhd_ec_float32.jl index 12423546b6b..02186c202f4 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_ec_float32.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_ec_float32.jl @@ -18,9 +18,10 @@ coordinates_max = (2.0f0, 2.0f0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, n_cells_max = 10_000, - RealT = Float32) + RealT = Float32, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhd_onion.jl b/examples/tree_2d_dgsem/elixir_mhd_onion.jl index bcf1db82363..87f117e6260 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_onion.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_onion.jl @@ -37,19 +37,19 @@ mesh = TreeMesh(coordinates_min, coordinates_max, # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) solver = DGSEM(polydeg = 3, surface_flux = surface_flux, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) -boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition), +boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition), x_pos = BoundaryConditionDirichlet(initial_condition), y_neg = BoundaryConditionDirichlet(initial_condition), y_pos = BoundaryConditionDirichlet(initial_condition)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_2d_dgsem/elixir_mhd_orszag_tang.jl b/examples/tree_2d_dgsem/elixir_mhd_orszag_tang.jl index dd61b2ab0c2..a1b89b11c23 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_orszag_tang.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_orszag_tang.jl @@ -54,9 +54,10 @@ coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhd_rotor.jl b/examples/tree_2d_dgsem/elixir_mhd_rotor.jl index 0b1c126a0e8..414573f2dfe 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_rotor.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_rotor.jl @@ -69,9 +69,10 @@ coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl b/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl index 5e1e2a3c2d7..dc4d8c965a6 100644 --- a/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl @@ -70,9 +70,10 @@ coordinates_min = (-0.5, -0.5) coordinates_max = (0.5, 0.5) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl index e3e231c520c..725919a8cfe 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl @@ -25,9 +25,10 @@ coordinates_min = (0.0, 0.0) coordinates_max = (sqrt(2), sqrt(2)) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_ec.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_ec.jl index eb674b068d9..ae12d4daea9 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmulti_ec.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmulti_ec.jl @@ -18,9 +18,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_es.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_es.jl index 207d81cc154..5d60b00267f 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmulti_es.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmulti_es.jl @@ -25,9 +25,10 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl index e1f6bd2b176..f34628594e5 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl @@ -70,9 +70,10 @@ coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_mhdmultiion_collisions.jl b/examples/tree_2d_dgsem/elixir_mhdmultiion_collisions.jl index e05b1565095..816e638d472 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmultiion_collisions.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmultiion_collisions.jl @@ -3,11 +3,11 @@ using OrdinaryDiffEqLowStorageRK using Trixi ############################################################################### -# This elixir describes the frictional slowing of an ionized carbon fluid (C6+) with respect to another species +# This elixir describes the frictional slowing of an ionized carbon fluid (C6+) with respect to another species # of a background ionized carbon fluid with an initially nonzero relative velocity. It is the second slow-down # test (fluids with different densities) described in: -# - Ghosh, D., Chapman, T. D., Berger, R. L., Dimits, A., & Banks, J. W. (2019). A -# multispecies, multifluid model for laser–induced counterstreaming plasma simulations. +# - Ghosh, D., Chapman, T. D., Berger, R. L., Dimits, A., & Banks, J. W. (2019). A +# multispecies, multifluid model for laser–induced counterstreaming plasma simulations. # Computers & Fluids, 186, 38-57. [DOI: 10.1016/j.compfluid.2019.04.012](https://doi.org/10.1016/j.compfluid.2019.04.012). # # This is effectively a zero-dimensional case because the spatial gradients are zero, and we use it to test the @@ -22,7 +22,7 @@ using Trixi # Characteristic velocity: V_inf = 1.00E+06 m/s # # The results of the paper can be reproduced using `source_terms = source_terms_collision_ion_ion` (i.e., only -# taking into account ion-ion collisions). However, we include ion-electron collisions assuming a constant +# taking into account ion-ion collisions). However, we include ion-electron collisions assuming a constant # electron temperature of 1 keV in this elixir to test the function `source_terms_collision_ion_electron` # Return the electron pressure for a constant electron temperature Te = 1 keV @@ -108,7 +108,7 @@ volume_flux = (flux_ruedaramirez_etal, flux_nonconservative_ruedaramirez_etal) # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_central) @@ -120,7 +120,7 @@ coordinates_max = (1.0, 1.0) # We use a very coarse mesh because this is a 0-dimensional case mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 1, - n_cells_max = 1_000_000) + n_cells_max = 1_000_000, periodicity = true) # Ion-ion and ion-electron collision source terms # In this particular case, we can omit source_terms_lorentz because the magnetic field is zero! @@ -129,8 +129,9 @@ function source_terms(u, x, t, equations::IdealGlmMhdMultiIonEquations2D) source_terms_collision_ion_electron(u, x, t, equations) end -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. @@ -147,7 +148,7 @@ analysis_callback = AnalysisCallback(semi, temperature2)) alive_callback = AliveCallback(analysis_interval = analysis_interval) -stepsize_callback = StepsizeCallback(cfl = 0.01) # Very small CFL due to the stiff source terms +stepsize_callback = StepsizeCallback(cfl = 0.01) # Very small CFL due to the stiff source terms save_restart = SaveRestartCallback(interval = 100, save_final_restart = true) diff --git a/examples/tree_2d_dgsem/elixir_mhdmultiion_ec.jl b/examples/tree_2d_dgsem/elixir_mhdmultiion_ec.jl index 9e1828cb1c1..33608ecd585 100644 --- a/examples/tree_2d_dgsem/elixir_mhdmultiion_ec.jl +++ b/examples/tree_2d_dgsem/elixir_mhdmultiion_ec.jl @@ -24,12 +24,13 @@ coordinates_min = (-2.0, -2.0) coordinates_max = (2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -# The multi-ion GLM-MHD equations require the inclusion of source_terms_lorentz +# The multi-ion GLM-MHD equations require the inclusion of source_terms_lorentz # whenever multiple ion species are present -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_lorentz) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_lorentz, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_kelvin_helmholtz_instability_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_navierstokes_kelvin_helmholtz_instability_sc_subcell.jl index 2b1d13cc5ca..e1580d68e7b 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_kelvin_helmholtz_instability_sc_subcell.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_kelvin_helmholtz_instability_sc_subcell.jl @@ -40,7 +40,7 @@ initial_condition = initial_condition_kelvin_helmholtz_instability # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = FluxLaxFriedrichs(max_abs_speed_naive) volume_flux = flux_ranocha @@ -59,9 +59,11 @@ coordinates_min = (-1.0, -1.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_shearlayer_amr.jl b/examples/tree_2d_dgsem/elixir_navierstokes_shearlayer_amr.jl index 637570ead2f..b25995cc8aa 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_shearlayer_amr.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_shearlayer_amr.jl @@ -45,10 +45,12 @@ coordinates_min = (0.0, 0.0) coordinates_max = (1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index 8c1239bfa00..b340d95ec77 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -44,10 +44,12 @@ coordinates_min = (-1.0, -1.0) .* pi coordinates_max = (1.0, 1.0) .* pi mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex_sutherland.jl b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex_sutherland.jl index df16dca0302..cdbb9b9c32e 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex_sutherland.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex_sutherland.jl @@ -61,10 +61,12 @@ coordinates_min = (-1.0, -1.0) .* pi coordinates_max = (1.0, 1.0) .* pi mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_viscous_shock.jl b/examples/tree_2d_dgsem/elixir_navierstokes_viscous_shock.jl index 75c8273594f..6a06e3cb4f6 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_viscous_shock.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_viscous_shock.jl @@ -123,7 +123,7 @@ function boundary_condition_outflow(u_inner, orientation, direction, x, t, return flux(u_inner, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_inflow, +boundary_conditions = (; x_neg = boundary_condition_inflow, x_pos = boundary_condition_outflow, y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic) @@ -171,7 +171,7 @@ analysis_interval = 100 analysis_callback = AnalysisCallback(semi, interval = analysis_interval) # Admissible stepsize is governed by the diffusive CFL condition. -# Unless the advective cfl number `cfl` is not reduced to e.g. `0.1` +# Unless the advective cfl number `cfl` is not reduced to e.g. `0.1` # (which is overly restrictive for this problem), # the diffusive CFL restricts the timestep for this problem. stepsize_callback = StepsizeCallback(cfl = 0.2, diff --git a/examples/tree_2d_fdsbp/elixir_advection_extended.jl b/examples/tree_2d_fdsbp/elixir_advection_extended.jl index e4d82d961b8..b2279cd2bd4 100644 --- a/examples/tree_2d_fdsbp/elixir_advection_extended.jl +++ b/examples/tree_2d_fdsbp/elixir_advection_extended.jl @@ -26,7 +26,8 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_fdsbp/elixir_euler_convergence.jl b/examples/tree_2d_fdsbp/elixir_euler_convergence.jl index 86540e0b135..1b1db2c2e82 100644 --- a/examples/tree_2d_fdsbp/elixir_euler_convergence.jl +++ b/examples/tree_2d_fdsbp/elixir_euler_convergence.jl @@ -29,8 +29,9 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_fdsbp/elixir_euler_kelvin_helmholtz_instability.jl b/examples/tree_2d_fdsbp/elixir_euler_kelvin_helmholtz_instability.jl index f664c15e93b..15ed74cf072 100644 --- a/examples/tree_2d_fdsbp/elixir_euler_kelvin_helmholtz_instability.jl +++ b/examples/tree_2d_fdsbp/elixir_euler_kelvin_helmholtz_instability.jl @@ -43,7 +43,8 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_2d_fdsbp/elixir_euler_vortex.jl b/examples/tree_2d_fdsbp/elixir_euler_vortex.jl index 4de7125cc97..639d97e86f5 100644 --- a/examples/tree_2d_fdsbp/elixir_euler_vortex.jl +++ b/examples/tree_2d_fdsbp/elixir_euler_vortex.jl @@ -72,7 +72,8 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_advection_amr.jl b/examples/tree_3d_dgsem/elixir_advection_amr.jl index 368d312dc43..82bd92f7e12 100644 --- a/examples/tree_3d_dgsem/elixir_advection_amr.jl +++ b/examples/tree_3d_dgsem/elixir_advection_amr.jl @@ -14,9 +14,10 @@ coordinates_min = (-5.0, -5.0, -5.0) coordinates_max = (5.0, 5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_advection_basic.jl b/examples/tree_3d_dgsem/elixir_advection_basic.jl index 715b589cef3..7bce15cba19 100644 --- a/examples/tree_3d_dgsem/elixir_advection_basic.jl +++ b/examples/tree_3d_dgsem/elixir_advection_basic.jl @@ -16,11 +16,12 @@ coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z)) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) # set maximum capacity of tree data structure + n_cells_max = 30_000, periodicity = true) # set maximum capacity of tree data structure # A semidiscretization collects data structures and functions for the spatial discretization semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_advection_convergence_fvO2.jl b/examples/tree_3d_dgsem/elixir_advection_convergence_fvO2.jl index a1c2106031f..e970570a838 100644 --- a/examples/tree_3d_dgsem/elixir_advection_convergence_fvO2.jl +++ b/examples/tree_3d_dgsem/elixir_advection_convergence_fvO2.jl @@ -22,10 +22,11 @@ coordinates_max = (1.0, 1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_advection_diffusion_amr.jl b/examples/tree_3d_dgsem/elixir_advection_diffusion_amr.jl index 5f8b305674b..5d886b01cf4 100644 --- a/examples/tree_3d_dgsem/elixir_advection_diffusion_amr.jl +++ b/examples/tree_3d_dgsem/elixir_advection_diffusion_amr.jl @@ -16,7 +16,7 @@ coordinates_min = (-1.0, -1.0, -1.0) coordinates_max = (1.0, 1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 80_000) + n_cells_max = 80_000, periodicity = true) # Define initial condition function initial_condition_diffusive_convergence_test(x, t, diff --git a/examples/tree_3d_dgsem/elixir_advection_er.jl b/examples/tree_3d_dgsem/elixir_advection_er.jl index 988dd3d7d54..471f34ede04 100644 --- a/examples/tree_3d_dgsem/elixir_advection_er.jl +++ b/examples/tree_3d_dgsem/elixir_advection_er.jl @@ -14,10 +14,11 @@ coordinates_max = (1.0, 1.0, 1.0) # Create a uniformly refined mesh with periodic boundaries mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_advection_extended.jl b/examples/tree_3d_dgsem/elixir_advection_extended.jl index 4b3a86cee72..ced77744f2c 100644 --- a/examples/tree_3d_dgsem/elixir_advection_extended.jl +++ b/examples/tree_3d_dgsem/elixir_advection_extended.jl @@ -22,18 +22,12 @@ mesh = TreeMesh(coordinates_min, coordinates_max, periodicity = true) # you can either use a single function to impose the BCs weakly in all -# 2*ndims == 6 directions or you can pass a tuple containing BCs for +# 2*ndims == 6 directions or you can pass a named tuple containing BCs for # each direction -# Note: "boundary_condition_periodic" indicates that it is a periodic boundary and can be omitted on -# fully periodic domains. Here, however, it is included to allow easy override during testing -# Assign a single boundary condition to all boundaries -boundary_condition = boundary_condition_periodic -boundary_conditions = boundary_condition_default(mesh, boundary_condition) -# Alternatively, you can use -# boundary_conditions = boundary_condition_periodic +boundary_conditions = boundary_condition_periodic # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_3d_dgsem/elixir_advection_mortar.jl b/examples/tree_3d_dgsem/elixir_advection_mortar.jl index dc248b1adda..7584470e6ab 100644 --- a/examples/tree_3d_dgsem/elixir_advection_mortar.jl +++ b/examples/tree_3d_dgsem/elixir_advection_mortar.jl @@ -19,9 +19,10 @@ refinement_patches = ((type = "box", coordinates_min = (0.0, -1.0, -1.0), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, refinement_patches = refinement_patches, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_advection_restart.jl b/examples/tree_3d_dgsem/elixir_advection_restart.jl index a2b4355960e..8daadc24d20 100644 --- a/examples/tree_3d_dgsem/elixir_advection_restart.jl +++ b/examples/tree_3d_dgsem/elixir_advection_restart.jl @@ -16,7 +16,8 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_extended.jl")) restart_filename = joinpath("out", "restart_000000019.h5") mesh = load_mesh(restart_filename) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) tspan = (load_time(restart_filename), 2.0) dt = load_dt(restart_filename) diff --git a/examples/tree_3d_dgsem/elixir_euler_amr.jl b/examples/tree_3d_dgsem/elixir_euler_amr.jl index 3b9bb441321..b296b85ef7e 100644 --- a/examples/tree_3d_dgsem/elixir_euler_amr.jl +++ b/examples/tree_3d_dgsem/elixir_euler_amr.jl @@ -38,9 +38,10 @@ coordinates_min = (-5.0, -5.0, -5.0) coordinates_max = (5.0, 5.0, 5.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl b/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl index 2fdc58967d0..f9978e8cbb4 100644 --- a/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl +++ b/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl @@ -70,9 +70,10 @@ refinement_patches = ((type = "box", coordinates_min = (-20.0, -10.0, -10.0), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, refinement_patches = refinement_patches, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_convergence.jl b/examples/tree_3d_dgsem/elixir_euler_convergence.jl index aae0f774c56..1e78c1d1178 100644 --- a/examples/tree_3d_dgsem/elixir_euler_convergence.jl +++ b/examples/tree_3d_dgsem/elixir_euler_convergence.jl @@ -15,10 +15,11 @@ coordinates_min = (0.0, 0.0, 0.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_eoc_test_euler) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_eoc_test_euler, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_convergence_pure_fv.jl b/examples/tree_3d_dgsem/elixir_euler_convergence_pure_fv.jl index 5d98d60c1e7..e05d1eb2de7 100644 --- a/examples/tree_3d_dgsem/elixir_euler_convergence_pure_fv.jl +++ b/examples/tree_3d_dgsem/elixir_euler_convergence_pure_fv.jl @@ -15,10 +15,11 @@ coordinates_min = (0.0, 0.0, 0.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_density_pulse.jl b/examples/tree_3d_dgsem/elixir_euler_density_pulse.jl index 1a107f374b1..0eb82331926 100644 --- a/examples/tree_3d_dgsem/elixir_euler_density_pulse.jl +++ b/examples/tree_3d_dgsem/elixir_euler_density_pulse.jl @@ -34,9 +34,10 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_ec.jl b/examples/tree_3d_dgsem/elixir_euler_ec.jl index 21b5ff0950c..6e1da1b566a 100644 --- a/examples/tree_3d_dgsem/elixir_euler_ec.jl +++ b/examples/tree_3d_dgsem/elixir_euler_ec.jl @@ -16,9 +16,10 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_laplace_diffusion.jl b/examples/tree_3d_dgsem/elixir_euler_laplace_diffusion.jl index 852c0928a49..17d645248b7 100644 --- a/examples/tree_3d_dgsem/elixir_euler_laplace_diffusion.jl +++ b/examples/tree_3d_dgsem/elixir_euler_laplace_diffusion.jl @@ -17,10 +17,12 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_mortar.jl b/examples/tree_3d_dgsem/elixir_euler_mortar.jl index fbf20e9ecca..14c3ea22fe8 100644 --- a/examples/tree_3d_dgsem/elixir_euler_mortar.jl +++ b/examples/tree_3d_dgsem/elixir_euler_mortar.jl @@ -12,7 +12,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -23,10 +23,11 @@ refinement_patches = ((type = "box", coordinates_min = (0.5, 0.5, 0.5), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, refinement_patches = refinement_patches, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl index 5ac107cbf92..681159f13af 100644 --- a/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl +++ b/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl @@ -107,7 +107,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 1_000_000, periodicity = false) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/tree_3d_dgsem/elixir_euler_sedov_scO2.jl b/examples/tree_3d_dgsem/elixir_euler_sedov_scO2.jl index 08432696df0..bb515a5c175 100644 --- a/examples/tree_3d_dgsem/elixir_euler_sedov_scO2.jl +++ b/examples/tree_3d_dgsem/elixir_euler_sedov_scO2.jl @@ -58,9 +58,10 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 1_000_000) + n_cells_max = 1_000_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl b/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl index 6cf46da8e78..9f4b37acf87 100644 --- a/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl +++ b/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl @@ -27,9 +27,10 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_shockcapturing_amr.jl b/examples/tree_3d_dgsem/elixir_euler_shockcapturing_amr.jl index 671f6d47d2b..db24526bd6a 100644 --- a/examples/tree_3d_dgsem/elixir_euler_shockcapturing_amr.jl +++ b/examples/tree_3d_dgsem/elixir_euler_shockcapturing_amr.jl @@ -27,9 +27,10 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_source_terms.jl b/examples/tree_3d_dgsem/elixir_euler_source_terms.jl index c3f7c44c8cc..9f0ff26b2c3 100644 --- a/examples/tree_3d_dgsem/elixir_euler_source_terms.jl +++ b/examples/tree_3d_dgsem/elixir_euler_source_terms.jl @@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive), volume_integral = VolumeIntegralWeakForm()) @@ -22,10 +22,11 @@ coordinates_min = (0.0, 0.0, 0.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_euler_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_euler_taylor_green_vortex.jl index 6ff5d1c46ff..a38d272ba97 100644 --- a/examples/tree_3d_dgsem/elixir_euler_taylor_green_vortex.jl +++ b/examples/tree_3d_dgsem/elixir_euler_taylor_green_vortex.jl @@ -45,9 +45,10 @@ coordinates_min = (-1.0, -1.0, -1.0) .* pi coordinates_max = (1.0, 1.0, 1.0) .* pi mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_eulergravity_convergence.jl b/examples/tree_3d_dgsem/elixir_eulergravity_convergence.jl index 861e7d565f7..a1ad0faba15 100644 --- a/examples/tree_3d_dgsem/elixir_eulergravity_convergence.jl +++ b/examples/tree_3d_dgsem/elixir_eulergravity_convergence.jl @@ -15,10 +15,11 @@ coordinates_min = (0.0, 0.0, 0.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, - solver_euler, + solver_euler; + boundary_conditions = boundary_condition_periodic, source_terms = source_terms_eoc_test_coupled_euler_gravity) ############################################################################### @@ -30,13 +31,14 @@ equations_gravity = HyperbolicDiffusionEquations3D() # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver_gravity = DGSEM(polydeg, FluxLaxFriedrichs(max_abs_speed_naive)) semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, - solver_gravity, - source_terms = source_terms_harmonic) + solver_gravity; + source_terms = source_terms_harmonic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # combining both semidiscretizations for Euler + self-gravity diff --git a/examples/tree_3d_dgsem/elixir_hypdiff_lax_friedrichs.jl b/examples/tree_3d_dgsem/elixir_hypdiff_lax_friedrichs.jl index 0a3119e6e6e..501ecde8a9e 100644 --- a/examples/tree_3d_dgsem/elixir_hypdiff_lax_friedrichs.jl +++ b/examples/tree_3d_dgsem/elixir_hypdiff_lax_friedrichs.jl @@ -48,10 +48,11 @@ coordinates_min = (0.0, 0.0, 0.0) coordinates_max = (1.0, 1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 30_000) + n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_poisson_periodic) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_poisson_periodic, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl b/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl index 51ada9cc233..359665f2d01 100644 --- a/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl +++ b/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl @@ -16,7 +16,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = (false, true, true)) -boundary_conditions = (x_neg = boundary_condition_poisson_nonperiodic, +boundary_conditions = (; x_neg = boundary_condition_poisson_nonperiodic, x_pos = boundary_condition_poisson_nonperiodic, y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic, diff --git a/examples/tree_3d_dgsem/elixir_lbm_constant.jl b/examples/tree_3d_dgsem/elixir_lbm_constant.jl index f1c5c8ec891..ea70a5334d7 100644 --- a/examples/tree_3d_dgsem/elixir_lbm_constant.jl +++ b/examples/tree_3d_dgsem/elixir_lbm_constant.jl @@ -14,9 +14,10 @@ coordinates_min = (-1.0, -1.0, -1.0) coordinates_max = (1.0, 1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl index e59a853309a..e2318e47f07 100644 --- a/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl +++ b/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl @@ -33,9 +33,10 @@ coordinates_min = (-pi * L, -pi * L, -pi * L) coordinates_max = (pi * L, pi * L, pi * L) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, - n_cells_max = 300_000) + n_cells_max = 300_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_linearizedeuler_gauss_wall.jl b/examples/tree_3d_dgsem/elixir_linearizedeuler_gauss_wall.jl index 1382f6c4fc2..44a79b0f39b 100644 --- a/examples/tree_3d_dgsem/elixir_linearizedeuler_gauss_wall.jl +++ b/examples/tree_3d_dgsem/elixir_linearizedeuler_gauss_wall.jl @@ -29,7 +29,7 @@ end initial_condition = initial_condition_gauss_wall # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_condition_wall) ############################################################################### diff --git a/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl b/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl index e99c9c8c775..4fbb177b732 100644 --- a/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl @@ -24,9 +24,10 @@ coordinates_min = (-1.0, -1.0, -1.0) coordinates_max = (1.0, 1.0, 1.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl b/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl index b88f4132e7f..99fdde148cd 100644 --- a/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl +++ b/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl @@ -21,9 +21,10 @@ refinement_patches = ((type = "box", coordinates_min = (-0.5, -0.5, -0.5), mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, refinement_patches = refinement_patches, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_mhd_ec.jl b/examples/tree_3d_dgsem/elixir_mhd_ec.jl index 779012a485f..79f4ebb67ad 100644 --- a/examples/tree_3d_dgsem/elixir_mhd_ec.jl +++ b/examples/tree_3d_dgsem/elixir_mhd_ec.jl @@ -17,9 +17,10 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl b/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl index 44e8f429ba9..5f4677c0204 100644 --- a/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl +++ b/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl @@ -28,10 +28,11 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_mhdmultiion_ec.jl b/examples/tree_3d_dgsem/elixir_mhdmultiion_ec.jl index c06400f38b5..91131cecacc 100644 --- a/examples/tree_3d_dgsem/elixir_mhdmultiion_ec.jl +++ b/examples/tree_3d_dgsem/elixir_mhdmultiion_ec.jl @@ -18,12 +18,13 @@ coordinates_min = (-2.0, -2.0, -2.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -# The multi-ion GLM-MHD equations require the inclusion of source_terms_lorentz +# The multi-ion GLM-MHD equations require the inclusion of source_terms_lorentz # whenever multiple ion species are present -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_lorentz) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_lorentz, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index 361126279ed..5464da3e166 100644 --- a/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -47,10 +47,12 @@ coordinates_min = (-1.0, -1.0, -1.0) .* pi coordinates_max = (1.0, 1.0, 1.0) .* pi mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 3, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_dgsem/elixir_navierstokes_viscous_shock.jl b/examples/tree_3d_dgsem/elixir_navierstokes_viscous_shock.jl index aecbf4fbc7e..8df31a0561a 100644 --- a/examples/tree_3d_dgsem/elixir_navierstokes_viscous_shock.jl +++ b/examples/tree_3d_dgsem/elixir_navierstokes_viscous_shock.jl @@ -123,7 +123,7 @@ function boundary_condition_outflow(u_inner, orientation, direction, x, t, return flux(u_inner, orientation, equations) end -boundary_conditions = (x_neg = boundary_condition_inflow, +boundary_conditions = (; x_neg = boundary_condition_inflow, x_pos = boundary_condition_outflow, y_neg = boundary_condition_periodic, y_pos = boundary_condition_periodic, @@ -174,7 +174,7 @@ alive_callback = AliveCallback(alive_interval = 10) analysis_interval = 100 analysis_callback = AnalysisCallback(semi, interval = analysis_interval) -# For this setup, both advective and diffusive time step restrictions are relevant, i.e., +# For this setup, both advective and diffusive time step restrictions are relevant, i.e., # may not be increased beyond the given values. stepsize_callback = StepsizeCallback(cfl = 0.4, cfl_diffusive = 0.2) diff --git a/examples/tree_3d_fdsbp/elixir_advection_extended.jl b/examples/tree_3d_fdsbp/elixir_advection_extended.jl index 643dbe23208..799ae1d3c65 100644 --- a/examples/tree_3d_fdsbp/elixir_advection_extended.jl +++ b/examples/tree_3d_fdsbp/elixir_advection_extended.jl @@ -26,7 +26,8 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max = 30_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_fdsbp/elixir_euler_convergence.jl b/examples/tree_3d_fdsbp/elixir_euler_convergence.jl index 1767ce7f8a3..572f1f40994 100644 --- a/examples/tree_3d_fdsbp/elixir_euler_convergence.jl +++ b/examples/tree_3d_fdsbp/elixir_euler_convergence.jl @@ -24,10 +24,11 @@ coordinates_min = (0.0, 0.0, 0.0) coordinates_max = (2.0, 2.0, 2.0) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl b/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl index d3cc34eebaf..ec70af566e6 100644 --- a/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl +++ b/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl @@ -47,9 +47,10 @@ coordinates_min = (-1.0, -1.0, -1.0) .* pi coordinates_max = (1.0, 1.0, 1.0) .* pi mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2, - n_cells_max = 100_000) + n_cells_max = 100_000, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl b/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl index 17a87da4fc7..23b3e0718a0 100644 --- a/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl +++ b/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl @@ -15,7 +15,7 @@ equations = AcousticPerturbationEquations2D(v_mean_global = (0.0, -0.5), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 4, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) @@ -42,15 +42,15 @@ function initial_condition_gauss_wall(x, t, equations::AcousticPerturbationEquat end initial_condition = initial_condition_gauss_wall -boundary_conditions = Dict(:OuterCircle => boundary_condition_slip_wall, - :InnerCircle1 => boundary_condition_slip_wall, - :InnerCircle2 => boundary_condition_slip_wall, - :InnerCircle3 => boundary_condition_slip_wall, - :InnerCircle4 => boundary_condition_slip_wall, - :InnerCircle5 => boundary_condition_slip_wall) +boundary_conditions = (; OuterCircle = boundary_condition_slip_wall, + InnerCircle1 = boundary_condition_slip_wall, + InnerCircle2 = boundary_condition_slip_wall, + InnerCircle3 = boundary_condition_slip_wall, + InnerCircle4 = boundary_condition_slip_wall, + InnerCircle5 = boundary_condition_slip_wall) # A semidiscretization collects data structures and functions for the spatial discretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/unstructured_2d_dgsem/elixir_advection_basic.jl b/examples/unstructured_2d_dgsem/elixir_advection_basic.jl index e111c384ecc..438307b97c5 100644 --- a/examples/unstructured_2d_dgsem/elixir_advection_basic.jl +++ b/examples/unstructured_2d_dgsem/elixir_advection_basic.jl @@ -23,7 +23,8 @@ mesh = UnstructuredMesh2D(mesh_file, periodicity = true) # create the semi discretization object semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_dgsem/elixir_euler_basic.jl b/examples/unstructured_2d_dgsem/elixir_euler_basic.jl index 3bdedc1425e..94d44af3c05 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_basic.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_basic.jl @@ -10,11 +10,11 @@ initial_condition = initial_condition_convergence_test source_terms = source_terms_convergence_test boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:Slant => boundary_condition_convergence_test, - :Bezier => boundary_condition_convergence_test, - :Right => boundary_condition_convergence_test, - :Bottom => boundary_condition_convergence_test, - :Top => boundary_condition_convergence_test) +boundary_conditions = (; Slant = boundary_condition_convergence_test, + Bezier = boundary_condition_convergence_test, + Right = boundary_condition_convergence_test, + Bottom = boundary_condition_convergence_test, + Top = boundary_condition_convergence_test) ############################################################################### # Get the DG approximation space @@ -24,7 +24,7 @@ boundary_conditions = Dict(:Slant => boundary_condition_convergence_test, # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = DGSEM(polydeg = 8, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)) diff --git a/examples/unstructured_2d_dgsem/elixir_euler_ec.jl b/examples/unstructured_2d_dgsem/elixir_euler_ec.jl index c3855d97cd4..10c91f3f4b4 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_ec.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_ec.jl @@ -25,7 +25,8 @@ mesh = UnstructuredMesh2D(mesh_file, periodicity = true) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_dgsem/elixir_euler_free_stream.jl b/examples/unstructured_2d_dgsem/elixir_euler_free_stream.jl index e0cec5129ae..1a6fcd3f571 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_free_stream.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_free_stream.jl @@ -9,13 +9,13 @@ equations = CompressibleEulerEquations2D(1.4) initial_condition = initial_condition_constant boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:Body => boundary_condition_free_stream, - :Button1 => boundary_condition_free_stream, - :Button2 => boundary_condition_free_stream, - :Eye1 => boundary_condition_free_stream, - :Eye2 => boundary_condition_free_stream, - :Smile => boundary_condition_free_stream, - :Bowtie => boundary_condition_free_stream) +boundary_conditions = (; Body = boundary_condition_free_stream, + Button1 = boundary_condition_free_stream, + Button2 = boundary_condition_free_stream, + Eye1 = boundary_condition_free_stream, + Eye2 = boundary_condition_free_stream, + Smile = boundary_condition_free_stream, + Bowtie = boundary_condition_free_stream) ############################################################################### # Get the DG approximation space @@ -32,7 +32,7 @@ mesh = UnstructuredMesh2D(mesh_file) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl b/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl index d3488c81075..b448b10b56e 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl @@ -68,7 +68,8 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = UnstructuredMesh2D(mesh_file, periodicity = true) # create the semidiscretization -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_dgsem/elixir_euler_time_series.jl b/examples/unstructured_2d_dgsem/elixir_euler_time_series.jl index 2dad63ae3af..00c23ebd03c 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_time_series.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_time_series.jl @@ -84,8 +84,9 @@ mesh = UnstructuredMesh2D(mesh_file, periodicity = true) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_term) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_term, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl b/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl index 43d50f94b16..264e5a7facf 100644 --- a/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl +++ b/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl @@ -25,11 +25,11 @@ end initial_condition = uniform_flow_state boundary_condition_uniform_flow = BoundaryConditionDirichlet(uniform_flow_state) -boundary_conditions = Dict(:Bottom => boundary_condition_uniform_flow, - :Top => boundary_condition_uniform_flow, - :Right => boundary_condition_uniform_flow, - :Left => boundary_condition_uniform_flow, - :Circle => boundary_condition_slip_wall) +boundary_conditions = (; Bottom = boundary_condition_uniform_flow, + Top = boundary_condition_uniform_flow, + Right = boundary_condition_uniform_flow, + Left = boundary_condition_uniform_flow, + Circle = boundary_condition_slip_wall) ############################################################################### # Get the DG approximation space @@ -46,7 +46,7 @@ mesh = UnstructuredMesh2D(mesh_file) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl index 9a8134f8404..8dd82ec94f2 100644 --- a/examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl +++ b/examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl @@ -20,7 +20,8 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = UnstructuredMesh2D(mesh_file, periodicity = true) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl b/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl index 41a521e106d..42659924782 100644 --- a/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl +++ b/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl @@ -39,7 +39,8 @@ mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000 mesh = UnstructuredMesh2D(mesh_file, periodicity = true) # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_dgsem/elixir_mhd_onion.jl b/examples/unstructured_2d_dgsem/elixir_mhd_onion.jl index a6b5bc4e4ca..b75c09112f6 100644 --- a/examples/unstructured_2d_dgsem/elixir_mhd_onion.jl +++ b/examples/unstructured_2d_dgsem/elixir_mhd_onion.jl @@ -35,19 +35,19 @@ mesh = UnstructuredMesh2D(mesh_file, periodicity = false) # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. surface_flux = (FluxLaxFriedrichs(max_abs_speed_naive), flux_nonconservative_powell) volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell) solver = DGSEM(polydeg = 3, surface_flux = surface_flux, volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) -boundary_conditions = Dict(:Bottom => BoundaryConditionDirichlet(initial_condition), - :Top => BoundaryConditionDirichlet(initial_condition), - :Right => BoundaryConditionDirichlet(initial_condition), - :Left => BoundaryConditionDirichlet(initial_condition)) +boundary_conditions = (; Bottom = BoundaryConditionDirichlet(initial_condition), + Top = BoundaryConditionDirichlet(initial_condition), + Right = BoundaryConditionDirichlet(initial_condition), + Left = BoundaryConditionDirichlet(initial_condition)) -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/unstructured_2d_fdsbp/elixir_advection_basic.jl b/examples/unstructured_2d_fdsbp/elixir_advection_basic.jl index 000883c694a..c17730f6766 100644 --- a/examples/unstructured_2d_fdsbp/elixir_advection_basic.jl +++ b/examples/unstructured_2d_fdsbp/elixir_advection_basic.jl @@ -28,7 +28,8 @@ mesh = UnstructuredMesh2D(mesh_file, periodicity = true) # create the semidiscretization object semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_fdsbp/elixir_euler_free_stream.jl b/examples/unstructured_2d_fdsbp/elixir_euler_free_stream.jl index 1ec93e1e3c9..17894ccf560 100644 --- a/examples/unstructured_2d_fdsbp/elixir_euler_free_stream.jl +++ b/examples/unstructured_2d_fdsbp/elixir_euler_free_stream.jl @@ -11,13 +11,13 @@ initial_condition = initial_condition_constant # Boundary conditions for free-stream testing boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:Body => boundary_condition_free_stream, - :Button1 => boundary_condition_free_stream, - :Button2 => boundary_condition_free_stream, - :Eye1 => boundary_condition_free_stream, - :Eye2 => boundary_condition_free_stream, - :Smile => boundary_condition_free_stream, - :Bowtie => boundary_condition_free_stream) +boundary_conditions = (; Body = boundary_condition_free_stream, + Button1 = boundary_condition_free_stream, + Button2 = boundary_condition_free_stream, + Eye1 = boundary_condition_free_stream, + Eye2 = boundary_condition_free_stream, + Smile = boundary_condition_free_stream, + Bowtie = boundary_condition_free_stream) ############################################################################### # Get the FDSBP approximation space @@ -39,7 +39,7 @@ mesh = UnstructuredMesh2D(mesh_file) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind.jl b/examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind.jl index e3f65af53f7..942b6a6078b 100644 --- a/examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind.jl +++ b/examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind.jl @@ -14,10 +14,10 @@ initial_condition = initial_condition_constant # Boundary conditions for free-stream preservation test boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:outerCircle => boundary_condition_free_stream, - :cone1 => boundary_condition_free_stream, - :cone2 => boundary_condition_free_stream, - :iceCream => boundary_condition_free_stream) +boundary_conditions = (; outerCircle = boundary_condition_free_stream, + cone1 = boundary_condition_free_stream, + cone2 = boundary_condition_free_stream, + iceCream = boundary_condition_free_stream) ############################################################################### # Get the Upwind FDSBP approximation space @@ -51,7 +51,7 @@ mesh = UnstructuredMesh2D(mesh_file) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind_float32.jl b/examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind_float32.jl index 1d6c2a4534c..00a65b6f6de 100644 --- a/examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind_float32.jl +++ b/examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind_float32.jl @@ -16,10 +16,10 @@ initial_condition = initial_condition_constant # Boundary conditions for free-stream preservation test boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:outerCircle => boundary_condition_free_stream, - :cone1 => boundary_condition_free_stream, - :cone2 => boundary_condition_free_stream, - :iceCream => boundary_condition_free_stream) +boundary_conditions = (; outerCircle = boundary_condition_free_stream, + cone1 = boundary_condition_free_stream, + cone2 = boundary_condition_free_stream, + iceCream = boundary_condition_free_stream) ############################################################################### # Get the Upwind FDSBP approximation space @@ -53,7 +53,7 @@ mesh = UnstructuredMesh2D(mesh_file, RealT = Float32) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; boundary_conditions = boundary_conditions) ############################################################################### diff --git a/examples/unstructured_2d_fdsbp/elixir_euler_source_terms.jl b/examples/unstructured_2d_fdsbp/elixir_euler_source_terms.jl index d907b40b0bc..b4d5b6dc60f 100644 --- a/examples/unstructured_2d_fdsbp/elixir_euler_source_terms.jl +++ b/examples/unstructured_2d_fdsbp/elixir_euler_source_terms.jl @@ -19,7 +19,7 @@ D_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(), # In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`. # Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`. # To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`. -# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the +# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the # `StepsizeCallback` (CFL-Condition) and less diffusion. solver = FDSBP(D_SBP, surface_integral = SurfaceIntegralStrongForm(FluxLaxFriedrichs(max_abs_speed_naive)), @@ -35,8 +35,9 @@ mesh = UnstructuredMesh2D(mesh_file, periodicity = true) ############################################################################### # create the semi discretization object -semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, - source_terms = source_terms_convergence_test) +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + source_terms = source_terms_convergence_test, + boundary_conditions = boundary_condition_periodic) ############################################################################### # ODE solvers, callbacks etc. diff --git a/examples/unstructured_2d_fdsbp/elixir_euler_source_terms_upwind.jl b/examples/unstructured_2d_fdsbp/elixir_euler_source_terms_upwind.jl index d8d6b4a9fa2..6bd8deb9e81 100644 --- a/examples/unstructured_2d_fdsbp/elixir_euler_source_terms_upwind.jl +++ b/examples/unstructured_2d_fdsbp/elixir_euler_source_terms_upwind.jl @@ -15,10 +15,10 @@ source_term = source_terms_convergence_test boundary_condition_eoc = BoundaryConditionDirichlet(initial_condition) -boundary_conditions = Dict(:Top => boundary_condition_eoc, - :Bottom => boundary_condition_eoc, - :Right => boundary_condition_eoc, - :Left => boundary_condition_eoc) +boundary_conditions = (; Top = boundary_condition_eoc, + Bottom = boundary_condition_eoc, + Right = boundary_condition_eoc, + Left = boundary_condition_eoc) ############################################################################### # Get the Upwind FDSBP approximation space diff --git a/src/Trixi.jl b/src/Trixi.jl index 2cdfb37a01e..2259b443be9 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -141,7 +141,6 @@ include("auxiliary/t8code.jl") include("equations/equations.jl") include("meshes/meshes.jl") include("solvers/solvers.jl") -include("solvers/boundary_condition_default.jl") include("equations/equations_parabolic.jl") # these depend on parabolic solver types include("semidiscretization/semidiscretization.jl") include("semidiscretization/semidiscretization_hyperbolic.jl") @@ -225,7 +224,6 @@ export initial_condition_constant, initial_condition_weak_blast_wave export boundary_condition_do_nothing, - boundary_condition_default, boundary_condition_periodic, BoundaryConditionDirichlet, BoundaryConditionNeumann, diff --git a/src/meshes/mesh_io.jl b/src/meshes/mesh_io.jl index dd569e3930b..ad4689bef1f 100644 --- a/src/meshes/mesh_io.jl +++ b/src/meshes/mesh_io.jl @@ -120,6 +120,7 @@ function save_mesh_file(mesh::StructuredMesh, output_directory; system = "", attributes(file)["ndims"] = ndims(mesh) attributes(file)["size"] = collect(size(mesh)) attributes(file)["mapping"] = mesh.mapping_as_string + attributes(file)["periodicity"] = collect(mesh.periodicity) return nothing end @@ -420,8 +421,9 @@ function load_mesh_serial(mesh_file::AbstractString; n_cells_max, RealT) RealT = RealT) load_mesh!(mesh, mesh_file) elseif mesh_type in ("StructuredMesh", "StructuredMeshView") - size_, mapping_as_string = h5open(mesh_file, "r") do file + size_, periodicity, mapping_as_string = h5open(mesh_file, "r") do file return read(attributes(file)["size"]), + read(attributes(file)["periodicity"]), read(attributes(file)["mapping"]) end @@ -452,6 +454,7 @@ function load_mesh_serial(mesh_file::AbstractString; n_cells_max, RealT) end mesh = StructuredMesh(size, mapping; RealT = RealT, unsaved_changes = false, + periodicity = periodicity, mapping_as_string = mapping_as_string) mesh.current_filename = mesh_file elseif mesh_type == "UnstructuredMesh2D" diff --git a/src/meshes/p4est_mesh.jl b/src/meshes/p4est_mesh.jl index b77d67eb198..ae099d601ed 100644 --- a/src/meshes/p4est_mesh.jl +++ b/src/meshes/p4est_mesh.jl @@ -142,7 +142,7 @@ end """ P4estMesh(trees_per_dimension; polydeg, mapping=nothing, faces=nothing, coordinates_min=nothing, coordinates_max=nothing, - RealT=Float64, initial_refinement_level=0, periodicity=true, unsaved_changes=true, + RealT=Float64, initial_refinement_level=0, periodicity=false, unsaved_changes=true, p4est_partition_allow_for_coarsening=true) Create a structured curved/higher-order `P4estMesh` of the specified size. @@ -189,7 +189,7 @@ Non-periodic boundaries will be called `:x_neg`, `:x_pos`, `:y_neg`, `:y_pos`, ` function P4estMesh(trees_per_dimension; polydeg, mapping = nothing, faces = nothing, coordinates_min = nothing, coordinates_max = nothing, - RealT = Float64, initial_refinement_level = 0, periodicity = true, + RealT = Float64, initial_refinement_level = 0, periodicity = false, unsaved_changes = true, p4est_partition_allow_for_coarsening = true) @assert ((coordinates_min === nothing)===(coordinates_max === nothing)) "Either both or none of coordinates_min and coordinates_max must be specified" diff --git a/src/meshes/parallel_tree.jl b/src/meshes/parallel_tree.jl index 43e99067aba..51a4c1d1fec 100644 --- a/src/meshes/parallel_tree.jl +++ b/src/meshes/parallel_tree.jl @@ -71,7 +71,7 @@ ParallelTree(::Val{NDIMS}, args...) where {NDIMS} = ParallelTree{NDIMS, Float64} # Create and initialize tree function ParallelTree{NDIMS, RealT}(capacity::Int, center::AbstractArray{RealT}, length::RealT, - periodicity = true) where {NDIMS, RealT <: Real} + periodicity = false) where {NDIMS, RealT <: Real} # Create instance t = ParallelTree{NDIMS, RealT}(capacity) @@ -83,17 +83,17 @@ end # Constructors accepting a single number as center (as opposed to an array) for 1D function ParallelTree{1, RealT}(cap::Int, center::RealT, len::RealT, - periodicity = true) where {RealT <: Real} + periodicity = false) where {RealT <: Real} return ParallelTree{1, RealT}(cap, [center], len, periodicity) end function ParallelTree{1}(cap::Int, center::RealT, len::RealT, - periodicity = true) where {RealT <: Real} + periodicity = false) where {RealT <: Real} return ParallelTree{1, RealT}(cap, [center], len, periodicity) end # Clear tree with deleting data structures, store center and length, and create root cell function init!(t::ParallelTree, center::AbstractArray{RealT}, length::RealT, - periodicity = true) where {RealT} + periodicity = false) where {RealT} clear!(t) # Set domain information diff --git a/src/meshes/serial_tree.jl b/src/meshes/serial_tree.jl index 9c8e0ae855a..a77bc83932d 100644 --- a/src/meshes/serial_tree.jl +++ b/src/meshes/serial_tree.jl @@ -68,7 +68,7 @@ SerialTree(::Val{NDIMS}, args...) where {NDIMS} = SerialTree{NDIMS, Float64}(arg # Create and initialize tree function SerialTree{NDIMS, RealT}(capacity::Int, center::AbstractArray{RealT}, length::RealT, - periodicity = true) where {NDIMS, RealT <: Real} + periodicity = false) where {NDIMS, RealT <: Real} # Create instance t = SerialTree{NDIMS, RealT}(capacity) @@ -80,17 +80,17 @@ end # Constructors accepting a single number as center (as opposed to an array) for 1D function SerialTree{1, RealT}(cap::Int, center::RealT, len::RealT, - periodicity = true) where {RealT <: Real} + periodicity = false) where {RealT <: Real} return SerialTree{1, RealT}(cap, [center], len, periodicity) end function SerialTree{1}(cap::Int, center::RealT, len::RealT, - periodicity = true) where {RealT <: Real} + periodicity = false) where {RealT <: Real} return SerialTree{1, RealT}(cap, [center], len, periodicity) end # Clear tree with deleting data structures, store center and length, and create root cell function init!(t::SerialTree, center::AbstractArray{RealT}, length::RealT, - periodicity = true) where {RealT} + periodicity = false) where {RealT} clear!(t) # Set domain information diff --git a/src/meshes/structured_mesh.jl b/src/meshes/structured_mesh.jl index 97b6aa17b5b..716015d746e 100644 --- a/src/meshes/structured_mesh.jl +++ b/src/meshes/structured_mesh.jl @@ -25,7 +25,7 @@ end """ StructuredMesh(cells_per_dimension, mapping; RealT = Float64, - periodicity = true, + periodicity = false, unsaved_changes = true, mapping_as_string = mapping2string(mapping, length(cells_per_dimension), RealT=RealT)) @@ -49,7 +49,7 @@ Create a StructuredMesh of the given size and shape that uses `RealT` as coordin """ function StructuredMesh(cells_per_dimension, mapping; RealT = Float64, - periodicity = true, + periodicity = false, unsaved_changes = true, mapping_as_string = mapping2string(mapping, length(cells_per_dimension), @@ -75,7 +75,7 @@ end """ StructuredMesh(cells_per_dimension, faces; RealT = Float64, - periodicity = true) + periodicity = false) Create a StructuredMesh of the given size and shape that uses `RealT` as coordinate type. @@ -95,7 +95,7 @@ Create a StructuredMesh of the given size and shape that uses `RealT` as coordin """ function StructuredMesh(cells_per_dimension, faces::Tuple; RealT = Float64, - periodicity = true) + periodicity = false) NDIMS = length(cells_per_dimension) validate_faces(faces) @@ -120,7 +120,7 @@ end """ StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max; - periodicity = true) + periodicity = false) Create a StructuredMesh that represents a uncurved structured mesh with a rectangular domain. @@ -132,7 +132,7 @@ Create a StructuredMesh that represents a uncurved structured mesh with a rectan each dimension if the boundaries in this dimension are periodic. """ function StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max; - periodicity = true) + periodicity = false) RealT = promote_type(eltype(coordinates_min), eltype(coordinates_max)) coordinates_min_max_check(coordinates_min, coordinates_max) diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index ee1d7d4d8bb..9cfbe7016a4 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -391,7 +391,7 @@ end """ T8codeMesh(trees_per_dimension; polydeg, mapping=identity, - RealT=Float64, initial_refinement_level=0, periodicity=true) + RealT=Float64, initial_refinement_level=0, periodicity=false) Create a structured potentially curved 'T8codeMesh' of the specified size. @@ -422,14 +422,14 @@ Non-periodic boundaries will be called ':x_neg', ':x_pos', ':y_neg', ':y_pos', ' Use only one of `mapping`, `faces` and `coordinates_min`/`coordinates_max`. - 'RealT::Type': the type that should be used for coordinates. - 'initial_refinement_level::Integer': refine the mesh uniformly to this level before the simulation starts. -- 'periodicity': either a 'Bool' deciding if all of the boundaries are periodic or an 'NTuple{NDIMS, Bool}' +- 'periodicity': either a `Bool` deciding if all of the boundaries are periodic or an `NTuple{NDIMS, Bool}` deciding for each dimension if the boundaries in this dimension are periodic. """ function T8codeMesh(trees_per_dimension; polydeg = 1, mapping = nothing, faces = nothing, coordinates_min = nothing, coordinates_max = nothing, RealT = Float64, initial_refinement_level = 0, - periodicity = true) + periodicity = false) @assert ((coordinates_min === nothing)===(coordinates_max === nothing)) "Either both or none of coordinates_min and coordinates_max must be specified" coordinates_min_max_check(coordinates_min, coordinates_max) diff --git a/src/meshes/tree_mesh.jl b/src/meshes/tree_mesh.jl index 4c5f5a9da07..351487c40bc 100644 --- a/src/meshes/tree_mesh.jl +++ b/src/meshes/tree_mesh.jl @@ -52,10 +52,10 @@ mutable struct TreeMesh{NDIMS, TreeType <: AbstractTree{NDIMS}, RealT <: Real} < function TreeMesh{NDIMS, TreeType, RealT}(n_cells_max::Integer, domain_center::AbstractArray{RealT}, domain_length::RealT, - periodicity = true) where {NDIMS, - TreeType <: - AbstractTree{NDIMS}, - RealT <: Real} + periodicity = false) where {NDIMS, + TreeType <: + AbstractTree{NDIMS}, + RealT <: Real} tree = TreeType(n_cells_max, domain_center, domain_length, periodicity) current_filename = "" unsaved_changes = true @@ -87,29 +87,50 @@ end # Constructor accepting a single number as center (as opposed to an array) for 1D function TreeMesh{1, TreeType, RealT}(n::Int, center::RealT, len::RealT, - periodicity = true) where { - TreeType <: - AbstractTree{1}, - RealT <: Real} + periodicity = false) where { + TreeType <: + AbstractTree{1}, + RealT <: Real} return TreeMesh{1, TreeType, RealT}(n, SVector{1, RealT}(center), len, periodicity) end function TreeMesh{NDIMS, TreeType, RealT}(n_cells_max::Integer, domain_center::NTuple{NDIMS, RealT}, domain_length::RealT, - periodicity = true) where {NDIMS, - TreeType <: - AbstractTree{NDIMS}, - RealT <: Real} + periodicity = false) where {NDIMS, + TreeType <: + AbstractTree{NDIMS}, + RealT <: Real} return TreeMesh{NDIMS, TreeType, RealT}(n_cells_max, SVector{NDIMS, RealT}(domain_center), domain_length, periodicity) end +""" + TreeMesh(coordinates_min::NTuple{NDIMS, Real}, + coordinates_max::NTuple{NDIMS, Real}; + n_cells_max, + periodicity = false, + initial_refinement_level, + refinement_patches = (), + coarsening_patches = (), + RealT = Float64) where {NDIMS} + +Create a `TreeMesh` in `NDIMS` dimensions with real type `RealT` covering the domain defined by +`coordinates_min` and `coordinates_max`. The mesh is initialized with a uniform +refinement to the specified `initial_refinement_level`. Further refinement and +coarsening patches can be specified using `refinement_patches` and +`coarsening_patches`, respectively. The maximum number of cells allowed in the mesh is +given by `n_cells_max`. The periodicity in each dimension can be specified using the +`periodicity` argument (default: non-periodic in all dimensions). If it is a single +`Bool`, the same periodicity is applied in all dimensions; otherwise, a tuple of +`Bool`s of length `NDIMS` must be provided. Note that the domain must be a hypercube, i.e., +all dimensions must have the same length. +""" function TreeMesh(coordinates_min::NTuple{NDIMS, Real}, coordinates_max::NTuple{NDIMS, Real}; n_cells_max, - periodicity = true, + periodicity = false, initial_refinement_level, refinement_patches = (), coarsening_patches = (), diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 8d1cc9eca29..cd20fbf8e3f 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -38,15 +38,18 @@ end """ SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms=nothing, - boundary_conditions=boundary_condition_periodic, + boundary_conditions, RealT=real(solver), uEltype=RealT) Construct a semidiscretization of a hyperbolic PDE. + +Boundary conditions must be provided explicitly either as a `NamedTuple` or as a +single boundary condition that gets applied to all boundaries. """ function SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms = nothing, - boundary_conditions = boundary_condition_periodic, + boundary_conditions, # `RealT` is used as real type for node locations etc. # while `uEltype` is used as element type of solutions etc. RealT = real(solver), uEltype = RealT) @@ -113,14 +116,27 @@ function digest_boundary_conditions(boundary_conditions::BoundaryConditionPeriod end function digest_boundary_conditions(boundary_conditions::BoundaryConditionPeriodic, - mesh::Union{TreeMesh{2}, StructuredMesh{2}}, solver, - cache) + mesh::Union{TreeMesh{2}, StructuredMesh{2}}, + solver, cache) return boundary_conditions end function digest_boundary_conditions(boundary_conditions::BoundaryConditionPeriodic, - mesh::Union{TreeMesh{3}, StructuredMesh{3}}, solver, - cache) + mesh::Union{TreeMesh{3}, StructuredMesh{3}}, + solver, cache) + return boundary_conditions +end + +function digest_boundary_conditions(boundary_conditions::BoundaryConditionPeriodic, + mesh::Union{P4estMesh{2}, UnstructuredMesh2D, + T8codeMesh{2}}, + solver, cache) + return boundary_conditions +end + +function digest_boundary_conditions(boundary_conditions::BoundaryConditionPeriodic, + mesh::Union{P4estMesh{3}, T8codeMesh{3}}, + solver, cache) return boundary_conditions end @@ -147,29 +163,6 @@ function digest_boundary_conditions(boundary_conditions, z_neg = boundary_conditions, z_pos = boundary_conditions) end -# allow passing a tuple of BCs that get converted into a named tuple to make it -# self-documenting on (mapped) hypercube domains -function digest_boundary_conditions(boundary_conditions::NTuple{2, Any}, - mesh::Union{TreeMesh{1}, StructuredMesh{1}}, solver, - cache) - return (; x_neg = boundary_conditions[1], x_pos = boundary_conditions[2]) -end - -function digest_boundary_conditions(boundary_conditions::NTuple{4, Any}, - mesh::Union{TreeMesh{2}, StructuredMesh{2}}, solver, - cache) - return (; x_neg = boundary_conditions[1], x_pos = boundary_conditions[2], - y_neg = boundary_conditions[3], y_pos = boundary_conditions[4]) -end - -function digest_boundary_conditions(boundary_conditions::NTuple{6, Any}, - mesh::Union{TreeMesh{3}, StructuredMesh{3}}, solver, - cache) - return (; x_neg = boundary_conditions[1], x_pos = boundary_conditions[2], - y_neg = boundary_conditions[3], y_pos = boundary_conditions[4], - z_neg = boundary_conditions[5], z_pos = boundary_conditions[6]) -end - # allow passing named tuples of BCs constructed in an arbitrary order # on (mapped) hypercube domains function digest_boundary_conditions(boundary_conditions::NamedTuple{Keys, ValueTypes}, @@ -193,14 +186,172 @@ function digest_boundary_conditions(boundary_conditions::NamedTuple{Keys, ValueT return (; x_neg, x_pos, y_neg, y_pos, z_neg, z_pos) end -# sort the boundary conditions from a dictionary and into tuples -function digest_boundary_conditions(boundary_conditions::Dict, mesh, solver, cache) - return UnstructuredSortedBoundaryTypes(boundary_conditions, cache) +# If a NamedTuple is passed with not the same number of BCs, ensure that the keys are correct. +# For periodic boundary parts, the keys can be missing and get filled with `boundary_condition_periodic`. +function digest_boundary_conditions(boundary_conditions::NamedTuple, + mesh::Union{TreeMesh{1}, StructuredMesh{1}}, solver, + cache) + x_neg, x_pos = get_periodicity_boundary_conditions_x(boundary_conditions, mesh) + return (; x_neg, x_pos) end -function digest_boundary_conditions(boundary_conditions::AbstractArray, mesh, solver, +function digest_boundary_conditions(boundary_conditions::NamedTuple, + mesh::Union{TreeMesh{2}, StructuredMesh{2}}, solver, cache) - throw(ArgumentError("Please use a (named) tuple instead of an (abstract) array to supply multiple boundary conditions (to improve performance).")) + x_neg, x_pos = get_periodicity_boundary_conditions_x(boundary_conditions, mesh) + y_neg, y_pos = get_periodicity_boundary_conditions_y(boundary_conditions, mesh) + return (; x_neg, x_pos, y_neg, y_pos) +end + +function digest_boundary_conditions(boundary_conditions::NamedTuple, + mesh::Union{TreeMesh{3}, StructuredMesh{3}}, solver, + cache) + x_neg, x_pos = get_periodicity_boundary_conditions_x(boundary_conditions, mesh) + y_neg, y_pos = get_periodicity_boundary_conditions_y(boundary_conditions, mesh) + z_neg, z_pos = get_periodicity_boundary_conditions_z(boundary_conditions, mesh) + return (; x_neg, x_pos, y_neg, y_pos, z_neg, z_pos) +end + +# Allow NamedTuple for P4estMesh, UnstructuredMesh2D, and T8codeMesh +# define in two functions to resolve ambiguities +function digest_boundary_conditions(boundary_conditions::NamedTuple, + mesh::Union{P4estMesh{2}, UnstructuredMesh2D, + T8codeMesh{2}}, + solver, cache) + return UnstructuredSortedBoundaryTypes(boundary_conditions, cache) +end + +function digest_boundary_conditions(boundary_conditions::NamedTuple, + mesh::Union{P4estMesh{3}, T8codeMesh{3}}, + solver, cache) + return UnstructuredSortedBoundaryTypes(boundary_conditions, cache) +end + +function digest_boundary_conditions(boundary_conditions::UnstructuredSortedBoundaryTypes, + mesh::Union{P4estMesh{2}, UnstructuredMesh2D, + T8codeMesh{2}}, + solver, cache) + return boundary_conditions +end + +function digest_boundary_conditions(boundary_conditions::UnstructuredSortedBoundaryTypes, + mesh::Union{P4estMesh{3}, T8codeMesh{3}}, + solver, cache) + return boundary_conditions +end + +# allow passing a single BC that get converted into a named tuple of BCs +# on (mapped) hypercube domains +function digest_boundary_conditions(boundary_conditions, + mesh::Union{P4estMesh{2}, UnstructuredMesh2D, + T8codeMesh{2}}, + solver, cache) + bcs = (; x_neg = boundary_conditions, x_pos = boundary_conditions, + y_neg = boundary_conditions, y_pos = boundary_conditions) + return UnstructuredSortedBoundaryTypes(bcs, cache) +end + +function digest_boundary_conditions(boundary_conditions, + mesh::Union{P4estMesh{3}, T8codeMesh{3}}, + solver, cache) + bcs = (; x_neg = boundary_conditions, x_pos = boundary_conditions, + y_neg = boundary_conditions, y_pos = boundary_conditions, + z_neg = boundary_conditions, z_pos = boundary_conditions) + return UnstructuredSortedBoundaryTypes(bcs, cache) +end + +# add methods for every dimension to resolve ambiguities +function digest_boundary_conditions(boundary_conditions::AbstractArray, + mesh::Union{TreeMesh{1}, StructuredMesh{1}}, + solver, cache) + throw(ArgumentError("Please use a named tuple instead of an (abstract) array to supply multiple boundary conditions (to improve performance).")) +end + +function digest_boundary_conditions(boundary_conditions::AbstractArray, + mesh::Union{TreeMesh{2}, StructuredMesh{2}}, + solver, cache) + throw(ArgumentError("Please use a named tuple instead of an (abstract) array to supply multiple boundary conditions (to improve performance).")) +end + +function digest_boundary_conditions(boundary_conditions::AbstractArray, + mesh::Union{TreeMesh{3}, StructuredMesh{3}}, + solver, cache) + throw(ArgumentError("Please use a named tuple instead of an (abstract) array to supply multiple boundary conditions (to improve performance).")) +end + +function digest_boundary_conditions(boundary_conditions::Tuple, + mesh::Union{TreeMesh{1}, StructuredMesh{1}}, + solver, cache) + throw(ArgumentError("Please use a named tuple instead of a tuple to supply multiple boundary conditions.")) +end + +function digest_boundary_conditions(boundary_conditions::Tuple, + mesh::Union{TreeMesh{2}, StructuredMesh{2}}, + solver, cache) + throw(ArgumentError("Please use a named tuple instead of a tuple to supply multiple boundary conditions.")) +end + +function digest_boundary_conditions(boundary_conditions::Tuple, + mesh::Union{TreeMesh{3}, StructuredMesh{3}}, + solver, cache) + throw(ArgumentError("Please use a named tuple instead of a tuple to supply multiple boundary conditions.")) +end + +function get_periodicity_boundary_conditions_x(boundary_conditions, mesh) + if isperiodic(mesh, 1) + if :x_neg in keys(boundary_conditions) && + boundary_conditions.x_neg != boundary_condition_periodic || + :x_pos in keys(boundary_conditions) && + boundary_conditions.x_pos != boundary_condition_periodic + throw(ArgumentError("For periodic mesh non-periodic boundary conditions in x-direction are supplied.")) + end + x_neg = x_pos = boundary_condition_periodic + else + required = (:x_neg, :x_pos) + if !all(in(keys(boundary_conditions)), required) + throw(ArgumentError("NamedTuple of boundary conditions for 1-dimensional (non-periodic) mesh must have keys $(required), got $(keys(boundary_conditions))")) + end + @unpack x_neg, x_pos = boundary_conditions + end + return x_neg, x_pos +end + +function get_periodicity_boundary_conditions_y(boundary_conditions, mesh) + if isperiodic(mesh, 2) + if :y_neg in keys(boundary_conditions) && + boundary_conditions.y_neg != boundary_condition_periodic || + :y_pos in keys(boundary_conditions) && + boundary_conditions.y_pos != boundary_condition_periodic + throw(ArgumentError("For periodic mesh non-periodic boundary conditions in y-direction are supplied.")) + end + y_neg = y_pos = boundary_condition_periodic + else + required = (:y_neg, :y_pos) + if !all(in(keys(boundary_conditions)), required) + throw(ArgumentError("NamedTuple of boundary conditions for 2-dimensional (non-periodic) mesh must have keys $(required), got $(keys(boundary_conditions))")) + end + @unpack y_neg, y_pos = boundary_conditions + end + return y_neg, y_pos +end + +function get_periodicity_boundary_conditions_z(boundary_conditions, mesh) + if isperiodic(mesh, 3) + if :z_neg in keys(boundary_conditions) && + boundary_conditions.z_neg != boundary_condition_periodic || + :z_pos in keys(boundary_conditions) && + boundary_conditions.z_pos != boundary_condition_periodic + throw(ArgumentError("For periodic mesh non-periodic boundary conditions in z-direction are supplied.")) + end + z_neg = z_pos = boundary_condition_periodic + else + required = (:z_neg, :z_pos) + if !all(in(keys(boundary_conditions)), required) + throw(ArgumentError("NamedTuple of boundary conditions for 3-dimensional (non-periodic) mesh must have keys $(required), got $(keys(boundary_conditions))")) + end + @unpack z_neg, z_pos = boundary_conditions + end + return z_neg, z_pos end # No checks for these meshes yet available @@ -210,68 +361,87 @@ function check_periodicity_mesh_boundary_conditions(mesh::Union{P4estMesh, T8codeMesh, DGMultiMesh}, boundary_conditions) + return nothing end -# No actions needed for periodic boundary conditions function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh, StructuredMesh, StructuredMeshView}, boundary_conditions::BoundaryConditionPeriodic) + if !isperiodic(mesh) + throw(ArgumentError("Periodic boundary condition supplied for non-periodic mesh.")) + end + return nothing end function check_periodicity_mesh_boundary_conditions_x(mesh, x_neg, x_pos) if isperiodic(mesh, 1) && - (x_neg != BoundaryConditionPeriodic() || - x_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in x-direction are supplied." + (x_neg != boundary_condition_periodic || + x_pos != boundary_condition_periodic) + throw(ArgumentError("For periodic mesh non-periodic boundary conditions in x-direction are supplied.")) + end + if !isperiodic(mesh, 1) && + (x_neg == boundary_condition_periodic || + x_pos == boundary_condition_periodic) + throw(ArgumentError("For non-periodic mesh periodic boundary conditions in x-direction are supplied.")) end + return nothing end function check_periodicity_mesh_boundary_conditions_y(mesh, y_neg, y_pos) if isperiodic(mesh, 2) && - (y_neg != BoundaryConditionPeriodic() || - y_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in y-direction are supplied." + (y_neg != boundary_condition_periodic || + y_pos != boundary_condition_periodic) + throw(ArgumentError("For periodic mesh non-periodic boundary conditions in y-direction are supplied.")) + end + if !isperiodic(mesh, 2) && + (y_neg == boundary_condition_periodic || + y_pos == boundary_condition_periodic) + throw(ArgumentError("For non-periodic mesh periodic boundary conditions in y-direction are supplied.")) end + return nothing end function check_periodicity_mesh_boundary_conditions_z(mesh, z_neg, z_pos) if isperiodic(mesh, 3) && - (z_neg != BoundaryConditionPeriodic() || - z_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in z-direction are supplied." + (z_neg != boundary_condition_periodic || + z_pos != boundary_condition_periodic) + throw(ArgumentError("For periodic mesh non-periodic boundary conditions in z-direction are supplied.")) + end + if !isperiodic(mesh, 3) && + (z_neg == boundary_condition_periodic || + z_pos == boundary_condition_periodic) + throw(ArgumentError("For non-periodic mesh periodic boundary conditions in z-direction are supplied.")) end + return nothing end function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{1}, StructuredMesh{1}}, - boundary_conditions::Union{NamedTuple, - Tuple}) - return check_periodicity_mesh_boundary_conditions_x(mesh, boundary_conditions[1], - boundary_conditions[2]) + boundary_conditions::NamedTuple) + return check_periodicity_mesh_boundary_conditions_x(mesh, boundary_conditions.x_neg, + boundary_conditions.x_pos) end function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{2}, StructuredMesh{2}, StructuredMeshView{2}}, - boundary_conditions::Union{NamedTuple, - Tuple}) - check_periodicity_mesh_boundary_conditions_x(mesh, boundary_conditions[1], - boundary_conditions[2]) - return check_periodicity_mesh_boundary_conditions_y(mesh, boundary_conditions[3], - boundary_conditions[4]) + boundary_conditions::NamedTuple) + check_periodicity_mesh_boundary_conditions_x(mesh, boundary_conditions.x_neg, + boundary_conditions.x_pos) + return check_periodicity_mesh_boundary_conditions_y(mesh, boundary_conditions.y_neg, + boundary_conditions.y_pos) end function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{3}, StructuredMesh{3}}, - boundary_conditions::Union{NamedTuple, - Tuple}) - check_periodicity_mesh_boundary_conditions_x(mesh, boundary_conditions[1], - boundary_conditions[2]) - check_periodicity_mesh_boundary_conditions_y(mesh, boundary_conditions[3], - boundary_conditions[4]) - return check_periodicity_mesh_boundary_conditions_z(mesh, boundary_conditions[5], - boundary_conditions[6]) + boundary_conditions::NamedTuple) + check_periodicity_mesh_boundary_conditions_x(mesh, boundary_conditions.x_neg, + boundary_conditions.x_pos) + check_periodicity_mesh_boundary_conditions_y(mesh, boundary_conditions.y_neg, + boundary_conditions.y_pos) + return check_periodicity_mesh_boundary_conditions_z(mesh, boundary_conditions.z_neg, + boundary_conditions.z_pos) end function Base.show(io::IO, semi::SemidiscretizationHyperbolic) @@ -335,10 +505,9 @@ end function print_boundary_conditions(io, semi::SemiHypMeshBCSolver{<:Any, <:UnstructuredSortedBoundaryTypes}) - @unpack boundary_conditions = semi - @unpack boundary_dictionary = boundary_conditions - summary_line(io, "boundary conditions", length(boundary_dictionary)) - for (boundary_name, boundary_condition) in boundary_dictionary + @unpack boundary_conditions = semi.boundary_conditions + summary_line(io, "boundary conditions", length(boundary_conditions)) + for (boundary_name, boundary_condition) in pairs(boundary_conditions) summary_line(increment_indent(io), boundary_name, typeof(boundary_condition)) end end @@ -356,20 +525,20 @@ end function print_boundary_conditions(io, semi::SemiHypMeshBCSolver{<:Union{TreeMesh, StructuredMesh}, - <:Union{Tuple, NamedTuple, + <:Union{NamedTuple, AbstractArray}}) summary_line(io, "boundary conditions", 2 * ndims(semi)) bcs = semi.boundary_conditions - summary_line(increment_indent(io), "negative x", bcs[1]) - summary_line(increment_indent(io), "positive x", bcs[2]) + summary_line(increment_indent(io), "negative x", bcs.x_neg) + summary_line(increment_indent(io), "positive x", bcs.x_pos) if ndims(semi) > 1 - summary_line(increment_indent(io), "negative y", bcs[3]) - summary_line(increment_indent(io), "positive y", bcs[4]) + summary_line(increment_indent(io), "negative y", bcs.y_neg) + summary_line(increment_indent(io), "positive y", bcs.y_pos) end if ndims(semi) > 2 - summary_line(increment_indent(io), "negative z", bcs[5]) - summary_line(increment_indent(io), "positive z", bcs[6]) + summary_line(increment_indent(io), "negative z", bcs.z_neg) + summary_line(increment_indent(io), "positive z", bcs.z_pos) end end diff --git a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl index 3f0e2343bb6..c730439017c 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl @@ -53,20 +53,23 @@ end SemidiscretizationHyperbolicParabolic(mesh, both_equations, initial_condition, solver; solver_parabolic=default_parabolic_solver(), source_terms=nothing, - source_terms_parabolic=nothing, - both_boundary_conditions=(boundary_condition_periodic, boundary_condition_periodic), + source_terms_parabolic=nothing, + bboundary_conditions, RealT=real(solver), uEltype=RealT) Construct a semidiscretization of a hyperbolic-parabolic PDE. + +Boundary conditions must be provided explicitly as a tuple of two boundary conditions, where the first entry corresponds to the +hyperbolic part and the second to the parabolic part. The boundary conditions for the hyperbolic and parabolic part can be +either passed as `NamedTuple` or as a single boundary condition that is applied to all boundaries. """ function SemidiscretizationHyperbolicParabolic(mesh, equations::Tuple, initial_condition, solver; solver_parabolic = default_parabolic_solver(), source_terms = nothing, source_terms_parabolic = nothing, - boundary_conditions = (boundary_condition_periodic, - boundary_condition_periodic), + boundary_conditions, # `RealT` is used as real type for node locations etc. # while `uEltype` is used as element type of solutions etc. RealT = real(solver), uEltype = RealT) diff --git a/src/solvers/boundary_condition_default.jl b/src/solvers/boundary_condition_default.jl deleted file mode 100644 index 7b26fbfc19a..00000000000 --- a/src/solvers/boundary_condition_default.jl +++ /dev/null @@ -1,203 +0,0 @@ -""" - boundary_condition_default(mesh::P4estMesh{2,2}, boundary_condition) - -Create a default boundary condition dictionary for [`P4estMesh`](@ref)es in 2D -that uses the standard boundary naming convention. -This function applies the same boundary condition to all standard boundaries: -- `:x_neg`: negative x-direction boundary -- `:x_pos`: positive x-direction boundary -- `:y_neg`: negative y-direction boundary -- `:y_pos`: positive y-direction boundary - -# Arguments -- `boundary_condition`: The boundary condition function to apply to all boundaries -- `mesh`: The [`P4estMesh`](@ref) in 2D for which boundary conditions are created - -# Returns -- `Dict{Symbol, Any}`: Dictionary mapping boundary names to the boundary condition -""" -function boundary_condition_default(mesh::P4estMesh{2, 2}, boundary_condition) - return Dict(:x_neg => boundary_condition, - :y_neg => boundary_condition, - :y_pos => boundary_condition, - :x_pos => boundary_condition) -end - -""" - boundary_condition_default(mesh::P4estMesh{3,3}, boundary_condition) - -Create a default boundary condition dictionary for [`P4estMesh`](@ref)es in 3D -that uses the standard boundary naming convention. -This function applies the same boundary condition to all standard boundaries: -- `:x_neg`: negative x-direction boundary -- `:x_pos`: positive x-direction boundary -- `:y_neg`: negative y-direction boundary -- `:y_pos`: positive y-direction boundary -- `:z_neg`: negative z-direction boundary -- `:z_pos`: positive z-direction boundary - -# Arguments -- `boundary_condition`: The boundary condition function to apply to all boundaries -- `mesh`: The [`P4estMesh`](@ref) in 3D for which boundary conditions are created - -# Returns -- `Dict{Symbol, Any}`: Dictionary mapping boundary names to the boundary condition -""" -function boundary_condition_default(mesh::P4estMesh{3, 3}, boundary_condition) - return Dict(:x_neg => boundary_condition, - :x_pos => boundary_condition, - :y_neg => boundary_condition, - :y_pos => boundary_condition, - :z_neg => boundary_condition, - :z_pos => boundary_condition) -end - -""" - boundary_condition_default(mesh::StructuredMesh1D, boundary_condition) - -Create a default boundary condition dictionary for [`StructuredMesh`](@ref)es in 1D -that uses the standard boundary naming convention. -This function applies the same boundary condition to all standard boundaries: -- `:x_neg`: negative x-direction boundary -- `:x_pos`: positive x-direction boundary - -# Arguments -- `boundary_condition`: The boundary condition function to apply to all boundaries -- `mesh`: The [`StructuredMesh`](@ref) in 1D for which boundary conditions are created - -# Returns -- Named tuple mapping boundary names to the boundary condition -""" -function boundary_condition_default(mesh::StructuredMesh{1}, boundary_condition) - return (x_neg = boundary_condition, - x_pos = boundary_condition) -end - -""" - boundary_condition_default(mesh::StructuredMesh2D, boundary_condition) - -Create a default boundary condition dictionary for [`StructuredMesh`](@ref)es in 2D -that uses the standard boundary naming convention. -This function applies the same boundary condition to all standard boundaries: -- `:x_neg`: negative x-direction boundary -- `:x_pos`: positive x-direction boundary -- `:y_neg`: negative y-direction boundary -- `:y_pos`: positive y-direction boundary - -# Arguments -- `boundary_condition`: The boundary condition function to apply to all boundaries -- `mesh`: The [`StructuredMesh`](@ref) in 2D for which boundary conditions are created - -# Returns -- Named tuple mapping boundary names to the boundary condition -""" -function boundary_condition_default(mesh::StructuredMesh{2}, boundary_condition) - return (x_neg = boundary_condition, - x_pos = boundary_condition, - y_neg = boundary_condition, - y_pos = boundary_condition) -end - -""" - boundary_condition_default(mesh::StructuredMesh3D, boundary_condition) - -Create a default boundary condition dictionary for [`StructuredMesh`](@ref)es in 3D -that uses the standard boundary naming convention. -This function applies the same boundary condition to all standard boundaries: -- `:x_neg`: negative x-direction boundary -- `:x_pos`: positive x-direction boundary -- `:y_neg`: negative y-direction boundary -- `:y_pos`: positive y-direction boundary -- `:z_neg`: negative z-direction boundary -- `:z_pos`: positive z-direction boundary - -# Arguments -- `boundary_condition`: The boundary condition function to apply to all boundaries -- `mesh`: The [`StructuredMesh`](@ref) in 3D for which boundary conditions are created - -# Returns -- Named tuple mapping boundary names to the boundary condition -""" -function boundary_condition_default(mesh::StructuredMesh{3}, boundary_condition) - return (x_neg = boundary_condition, - x_pos = boundary_condition, - y_neg = boundary_condition, - y_pos = boundary_condition, - z_neg = boundary_condition, - z_pos = boundary_condition) -end - -""" - boundary_condition_default(mesh::TreeMesh1D, boundary_condition) - -Create a default boundary condition dictionary for [`TreeMesh`](@ref)es in 1D -that uses the standard boundary naming convention. -This function applies the same boundary condition to all standard boundaries: -- `:x_neg`: negative x-direction boundary -- `:x_pos`: positive x-direction boundary - -# Arguments -- `boundary_condition`: The boundary condition function to apply to all boundaries -- `mesh`: The [`TreeMesh`](@ref) in 1D for which boundary conditions are created - -# Returns -- Named tuple mapping boundary names to the boundary condition -""" -function boundary_condition_default(mesh::TreeMesh1D, boundary_condition) - return (x_neg = boundary_condition, - x_pos = boundary_condition) -end - -""" - boundary_condition_default(mesh::TreeMesh2D, boundary_condition) - -Create a default boundary condition dictionary for [`TreeMesh`](@ref)es in 2D -that uses the standard boundary naming convention. -This function applies the same boundary condition to all standard boundaries: -- `:x_neg`: negative x-direction boundary -- `:x_pos`: positive x-direction boundary -- `:y_neg`: negative y-direction boundary -- `:y_pos`: positive y-direction boundary - -# Arguments -- `boundary_condition`: The boundary condition function to apply to all boundaries -- `mesh`: The [`TreeMesh`](@ref) in 2D for which boundary conditions are created - -# Returns -- Named tuple mapping boundary names to the boundary condition -""" -function boundary_condition_default(mesh::TreeMesh2D, boundary_condition) - return (x_neg = boundary_condition, - x_pos = boundary_condition, - y_neg = boundary_condition, - y_pos = boundary_condition) -end - -""" - boundary_condition_default(mesh::TreeMesh3D, boundary_condition) - -Create a default boundary condition dictionary for [`TreeMesh`](@ref)es in 3D -that uses the standard boundary naming convention. -This function applies the same boundary condition to all standard boundaries: -- `:x_neg`: negative x-direction boundary -- `:x_pos`: positive x-direction boundary -- `:y_neg`: negative y-direction boundary -- `:y_pos`: positive y-direction boundary -- `:z_neg`: negative z-direction boundary -- `:z_pos`: positive z-direction boundary - -# Arguments -- `boundary_condition`: The boundary condition function to apply to all boundaries -- `mesh`: The [`TreeMesh`](@ref) in 3D for which boundary conditions are created - -# Returns -- Named tuple mapping boundary names to the boundary condition -""" -function boundary_condition_default(mesh::TreeMesh3D, boundary_condition) - return (x_neg = boundary_condition, - x_pos = boundary_condition, - y_neg = boundary_condition, - y_pos = boundary_condition, - z_neg = boundary_condition, - z_pos = boundary_condition) -end diff --git a/src/solvers/dgmulti/dg.jl b/src/solvers/dgmulti/dg.jl index 0d00c38033d..1a97892389c 100644 --- a/src/solvers/dgmulti/dg.jl +++ b/src/solvers/dgmulti/dg.jl @@ -139,8 +139,7 @@ end wrap_array(u_ode::VectorOfArray, mesh::DGMultiMesh, equations, dg::DGMulti, cache) = parent(u_ode) function digest_boundary_conditions(boundary_conditions::NamedTuple{Keys, ValueTypes}, - mesh::DGMultiMesh, - dg::DGMulti, + mesh::DGMultiMesh, dg::DGMulti, cache) where {Keys, ValueTypes <: NTuple{N, Any} } where {N} return boundary_conditions diff --git a/src/solvers/dgmulti/types.jl b/src/solvers/dgmulti/types.jl index 21ee62dfc31..a643da9889d 100644 --- a/src/solvers/dgmulti/types.jl +++ b/src/solvers/dgmulti/types.jl @@ -219,7 +219,7 @@ GeometricTermsType(mesh_type::Curved, element_type::AbstractElemShape) = NonAffi basis evaluation, differentiation, etc). - `vertex_coordinates` is a tuple of vectors containing x,y,... components of the vertex coordinates - `EToV` is a 2D array containing element-to-vertex connectivities for each element -- `is_on_boundary` specifies boundary using a `Dict{Symbol, <:Function}` +- `is_on_boundary` specifies boundary using a `NamedTuple` - `periodicity` is a tuple of booleans specifying if the domain is periodic `true`/`false` in the (x,y,z) direction. """ @@ -264,7 +264,7 @@ end Constructs a Cartesian [`DGMultiMesh`](@ref) with element type `dg.basis.element_type`. The domain is the tensor product of the intervals `[coordinates_min[i], coordinates_max[i]]`. -- `is_on_boundary` specifies boundary using a `Dict{Symbol, <:Function}` +- `is_on_boundary` specifies boundary using a `NamedTuple` - `periodicity` is a tuple of `Bool`s specifying periodicity = `true`/`false` in the (x,y,z) direction. """ function DGMultiMesh(dg::DGMulti{NDIMS}, cells_per_dimension; @@ -299,7 +299,7 @@ end Constructs a `Curved()` [`DGMultiMesh`](@ref) with element type `dg.basis.element_type`. - `mapping` is a function which maps from a reference [-1, 1]^NDIMS domain to a mapped domain, e.g., `xy = mapping(x, y)` in 2D. -- `is_on_boundary` specifies boundary using a `Dict{Symbol, <:Function}` +- `is_on_boundary` specifies boundary using a `NamedTuple` - `periodicity` is a tuple of `Bool`s specifying periodicity = `true`/`false` in the (x,y,z) direction. """ function DGMultiMesh(dg::DGMulti{NDIMS}, cells_per_dimension, mapping; diff --git a/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl b/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl index 782fd57c1d9..3bb9609ea7b 100644 --- a/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl +++ b/src/solvers/dgsem_unstructured/sort_boundary_conditions.jl @@ -10,23 +10,25 @@ General struct to sort the boundary conditions by type and name for some unstructured meshes/solvers. It stores a set of global indices for each boundary condition type and name to expedite computation -during the call to `calc_boundary_flux!`. The original dictionary form of the boundary conditions +during the call to `calc_boundary_flux!`. The original `NamedTuple` of the boundary conditions set by the user in the elixir file is also stored for printing. """ mutable struct UnstructuredSortedBoundaryTypes{N, BCs <: NTuple{N, Any}, - Vec <: AbstractVector{<:Integer}} + Vec <: AbstractVector{<:Integer}, + BoundaryConditions <: NamedTuple} const boundary_condition_types::BCs # specific boundary condition type(s), e.g. BoundaryConditionDirichlet boundary_indices::NTuple{N, Vec} # integer vectors containing global boundary indices - const boundary_dictionary::Dict{Symbol, Any} # boundary conditions as set by the user in the elixir file + const boundary_conditions::BoundaryConditions # boundary conditions as set by the user in the elixir file boundary_symbol_indices::Dict{Symbol, Vector{Int}} # integer vectors containing global boundary indices per boundary identifier end -# constructor that "eats" the original boundary condition dictionary and sorts the information +# constructor that "eats" the original boundary condition NamedTuple and sorts the information # from the `UnstructuredBoundaryContainer2D` in cache.boundaries according to the boundary types # and stores the associated global boundary indexing in NTuple -function UnstructuredSortedBoundaryTypes(boundary_conditions::Dict, cache) - # extract the unique boundary function routines from the dictionary - boundary_condition_types = Tuple(unique(collect(values(boundary_conditions)))) +function UnstructuredSortedBoundaryTypes(boundary_conditions::NamedTuple, cache) + # extract the unique boundary function routines from the NamedTuple + BoundaryConditions = typeof(boundary_conditions) + boundary_condition_types = Tuple(unique(values(boundary_conditions))) n_boundary_types = length(boundary_condition_types) boundary_indices = ntuple(_ -> [], n_boundary_types) @@ -35,17 +37,18 @@ function UnstructuredSortedBoundaryTypes(boundary_conditions::Dict, cache) container = UnstructuredSortedBoundaryTypes{n_boundary_types, typeof(boundary_condition_types), - Vector{Int}}(boundary_condition_types, - boundary_indices, - boundary_conditions, - boundary_symbol_indices) + Vector{Int}, + BoundaryConditions}(boundary_condition_types, + boundary_indices, + boundary_conditions, + boundary_symbol_indices) return initialize!(container, cache) end function initialize!(boundary_types_container::UnstructuredSortedBoundaryTypes{N}, cache) where {N} - @unpack boundary_dictionary, boundary_condition_types = boundary_types_container + @unpack boundary_conditions, boundary_condition_types = boundary_types_container unique_names = unique(cache.boundaries.name) @@ -60,7 +63,7 @@ function initialize!(boundary_types_container::UnstructuredSortedBoundaryTypes{N mpi_root(), mpi_comm()) all_names = unique(Symbol.(split(String(recv_buffer), "\0"; keepempty = false))) - for key in keys(boundary_dictionary) + for key in keys(boundary_conditions) if !(key in all_names) println(stderr, "ERROR: Key $(repr(key)) is not a valid boundary name. " * @@ -73,7 +76,7 @@ function initialize!(boundary_types_container::UnstructuredSortedBoundaryTypes{N MPI.Gatherv!(send_buffer, nothing, mpi_root(), mpi_comm()) end else - for key in keys(boundary_dictionary) + for key in keys(boundary_conditions) if !(key in unique_names) error("Key $(repr(key)) is not a valid boundary name. " * "Valid names are $unique_names.") @@ -83,7 +86,7 @@ function initialize!(boundary_types_container::UnstructuredSortedBoundaryTypes{N # Verify that each boundary has a boundary condition for name in unique_names - if name !== Symbol("---") && !haskey(boundary_dictionary, name) + if name !== Symbol("---") && !(name in keys(boundary_conditions)) error("No boundary condition specified for boundary $(repr(name))") end end @@ -92,7 +95,7 @@ function initialize!(boundary_types_container::UnstructuredSortedBoundaryTypes{N _boundary_indices = Vector{Any}(nothing, N) for j in 1:N indices_for_current_type = Int[] - for (test_name, test_condition) in boundary_dictionary + for (test_name, test_condition) in pairs(boundary_conditions) temp_indices = findall(x -> x === test_name, cache.boundaries.name) if test_condition === boundary_condition_types[j] indices_for_current_type = vcat(indices_for_current_type, temp_indices) @@ -103,9 +106,9 @@ function initialize!(boundary_types_container::UnstructuredSortedBoundaryTypes{N # Check if all boundaries (determined from connectivity) are equipped with a boundary condition for (index, boundary_name) in enumerate(cache.boundaries.name) - if !(boundary_name in keys(boundary_dictionary)) + if !(boundary_name in keys(boundary_conditions)) neighbor_element = cache.boundaries.neighbor_ids[index] - @warn "Boundary condition for boundary type $(repr(boundary_name)) of boundary $(index) (neighbor element $neighbor_element) not found in boundary dictionary!" + @warn "Boundary condition for boundary type $(repr(boundary_name)) of boundary $(index) (neighbor element $neighbor_element) not found in boundary conditions!" end end @@ -113,7 +116,7 @@ function initialize!(boundary_types_container::UnstructuredSortedBoundaryTypes{N boundary_types_container.boundary_indices = Tuple(_boundary_indices) # Store boundary indices per symbol (required for force computations, for instance) - for (symbol, _) in boundary_dictionary + for (symbol, _) in pairs(boundary_conditions) indices = findall(x -> x === symbol, cache.boundaries.name) # Store the indices in `boundary_symbol_indices` dictionary boundary_types_container.boundary_symbol_indices[symbol] = sort!(indices) diff --git a/test/test_p4est_2d.jl b/test/test_p4est_2d.jl index 6ec995c1600..e360e23396a 100644 --- a/test/test_p4est_2d.jl +++ b/test/test_p4est_2d.jl @@ -365,7 +365,8 @@ end # Test `resize!` for non `VolumeIntegralSubcellLimiting` let solver = DGSEM(basis, surface_flux) - semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, tspan) ode_alg = Trixi.SimpleSSPRK33(stage_callbacks = (;)) @@ -853,7 +854,8 @@ end tspan=(0.0, 0.5), mesh=P4estMesh((64, 64), polydeg = 3, coordinates_min = (-2.0, -2.0), - coordinates_max = (2.0, 2.0))) + coordinates_max = (2.0, 2.0), + periodicity = true)) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) @test_allocations(Trixi.rhs!, semi, sol, 1000) diff --git a/test/test_parabolic_2d.jl b/test/test_parabolic_2d.jl index ae687823516..a9cb6974b7e 100644 --- a/test/test_parabolic_2d.jl +++ b/test/test_parabolic_2d.jl @@ -30,7 +30,9 @@ isdir(outdir) && rm(outdir, recursive = true) equations_parabolic = LaplaceDiffusion2D(1.0, equations) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, dg) + initial_condition, dg; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) @trixi_test_nowarn show(stdout, semi) @trixi_test_nowarn show(stdout, MIME"text/plain"(), semi) @trixi_test_nowarn show(stdout, boundary_condition_do_nothing) diff --git a/test/test_parabolic_3d.jl b/test/test_parabolic_3d.jl index 7772fa9abf3..aa3028e9a01 100644 --- a/test/test_parabolic_3d.jl +++ b/test/test_parabolic_3d.jl @@ -290,7 +290,9 @@ end Trixi.refine!(mesh.tree, LLID[1:Int(num_leaves / 32)]) tspan = (0.0, 0.1) semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), - initial_condition, solver) + initial_condition, solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic)) ode = semidiscretize(semi, tspan) analysis_callback = AnalysisCallback(semi, interval = analysis_interval, save_analysis = true, diff --git a/test/test_special_elixirs.jl b/test/test_special_elixirs.jl index 03670533579..5aadf1b3c83 100644 --- a/test/test_special_elixirs.jl +++ b/test/test_special_elixirs.jl @@ -250,7 +250,8 @@ end periodicity = (true, true)) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, - solver) + solver; + boundary_conditions = boundary_condition_periodic) J = jacobian_ad_forward(semi) λ = eigvals(J) @@ -272,7 +273,8 @@ end periodicity = (true, true)) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, - solver) + solver; + boundary_conditions = boundary_condition_periodic) J = jacobian_ad_forward(semi) λ = eigvals(J) @@ -428,7 +430,7 @@ end function entropy_at_final_time(k) # k is the wave number of the initial condition equations = CompressibleEulerEquations1D(1.4) mesh = TreeMesh((-1.0,), (1.0,), initial_refinement_level = 3, - n_cells_max = 10^4) + n_cells_max = 10^4, periodicity = true) solver = DGSEM(3, FluxHLL(min_max_speed_naive), VolumeIntegralFluxDifferencing(flux_ranocha)) initial_condition = (x, t, equations) -> begin @@ -438,7 +440,8 @@ end return prim2cons(SVector(rho, v1, p), equations) end semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, - solver, + solver; + boundary_conditions = boundary_condition_periodic, uEltype = typeof(k)) ode = semidiscretize(semi, (0.0, 1.0)) summary_callback = SummaryCallback() @@ -458,14 +461,15 @@ end function energy_at_final_time(k) # k is the wave number of the initial condition equations = LinearScalarAdvectionEquation2D(0.2, -0.7) mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level = 3, - n_cells_max = 10^4) + n_cells_max = 10^4, periodicity = true) solver = DGSEM(3, flux_lax_friedrichs) initial_condition = (x, t, equation) -> begin x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t) return SVector(sinpi(k * sum(x_trans))) end semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, - solver, + solver; + boundary_conditions = boundary_condition_periodic, uEltype = typeof(k)) ode = semidiscretize(semi, (0.0, 1.0)) summary_callback = SummaryCallback() diff --git a/test/test_structured_1d.jl b/test/test_structured_1d.jl index 30b39505060..2e255e07240 100644 --- a/test/test_structured_1d.jl +++ b/test/test_structured_1d.jl @@ -261,7 +261,7 @@ end using Trixi: Trixi @test_trixi_include(joinpath(pkgdir(Trixi, "examples", "tree_1d_dgsem"), "elixir_euler_convergence_pure_fv.jl"), - mesh=StructuredMesh(16, (0.0,), (2.0,)), + mesh=StructuredMesh(16, (0.0,), (2.0,), periodicity = true), l2=[ 0.019355699748523896, 0.022326984561234497, diff --git a/test/test_structured_2d.jl b/test/test_structured_2d.jl index eebea92dcab..64df062e80a 100644 --- a/test/test_structured_2d.jl +++ b/test/test_structured_2d.jl @@ -769,7 +769,8 @@ end # Semidiscretization for sparsity pattern detection semi_jac_type = SemidiscretizationHyperbolic(mesh, equations, initial_condition, - solver, + solver; + boundary_conditions = boundary_condition_periodic, source_terms = source_terms_convergence_test, uEltype = jac_eltype) # Need to supply Jacobian element type diff --git a/test/test_t8code_3d.jl b/test/test_t8code_3d.jl index e8eea24df4f..d251fdfd1be 100644 --- a/test/test_t8code_3d.jl +++ b/test/test_t8code_3d.jl @@ -265,7 +265,8 @@ mkdir(outdir) ], mesh=T8codeMesh((4, 4, 4), polydeg = 3, coordinates_min = (0.0, 0.0, 0.0), - coordinates_max = (2.0, 2.0, 2.0)), + coordinates_max = (2.0, 2.0, 2.0), + periodicity = true), # Remove SaveSolution callback callbacks=CallbackSet(summary_callback, analysis_callback, alive_callback, diff --git a/test/test_tree_1d.jl b/test/test_tree_1d.jl index c2db97ddb41..50ee70ef1ea 100644 --- a/test/test_tree_1d.jl +++ b/test/test_tree_1d.jl @@ -279,7 +279,8 @@ end # Create a uniform mesh in 1D in the interval [-π, π] with periodic boundaries mesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates - initial_refinement_level = 4, n_cells_max = 10^4) + initial_refinement_level = 4, n_cells_max = 10^4, + periodicity = true) # Create a DGSEM solver with polynomials of degree `polydeg` volume_flux = (flux_central, flux_nonconservative) @@ -288,7 +289,8 @@ end volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) # Setup the spatial semidiscretization containing all ingredients - semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver) + semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver; + boundary_conditions = boundary_condition_periodic) # Create an ODE problem with given time span tspan = (0.0, 1.0) diff --git a/test/test_type.jl b/test/test_type.jl index 695f7d4373e..c06dfe6c3b2 100644 --- a/test/test_type.jl +++ b/test/test_type.jl @@ -33,7 +33,7 @@ isdir(outdir) && rm(outdir, recursive = true) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 6, n_cells_max = 30_000, - RealT = RealT) + RealT = RealT, periodicity = true) @test typeof(@inferred Trixi.total_volume(mesh)) == RealT @@ -43,7 +43,7 @@ isdir(outdir) && rm(outdir, recursive = true) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 5, n_cells_max = 30_000, - RealT = RealT) + RealT = RealT, periodicity = true) @test typeof(@inferred Trixi.total_volume(mesh)) == RealT @@ -55,7 +55,7 @@ isdir(outdir) && rm(outdir, recursive = true) mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, n_cells_max = 30_000, - RealT = RealT) + RealT = RealT, periodicity = true) @test typeof(@inferred Trixi.total_volume(mesh)) == RealT end diff --git a/test/test_unit.jl b/test/test_unit.jl index 773c2c00274..4ffef24f3d8 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -35,12 +35,12 @@ isdir(outdir) && rm(outdir, recursive = true) @timed_testset "SerialTree" begin @testset "constructors" begin - @test_nowarn Trixi.SerialTree(Val(1), 10, 0.0, 1.0) - @test_nowarn Trixi.SerialTree{1}(10, 0.0, 1.0) + @test_nowarn Trixi.SerialTree(Val(1), 10, 0.0, 1.0, true) + @test_nowarn Trixi.SerialTree{1}(10, 0.0, 1.0, true) end @testset "helper functions" begin - t = Trixi.SerialTree(Val(1), 10, 0.0, 1.0) + t = Trixi.SerialTree(Val(1), 10, 0.0, 1.0, true) @test_nowarn display(t) @test Trixi.ndims(t) == 1 @test Trixi.has_any_neighbor(t, 1, 1) == true @@ -50,7 +50,7 @@ isdir(outdir) && rm(outdir, recursive = true) end @testset "refine!/coarsen!" begin - t = Trixi.SerialTree(Val(1), 10, 0.0, 1.0) + t = Trixi.SerialTree(Val(1), 10, 0.0, 1.0, true) @test Trixi.refine!(t) == [1] @test Trixi.coarsen!(t) == [1] @test Trixi.refine!(t) == [1] @@ -66,12 +66,12 @@ end @timed_testset "ParallelTree" begin @testset "constructors" begin - @test_nowarn Trixi.ParallelTree(Val(1), 10, 0.0, 1.0) - @test_nowarn Trixi.ParallelTree{1}(10, 0.0, 1.0) + @test_nowarn Trixi.ParallelTree(Val(1), 10, 0.0, 1.0, true) + @test_nowarn Trixi.ParallelTree{1}(10, 0.0, 1.0, true) end @testset "helper functions" begin - t = Trixi.ParallelTree(Val(1), 10, 0.0, 1.0) + t = Trixi.ParallelTree(Val(1), 10, 0.0, 1.0, true) @test isnothing(display(t)) @test isnothing(Trixi.reset_data_structures!(t)) end @@ -79,18 +79,20 @@ end @timed_testset "TreeMesh" begin @testset "constructors" begin - @test TreeMesh{1, Trixi.SerialTree{1, Float64}, Float64}(1, 5.0, 2.0) isa + @test TreeMesh{1, Trixi.SerialTree{1, Float64}, Float64}(1, 5.0, 2.0, true) isa TreeMesh # Invalid domain length check (TreeMesh expects a hypercube) # 2D @test_throws ArgumentError TreeMesh((-0.5, 0.0), (1.0, 2.0), initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, + periodicity = true) # 3D @test_throws ArgumentError TreeMesh((-0.5, 0.0, -0.2), (1.0, 2.0, 1.5), initial_refinement_level = 2, - n_cells_max = 10_000) + n_cells_max = 10_000, + periodicity = true) end end @@ -103,7 +105,8 @@ end mesh = TreeMesh{2, Trixi.ParallelTree{2, Float64}, Float64}(30, (0.0, 0.0), - 1.0) + 1.0, + true) # Refine twice Trixi.refine!(mesh.tree) Trixi.refine!(mesh.tree) @@ -133,7 +136,8 @@ end mesh = TreeMesh{2, Trixi.ParallelTree{2, Float64}, Float64}(100, (0.0, 0.0), - 1.0) + 1.0, + true) # Refine twice Trixi.refine!(mesh.tree) Trixi.refine!(mesh.tree) @@ -163,7 +167,8 @@ end mesh = TreeMesh{2, Trixi.ParallelTree{2, Float64}, Float64}(1000, (0.0, 0.0), - 1.0) + 1.0, + true) # Refine twice Trixi.refine!(mesh.tree) Trixi.refine!(mesh.tree) @@ -188,7 +193,8 @@ end mesh = TreeMesh{2, Trixi.ParallelTree{2, Float64}, Float64}(100, (0.0, 0.0), - 1.0) + 1.0, + true) # Refine whole tree Trixi.refine!(mesh.tree) # Refine left leaf @@ -217,7 +223,8 @@ end mesh = TreeMesh{2, Trixi.ParallelTree{2, Float64}, Float64}(100, (0.0, 0.0), - 1.0) + 1.0, + true) # Only one leaf @test_throws AssertionError("Too many ranks to properly partition the mesh!") Trixi.partition!(mesh) @@ -802,8 +809,8 @@ end @test flux_terashima_etal(u, u, 1, equations) ≈ flux(u, 1, equations) @test flux_central_terashima_etal(u, u, 1, equations) ≈ flux(u, 1, equations) - # check that the fallback temperature and specialized temperature - # return the same value + # check that the fallback temperature and specialized temperature + # return the same value V, v1, T = Trixi.cons2thermo(u, equations) e_internal = energy_internal_specific(V, T, eos) @test temperature(V, e_internal, eos) ≈ @@ -854,10 +861,12 @@ end solver = DGSEM(polydeg = 0, surface_flux = flux_ranocha) mesh = TreeMesh((0.0,), (1.0,), initial_refinement_level = 2, - n_cells_max = 30_000) + n_cells_max = 30_000, + periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) u0 = zeros(4) tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan) @@ -2864,8 +2873,8 @@ end mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) - + n_cells_max = 30_000, + periodicity = true) ############################################################################### ### semidiscretization for sparsity detection ### @@ -2877,7 +2886,8 @@ end # Semidiscretization for sparsity pattern detection semi_jac_type = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver, + solver; + boundary_conditions = boundary_condition_periodic, uEltype = jac_eltype) # Need to supply Jacobian element type tspan = (0.0, 1.0) # Re-used for wrapping `rhs` below @@ -2908,7 +2918,8 @@ end semi_float_type = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ode_float_type = semidiscretize(semi_float_type, tspan) u0_ode = ode_float_type.u0 @@ -2963,7 +2974,8 @@ end mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 4, - n_cells_max = 30_000) + n_cells_max = 30_000, + periodicity = true) ############################################################################### ### semidiscretization for sparsity detection ### @@ -2978,7 +2990,9 @@ end (equations_hyperbolic, equations_parabolic), initial_condition_convergence_test, - solver, + solver; + boundary_conditions = (boundary_condition_periodic, + boundary_condition_periodic), uEltype = jac_eltype) # Need to supply Jacobian element type tspan = (0.0, 1.5) # Re-used for wrapping `rhs` below @@ -3027,6 +3041,340 @@ end # the sparsity pattern of the parabolic part of a hyperbolic-parabolic problem always includes the hyperbolic one @test jac_prototype_parabolic == jac_prototype_hyperbolic_parabolic end + +@testset "TreeMesh and StructuredMesh boundary condition argument checks" begin + solver = DGSEM(polydeg = 1) + ic = initial_condition_convergence_test + bc = boundary_condition_periodic + bc_dn = boundary_condition_do_nothing + # 1D + eq1d = LinearScalarAdvectionEquation1D(1.0) + tree_mesh1d_periodic = TreeMesh((-1.0,), (1.0,), initial_refinement_level = 1, + n_cells_max = 10, periodicity = true) + structured_mesh1d_periodic = StructuredMesh((4,), (-1.0,), (1.0,), + periodicity = true) + for mesh1d_periodic in (tree_mesh1d_periodic, + structured_mesh1d_periodic) + # Passing Tuples and arrays is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh1d_periodic, eq1d, + ic, solver; + boundary_conditions = (bc, + bc)) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh1d_periodic, eq1d, + ic, solver; + boundary_conditions = [bc, + bc]) + @test_nowarn SemidiscretizationHyperbolic(mesh1d_periodic, eq1d, + initial_condition_convergence_test, + solver; + boundary_conditions = bc) + # Not passing periodic boundary conditions in NamedTuple for periodic mesh is allowed + @test_nowarn SemidiscretizationHyperbolic(mesh1d_periodic, eq1d, + ic, solver; + boundary_conditions = (; + x_neg = bc,)) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh1d_periodic, eq1d, + ic, solver; + boundary_conditions = (; + x_neg = bc_dn,)) + # Wrong keys NamedTuple + @test_throws ErrorException SemidiscretizationHyperbolic(mesh1d_periodic, eq1d, + ic, solver; + boundary_conditions = (; + x_neg = bc, + y_pos = bc)) + end + # non-periodic mesh + tree_mesh1d_nonperiodic = TreeMesh((-1.0,), (1.0,), initial_refinement_level = 1, + n_cells_max = 10, periodicity = false) + structured_mesh1d_nonperiodic = StructuredMesh((4,), (-1.0,), (1.0,), + periodicity = false) + for mesh1d_nonperiodic in (tree_mesh1d_nonperiodic, + structured_mesh1d_nonperiodic) + @test_nowarn SemidiscretizationHyperbolic(mesh1d_nonperiodic, + eq1d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn)) + # periodic boundary conditions for non-periodic mesh is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh1d_nonperiodic, + eq1d, ic, solver; + boundary_conditions = bc) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh1d_nonperiodic, + eq1d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc)) + # not passing non-periodic boundary conditions for non-periodic mesh is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh1d_nonperiodic, + eq1d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn,)) + end + # 2D + eq2d = LinearScalarAdvectionEquation2D((1.0, -1.0)) + tree_mesh2d_periodic = TreeMesh((-1.0, -1.0), (1.0, 1.0), + initial_refinement_level = 1, + n_cells_max = 10, periodicity = true) + structured_mesh2d_periodic = StructuredMesh((4, 4), (-1.0, -1.0), (1.0, 1.0), + periodicity = true) + for mesh2d_periodic in (tree_mesh2d_periodic, + structured_mesh2d_periodic) + # Passing Tuples and arrays is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_periodic, eq2d, + ic, solver; + boundary_conditions = (bc, + bc, + bc, + bc)) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_periodic, eq2d, + ic, solver; + boundary_conditions = [bc, + bc, bc, bc]) + @test_nowarn SemidiscretizationHyperbolic(mesh2d_periodic, eq2d, + ic, solver; + boundary_conditions = bc) + @test_nowarn SemidiscretizationHyperbolic(mesh2d_periodic, eq2d, + ic, solver; + boundary_conditions = (; x_neg = bc, + x_pos = bc, + y_neg = bc, + y_pos = bc)) + # Not passing periodic boundary conditions in NamedTuple for periodic mesh is allowed + @test_nowarn SemidiscretizationHyperbolic(mesh2d_periodic, eq2d, + ic, solver; + boundary_conditions = (; + x_neg = bc,)) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_periodic, eq2d, + ic, solver; + boundary_conditions = (; + x_neg = bc_dn,)) + # Wrong keys NamedTuple + @test_throws ErrorException SemidiscretizationHyperbolic(mesh2d_periodic, eq2d, + ic, solver; + boundary_conditions = (; + x_neg = bc, + x_pos = bc, + z_neg = bc, + z_pos = bc)) + end + # non-periodic mesh + tree_mesh2d_nonperiodic = TreeMesh((-1.0, -1.0), (1.0, 1.0), + initial_refinement_level = 1, + n_cells_max = 10, periodicity = false) + structured_mesh2d_nonperiodic = StructuredMesh((4, 4), (-1.0, -1.0), (1.0, 1.0), + periodicity = false) + for mesh2d_nonperiodic in (tree_mesh2d_nonperiodic, + structured_mesh2d_nonperiodic) + @test_nowarn SemidiscretizationHyperbolic(mesh2d_nonperiodic, + eq2d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn, + y_neg = bc_dn, + y_pos = bc_dn)) + # periodic boundary conditions for non-periodic mesh is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_nonperiodic, + eq2d, ic, solver; + boundary_conditions = bc) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_nonperiodic, + eq2d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc, + y_neg = bc, + y_pos = bc)) + # not passing non-periodic boundary conditions for non-periodic mesh is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_nonperiodic, + eq2d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn, + y_neg = bc_dn)) + end + # partially periodic + tree_mesh2d_partial_periodic = TreeMesh((-1.0, -1.0), (1.0, 1.0), + initial_refinement_level = 1, + n_cells_max = 10, + periodicity = (true, false)) + structured_mesh2d_partial_periodic = StructuredMesh((4, 4), (-1.0, -1.0), + (1.0, 1.0), + periodicity = (true, false)) + for mesh2d_partial_periodic in (tree_mesh2d_partial_periodic, + structured_mesh2d_partial_periodic) + # Specifying all boundary conditions is allowed + @test_nowarn SemidiscretizationHyperbolic(mesh2d_partial_periodic, + eq2d, ic, solver; + boundary_conditions = (; + x_neg = bc, + x_pos = bc, + y_neg = bc_dn, + y_pos = bc_dn)) + # Only specifying non-periodic boundary conditions is allowed when using NamedTuple + @test_nowarn SemidiscretizationHyperbolic(mesh2d_partial_periodic, + eq2d, ic, solver; + boundary_conditions = (; + y_neg = bc_dn, + y_pos = bc_dn)) + # For partially periodic mesh, need to specify separate boundary conditions + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_partial_periodic, + eq2d, ic, solver; + boundary_conditions = bc_dn) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_partial_periodic, + eq2d, ic, solver; + boundary_conditions = bc) + # Non-periodic boundary condition on periodic direction + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh2d_partial_periodic, + eq2d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn, + y_neg = bc_dn, + y_pos = bc_dn)) + end + # 3D + eq3d = LinearScalarAdvectionEquation3D((1.0, 1.0, -1.0)) + tree_mesh3d_periodic = TreeMesh((-1.0, -1.0, -1.0), (1.0, 1.0, 1.0), + initial_refinement_level = 1, + n_cells_max = 10, periodicity = true) + structured_mesh3d_periodic = StructuredMesh((4, 4, 4), (-1.0, -1.0, -1.0), + (1.0, 1.0, 1.0), + periodicity = true) + for mesh3d_periodic in (tree_mesh3d_periodic, + structured_mesh3d_periodic) + # Passing Tuples and arrays is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_periodic, eq3d, + ic, solver; + boundary_conditions = (bc, + bc, + bc, + bc, + bc, + bc)) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_periodic, eq3d, + ic, solver; + boundary_conditions = [bc, + bc, bc, bc, bc, bc]) + @test_nowarn SemidiscretizationHyperbolic(mesh3d_periodic, eq3d, + ic, solver; + boundary_conditions = bc) + @test_nowarn SemidiscretizationHyperbolic(mesh3d_periodic, eq3d, + ic, solver; + boundary_conditions = (; x_neg = bc, + x_pos = bc, + y_neg = bc, + y_pos = bc, + z_neg = bc, + z_pos = bc)) + # Not passing periodic boundary conditions in NamedTuple for periodic mesh is allowed + @test_nowarn SemidiscretizationHyperbolic(mesh3d_periodic, eq3d, + ic, solver; + boundary_conditions = (; + x_neg = bc,)) + # Passing non-periodic boundary conditions for periodic mesh is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_periodic, eq3d, + ic, solver; + boundary_conditions = (; + x_neg = bc_dn,)) + # Wrong keys NamedTuple + @test_throws ErrorException SemidiscretizationHyperbolic(mesh3d_periodic, eq3d, + ic, solver; + boundary_conditions = (; + x_neg = bc, + x_pos = bc, + y_neg = bc, + y_pos = bc, + z_neg = bc, + pos = bc)) + end + # non-periodic mesh + tree_mesh3d_nonperiodic = TreeMesh((-1.0, -1.0, -1.0), (1.0, 1.0, 1.0), + initial_refinement_level = 1, + n_cells_max = 10, periodicity = false) + structured_mesh3d_nonperiodic = StructuredMesh((4, 4, 4), (-1.0, -1.0, -1.0), + (1.0, 1.0, 1.0), + periodicity = false) + for mesh3d_nonperiodic in (tree_mesh3d_nonperiodic, + structured_mesh3d_nonperiodic) + # Passing all non-periodic boundary conditions for non-periodic mesh is allowed + @test_nowarn SemidiscretizationHyperbolic(mesh3d_nonperiodic, + eq3d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn, + y_neg = bc_dn, + y_pos = bc_dn, + z_neg = bc_dn, + z_pos = bc_dn)) + # periodic boundary conditions for non-periodic mesh is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_nonperiodic, + eq3d, ic, solver; + boundary_conditions = bc) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_nonperiodic, + eq3d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc, + y_neg = bc, + y_pos = bc, + z_neg = bc, + z_pos = bc)) + # not passing non-periodic boundary conditions for non-periodic mesh is not allowed + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_nonperiodic, + eq3d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn, + y_neg = bc_dn, + y_pos = bc_dn, + z_neg = bc_dn)) + end + # partially periodic + tree_mesh3d_partial_periodic = TreeMesh((-1.0, -1.0, -1.0), (1.0, 1.0, 1.0), + initial_refinement_level = 1, + n_cells_max = 10, + periodicity = (false, true, true)) + structured_mesh3d_partial_periodic = StructuredMesh((4, 4, 4), (-1.0, -1.0, -1.0), + (1.0, 1.0, 1.0), + periodicity = (false, true, + true)) + for mesh3d_partial_periodic in (tree_mesh3d_partial_periodic, + structured_mesh3d_partial_periodic) + # Specifying all boundary conditions is allowed + @test_nowarn SemidiscretizationHyperbolic(mesh3d_partial_periodic, + eq3d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn, + y_neg = bc, + y_pos = bc, + z_neg = bc, + z_pos = bc)) + # Only specifying non-periodic boundary conditions is allowed when using NamedTuple + @test_nowarn SemidiscretizationHyperbolic(mesh3d_partial_periodic, + eq3d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn)) + # For partially periodic mesh, need to specify separate boundary conditions + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_partial_periodic, + eq3d, ic, solver; + boundary_conditions = bc_dn) + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_partial_periodic, + eq3d, ic, solver; + boundary_conditions = bc) + # Non-periodic boundary condition on periodic direction + @test_throws ArgumentError SemidiscretizationHyperbolic(mesh3d_partial_periodic, + eq3d, ic, solver; + boundary_conditions = (; + x_neg = bc_dn, + x_pos = bc_dn, + y_neg = bc_dn, + y_pos = bc_dn, + z_neg = bc, + z_pos = bc_dn)) + end +end end end #module diff --git a/test/test_visualization.jl b/test/test_visualization.jl index 41f2bff5a05..7090c1dec32 100644 --- a/test/test_visualization.jl +++ b/test/test_visualization.jl @@ -233,11 +233,13 @@ end trees_per_dimension = (2, 2) mesh = MeshType(trees_per_dimension; polydeg = 1, coordinates_min, coordinates_max, - initial_refinement_level = 0) + initial_refinement_level = 0, + periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_constant, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) # SSPRK43 with optimized controller of Ranocha, Dalcin, Parsani, # and Ketcheson (2021) @@ -269,17 +271,21 @@ end mesh_tree = TreeMesh(coordinates_min, coordinates_max; n_cells_max = 10^5, - initial_refinement_level) + initial_refinement_level, + periodicity = true) trees_per_dimension = (1, 1) mesh_p4est = P4estMesh(trees_per_dimension; polydeg = 1, coordinates_min, coordinates_max, - initial_refinement_level) + initial_refinement_level, + periodicity = true) mesh_t8code = T8codeMesh(trees_per_dimension; polydeg = 1, coordinates_min, coordinates_max, - initial_refinement_level) + initial_refinement_level, + periodicity = true) cells_per_dimension = (2, 2) .^ initial_refinement_level mesh_structured = StructuredMesh(cells_per_dimension, - coordinates_min, coordinates_max) + coordinates_min, coordinates_max, + periodicity = true) function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D) @@ -300,22 +306,26 @@ end ic = initial_condition_taylor_green_vortex ode_tree = let mesh = mesh_tree - semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) end ode_p4est = let mesh = mesh_p4est - semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) end ode_t8code = let mesh = mesh_t8code - semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) end ode_structured = let mesh = mesh_structured - semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) end @@ -521,11 +531,13 @@ end trees_per_dimension = (2, 2, 2) mesh = MeshType(trees_per_dimension; polydeg = 1, coordinates_min, coordinates_max, - initial_refinement_level = 0) + initial_refinement_level = 0, + periodicity = true) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_constant, - solver) + solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) # SSPRK43 with optimized controller of Ranocha, Dalcin, Parsani, # and Ketcheson (2021) @@ -558,17 +570,21 @@ end mesh_tree = TreeMesh(coordinates_min, coordinates_max; n_cells_max = 10^6, - initial_refinement_level) + initial_refinement_level, + periodicity = true) trees_per_dimension = (1, 1, 1) mesh_p4est = P4estMesh(trees_per_dimension; polydeg = 1, coordinates_min, coordinates_max, - initial_refinement_level) + initial_refinement_level, + periodicity = true) mesh_t8code = T8codeMesh(trees_per_dimension; polydeg = 1, coordinates_min, coordinates_max, - initial_refinement_level) + initial_refinement_level, + periodicity = true) cells_per_dimension = (2, 2, 2) .^ initial_refinement_level mesh_structured = StructuredMesh(cells_per_dimension, - coordinates_min, coordinates_max) + coordinates_min, coordinates_max, + periodicity = true) function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D) @@ -591,22 +607,26 @@ end ic = initial_condition_taylor_green_vortex ode_tree = let mesh = mesh_tree - semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) end ode_p4est = let mesh = mesh_p4est - semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) end ode_t8code = let mesh = mesh_t8code - semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) end ode_structured = let mesh = mesh_structured - semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver) + semi = SemidiscretizationHyperbolic(mesh, equations, ic, solver; + boundary_conditions = boundary_condition_periodic) ode = semidiscretize(semi, (0.0, 0.1)) end