Skip to content

Commit

Permalink
Merge branch 'main' into bg/print-global-number-of-cells-dofs
Browse files Browse the repository at this point in the history
  • Loading branch information
benegee authored Mar 7, 2024
2 parents 51127eb + c4bf3df commit eef69b9
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Trixi"
uuid = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
authors = ["Michael Schlottke-Lakemper <[email protected]>", "Gregor Gassner <[email protected]>", "Hendrik Ranocha <[email protected]>", "Andrew R. Winters <[email protected]>", "Jesse Chan <[email protected]>"]
version = "0.7.2-pre"
version = "0.7.3-pre"

[deps]
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
Expand Down
3 changes: 1 addition & 2 deletions docs/src/parallelization.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ installations. Follow the steps described [here](https://github.com/DLR-AMR/T8co
[here](https://github.com/trixi-framework/P4est.jl/blob/main/README.md#installation) for the configuration.
The paths that point to `libp4est.so` (and potentially to `libsc.so`) need to be
the same for P4est.jl and T8code.jl. This could, e.g., be `libp4est.so` that usually can be found
in `lib/` or `local/lib/` in the installation directory of `t8code`. Note that the `T8codeMesh`, however,
does not support MPI yet.
in `lib/` or `local/lib/` in the installation directory of `t8code`.
The preferences for [HDF5.jl](https://github.com/JuliaIO/HDF5.jl) always need to be set, even if you
do not want to use `HDF5` from Trixi.jl, see also [issue #1079 in HDF5.jl](https://github.com/JuliaIO/HDF5.jl/issues/1079).
To set the preferences for HDF5.jl, follow the instructions described
Expand Down
12 changes: 8 additions & 4 deletions examples/structured_2d_dgsem/elixir_advection_coupled.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ cells_per_dimension = (8, 8)
coordinates_min1 = (-1.0, 0.0) # minimum coordinates (min(x), min(y))
coordinates_max1 = (0.0, 1.0) # maximum coordinates (max(x), max(y))

mesh1 = StructuredMesh(cells_per_dimension, coordinates_min1, coordinates_max1)
mesh1 = StructuredMesh(cells_per_dimension, coordinates_min1, coordinates_max1,
periodicity = false)

# Define the coupling functions
coupling_function12 = (x, u, equations_other, equations_own) -> u
Expand Down Expand Up @@ -84,7 +85,8 @@ semi1 = SemidiscretizationHyperbolic(mesh1, equations, initial_condition_converg
coordinates_min2 = (0.0, 0.0) # minimum coordinates (min(x), min(y))
coordinates_max2 = (1.0, 1.0) # maximum coordinates (max(x), max(y))

mesh2 = StructuredMesh(cells_per_dimension, coordinates_min2, coordinates_max2)
mesh2 = StructuredMesh(cells_per_dimension, coordinates_min2, coordinates_max2,
periodicity = false)

# Define the coupling functions
coupling_function21 = (x, u, equations_other, equations_own) -> u
Expand Down Expand Up @@ -115,7 +117,8 @@ semi2 = SemidiscretizationHyperbolic(mesh2, equations, initial_condition_converg
coordinates_min3 = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
coordinates_max3 = (0.0, 0.0) # maximum coordinates (max(x), max(y))

mesh3 = StructuredMesh(cells_per_dimension, coordinates_min3, coordinates_max3)
mesh3 = StructuredMesh(cells_per_dimension, coordinates_min3, coordinates_max3,
periodicity = false)

# Define the coupling functions
coupling_function34 = (x, u, equations_other, equations_own) -> u
Expand Down Expand Up @@ -146,7 +149,8 @@ semi3 = SemidiscretizationHyperbolic(mesh3, equations, initial_condition_converg
coordinates_min4 = (0.0, -1.0) # minimum coordinates (min(x), min(y))
coordinates_max4 = (1.0, 0.0) # maximum coordinates (max(x), max(y))

mesh4 = StructuredMesh(cells_per_dimension, coordinates_min4, coordinates_max4)
mesh4 = StructuredMesh(cells_per_dimension, coordinates_min4, coordinates_max4,
periodicity = false)

# Define the coupling functions
coupling_function43 = (x, u, equations_other, equations_own) -> u
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ mapping(xi, eta) = SVector(0.25 * 0.5 * (1.0 + xi), 0.5 * (1.0 + eta))

num_elements_per_dimension = 32
cells_per_dimension = (num_elements_per_dimension, num_elements_per_dimension * 4)
mesh = StructuredMesh(cells_per_dimension, mapping)
mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = false)

initial_condition = initial_condition_rayleigh_taylor_instability
boundary_conditions = (x_neg = boundary_condition_slip_wall,
Expand Down
3 changes: 2 additions & 1 deletion examples/structured_2d_dgsem/elixir_euler_warm_bubble.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ coordinates_min = (0.0, 0.0)
coordinates_max = (20_000.0, 10_000.0)

cells_per_dimension = (64, 32)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,
periodicity = (true, false))

semi = SemidiscretizationHyperbolic(mesh, equations, warm_bubble_setup, solver,
source_terms = warm_bubble_setup,
Expand Down
3 changes: 3 additions & 0 deletions src/meshes/tree_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,8 @@ function total_volume(mesh::TreeMesh)
return mesh.tree.length_level_0^ndims(mesh)
end

isperiodic(mesh::TreeMesh) = isperiodic(mesh.tree)
isperiodic(mesh::TreeMesh, dimension) = isperiodic(mesh.tree, dimension)

include("parallel_tree_mesh.jl")
end # @muladd
70 changes: 70 additions & 0 deletions src/semidiscretization/semidiscretization_hyperbolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver
_boundary_conditions = digest_boundary_conditions(boundary_conditions, mesh, solver,
cache)

check_periodicity_mesh_boundary_conditions(mesh, _boundary_conditions)

SemidiscretizationHyperbolic{typeof(mesh), typeof(equations),
typeof(initial_condition),
typeof(_boundary_conditions), typeof(source_terms),
Expand Down Expand Up @@ -210,6 +212,74 @@ function digest_boundary_conditions(boundary_conditions::AbstractArray, mesh, so
throw(ArgumentError("Please use a (named) tuple instead of an (abstract) array to supply multiple boundary conditions (to improve performance)."))
end

# No checks for these meshes yet available
function check_periodicity_mesh_boundary_conditions(mesh::Union{P4estMesh,
UnstructuredMesh2D,
T8codeMesh,
DGMultiMesh},
boundary_conditions)
end

# No actions needed for periodic boundary conditions
function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh,
StructuredMesh},
boundary_conditions::BoundaryConditionPeriodic)
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."
end
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."
end
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."
end
end

function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{1},
StructuredMesh{1}},
boundary_conditions::Union{NamedTuple,
Tuple})
check_periodicity_mesh_boundary_conditions_x(mesh, boundary_conditions[1],
boundary_conditions[2])
end

function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{2},
StructuredMesh{2}},
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])
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])
check_periodicity_mesh_boundary_conditions_z(mesh, boundary_conditions[5],
boundary_conditions[6])
end

function Base.show(io::IO, semi::SemidiscretizationHyperbolic)
@nospecialize semi # reduce precompilation time

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ function SemidiscretizationHyperbolicParabolic(mesh, equations, equations_parabo
_boundary_conditions_parabolic = digest_boundary_conditions(boundary_conditions_parabolic,
mesh, solver, cache)

check_periodicity_mesh_boundary_conditions(mesh, _boundary_conditions)

cache_parabolic = (;
create_cache_parabolic(mesh, equations, equations_parabolic,
solver, solver_parabolic, RealT,
Expand Down
1 change: 1 addition & 0 deletions src/solvers/dgsem/basis_lobatto_legendre.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Create a nodal Lobatto-Legendre basis for polynomials of degree `polydeg`.
For the special case `polydeg=0` the DG method reduces to a finite volume method.
Therefore, this function sets the center point of the cell as single node.
This exceptional case is currently only supported for TreeMesh!
"""
struct LobattoLegendreBasis{RealT <: Real, NNODES,
VectorT <: AbstractVector{RealT},
Expand Down

0 comments on commit eef69b9

Please sign in to comment.