Path: blob/main/src/solvers/dgsem_structured/indicators_3d.jl
5590 views
# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).1# Since these FMAs can increase the performance of many numerical algorithms,2# we need to opt-in explicitly.3# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.4@muladd begin5#! format: noindent67function apply_smoothing!(mesh::StructuredMesh{3}, alpha, alpha_tmp, dg, cache)8# Diffuse alpha values by setting each alpha to at least 50% of neighboring elements' alpha9# Copy alpha values such that smoothing is indpedenent of the element access order10alpha_tmp .= alpha1112# So far, alpha smoothing doesn't work for non-periodic initial conditions for structured meshes.13@assert isperiodic(mesh) "alpha smoothing for structured meshes works only with periodic initial conditions so far"1415# Loop over elements, because there is no interface container16for element in eachelement(dg, cache)17# Get neighboring element ids18left = cache.elements.left_neighbors[1, element]19lower = cache.elements.left_neighbors[2, element]20front = cache.elements.left_neighbors[3, element]2122# Apply smoothing23alpha[left] = max(alpha_tmp[left], 0.5f0 * alpha_tmp[element], alpha[left])24alpha[element] = max(alpha_tmp[element], 0.5f0 * alpha_tmp[left],25alpha[element])2627alpha[lower] = max(alpha_tmp[lower], 0.5f0 * alpha_tmp[element], alpha[lower])28alpha[element] = max(alpha_tmp[element], 0.5f0 * alpha_tmp[lower],29alpha[element])3031alpha[front] = max(alpha_tmp[front], 0.5f0 * alpha_tmp[element], alpha[front])32alpha[element] = max(alpha_tmp[element], 0.5f0 * alpha_tmp[front],33alpha[element])34end3536return nothing37end38end # @muladd394041