diff --git a/examples/t8code_2d_fv/elixir_advection_basic.jl b/examples/t8code_2d_fv/elixir_advection_basic.jl index 4e6c13f1d08..e16fc5a7ff1 100644 --- a/examples/t8code_2d_fv/elixir_advection_basic.jl +++ b/examples/t8code_2d_fv/elixir_advection_basic.jl @@ -34,10 +34,10 @@ mapping_coordinates = Trixi.coordinates2mapping(coordinates_min, coordinates_max # f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s)) # [0,8]^2 -f1(s) = SVector(0.0, 4*(s+1)) -f2(s) = SVector(8.0, 4*(s+1)) -f3(s) = SVector(4*(s+1), 0.0) -f4(s) = SVector(4*(s+1), 8.0) +f1(s) = SVector(0.0, 4 * (s + 1)) +f2(s) = SVector(8.0, 4 * (s + 1)) +f3(s) = SVector(4 * (s + 1), 0.0) +f4(s) = SVector(4 * (s + 1), 8.0) faces = (f1, f2, f3, f4) Trixi.validate_faces(faces) mapping_faces = Trixi.transfinite_mapping(faces) @@ -57,7 +57,8 @@ end # directly within this elixir (e.g. mapping = trixi_t8_mapping_c(mapping)), we get the SegFault error. # - Is the function called with the correct parameters? Memory location correct? It seems so, yes. # - Life time issue for the GC tracked Julia object used in C? **Yes, see gc deactivation in elixir.** -function trixi_t8_mapping(cmesh, gtreeid, ref_coords, num_coords, out_coords, tree_data, user_data) +function trixi_t8_mapping(cmesh, gtreeid, ref_coords, num_coords, out_coords, + tree_data, user_data) ltreeid = t8_cmesh_get_local_id(cmesh, gtreeid) eclass = t8_cmesh_get_tree_class(cmesh, ltreeid) T8code.t8_geom_compute_linear_geometry(eclass, tree_data, diff --git a/examples/t8code_3d_fv/elixir_advection_basic.jl b/examples/t8code_3d_fv/elixir_advection_basic.jl index a9e08bf897e..4fe2f147fd4 100644 --- a/examples/t8code_3d_fv/elixir_advection_basic.jl +++ b/examples/t8code_3d_fv/elixir_advection_basic.jl @@ -26,7 +26,8 @@ function mapping(xi, eta, zeta) return SVector(x, y, z) end -function trixi_t8_mapping(cmesh, gtreeid, ref_coords, num_coords, out_coords, tree_data, user_data) +function trixi_t8_mapping(cmesh, gtreeid, ref_coords, num_coords, out_coords, + tree_data, user_data) ltreeid = t8_cmesh_get_local_id(cmesh, gtreeid) eclass = t8_cmesh_get_tree_class(cmesh, ltreeid) T8code.t8_geom_compute_linear_geometry(eclass, tree_data, diff --git a/src/meshes/t8code_mesh.jl b/src/meshes/t8code_mesh.jl index ca1bf70396a..164a816aa15 100644 --- a/src/meshes/t8code_mesh.jl +++ b/src/meshes/t8code_mesh.jl @@ -389,7 +389,7 @@ function T8codeMesh(trees_per_dimension, eclass; cmesh = cmesh_ref[] @assert(allequal(trees_per_dimension), - "Different trees per dimensions are not supported for quad mesh. `trees_per_dimension`: $trees_per_dimension") + "Different trees per dimensions are not supported for quad mesh. `trees_per_dimension`: $trees_per_dimension") num_trees = prod(trees_per_dimension) * 1 # 1 = number of trees for single hypercube with quads vertices_per_tree = 2^NDIMS # number of vertices (=corners) in one tree @@ -425,8 +425,11 @@ function T8codeMesh(trees_per_dimension, eclass; coordinates_tree_y = range(-1.0, 1.0, length = trees_per_dimension[2] + 1) coordinates_tree_z = range(-1.0, 1.0, length = trees_per_dimension[3] + 1) - for itree_z in 1:trees_per_dimension[3], itree_y in 1:trees_per_dimension[2], itree_x in 1:trees_per_dimension[1] - index = trees_per_dimension[1] * trees_per_dimension[2] * 3 * vertices_per_tree * (itree_z - 1) + + for itree_z in 1:trees_per_dimension[3], itree_y in 1:trees_per_dimension[2], + itree_x in 1:trees_per_dimension[1] + + index = trees_per_dimension[1] * trees_per_dimension[2] * 3 * + vertices_per_tree * (itree_z - 1) + trees_per_dimension[1] * 3 * vertices_per_tree * (itree_y - 1) + 3 * vertices_per_tree * (itree_x - 1) + 1 @@ -494,7 +497,8 @@ function T8codeMesh(trees_per_dimension, eclass; offset_vertices = 3 * vertices_per_tree * (itree - 1) t8_cmesh_set_tree_class(cmesh, itree - 1, eclass) t8_cmesh_set_tree_vertices(cmesh, itree - 1, - @views(vertices[(1 + offset_vertices):end]), vertices_per_tree) + @views(vertices[(1 + offset_vertices):end]), + vertices_per_tree) end if NDIMS == 2 @@ -1808,7 +1812,8 @@ function cmesh_new_quad(; trees_per_dimension = (1, 1), end function cmesh_new_quad_3d(; trees_per_dimension = (1, 1, 1), - coordinates_min = (-1.0, -1.0, -1.0), coordinates_max = (1.0, 1.0, 1.0), + coordinates_min = (-1.0, -1.0, -1.0), + coordinates_max = (1.0, 1.0, 1.0), periodicity = (true, true, true))::t8_cmesh_t # This is how the cmesh looks like. The numbers are the tree numbers: # +---+ diff --git a/src/solvers/fv_t8code/fv.jl b/src/solvers/fv_t8code/fv.jl index 1e4646c89a3..e531c6ee8a5 100644 --- a/src/solvers/fv_t8code/fv.jl +++ b/src/solvers/fv_t8code/fv.jl @@ -160,7 +160,7 @@ function create_cache(mesh::T8codeMesh, equations::AbstractEquations, solver::FV end function rhs!(du, u, t, mesh::T8codeMesh, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, solver::FV, cache) where {Source} # Reset du @trixi_timeit timer() "reset ∂u/∂t" du.=zero(eltype(du)) diff --git a/test/test_mpi_t8code_fv_3d.jl b/test/test_mpi_t8code_fv_3d.jl index 5818b777b5a..ec3316c754b 100644 --- a/test/test_mpi_t8code_fv_3d.jl +++ b/test/test_mpi_t8code_fv_3d.jl @@ -12,11 +12,12 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_3d_fv") # Run basic tests @testset "Examples 3D" begin + # NOTE: Since I use 2x2x2 tree instead of 8x8x8, I need to increase the resolution 2 times by the factor of 2 -> +2 @trixi_testset "elixir_advection_basic.jl" begin @trixi_testset "first-order FV" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"), order=1, - initial_refinement_level=2+2, + initial_refinement_level=2 + 2, l2=[0.2848617953369851], linf=[0.3721898718954475]) # Ensure that we do not have excessive memory allocations @@ -30,7 +31,7 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_3d_fv") end @trixi_testset "second-order FV" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"), - initial_refinement_level=2+2, + initial_refinement_level=2 + 2, l2=[0.10381089565603231], linf=[0.13787405651527007]) # Ensure that we do not have excessive memory allocations @@ -48,7 +49,8 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_3d_fv") @trixi_testset "elixir_advection_basic_hybrid.jl" begin @trixi_testset "first-order FV" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic_hybrid.jl"), + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_advection_basic_hybrid.jl"), order=1, l2=[0.20282363730327146], linf=[0.28132446651281295]) @@ -62,7 +64,8 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_3d_fv") end end @trixi_testset "second-order FV" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic_hybrid.jl"), + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_advection_basic_hybrid.jl"), l2=[0.02153993127089835], linf=[0.039109618097251886]) # Ensure that we do not have excessive memory allocations diff --git a/test/test_t8code_fv_3d.jl b/test/test_t8code_fv_3d.jl index 5f09902198d..e2e1225abde 100644 --- a/test/test_t8code_fv_3d.jl +++ b/test/test_t8code_fv_3d.jl @@ -49,7 +49,7 @@ mkdir(outdir) @trixi_testset "first-order FV" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"), order=1, - initial_refinement_level=2+2, + initial_refinement_level=2 + 2, l2=[0.2848617953369851], linf=[0.3721898718954475]) # Ensure that we do not have excessive memory allocations @@ -63,7 +63,7 @@ mkdir(outdir) end @trixi_testset "second-order FV" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"), - initial_refinement_level=2+2, + initial_refinement_level=2 + 2, l2=[0.10381089565603231], linf=[0.13787405651527007]) # Ensure that we do not have excessive memory allocations @@ -77,7 +77,7 @@ mkdir(outdir) end @trixi_testset "second-order FV, extended reconstruction stencil" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"), - initial_refinement_level=1+2, + initial_refinement_level=1 + 2, extended_reconstruction_stencil=true, l2=[0.3282177575292713], linf=[0.39002345444858333]) @@ -177,14 +177,14 @@ end 0.0351299673616484, 0.0351299673616484, 0.03512996736164839, - 0.1601847269543808, + 0.1601847269543808 ], linf=[ 0.07175521415072939, 0.04648499338897771, 0.04648499338897816, 0.04648499338897816, - 0.2235470564880404, + 0.2235470564880404 ]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) @@ -203,14 +203,14 @@ end 0.010791416898840429, 0.010791416898840464, 0.010791416898840377, - 0.036995680347196136, + 0.036995680347196136 ], linf=[ 0.01982294164697862, 0.01840725612418126, 0.01840725612418148, 0.01840725612418148, - 0.05736595182767079, + 0.05736595182767079 ]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) @@ -230,14 +230,14 @@ end 0.03596196296013507, 0.03616867188152877, 0.03616867188152873, - 0.14939041550302212, + 0.14939041550302212 ], linf=[ 0.07943789383956079, 0.06389365911606859, 0.06469291944863809, 0.0646929194486372, - 0.23507781748792533, + 0.23507781748792533 ]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities)