Skip to content

Commit

Permalink
Fix entropy limiter for StructuredMesh
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibolm committed Nov 20, 2023
1 parent 1aa2eaf commit 4830bbb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
7 changes: 3 additions & 4 deletions src/solvers/dgsem_tree/subcell_limiters_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion test/test_structured_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4830bbb

Please sign in to comment.