Equation
#
homemade_conslaws.Equation
— Type.
Equation
Describes the flux term \(f\) in a conservation law \(u_t + f(u)_x = 0\). Should be a callable object of the form (::Equation)(U)
computing the flux at U
.
Example
julia> eq = BurgersEQ();
julia> eq.(-2:2)
5-element Vector{Float64}:
2.0
0.5
0.0
0.5
2.0
Dispatch functions
An implementation of Equation
should provide the following functions:
#
homemade_conslaws.compute_eigenvalues
— Function.
compute_eigenvalues(eq::Equation, U)
Compute the eigenvalues of the flux Jacobian \(f'(U)\) at U
for the equation eq
.
Example
julia> eq = BurgersEQ();
julia> compute_eigenvalues(eq, -2)
-2
julia> compute_eigenvalues(eq, 0)
0
julia> compute_eigenvalues(eq, 2)
2
#
homemade_conslaws.compute_max_abs_eigenvalue
— Function.
compute_max_abs_eigenvalue(eq::Equation, U)
Compute the maximum absolute eigenvalue of the flux Jacobian \(f'(U)\) at U
for the equation eq
. Used to compute the time step given the CFL condition.
Example
julia> eq = BurgersEQ();
julia> compute_max_abs_eigenvalue(eq, -2)
2
julia> compute_max_abs_eigenvalue(eq, 0)
0
julia> compute_max_abs_eigenvalue(eq, 2)
2
Implementations
Burgers' equation
#
homemade_conslaws.BurgersEQ
— Type.
BurgersEQ
The standard Burgers equation \(u_t + \qty(\frac12 u^2)_x = 0\) used as a test case for hyperbolic PDE solvers.
Shallow water equations
#
homemade_conslaws.ShallowWater1D
— Type.
ShallowWater1D(g)
Shallow water equations in 1D with gravity g
. It is given by the flux function
where \(h\) is the water height and \(hu\) is the momentum.