Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/solvers/fdsbp_tree/fdsbp.jl
5591 views
1
# !!! warning "Experimental implementation (upwind SBP)"
2
# This is an experimental feature and may change in future releases.
3
4
# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).
5
# Since these FMAs can increase the performance of many numerical algorithms,
6
# we need to opt-in explicitly.
7
# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.
8
@muladd begin
9
#! format: noindent
10
11
"""
12
FDSBP(D_SBP; surface_integral, volume_integral)
13
14
Specialization of [`DG`](@ref) methods that uses general summation by parts (SBP)
15
operators from
16
[SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl).
17
In particular, this includes classical finite difference (FD) SBP methods.
18
These methods have the same structure as classical DG methods - local operations
19
on elements with connectivity through interfaces without imposing any continuity
20
constraints.
21
22
`D_SBP` is an SBP derivative operator from SummationByPartsOperators.jl.
23
The other arguments have the same meaning as in [`DG`](@ref) or [`DGSEM`](@ref).
24
25
!!! warning "Experimental implementation (upwind SBP)"
26
This is an experimental feature and may change in future releases.
27
"""
28
const FDSBP = DG{Basis} where {Basis <: AbstractDerivativeOperator}
29
30
# Internal abbreviation for easier-to-read dispatch (not exported)
31
const PeriodicFDSBP = FDSBP{Basis} where {Basis <: AbstractPeriodicDerivativeOperator}
32
33
function FDSBP(D_SBP::AbstractDerivativeOperator; surface_integral, volume_integral)
34
# `nothing` is passed as `mortar`
35
return DG(D_SBP, nothing, surface_integral, volume_integral)
36
end
37
38
# General interface methods for SummationByPartsOperators.jl and Trixi.jl
39
nnodes(D::AbstractDerivativeOperator) = size(D, 1)
40
eachnode(D::AbstractDerivativeOperator) = Base.OneTo(nnodes(D))
41
get_nodes(D::AbstractDerivativeOperator) = grid(D)
42
43
# TODO: This is hack to enable the FDSBP solver to use the
44
# `SaveSolutionCallback`.
45
polydeg(D::AbstractDerivativeOperator) = size(D, 1) - 1
46
polydeg(fdsbp::FDSBP) = polydeg(fdsbp.basis)
47
48
# TODO: FD. No mortars supported at the moment
49
init_mortars(cell_ids, mesh, elements, mortar::Nothing) = nothing
50
create_cache(mesh, equations, mortar::Nothing, uEltype) = NamedTuple()
51
nmortars(mortar::Nothing) = 0
52
53
function prolong2mortars!(cache, u, mesh, equations, mortar::Nothing,
54
dg::DG)
55
@assert isempty(eachmortar(dg, cache))
56
end
57
58
function calc_mortar_flux!(surface_flux_values, mesh,
59
have_nonconservative_terms, equations,
60
mortar::Nothing,
61
surface_integral, dg::DG, cache)
62
@assert isempty(eachmortar(dg, cache))
63
end
64
65
# We do not use a specialized setup to analyze solutions
66
SolutionAnalyzer(D::AbstractDerivativeOperator) = D
67
68
# dimension-specific implementations
69
include("fdsbp_1d.jl")
70
include("fdsbp_2d.jl")
71
include("fdsbp_3d.jl")
72
end # @muladd
73
74