Finite-Volume Schemes

This section contains details related to the implementation of finite-volume schemes. Note that the flux-related methods are implemented using Cython.

Solving Equations in Characteristic Space

To solve hyperbolic systems of equations, we use an upwind scheme in characteristic space. The process begins by computing the Jacobian matrix , where is the flux function and represents the conservative variables. The Jacobian is evaluated at the central state .

Step 1: Eigenvalue Decomposition

Next, the Jacobian matrix is decomposed into its eigenvalues and eigenvectors:

where is the diagonal matrix of eigenvalues , and is the matrix of right eigenvectors.

Step 2: Transformation to Characteristic Variables

The conservative variables (left state), (central state), and (right state) are transformed into characteristic variables using the inverse of the eigenvector matrix:

where represents the characteristic variables.

Step 3: Scheme Application - Upwind Fluxes in Characteristic Space

Once the characteristic variables are computed, the fluxes are computed using any specified scheme. For the sake of disucssion, we will use the upwind scheme.

For each characteristic, the direction of the wave is determined by the sign of the corresponding eigenvalue :

  • If , the wave moves to the right, and the flux at the west (left) side is determined using the left state, while the flux at the east (right) side is determined using the central state. This corresponds to the 'upwind' direction.
  • If , the wave moves to the left, and the flux at the west side is determined using the central state, while the flux at the east side is determined using the right state. As the wave moves to the left in this case, the upwind direction is to the right.

The characteristic fluxes are computed as:

Step 4: Transformation Back to Conservative Variables

After computing the fluxes in characteristic space, they are transformed back to the original conservative variable space using the eigenvector matrix :

Thus, the west (left) and east (right) fluxes and are obtained in the original space.

This method allows the fluxes to be accurately computed by considering wave propagation direction, ensuring stability and correctness in solving hyperbolic systems.

fluxes(F, cell_sub, scheme, dFdU=None, limiter=None) method descriptor

Calculate the fluxes for a given stencil and numerical scheme with limiters.

This function calculates the west and east fluxes for a given stencil of cells, using the specified finite volume scheme. Optionally, a slope limiter can be applied to reduce non-physical oscillations in the fluxes.

Parameters:
  • F (function) –

    The flux function, which defines the relationship between the values of the conserved quantities and their fluxes.

  • cell_sub (list of Cell) –

    The stencil of cells over which the fluxes are calculated.

  • scheme (FVSchemes) –

    The finite volume scheme to use for flux calculations. Available options include:

    • LAX_FRIEDRICHS: Lax-Friedrichs scheme
    • UPWIND: Upwind differencing scheme
    • CENTRAL: Central differencing scheme
  • dFdU (function, default: None ) –

    The Jacobian of the flux function, used for schemes that require knowledge of wave propagation direction (e.g., upwind schemes).

Returns:
  • tuple of numpy.ndarray

    The west (Fw) and east (Fe) fluxes computed using the given scheme.

Raises:
  • SFXM

    If the stencil size is not appropriate for the chosen scheme.

Notes

Each scheme has its own method of calculating fluxes:

  • LAX_FRIEDRICHS: Uses a central average with a diffusive term.
  • UPWIND: Chooses fluxes based on the direction of the flow.
  • CENTRAL: Takes a simple average of fluxes at the cell interfaces.

diffusion_fluxes(D, cell_sub, scheme) method descriptor

Calculate the diffusion fluxes of a given stencil.

Parameters:
  • D (function) –

    The diffusion function.

  • cell_sub (list of Cell) –

    The stencil.

  • scheme

    The finite-volume scheme to use. Defaults to central scheme for now.

Returns:
  • tuple of numpy.ndarray

    The west and east diffusion fluxes.