Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/solvers/solvers_parabolic.jl
5586 views
1
"""
2
ParabolicFormulationBassiRebay1()
3
4
The classical BR1 flux from
5
6
- F. Bassi, S. Rebay (1997)
7
A High-Order Accurate Discontinuous Finite Element Method for
8
the Numerical Solution of the Compressible Navier-Stokes Equations
9
[DOI: 10.1006/jcph.1996.5572](https://doi.org/10.1006/jcph.1996.5572)
10
11
A more detailed study of the BR1 scheme for the DGSEM can be found in
12
- G. J. Gassner, A. R. Winters, F. J. Hindenlang, D. Kopriva (2018)
13
The BR1 Scheme is Stable for the Compressible Navier-Stokes Equations
14
[DOI: 10.1007/s10915-018-0702-1](https://doi.org/10.1007/s10915-018-0702-1)
15
16
The BR1 scheme works well for convection-dominated problems, but may cause instabilities or
17
reduced convergence for diffusion-dominated problems.
18
In the latter case, the [`ParabolicFormulationLocalDG`](@ref) scheme is recommended.
19
"""
20
struct ParabolicFormulationBassiRebay1 end
21
22
"""
23
flux_parabolic(u_ll, u_rr,
24
gradient_or_divergence, equations_parabolic,
25
parabolic_scheme::ParabolicFormulationBassiRebay1)
26
27
flux_parabolic(u_ll, u_rr, normal_direction::AbstractVector,
28
gradient_or_divergence, equations_parabolic,
29
parabolic_scheme::ParabolicFormulationBassiRebay1)
30
31
This computes the classical BR1 flux. Since the interface flux for both the
32
DG gradient and DG divergence under BR1 are identical, this function does
33
not need to be specialized for `Gradient` and `Divergence`.
34
35
`normal_direction` is not used in the BR1 flux,
36
but is included as an argument for consistency with the [`ParabolicFormulationLocalDG`](@ref) flux,
37
which does use the `normal_direction` to compute the LDG "switch" on the generally non-Cartesian [`P4estMesh`](@ref).
38
"""
39
function flux_parabolic(u_ll, u_rr, # Version for `TreeMesh`
40
gradient_or_divergence, equations_parabolic,
41
parabolic_scheme::ParabolicFormulationBassiRebay1)
42
return 0.5f0 * (u_ll + u_rr)
43
end
44
# Version for `P4estMesh`
45
function flux_parabolic(u_ll, u_rr, normal_direction::AbstractVector,
46
gradient_or_divergence, equations_parabolic,
47
parabolic_scheme::ParabolicFormulationBassiRebay1)
48
return 0.5f0 * (u_ll + u_rr)
49
end
50
51
"""
52
ParabolicFormulationLocalDG(penalty_parameter)
53
54
The local DG (LDG) flux from "The Local Discontinuous Galerkin Method for Time-Dependent
55
Convection-Diffusion Systems" by Cockburn and Shu (1998).
56
57
The parabolic "upwinding" vector is currently implemented for `TreeMesh`; for all other mesh types,
58
the LDG solver is equivalent to [`ParabolicFormulationBassiRebay1`](@ref) with an LDG-type penalization.
59
60
- Cockburn and Shu (1998).
61
The Local Discontinuous Galerkin Method for Time-Dependent
62
Convection-Diffusion Systems
63
[DOI: 10.1137/S0036142997316712](https://doi.org/10.1137/S0036142997316712)
64
"""
65
struct ParabolicFormulationLocalDG{P}
66
penalty_parameter::P
67
end
68
69
"""
70
ParabolicFormulationLocalDG()
71
72
The minimum dissipation local DG (LDG) flux from "An Analysis of the Minimal Dissipation Local
73
Discontinuous Galerkin Method for Convection–Diffusion Problems" by Cockburn and Dong (2007).
74
This scheme corresponds to an LDG parabolic "upwinding/downwinding" but no LDG penalty parameter.
75
Cockburn and Dong proved that this scheme is still stable despite the zero penalty parameter.
76
77
- Cockburn and Dong (2007)
78
An Analysis of the Minimal Dissipation Local Discontinuous
79
Galerkin Method for Convection–Diffusion Problems.
80
[DOI: 10.1007/s10915-007-9130-3](https://doi.org/10.1007/s10915-007-9130-3)
81
"""
82
ParabolicFormulationLocalDG() = ParabolicFormulationLocalDG(nothing)
83
84
@doc raw"""
85
flux_parabolic(u_ll, u_rr,
86
::Gradient, equations_parabolic,
87
parabolic_scheme::ParabolicFormulationLocalDG)
88
89
flux_parabolic(u_ll, u_rr, normal_direction,
90
::Gradient, equations_parabolic,
91
parabolic_scheme::ParabolicFormulationLocalDG)
92
93
These fluxes computes the gradient and divergence interface fluxes for the
94
local DG method. The local DG method uses an "upwind/downwind" flux for the
95
gradient and divergence (i.e., if the gradient is upwinded, the divergence
96
must be downwinded in order to preserve symmetry and positive definiteness).
97
Here, we use the convention that the gradient flux is upwinded, thus we have
98
```math
99
f_{\text{gradient}} = u_{L}
100
```
101
on the Cartesian [`TreeMesh`](@ref).
102
103
For the [`P4estMesh`](@ref), the `normal_direction` is used to compute the LDG "switch" ``\sigma`` for the upwinding.
104
This is realized by selecting the sign of the maximum (in absolute value sense) normal direction component,
105
which corresponds to the "dominant" direction of the interface normal.
106
```math
107
i = \text{argmax} \{ \begin{pmatrix} \vert n_1 \vert \\ \vert n_2 \vert \\ \dots \end{pmatrix} \}
108
\sigma = \text{sign} (n_i)
109
```
110
"""
111
function flux_parabolic(u_ll, u_rr, # Version for `TreeMesh`
112
::Gradient, equations_parabolic,
113
parabolic_scheme::ParabolicFormulationLocalDG)
114
# The LDG flux is {{f}} + beta * [[f]], where beta is the LDG "switch",
115
# which we set to -1 on the left and +1 on the right in 1D. The sign of the
116
# jump term should be opposite that of the sign used in the divergence flux.
117
# This is equivalent to setting the flux equal to `u_ll` for the gradient,
118
# and `u_rr` for the divergence.
119
return u_ll # Use the upwind value for the gradient interface flux
120
end
121
# Version for `P4estMesh`
122
function flux_parabolic(u_ll, u_rr, normal_direction,
123
::Gradient, equations_parabolic,
124
parabolic_scheme::ParabolicFormulationLocalDG)
125
# Use "Upwind in dominant direction" for LDG switch
126
abs_max_dir = argmax(abs.(normal_direction))
127
ldg_switch = sign(normal_direction[abs_max_dir])
128
return 0.5f0 * (u_ll + u_rr - ldg_switch * (u_rr - u_ll))
129
end
130
131
@doc raw"""
132
flux_parabolic(u_ll, u_rr,
133
::Divergence, equations_parabolic,
134
parabolic_scheme::ParabolicFormulationLocalDG)
135
136
flux_parabolic(u_ll, u_rr, normal_direction,
137
::Divergence, equations_parabolic,
138
parabolic_scheme::ParabolicFormulationLocalDG)
139
140
These fluxes computes the gradient and divergence interface fluxes for the
141
local DG method. The local DG method uses an "upwind/downwind" flux for the
142
gradient and divergence (i.e., if the gradient is upwinded, the divergence
143
must be downwinded in order to preserve symmetry and positive definiteness).
144
Here, we use the convention that, because the gradient flux is upwinded, the divergence flux is downwinded.
145
Thus we have
146
```math
147
f_{\text{divergence}} = u_{R}
148
```
149
on the Cartesian [`TreeMesh`](@ref).
150
151
For the [`P4estMesh`](@ref), the `normal_direction` is used to compute the LDG "switch" ``\sigma`` for the downwinding.
152
This is realized by selecting the sign of the maximum (in absolute value sense) normal direction component,
153
which corresponds to the "dominant" direction of the interface normal.
154
```math
155
i = \text{argmax} \{ \begin{pmatrix} \vert n_1 \vert \\ \vert n_2 \vert \\ \dots \end{pmatrix} \}
156
\sigma = -\text{sign} (n_i)
157
```
158
"""
159
function flux_parabolic(u_ll, u_rr, # Version for `TreeMesh`
160
::Divergence, equations_parabolic,
161
parabolic_scheme::ParabolicFormulationLocalDG)
162
return u_rr # Use the downwind value for the divergence interface flux
163
end
164
# Version for `P4estMesh`
165
function flux_parabolic(u_ll, u_rr, normal_direction,
166
::Divergence, equations_parabolic,
167
parabolic_scheme::ParabolicFormulationLocalDG)
168
# Use "Downwind in dominant direction" for LDG switch
169
abs_max_dir = argmax(abs.(normal_direction))
170
ldg_switch = -sign(normal_direction[abs_max_dir])
171
return 0.5f0 * (u_ll + u_rr - ldg_switch * (u_rr - u_ll))
172
end
173
174
default_parabolic_solver() = ParabolicFormulationBassiRebay1()
175
176