From 4830bbbbbeebee25276c203a2378a5380c4f9da1 Mon Sep 17 00:00:00 2001 From: bennibolm Date: Mon, 20 Nov 2023 12:02:29 +0100 Subject: [PATCH] Fix entropy limiter for StructuredMesh --- .../elixir_euler_shock_upstream_sc_subcell.jl | 4 ++-- src/solvers/dgsem_tree/subcell_limiters_2d.jl | 7 +++---- test/test_structured_2d.jl | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/examples/structured_2d_dgsem/elixir_euler_shock_upstream_sc_subcell.jl b/examples/structured_2d_dgsem/elixir_euler_shock_upstream_sc_subcell.jl index 303cfa71de7..3bfa0271978 100644 --- a/examples/structured_2d_dgsem/elixir_euler_shock_upstream_sc_subcell.jl +++ b/examples/structured_2d_dgsem/elixir_euler_shock_upstream_sc_subcell.jl @@ -96,7 +96,7 @@ mapping_as_string = "a = sqrt(5.9^2 - 3.85^2); alpha = acos(3.85 / 5.9); l = (pi "f4(s) = SVector(0.0, -(a - 1.0) * 0.5 * (s + 1.0) + a); " * "faces = (f1, f2, f3, f4); mapping = Trixi.transfinite_mapping(faces)" -cells_per_dimension = (24, 36) +cells_per_dimension = (8, 12) mesh = StructuredMesh(cells_per_dimension, mapping_bow, mapping_as_string = mapping_as_string, periodicity = false) @@ -107,7 +107,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, ############################################################################### # ODE solvers, callbacks etc. -tspan = (0.0, 10.0) +tspan = (0.0, 2.0) ode = semidiscretize(semi, tspan) summary_callback = SummaryCallback() diff --git a/src/solvers/dgsem_tree/subcell_limiters_2d.jl b/src/solvers/dgsem_tree/subcell_limiters_2d.jl index 116658cea99..01764a3996b 100644 --- a/src/solvers/dgsem_tree/subcell_limiters_2d.jl +++ b/src/solvers/dgsem_tree/subcell_limiters_2d.jl @@ -485,7 +485,7 @@ end # Perform Newton's bisection method to find new alpha @threaded for element in elements for j in eachnode(dg), i in eachnode(dg) - inverse_jacobian = cache.elements.inverse_jacobian[element] + inverse_jacobian = cache.elements.inverse_jacobian[i, j, element] u_local = get_node_vars(u, equations, dg, i, j, element) newton_loops_alpha!(alpha, s_min[i, j, element], u_local, inverse_jacobian, i, j, element, dt, equations, dg, cache, limiter, @@ -525,8 +525,7 @@ end end @inline function idp_math_entropy!(alpha, limiter, u, t, dt, semi, - mesh::StructuredMesh{2}, - elements) + mesh::StructuredMesh{2}, elements) _, equations, dg, cache = mesh_equations_solver_cache(semi) (; variable_bounds) = limiter.cache.subcell_limiter_coefficients s_max = variable_bounds[:math_entropy_max] @@ -537,7 +536,7 @@ end # Perform Newton's bisection method to find new alpha @threaded for element in elements for j in eachnode(dg), i in eachnode(dg) - inverse_jacobian = cache.elements.inverse_jacobian[element] + inverse_jacobian = cache.elements.inverse_jacobian[i, j, element] u_local = get_node_vars(u, equations, dg, i, j, element) newton_loops_alpha!(alpha, s_max[i, j, element], u_local, inverse_jacobian, i, j, element, dt, equations, dg, cache, limiter, diff --git a/test/test_structured_2d.jl b/test/test_structured_2d.jl index 405709242c6..622d6daf2e2 100644 --- a/test/test_structured_2d.jl +++ b/test/test_structured_2d.jl @@ -664,7 +664,6 @@ end 10.06523457762742, 51.00903155017642, ], - cells_per_dimension=(8, 12), tspan=(0.0, 0.5)) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities)