Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/equations/compressible_navier_stokes.jl
2055 views
1
# TODO: can we generalize this to MHD?
2
"""
3
struct BoundaryConditionNavierStokesWall
4
5
Creates a wall-type boundary conditions for the compressible Navier-Stokes equations, see
6
[`CompressibleNavierStokesDiffusion1D`](@ref), [`CompressibleNavierStokesDiffusion2D`](@ref), and
7
[`CompressibleNavierStokesDiffusion3D`](@ref).
8
The fields `boundary_condition_velocity` and `boundary_condition_heat_flux` are intended
9
to be boundary condition types such as the [`NoSlip`](@ref) velocity boundary condition and the
10
[`Adiabatic`](@ref) or [`Isothermal`](@ref) heat boundary condition.
11
"""
12
struct BoundaryConditionNavierStokesWall{V, H}
13
boundary_condition_velocity::V
14
boundary_condition_heat_flux::H
15
end
16
17
"""
18
struct NoSlip
19
20
Use to create a no-slip boundary condition with [`BoundaryConditionNavierStokesWall`](@ref).
21
The field `boundary_value_function` should be a function with signature
22
`boundary_value_function(x, t, equations)` and return a `SVector{NDIMS}`
23
whose entries are the velocity vector at a point `x` and time `t`.
24
"""
25
struct NoSlip{F}
26
boundary_value_function::F # value of the velocity vector on the boundary
27
end
28
29
"""
30
struct Slip
31
32
Creates a symmetric velocity boundary condition which eliminates any normal velocity gradients across the boundary, i.e.,
33
allows only the tangential velocity gradients to be non-zero.
34
When combined with the heat boundary condition [`Adiabatic`](@ref), this creates a truly symmetric boundary condition.
35
Any boundary on which this combined boundary condition is applied thus acts as a symmetry plane for the flow.
36
In contrast to the [`NoSlip`](@ref) boundary condition, `Slip` does not require a function to be supplied.
37
38
The (purely) hyperbolic equivalent boundary condition is [`boundary_condition_slip_wall`](@ref) which
39
permits only tangential velocities.
40
41
This boundary condition can also be employed as a reflective wall.
42
43
Note that in 1D this degenerates to the [`NoSlip`](@ref) boundary condition which must be used instead.
44
45
!!! note
46
Currently this (velocity) boundary condition is only implemented for
47
[`P4estMesh`](@ref) and [`GradientVariablesPrimitive`](@ref).
48
"""
49
struct Slip end
50
51
"""
52
struct Isothermal
53
54
Used to create a no-slip boundary condition with [`BoundaryConditionNavierStokesWall`](@ref).
55
The field `boundary_value_function` should be a function with signature
56
`boundary_value_function(x, t, equations)` and return a scalar value for the
57
temperature at point `x` and time `t`.
58
"""
59
struct Isothermal{F}
60
boundary_value_function::F # value of the temperature on the boundary
61
end
62
63
"""
64
struct Adiabatic
65
66
Used to create a no-slip boundary condition with [`BoundaryConditionNavierStokesWall`](@ref).
67
The field `boundary_value_normal_flux_function` should be a function with signature
68
`boundary_value_normal_flux_function(x, t, equations)` and return a scalar value for the
69
normal heat flux at point `x` and time `t`.
70
"""
71
struct Adiabatic{F}
72
boundary_value_normal_flux_function::F # scaled heat flux 1/T * kappa * dT/dn
73
end
74
75
"""
76
`GradientVariablesPrimitive` is a gradient variable type parameter for the [`CompressibleNavierStokesDiffusion1D`](@ref),
77
[`CompressibleNavierStokesDiffusion2D`](@ref), and [`CompressibleNavierStokesDiffusion3D`](@ref).
78
The other available gradient variable type parameter is [`GradientVariablesEntropy`](@ref).
79
By default, the gradient variables are set to be `GradientVariablesPrimitive`.
80
"""
81
struct GradientVariablesPrimitive end
82
83
"""
84
`GradientVariablesEntropy` is a gradient variable type parameter for the [`CompressibleNavierStokesDiffusion1D`](@ref),
85
[`CompressibleNavierStokesDiffusion2D`](@ref), and [`CompressibleNavierStokesDiffusion3D`](@ref).
86
The other available gradient variable type parameter is [`GradientVariablesPrimitive`](@ref).
87
88
Specifying `GradientVariablesEntropy` uses the entropy variable formulation from
89
- Hughes, Mallet, Franca (1986)
90
A new finite element formulation for computational fluid dynamics: I. Symmetric forms of the
91
compressible Euler and Navier-Stokes equations and the second law of thermodynamics.
92
[https://doi.org/10.1016/0045-7825(86)90127-1](https://doi.org/10.1016/0045-7825(86)90127-1)
93
94
Under `GradientVariablesEntropy`, the Navier-Stokes discretization is provably entropy stable.
95
"""
96
struct GradientVariablesEntropy end
97
98
"""
99
dynamic_viscosity(u, equations)
100
101
Wrapper for the dynamic viscosity that calls
102
`dynamic_viscosity(u, equations.mu, equations)`, which dispatches on the type of
103
`equations.mu`.
104
For constant `equations.mu`, i.e., `equations.mu` is of `Real`-type it is returned directly.
105
In all other cases, `equations.mu` is assumed to be a function with arguments
106
`u` and `equations` and is called with these arguments.
107
"""
108
dynamic_viscosity(u, equations) = dynamic_viscosity(u, equations.mu, equations)
109
dynamic_viscosity(u, mu::Real, equations) = mu
110
dynamic_viscosity(u, mu::T, equations) where {T} = mu(u, equations)
111
112