diff --git a/src/meshes/tree_mesh.jl b/src/meshes/tree_mesh.jl index 05699d17d16..1092fc54cc1 100644 --- a/src/meshes/tree_mesh.jl +++ b/src/meshes/tree_mesh.jl @@ -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 diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 3dc874b426b..ad1ba0175f3 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -219,31 +219,9 @@ function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh, boundary_conditions::BoundaryConditionPeriodic) end -function check_periodicity_mesh_boundary_conditions(mesh::TreeMesh{1}, - boundary_conditions::NamedTuple{Keys, - ValueTypes}) - @unpack x_neg, x_pos = boundary_conditions - if isperiodic(mesh.tree, 1) && - (x_neg != BoundaryConditionPeriodic() || - x_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end -end - -function check_periodicity_mesh_boundary_conditions(mesh::TreeMesh{1}, - boundary_conditions::NTuple{2, Any}) - if isperiodic(mesh.tree, 1) && - (boundary_conditions[1] != BoundaryConditionPeriodic() || - boundary_conditions[2] != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end -end - -function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{1}, - boundary_conditions::NamedTuple{Keys, - ValueTypes}) +function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{1}, + StructuredMesh{1}}, + boundary_conditions::NamedTuple) @unpack x_neg, x_pos = boundary_conditions if isperiodic(mesh, 1) && (x_neg != BoundaryConditionPeriodic() || @@ -253,9 +231,9 @@ function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{1}, end end -function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{1}, +function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{1}, + StructuredMesh{1}}, boundary_conditions::NTuple{2, Any}) - @unpack x_neg, x_pos = boundary_conditions if isperiodic(mesh, 1) && (boundary_conditions[1] != BoundaryConditionPeriodic() || boundary_conditions[2] != BoundaryConditionPeriodic()) @@ -264,43 +242,9 @@ function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{1}, end end -function check_periodicity_mesh_boundary_conditions(mesh::TreeMesh{2}, - boundary_conditions::NamedTuple{Keys, - ValueTypes}) - @unpack x_neg, x_pos, y_neg, y_pos = boundary_conditions - if isperiodic(mesh.tree, 1) && - (x_neg != BoundaryConditionPeriodic() || - x_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in x-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end - if isperiodic(mesh.tree, 2) && - (y_neg != BoundaryConditionPeriodic() || - y_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in y-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end -end - -function check_periodicity_mesh_boundary_conditions(mesh::TreeMesh{2}, - boundary_conditions::NTuple{4, Any}) - if isperiodic(mesh.tree, 1) && - (boundary_conditions[1] != BoundaryConditionPeriodic() || - boundary_conditions[2] != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in x-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end - if isperiodic(mesh.tree, 2) && - (boundary_conditions[3] != BoundaryConditionPeriodic() || - boundary_conditions[4] != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in y-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end -end - -function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{2}, - boundary_conditions::NamedTuple{Keys, - ValueTypes}) +function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{2}, + StructuredMesh{2}}, + boundary_conditions::NamedTuple) @unpack x_neg, x_pos, y_neg, y_pos = boundary_conditions if isperiodic(mesh, 1) && (x_neg != BoundaryConditionPeriodic() || @@ -316,7 +260,8 @@ function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{2}, end end -function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{2}, +function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{2}, + StructuredMesh{2}}, boundary_conditions::NTuple{4, Any}) if isperiodic(mesh, 1) && (boundary_conditions[1] != BoundaryConditionPeriodic() || @@ -332,55 +277,9 @@ function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{2}, end end -function check_periodicity_mesh_boundary_conditions(mesh::TreeMesh{3}, - boundary_conditions::NamedTuple{Keys, - ValueTypes}) - @unpack x_neg, x_pos, y_neg, y_pos, z_neg, z_pos = boundary_conditions - if isperiodic(mesh.tree, 1) && - (x_neg != BoundaryConditionPeriodic() || - x_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in x-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end - if isperiodic(mesh.tree, 2) && - (y_neg != BoundaryConditionPeriodic() || - y_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in y-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end - if isperiodic(mesh.tree, 3) && - (z_neg != BoundaryConditionPeriodic() || - z_pos != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in z-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end -end - -function check_periodicity_mesh_boundary_conditions(mesh::TreeMesh{3}, - boundary_conditions::NTuple{6, Any}) - if isperiodic(mesh.tree, 1) && - (boundary_conditions[1] != BoundaryConditionPeriodic() || - boundary_conditions[2] != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in x-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end - if isperiodic(mesh.tree, 2) && - (boundary_conditions[3] != BoundaryConditionPeriodic() || - boundary_conditions[4] != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in y-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end - if isperiodic(mesh.tree, 3) && - (boundary_conditions[5] != BoundaryConditionPeriodic() || - boundary_conditions[6] != BoundaryConditionPeriodic()) - @error "For periodic mesh non-periodic boundary conditions in z-direction are supplied. - The boundary conditions will be ignored and periodic boundary conditions are used." - end -end - -function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{3}, - boundary_conditions::NamedTuple{Keys, - ValueTypes}) +function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{3}, + StructuredMesh{3}}, + boundary_conditions::NamedTuple) @unpack x_neg, x_pos, y_neg, y_pos, z_neg, z_pos = boundary_conditions if isperiodic(mesh, 1) && (x_neg != BoundaryConditionPeriodic() || @@ -402,7 +301,8 @@ function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{3}, end end -function check_periodicity_mesh_boundary_conditions(mesh::StructuredMesh{3}, +function check_periodicity_mesh_boundary_conditions(mesh::Union{TreeMesh{3}, + StructuredMesh{3}}, boundary_conditions::NTuple{6, Any}) @unpack x_neg, x_pos, y_neg, y_pos, z_neg, z_pos = boundary_conditions if isperiodic(mesh, 1) &&