Skip to content

Commit

Permalink
Docstrings for flux_godunov and flux_ec
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Dec 30, 2024
1 parent f09a707 commit 443c75d
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 13 deletions.
6 changes: 6 additions & 0 deletions src/equations/hyperbolic_diffusion_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ end
sqrt(equations.nu * equations.inv_Tr) * norm(normal_direction)
end

"""
flux_godunov(u_ll, u_rr, orientation_or_normal_direction,
equations::HyperbolicDiffusionEquations2D)
Godunov (upwind) flux for the hyperbolic diffusion equations.
"""
@inline function flux_godunov(u_ll, u_rr, orientation::Integer,
equations::HyperbolicDiffusionEquations2D)
# Obtain left and right fluxes
Expand Down
6 changes: 6 additions & 0 deletions src/equations/hyperbolic_diffusion_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ end
λ_max = sqrt(equations.nu * equations.inv_Tr)
end

"""
flux_godunov(u_ll, u_rr, orientation_or_normal_direction,
equations::HyperbolicDiffusionEquations3D)
Godunov (upwind) flux for the hyperbolic diffusion equations.
"""
@inline function flux_godunov(u_ll, u_rr, orientation::Integer,
equations::HyperbolicDiffusionEquations3D)
# Obtain left and right fluxes
Expand Down
18 changes: 15 additions & 3 deletions src/equations/inviscid_burgers_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,28 @@ end
return (abs(u[1]),)
end

# (Symmetric) Entropy Conserving flux
@doc raw"""
flux_ec(u_ll, u_rr, orientation, equations::InviscidBurgersEquation1D)
Entropy-conserving, symmetric flux for the inviscid Burgers' equation.
```math
F(u_L, u_R) = \frac{u_L^2 + u_L u_R + u_R^2}{6}
```
"""
function flux_ec(u_ll, u_rr, orientation, equation::InviscidBurgersEquation1D)
u_L = u_ll[1]
u_R = u_rr[1]

return SVector((u_L^2 + u_L * u_R + u_R^2) / 6)
end

# See https://metaphor.ethz.ch/x/2019/hs/401-4671-00L/literature/mishra_hyperbolic_pdes.pdf ,
# section 4.1.5 and especially equation (4.16).
"""
flux_godunov(u_ll, u_rr, orientation, equations::InviscidBurgersEquation1D)
Godunov (upwind) numerical flux for the inviscid Burgers' equation.
See https://metaphor.ethz.ch/x/2019/hs/401-4671-00L/literature/mishra_hyperbolic_pdes.pdf ,
section 4.1.5 and especially equation (4.16).
"""
function flux_godunov(u_ll, u_rr, orientation, equation::InviscidBurgersEquation1D)
u_L = u_ll[1]
u_R = u_rr[1]
Expand Down
6 changes: 6 additions & 0 deletions src/equations/lattice_boltzmann_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ end
# λ_max =
# end

"""
flux_godunov(u_ll, u_rr, orientation,
equations::LatticeBoltzmannEquations2D)
Godunov (upwind) flux for the Lattice-Boltzmann equations.
"""
@inline function flux_godunov(u_ll, u_rr, orientation::Integer,
equations::LatticeBoltzmannEquations2D)
if orientation == 1
Expand Down
6 changes: 6 additions & 0 deletions src/equations/lattice_boltzmann_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ end
# λ_max =
# end

"""
flux_godunov(u_ll, u_rr, orientation,
equations::LatticeBoltzmannEquations3D)
Godunov (upwind) flux for the Lattice-Boltzmann equations.
"""
@inline function flux_godunov(u_ll, u_rr, orientation::Integer,
equations::LatticeBoltzmannEquations3D)
if orientation == 1 # x-direction
Expand Down
9 changes: 7 additions & 2 deletions src/equations/linear_scalar_advection_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,13 @@ end
λ_max = abs(equation.advection_velocity[orientation])
end

# Essentially first order upwind, see e.g.
# https://math.stackexchange.com/a/4355076/805029
"""
flux_godunov(u_ll, u_rr, orientation,
equations::LinearScalarAdvectionEquation1D)
Godunov (upwind) flux for the linear scalar advection equation.
Essentially first order upwind, see e.g. https://math.stackexchange.com/a/4355076/805029 .
"""
function flux_godunov(u_ll, u_rr, orientation::Int,
equation::LinearScalarAdvectionEquation1D)
u_L = u_ll[1]
Expand Down
11 changes: 7 additions & 4 deletions src/equations/linear_scalar_advection_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,13 @@ end
return abs(a)
end

# Essentially first order upwind, see e.g.
# https://math.stackexchange.com/a/4355076/805029
"""
flux_godunov(u_ll, u_rr, orientation_or_normal_direction,
equations::LinearScalarAdvectionEquation2D)
Godunov (upwind) flux for the linear scalar advection equation.
Essentially first order upwind, see e.g. https://math.stackexchange.com/a/4355076/805029 .
"""
function flux_godunov(u_ll, u_rr, orientation::Integer,
equation::LinearScalarAdvectionEquation2D)
u_L = u_ll[1]
Expand All @@ -254,8 +259,6 @@ function flux_godunov(u_ll, u_rr, orientation::Integer,
end
end

# Essentially first order upwind, see e.g.
# https://math.stackexchange.com/a/4355076/805029
function flux_godunov(u_ll, u_rr, normal_direction::AbstractVector,
equation::LinearScalarAdvectionEquation2D)
u_L = u_ll[1]
Expand Down
11 changes: 7 additions & 4 deletions src/equations/linear_scalar_advection_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,13 @@ end
return abs(a)
end

# Essentially first order upwind, see e.g.
# https://math.stackexchange.com/a/4355076/805029
"""
flux_godunov(u_ll, u_rr, orientation_or_normal_direction,
equations::LinearScalarAdvectionEquation3D)
Godunov (upwind) flux for the linear scalar advection equation.
Essentially first order upwind, see e.g. https://math.stackexchange.com/a/4355076/805029 .
"""
function flux_godunov(u_ll, u_rr, orientation::Integer,
equation::LinearScalarAdvectionEquation3D)
u_L = u_ll[1]
Expand All @@ -173,8 +178,6 @@ function flux_godunov(u_ll, u_rr, orientation::Integer,
end
end

# Essentially first order upwind, see e.g.
# https://math.stackexchange.com/a/4355076/805029
function flux_godunov(u_ll, u_rr, normal_direction::AbstractVector,
equation::LinearScalarAdvectionEquation3D)
u_L = u_ll[1]
Expand Down

0 comments on commit 443c75d

Please sign in to comment.