Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstrings for flux_godunov and flux_ec #2219

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 2D 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 3D 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 2D 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 3D 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 1D 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 2D 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 3D 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
Loading