Path: blob/main/src/solvers/dgsem_structured/indicators_1d.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{1}, 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]1920# Apply smoothing21alpha[left] = max(alpha_tmp[left], 0.5f0 * alpha_tmp[element], alpha[left])22alpha[element] = max(alpha_tmp[element], 0.5f0 * alpha_tmp[left],23alpha[element])24end2526return nothing27end28end # @muladd293031