Skip to content

Equation

# homemade_conslaws.EquationType.

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

source

Dispatch functions

An implementation of Equation should provide the following functions:

# homemade_conslaws.compute_eigenvaluesFunction.

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

source

# homemade_conslaws.compute_max_abs_eigenvalueFunction.

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

source

Implementations

Burgers' equation

# homemade_conslaws.BurgersEQType.

BurgersEQ

The standard Burgers equation \(u_t + \qty(\frac12 u^2)_x = 0\) used as a test case for hyperbolic PDE solvers.

source


Shallow water equations

# homemade_conslaws.ShallowWater1DType.

ShallowWater1D(g)

Shallow water equations in 1D with gravity g. It is given by the flux function

\[ f(h, hu) = \begin{pmatrix} hu \\ \frac{hu^2}{h} + \frac{1}{2} g h^2 \end{pmatrix} \]

where \(h\) is the water height and \(hu\) is the momentum.

source