Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/solvers/dgsem/dgsem.jl
5591 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
# Include utilities
9
include("interpolation.jl")
10
include("l2projection.jl")
11
include("basis_lobatto_legendre.jl")
12
include("basis_gauss_legendre.jl")
13
14
"""
15
DGSEM(; RealT=Float64,
16
polydeg::Integer,
17
basis_type = LobattoLegendreBasis,
18
surface_flux=flux_central,
19
surface_integral=SurfaceIntegralWeakForm(surface_flux),
20
volume_integral=VolumeIntegralWeakForm())
21
22
Create a discontinuous Galerkin spectral element method (DGSEM) using a
23
[`LobattoLegendreBasis`](@ref) or a [`GaussLegendreBasis`](@ref) with polynomials of degree `polydeg`.
24
"""
25
const DGSEM = DG{Basis} where {Basis <: AbstractBasisSBP}
26
27
# This API is no longer documented, and we recommend avoiding its public use.
28
function DGSEM(basis::AbstractBasisSBP,
29
surface_flux = flux_central,
30
volume_integral = VolumeIntegralWeakForm(),
31
mortar = MortarL2(basis))
32
surface_integral = SurfaceIntegralWeakForm(surface_flux)
33
return DG{typeof(basis), typeof(mortar), typeof(surface_integral),
34
typeof(volume_integral)}(basis, mortar, surface_integral, volume_integral)
35
end
36
37
# This API is no longer documented, and we recommend avoiding its public use.
38
function DGSEM(basis::AbstractBasisSBP,
39
surface_integral::AbstractSurfaceIntegral,
40
volume_integral = VolumeIntegralWeakForm(),
41
mortar = MortarL2(basis))
42
return DG{typeof(basis), typeof(mortar), typeof(surface_integral),
43
typeof(volume_integral)}(basis, mortar, surface_integral, volume_integral)
44
end
45
46
# This API is no longer documented, and we recommend avoiding its public use.
47
function DGSEM(RealT, polydeg::Integer,
48
surface_flux = flux_central,
49
volume_integral = VolumeIntegralWeakForm(),
50
mortar = MortarL2(LobattoLegendreBasis(RealT, polydeg)))
51
basis = LobattoLegendreBasis(RealT, polydeg)
52
53
return DGSEM(basis, surface_flux, volume_integral, mortar)
54
end
55
56
# This API is no longer documented, and we recommend avoiding its public use.
57
function DGSEM(polydeg::Integer, surface_flux = flux_central,
58
volume_integral = VolumeIntegralWeakForm())
59
return DGSEM(Float64, polydeg, surface_flux, volume_integral)
60
end
61
62
# The constructor using only keyword arguments is convenient for elixirs since
63
# it allows to modify the polynomial degree and other parameters via
64
# `trixi_include`.
65
function DGSEM(; RealT = Float64,
66
polydeg::Integer,
67
basis_type = LobattoLegendreBasis,
68
surface_flux = flux_central,
69
surface_integral = SurfaceIntegralWeakForm(surface_flux),
70
volume_integral = VolumeIntegralWeakForm())
71
basis = basis_type(RealT, polydeg)
72
return DGSEM(basis, surface_integral, volume_integral)
73
end
74
75
@inline polydeg(dg::DGSEM) = polydeg(dg.basis)
76
77
Base.summary(io::IO, dg::DGSEM) = print(io, "DGSEM(polydeg=$(polydeg(dg)))")
78
79
include("compute_u_mean.jl")
80
81
include("containers.jl")
82
83
include("indicators.jl")
84
include("special_volume_integrals.jl")
85
include("calc_volume_integral.jl")
86
end # @muladd
87
88