Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/solvers/dgsem_unstructured/indicators_2d.jl
5590 views
1
# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).
2
# Since these FMAs can increase the performance of many numerical algorithms,
3
# we need to opt-in explicitly.
4
# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.
5
@muladd begin
6
#! format: noindent
7
8
function apply_smoothing!(mesh::UnstructuredMesh2D, alpha, alpha_tmp, dg, cache)
9
# Diffuse alpha values by setting each alpha to at least 50% of neighboring elements' alpha
10
# Copy alpha values such that smoothing is indpedenent of the element access order
11
alpha_tmp .= alpha
12
13
# Loop over interfaces
14
for interface in eachinterface(dg, cache)
15
# Get neighboring element ids
16
left = cache.interfaces.element_ids[1, interface]
17
right = cache.interfaces.element_ids[2, interface]
18
19
# Apply smoothing
20
alpha[left] = max(alpha_tmp[left], 0.5f0 * alpha_tmp[right], alpha[left])
21
alpha[right] = max(alpha_tmp[right], 0.5f0 * alpha_tmp[left], alpha[right])
22
end
23
24
return nothing
25
end
26
end # @muladd
27
28