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

Add two-sided Zalesak-type IDP subcell limiting #1648

Merged
merged 35 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1a2eb00
Add two-sided limiting for conservative variables
bennibolm Sep 26, 2023
ab9e5d9
Fix visualization routines
bennibolm Sep 26, 2023
534f148
Add bounds calculation for BoundaryConditionDirichlet
bennibolm Sep 26, 2023
9b0eee9
Reduce cfl in elixir
bennibolm Sep 26, 2023
3e6f7f8
Fix test
bennibolm Sep 26, 2023
d7dcb75
Merge branch 'main' into subcell-limiting-minmax
bennibolm Oct 12, 2023
de23b58
Add comment about subcell limiting with non-conforming meshes
bennibolm Oct 13, 2023
96be070
Remove subcell visualization
bennibolm Oct 16, 2023
fb4d876
Fix last commit
bennibolm Oct 16, 2023
2d8b49d
Remove @unpack
bennibolm Oct 16, 2023
64cf39c
Add comment to `News.md`
bennibolm Oct 16, 2023
2d7ce45
Fix source for sedov blast setup; Formatting
bennibolm Oct 16, 2023
6f9d3d1
Reduce allocations
bennibolm Oct 18, 2023
39b39b6
Replace construction of Symbols
bennibolm Oct 20, 2023
9b8398c
Merge branch 'main' into subcell-limiting-minmax
bennibolm Oct 20, 2023
535f520
Add bounds check for local limiting
bennibolm Oct 22, 2023
5b2b888
Implement suggestions
bennibolm Oct 24, 2023
b7bed59
Fix format
bennibolm Oct 24, 2023
394c486
Merge branch 'main' into subcell-limiting-minmax
sloede Oct 25, 2023
09cbdae
Merge branch 'main' into subcell-limiting-minmax
bennibolm Nov 2, 2023
6d01643
Add subcell allocation tests; Add changes to minmax limiter
bennibolm Nov 2, 2023
306fb19
Undo changes in elixirs
bennibolm Nov 2, 2023
5adf14c
Implement suggestions
bennibolm Nov 2, 2023
29ed6ce
Skip positivity limiting if local limiting is more restrictive
bennibolm Nov 3, 2023
ea226d5
Reduce allocations
bennibolm Nov 3, 2023
953926a
Merge branch 'main' into subcell-limiting-minmax
bennibolm Nov 6, 2023
3afa4c1
Pass variables as strings instead of ints
bennibolm Nov 7, 2023
de20a89
Add `_nonperiodic` to elixir name
bennibolm Nov 7, 2023
50e7bc2
Merge branch 'main' into subcell-limiting-minmax
bennibolm Nov 7, 2023
fd3d531
Fix unit test
bennibolm Nov 7, 2023
5e81530
Implement suggestions
bennibolm Nov 8, 2023
07c0436
Add missing comma in export of bounds check deviation
bennibolm Nov 9, 2023
89f1b6e
Implement suggestions
bennibolm Nov 9, 2023
4b90e2e
Merge branch 'main' into subcell-limiting-minmax
sloede Nov 9, 2023
f7b8d0a
Merge branch 'main' into subcell-limiting-minmax
amrueda Nov 13, 2023
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
Prev Previous commit
Next Next commit
Merge branch 'main' into subcell-limiting-minmax
  • Loading branch information
bennibolm committed Oct 12, 2023
commit d7dcb75cae453ce4dc9f666f92e23b59b6ebf0b9
16 changes: 9 additions & 7 deletions src/solvers/dgsem_tree/subcell_limiters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ function SubcellLimiterIDP(equations::AbstractEquations, basis;
local_minmax = (length(local_minmax_variables_cons) > 0)
positivity = (length(positivity_variables_cons) > 0)

number_bounds = 2 * length(local_minmax_variables_cons)

for index in positivity_variables_cons
if !(index in local_minmax_variables_cons)
number_bounds += 1
bound_keys = ()
if local_minmax
for i in local_minmax_variables_cons
bound_keys = (bound_keys..., Symbol("$(i)_min"), Symbol("$(i)_max"))
end
end
for i in positivity_variables_cons
if !(i in local_minmax_variables_cons)
bound_keys = (bound_keys..., Symbol("$(i)_min"))
end
end

bound_keys = Tuple(Symbol("$(i)_min") for i in positivity_variables_cons)

cache = create_cache(SubcellLimiterIDP, equations, basis, bound_keys)

Expand Down
50 changes: 14 additions & 36 deletions src/solvers/dgsem_tree/subcell_limiters_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@

# this method is used when the limiter is constructed as for shock-capturing volume integrals
function create_cache(limiter::Type{SubcellLimiterIDP}, equations::AbstractEquations{2},
basis::LobattoLegendreBasis, number_bounds)
basis::LobattoLegendreBasis, bound_keys)
subcell_limiter_coefficients = Trixi.ContainerSubcellLimiterIDP2D{real(basis)
}(0,
nnodes(basis),
bound_keys)

idp_bounds_delta = zeros(real(basis), number_bounds)

return (; subcell_limiter_coefficients, idp_bounds_delta)
return (; subcell_limiter_coefficients)
end

function (limiter::SubcellLimiterIDP)(u::AbstractArray{<:Any, 4}, semi, dg::DGSEM, t,
Expand Down Expand Up @@ -151,19 +149,19 @@ end
end

@inline function idp_local_minmax!(alpha, limiter, u, t, dt, semi)
for (index, variable) in enumerate(limiter.local_minmax_variables_cons)
idp_local_minmax!(alpha, limiter, u, t, dt, semi, variable, index)
for variable in limiter.local_minmax_variables_cons
idp_local_minmax!(alpha, limiter, u, t, dt, semi, variable)
end

return nothing
end

@inline function idp_local_minmax!(alpha, limiter, u, t, dt, semi, variable, index)
mesh, _, dg, cache = mesh_equations_solver_cache(semi)
@inline function idp_local_minmax!(alpha, limiter, u, t, dt, semi, variable)
_, _, dg, cache = mesh_equations_solver_cache(semi)
@unpack variable_bounds = limiter.cache.subcell_limiter_coefficients

var_min = variable_bounds[2 * (index - 1) + 1]
var_max = variable_bounds[2 * (index - 1) + 2]
var_min = variable_bounds[Symbol("$(variable)_min")]
var_max = variable_bounds[Symbol("$(variable)_max")]
calc_bounds_2sided!(var_min, var_max, variable, u, t, semi)

@unpack antidiffusive_flux1, antidiffusive_flux2 = cache.antidiffusive_fluxes
Expand Down Expand Up @@ -229,33 +227,13 @@ end
end

@inline function idp_positivity!(alpha, limiter, u, dt, semi, variable)
mesh, equations, dg, cache = mesh_equations_solver_cache(semi)
@unpack antidiffusive_flux1, antidiffusive_flux2 = cache.antidiffusive_fluxes
@unpack inverse_weights = dg.basis
@unpack local_minmax, positivity_correction_factor = limiter

@unpack variable_bounds = limiter.cache.subcell_limiter_coefficients
_, _, dg, cache = mesh_equations_solver_cache(semi)
(; antidiffusive_flux1, antidiffusive_flux2) = cache.antidiffusive_fluxes
(; inverse_weights) = dg.basis
(; positivity_correction_factor) = limiter

counter = 2 * length(limiter.local_minmax_variables_cons)
if local_minmax
if variable in limiter.local_minmax_variables_cons
for (index_, variable_) in enumerate(limiter.local_minmax_variables_cons)
if variable == variable_
var_min = variable_bounds[2 * (index_ - 1) + 1]
break
end
end
else
for variable_ in limiter.positivity_variables_cons[1:index]
if !(variable_ in limiter.local_minmax_variables_cons)
counter += 1
end
end
var_min = variable_bounds[counter]
end
else
var_min = variable_bounds[counter + index]
end
(; variable_bounds) = limiter.cache.subcell_limiter_coefficients
var_min = variable_bounds[Symbol("$(variable)_min")]

@threaded for element in eachelement(dg, semi.cache)
inverse_jacobian = cache.elements.inverse_jacobian[element]
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.