Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/callbacks_step/euler_acoustics_coupling_dg2d.jl
2055 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 calc_acoustic_sources!(acoustic_source_terms, u_euler, u_acoustics,
9
vorticity_mean,
10
coupled_element_ids, mesh,
11
equations::AbstractCompressibleEulerEquations{2},
12
dg::DGSEM, cache)
13
acoustic_source_terms .= zero(eltype(acoustic_source_terms))
14
15
@threaded for k in eachindex(coupled_element_ids)
16
element = coupled_element_ids[k]
17
18
for j in eachnode(dg), i in eachnode(dg)
19
vorticity = calc_vorticity_node(u_euler, mesh, equations, dg, cache, i, j,
20
element)
21
22
prim_euler = cons2prim(get_node_vars(u_euler, equations, dg, i, j, element),
23
equations)
24
v1 = prim_euler[2]
25
v2 = prim_euler[3]
26
v1_mean = u_acoustics[4, i, j, element]
27
v2_mean = u_acoustics[5, i, j, element]
28
29
vorticity_prime = vorticity - vorticity_mean[i, j, element]
30
v1_prime = v1 - v1_mean
31
v2_prime = v2 - v2_mean
32
33
acoustic_source_terms[1, i, j, k] -= -vorticity_prime * v2_mean -
34
vorticity_mean[i, j, element] *
35
v2_prime
36
acoustic_source_terms[2, i, j, k] -= vorticity_prime * v1_mean +
37
vorticity_mean[i, j, element] *
38
v1_prime
39
end
40
end
41
42
return nothing
43
end
44
end # @muladd
45
46