Path: blob/main/src/equations/compressible_navier_stokes.jl
2055 views
# TODO: can we generalize this to MHD?1"""2struct BoundaryConditionNavierStokesWall34Creates a wall-type boundary conditions for the compressible Navier-Stokes equations, see5[`CompressibleNavierStokesDiffusion1D`](@ref), [`CompressibleNavierStokesDiffusion2D`](@ref), and6[`CompressibleNavierStokesDiffusion3D`](@ref).7The fields `boundary_condition_velocity` and `boundary_condition_heat_flux` are intended8to be boundary condition types such as the [`NoSlip`](@ref) velocity boundary condition and the9[`Adiabatic`](@ref) or [`Isothermal`](@ref) heat boundary condition.10"""11struct BoundaryConditionNavierStokesWall{V, H}12boundary_condition_velocity::V13boundary_condition_heat_flux::H14end1516"""17struct NoSlip1819Use to create a no-slip boundary condition with [`BoundaryConditionNavierStokesWall`](@ref).20The field `boundary_value_function` should be a function with signature21`boundary_value_function(x, t, equations)` and return a `SVector{NDIMS}`22whose entries are the velocity vector at a point `x` and time `t`.23"""24struct NoSlip{F}25boundary_value_function::F # value of the velocity vector on the boundary26end2728"""29struct Slip3031Creates a symmetric velocity boundary condition which eliminates any normal velocity gradients across the boundary, i.e.,32allows only the tangential velocity gradients to be non-zero.33When combined with the heat boundary condition [`Adiabatic`](@ref), this creates a truly symmetric boundary condition.34Any boundary on which this combined boundary condition is applied thus acts as a symmetry plane for the flow.35In contrast to the [`NoSlip`](@ref) boundary condition, `Slip` does not require a function to be supplied.3637The (purely) hyperbolic equivalent boundary condition is [`boundary_condition_slip_wall`](@ref) which38permits only tangential velocities.3940This boundary condition can also be employed as a reflective wall.4142Note that in 1D this degenerates to the [`NoSlip`](@ref) boundary condition which must be used instead.4344!!! note45Currently this (velocity) boundary condition is only implemented for46[`P4estMesh`](@ref) and [`GradientVariablesPrimitive`](@ref).47"""48struct Slip end4950"""51struct Isothermal5253Used to create a no-slip boundary condition with [`BoundaryConditionNavierStokesWall`](@ref).54The field `boundary_value_function` should be a function with signature55`boundary_value_function(x, t, equations)` and return a scalar value for the56temperature at point `x` and time `t`.57"""58struct Isothermal{F}59boundary_value_function::F # value of the temperature on the boundary60end6162"""63struct Adiabatic6465Used to create a no-slip boundary condition with [`BoundaryConditionNavierStokesWall`](@ref).66The field `boundary_value_normal_flux_function` should be a function with signature67`boundary_value_normal_flux_function(x, t, equations)` and return a scalar value for the68normal heat flux at point `x` and time `t`.69"""70struct Adiabatic{F}71boundary_value_normal_flux_function::F # scaled heat flux 1/T * kappa * dT/dn72end7374"""75`GradientVariablesPrimitive` is a gradient variable type parameter for the [`CompressibleNavierStokesDiffusion1D`](@ref),76[`CompressibleNavierStokesDiffusion2D`](@ref), and [`CompressibleNavierStokesDiffusion3D`](@ref).77The other available gradient variable type parameter is [`GradientVariablesEntropy`](@ref).78By default, the gradient variables are set to be `GradientVariablesPrimitive`.79"""80struct GradientVariablesPrimitive end8182"""83`GradientVariablesEntropy` is a gradient variable type parameter for the [`CompressibleNavierStokesDiffusion1D`](@ref),84[`CompressibleNavierStokesDiffusion2D`](@ref), and [`CompressibleNavierStokesDiffusion3D`](@ref).85The other available gradient variable type parameter is [`GradientVariablesPrimitive`](@ref).8687Specifying `GradientVariablesEntropy` uses the entropy variable formulation from88- Hughes, Mallet, Franca (1986)89A new finite element formulation for computational fluid dynamics: I. Symmetric forms of the90compressible Euler and Navier-Stokes equations and the second law of thermodynamics.91[https://doi.org/10.1016/0045-7825(86)90127-1](https://doi.org/10.1016/0045-7825(86)90127-1)9293Under `GradientVariablesEntropy`, the Navier-Stokes discretization is provably entropy stable.94"""95struct GradientVariablesEntropy end9697"""98dynamic_viscosity(u, equations)99100Wrapper for the dynamic viscosity that calls101`dynamic_viscosity(u, equations.mu, equations)`, which dispatches on the type of102`equations.mu`.103For constant `equations.mu`, i.e., `equations.mu` is of `Real`-type it is returned directly.104In all other cases, `equations.mu` is assumed to be a function with arguments105`u` and `equations` and is called with these arguments.106"""107dynamic_viscosity(u, equations) = dynamic_viscosity(u, equations.mu, equations)108dynamic_viscosity(u, mu::Real, equations) = mu109dynamic_viscosity(u, mu::T, equations) where {T} = mu(u, equations)110111112