Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Read geometry information from t8code #1900

Merged
merged 55 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
95a021d
Wrap from_abaqus routines.
Apr 8, 2024
178ec18
Implement geometry data transfer from t8code to Trixi.
Apr 8, 2024
0fed965
Updated examples.
Apr 8, 2024
c50b434
Fixed typos.
Apr 8, 2024
5e18656
Applied formatter.
Apr 8, 2024
c388a94
Merge branch 'main' into feature-t8code-curved-geometry
Apr 8, 2024
3bb6292
cubed sphere test case, copied from p4est
benegee Mar 13, 2024
abbf702
add baroclinic instability (copy of p4est)
benegee Mar 27, 2024
5fa48e8
add cubed sphere constructor
benegee Apr 9, 2024
cd27998
Fix indentation.
Apr 19, 2024
f6653b0
Fix indentation.
Apr 19, 2024
aa4d0d4
Switching off formatter in two files.
Apr 19, 2024
f331a87
Merge branch 'feature-t8code-curved-geometry' of github.com:trixi-fra…
Apr 19, 2024
40cbb86
Upgrading T8code.jl.
Apr 19, 2024
ff964cc
Merge branch 'main' into feature-t8code-curved-geometry
Apr 19, 2024
df77f82
Fixed examples.
Apr 19, 2024
b80f890
stress different meaning of first argument
benegee Apr 22, 2024
c46799b
use lat lon levels
benegee Apr 22, 2024
e3c2492
add t8code cubed sphere tests
benegee Apr 22, 2024
544b10d
Merge branch 'main' into feature-t8code-curved-geometry
jmark Apr 25, 2024
7af3f31
Remove TODO comments
benegee Apr 25, 2024
6d835e3
Relaxing T8code.jl version requirement.
Apr 26, 2024
fe298b5
Merge branch 'main' into feature-t8code-curved-geometry
jmark Apr 26, 2024
54a5ec3
Restricted t8code version requirement.
Apr 26, 2024
1daec4b
Removed cubed spherical shell related code.
Apr 26, 2024
5c5ccc6
Merge branch 'feature-t8code-curved-geometry' of github.com:trixi-fra…
Apr 26, 2024
120af75
Removed cubed spherical shell tests.
Apr 26, 2024
4317d5e
Increasing code coverage.
Apr 26, 2024
071d65c
Merge branch 'main' into feature-t8code-curved-geometry
jmark Apr 30, 2024
4b5694d
Increasing code coverage.
Apr 30, 2024
48082e6
Further increasing code coverage.
Apr 30, 2024
18d28b7
Merge branch 'feature-t8code-curved-geometry' of github.com:trixi-fra…
Apr 30, 2024
72c5c92
Applied formatter.
Apr 30, 2024
115711c
Merge branch 'main' into feature-t8code-curved-geometry
jmark May 2, 2024
84e549a
Update src/meshes/t8code_mesh.jl
jmark May 3, 2024
e08c0f8
Update src/meshes/t8code_mesh.jl
jmark May 3, 2024
671702d
Update src/meshes/t8code_mesh.jl
jmark May 3, 2024
aee2086
Update src/meshes/t8code_mesh.jl
jmark May 3, 2024
1728893
Update src/meshes/t8code_mesh.jl
jmark May 3, 2024
b075f5c
Update src/meshes/t8code_mesh.jl
jmark May 3, 2024
f2f5995
Update src/meshes/t8code_mesh.jl
jmark May 3, 2024
d7d8599
Update src/meshes/t8code_mesh.jl
jmark May 3, 2024
870e6e9
Merge branch 'main' into feature-t8code-curved-geometry
May 8, 2024
896711c
Update test/test_t8code_2d.jl
jmark May 8, 2024
af49b37
Update src/meshes/t8code_mesh.jl
jmark May 8, 2024
2958b46
Update src/meshes/t8code_mesh.jl
jmark May 8, 2024
3240897
Update src/meshes/t8code_mesh.jl
jmark May 8, 2024
9c57b13
Fixing minor stuff.
May 8, 2024
7f0ce8b
Merge branch 'feature-t8code-curved-geometry' of github.com:trixi-fra…
May 8, 2024
d739b91
Update src/meshes/t8code_mesh.jl
jmark May 8, 2024
d69e4bf
Appyling comments.
May 8, 2024
1cec70e
Applied formatter.
May 8, 2024
7d4f2e6
Merge branch 'feature-t8code-curved-geometry' of github.com:trixi-fra…
May 8, 2024
3e8a8b5
Merge branch 'main' into feature-t8code-curved-geometry
jmark May 10, 2024
3158c44
Reverting changes to original state.
May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ StaticArrays = "1.5"
StrideArrays = "0.1.26"
StructArrays = "0.6.11"
SummationByPartsOperators = "0.5.41"
T8code = "0.4.3, 0.5"
T8code = "0.5"
TimerOutputs = "0.5.7"
Triangulate = "2.2"
TriplotBase = "0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,8 @@ mapping_flag = Trixi.transfinite_mapping(faces)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
joinpath(@__DIR__, "square_unstructured_2.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connecvity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(2))

mesh = T8codeMesh(conn, polydeg = 3,
mapping = mapping_flag,
mesh = T8codeMesh(mesh_file, 2;
mapping = mapping_flag, polydeg = 3,
initial_refinement_level = 1)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))

faces = (f1, f2, f3, f4)
mapping = Trixi.transfinite_mapping(faces)

# Create T8codeMesh with 3 x 2 trees and 6 x 4 elements,
# approximate the geometry with a smaller polydeg for testing.
trees_per_dimension = (3, 2)
mesh = T8codeMesh(trees_per_dimension, polydeg = 3,
mapping = mapping,
initial_refinement_level = 1)
faces = faces,
initial_refinement_level = 1,
periodicity = (true, true))

# Note: This is actually a `p4est_quadrant_t` which is much bigger than the
# following struct. But we only need the first three fields for our purpose.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ mapping_flag = Trixi.transfinite_mapping(faces)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
joinpath(@__DIR__, "square_unstructured_2.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connecvity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(2))

mesh = T8codeMesh(conn, polydeg = 3,
mapping = mapping_flag,
mesh = T8codeMesh(mesh_file, 2;
mapping = mapping_flag, polydeg = 3,
initial_refinement_level = 2)

# A semidiscretization collects data structures and functions for the spatial discretization.
Expand Down
7 changes: 1 addition & 6 deletions examples/t8code_2d_dgsem/elixir_euler_free_stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ end
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
joinpath(@__DIR__, "square_unstructured_1.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connecvity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(2))

mesh = T8codeMesh(conn, polydeg = 3,
mesh = T8codeMesh(mesh_file, 2; polydeg = 3,
mapping = mapping,
initial_refinement_level = 1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ mapping_flag = Trixi.transfinite_mapping(faces)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
joinpath(@__DIR__, "square_unstructured_2.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connecvity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(2))

mesh = T8codeMesh(conn, polydeg = 3,
mesh = T8codeMesh(mesh_file, 2; polydeg = 3,
mapping = mapping_flag,
initial_refinement_level = 1)

Expand Down
7 changes: 1 addition & 6 deletions examples/t8code_2d_dgsem/elixir_mhd_rotor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ end
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
joinpath(@__DIR__, "square_unstructured_2.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connecvity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(2))

mesh = T8codeMesh(conn, polydeg = 4,
mesh = T8codeMesh(mesh_file, 2; polydeg = 4,
mapping = mapping_twist,
initial_refinement_level = 1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ end
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
joinpath(@__DIR__, "cube_unstructured_2.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connectivity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(3))

mesh = T8codeMesh(conn, polydeg = 2,
mesh = T8codeMesh(mesh_file, 3; polydeg = 2,
mapping = mapping,
initial_refinement_level = 1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ end
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
joinpath(@__DIR__, "cube_unstructured_1.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connectivity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(3))

mesh = T8codeMesh(conn, polydeg = 3,
mesh = T8codeMesh(mesh_file, 3; polydeg = 3,
mapping = mapping,
initial_refinement_level = 2)

Expand Down
7 changes: 1 addition & 6 deletions examples/t8code_3d_dgsem/elixir_euler_ec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ end
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
joinpath(@__DIR__, "cube_unstructured_2.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connectivity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(3))

mesh = T8codeMesh(conn, polydeg = 5,
mesh = T8codeMesh(mesh_file, 3; polydeg = 5,
mapping = mapping,
initial_refinement_level = 0)

Expand Down
7 changes: 1 addition & 6 deletions examples/t8code_3d_dgsem/elixir_euler_free_stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ end
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
joinpath(@__DIR__, "cube_unstructured_1.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connectivity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(3))

mesh = T8codeMesh(conn, polydeg = 2,
mesh = T8codeMesh(mesh_file, 3; polydeg = 2,
mapping = mapping,
initial_refinement_level = 0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ end
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
joinpath(@__DIR__, "cube_unstructured_2.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connecvity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(3))

mesh = T8codeMesh(conn, polydeg = 3,
mesh = T8codeMesh(mesh_file, 3; polydeg = 3,
mapping = mapping,
initial_refinement_level = 0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,8 @@ end
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
joinpath(@__DIR__, "cube_unstructured_1.inp"))

# INP mesh files are only support by p4est. Hence, we
# create a p4est connecvity object first from which
# we can create a t8code mesh.
conn = Trixi.read_inp_p4est(mesh_file, Val(3))

# Mesh polydeg of 2 (half the solver polydeg) to ensure FSP (see above).
mesh = T8codeMesh(conn, polydeg = 2,
mesh = T8codeMesh(mesh_file, 3; polydeg = 2,
mapping = mapping,
initial_refinement_level = 0)

Expand Down
51 changes: 40 additions & 11 deletions src/meshes/p4est_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,44 @@ function P4estMesh{NDIMS}(meshfile::String;
p4est_partition_allow_for_coarsening)
end

# Wrapper for `p4est_connectivity_from_hohqmesh_abaqus`. The latter is used
# by `T8codeMesh`, too.
function p4est_mesh_from_hohqmesh_abaqus(meshfile, initial_refinement_level,
n_dimensions, RealT)
connectivity, tree_node_coordinates, nodes, boundary_names = p4est_connectivity_from_hohqmesh_abaqus(meshfile,
initial_refinement_level,
n_dimensions,
RealT)

p4est = new_p4est(connectivity, initial_refinement_level)

return p4est, tree_node_coordinates, nodes, boundary_names
end

# Wrapper for `p4est_connectivity_from_standard_abaqus`. The latter is used
# by `T8codeMesh`, too.
function p4est_mesh_from_standard_abaqus(meshfile, mapping, polydeg,
initial_refinement_level, n_dimensions, RealT,
boundary_symbols)
connectivity, tree_node_coordinates, nodes, boundary_names = p4est_connectivity_from_standard_abaqus(meshfile,
mapping,
polydeg,
initial_refinement_level,
n_dimensions,
RealT,
boundary_symbols)

p4est = new_p4est(connectivity, initial_refinement_level)

return p4est, tree_node_coordinates, nodes, boundary_names
end

# Create the mesh connectivity, mapped node coordinates within each tree, reference nodes in [-1,1]
# and a list of boundary names for the `P4estMesh`. High-order boundary curve information as well as
# the boundary names on each tree are provided by the `meshfile` created by
# [`HOHQMesh.jl`](https://github.com/trixi-framework/HOHQMesh.jl).
function p4est_mesh_from_hohqmesh_abaqus(meshfile, initial_refinement_level,
n_dimensions, RealT)
function p4est_connectivity_from_hohqmesh_abaqus(meshfile, initial_refinement_level,
n_dimensions, RealT)
# Create the mesh connectivity using `p4est`
connectivity = read_inp_p4est(meshfile, Val(n_dimensions))
connectivity_pw = PointerWrapper(connectivity)
Expand Down Expand Up @@ -440,18 +472,17 @@ function p4est_mesh_from_hohqmesh_abaqus(meshfile, initial_refinement_level,
file_idx += 1
end

p4est = new_p4est(connectivity, initial_refinement_level)

return p4est, tree_node_coordinates, nodes, boundary_names
return connectivity, tree_node_coordinates, nodes, boundary_names
end

# Create the mesh connectivity, mapped node coordinates within each tree, reference nodes in [-1,1]
# and a list of boundary names for the `P4estMesh`. The tree node coordinates are computed according to
# the `mapping` passed to this function using polynomial interpolants of degree `polydeg`. All boundary
# names are given the name `:all`.
function p4est_mesh_from_standard_abaqus(meshfile, mapping, polydeg,
initial_refinement_level, n_dimensions, RealT,
boundary_symbols)
function p4est_connectivity_from_standard_abaqus(meshfile, mapping, polydeg,
initial_refinement_level, n_dimensions,
RealT,
boundary_symbols)
# Create the mesh connectivity using `p4est`
connectivity = read_inp_p4est(meshfile, Val(n_dimensions))
connectivity_pw = PointerWrapper(connectivity)
Expand All @@ -474,8 +505,6 @@ function p4est_mesh_from_standard_abaqus(meshfile, mapping, polydeg,
calc_tree_node_coordinates!(tree_node_coordinates, nodes, mapping, vertices,
tree_to_vertex)

p4est = new_p4est(connectivity, initial_refinement_level)

if boundary_symbols === nothing
# There's no simple and generic way to distinguish boundaries without any information given.
# Name all of them :all.
Expand All @@ -495,7 +524,7 @@ function p4est_mesh_from_standard_abaqus(meshfile, mapping, polydeg,
Val(n_dimensions))
end

return p4est, tree_node_coordinates, nodes, boundary_names
return connectivity, tree_node_coordinates, nodes, boundary_names
end

function parse_elements(meshfile, n_trees, n_dims)
Expand Down
Loading
Loading