Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/callbacks_step/steady_state_dg1d.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 (steady_state_callback::SteadyStateCallback)(du, u, mesh::AbstractMesh{1},
9
equations, dg::DG, cache)
10
@unpack abstol, reltol = steady_state_callback
11
12
terminate = true
13
for element in eachelement(dg, cache)
14
for i in eachnode(dg)
15
u_local = get_node_vars(u, equations, dg, i, element)
16
du_local = get_node_vars(du, equations, dg, i, element)
17
threshold = abstol + reltol * residual_steady_state(u_local, equations)
18
terminate = terminate &&
19
residual_steady_state(du_local, equations) <= threshold
20
end
21
end
22
23
return terminate
24
end
25
end # @muladd
26
27