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

Speed up bar states bounds calculation of entropies #120

Merged
merged 3 commits into from
Nov 23, 2023
Merged
Changes from 2 commits
Commits
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
63 changes: 42 additions & 21 deletions src/solvers/dgsem_tree/dg_2d_subcell_limiters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -909,26 +909,36 @@ end
s_min[i, j, element] = typemax(eltype(s_min))
end
for j in eachnode(dg), i in eachnode(dg)
# FV solution at node (i, j)
s = entropy_spec(get_node_vars(u, equations, dg, i, j, element),
equations)
s_min[i, j, element] = min(s_min[i, j, element], s)
# TODO: Add source?
# - xi direction
# TODO: Add source term!
# xi direction: subcell face between (i-1, j) and (i, j)
s = entropy_spec(get_node_vars(bar_states1, equations, dg, i, j,
element), equations)
s_min[i, j, element] = min(s_min[i, j, element], s)
# + xi direction
s = entropy_spec(get_node_vars(bar_states1, equations, dg, i + 1, j,
element), equations)
s_min[i, j, element] = min(s_min[i, j, element], s)
# - eta direction
if i > 1
s_min[i - 1, j, element] = min(s_min[i - 1, j, element], s)
end
# eta direction: subcell face between (i, j-1) and (i, j)
s = entropy_spec(get_node_vars(bar_states2, equations, dg, i, j,
element), equations)
s_min[i, j, element] = min(s_min[i, j, element], s)
# + eta direction
s = entropy_spec(get_node_vars(bar_states2, equations, dg, i, j + 1,
element), equations)
s_min[i, j, element] = min(s_min[i, j, element], s)
if j > 1
s_min[i, j - 1, element] = min(s_min[i, j - 1, element], s)
end
end
for i in eachnode(dg)
# interface/boundary of (nnodes(dg), i) in positive xi direction
s = entropy_spec(get_node_vars(bar_states1, equations, dg,
nnodes(dg) + 1, i, element), equations)
s_min[nnodes(dg), i, element] = min(s_min[nnodes(dg), i, element], s)

# interface/boundary of (i, nnodes(dg)) in positive eta direction
s = entropy_spec(get_node_vars(bar_states2, equations, dg, i,
nnodes(dg) + 1, element), equations)
s_min[i, nnodes(dg), element] = min(s_min[i, nnodes(dg), element], s)
end
bennibolm marked this conversation as resolved.
Show resolved Hide resolved
end
end
Expand All @@ -940,25 +950,36 @@ end
s_max[i, j, element] = typemin(eltype(s_max))
end
for j in eachnode(dg), i in eachnode(dg)
# FV solution at node (i, j)
s = entropy_math(get_node_vars(u, equations, dg, i, j, element),
equations)
s_max[i, j, element] = max(s_max[i, j, element], s)
# - xi direction
# TODO: Add source term!
# xi direction: subcell face between (i-1, j) and (i, j)
s = entropy_math(get_node_vars(bar_states1, equations, dg, i, j,
element), equations)
s_max[i, j, element] = max(s_max[i, j, element], s)
# + xi direction
s = entropy_math(get_node_vars(bar_states1, equations, dg, i + 1, j,
element), equations)
s_max[i, j, element] = max(s_max[i, j, element], s)
# - eta direction
if i > 1
s_max[i - 1, j, element] = max(s_max[i - 1, j, element], s)
end
# eta direction: subcell face between (i, j-1) and (i, j)
s = entropy_math(get_node_vars(bar_states2, equations, dg, i, j,
element), equations)
s_max[i, j, element] = max(s_max[i, j, element], s)
# + eta direction
s = entropy_math(get_node_vars(bar_states2, equations, dg, i, j + 1,
element), equations)
s_max[i, j, element] = max(s_max[i, j, element], s)
if j > 1
s_max[i, j - 1, element] = max(s_max[i, j - 1, element], s)
end
end
for i in eachnode(dg)
# interface/boundary of (nnodes(dg), i) in positive xi direction
s = entropy_math(get_node_vars(bar_states1, equations, dg,
nnodes(dg) + 1, i, element), equations)
s_max[nnodes(dg), i, element] = max(s_max[nnodes(dg), i, element], s)

# interface/boundary of (i, nnodes(dg)) in positive eta direction
s = entropy_math(get_node_vars(bar_states2, equations, dg, i,
nnodes(dg) + 1, element), equations)
s_max[i, nnodes(dg), element] = max(s_max[i, nnodes(dg), element], s)
end
end
end
Expand Down