Finite-Difference Schemes

This section contains details related to the implementation of finite-difference schemes. Note that the solver can utilize any finite-difference scheme, including asymmetric stencils. Additionally, the derivative-related methods are implemented using Cython.

Dx(F, cell_sub, scheme) method descriptor

Calculate the first derivative using a given function and stencil.

Parameters:
  • F (function) –

    A function that takes the values at the stencil points.

  • cell_sub (list of Cell) –

    The stencil, a list of cells around the point of interest.

  • scheme (FDSchemes) –

    The finite difference scheme to use (CENTRAL or RIGHT_BIAS).

Returns:
  • ndarray

    The computed first derivative based on the selected scheme.

D2x(D, cell_sub, scheme) method descriptor

Calculate the second derivative using a given function and stencil.

Parameters:
  • D (function) –

    A function that takes the values at the stencil points.

  • cell_sub (list of Cell) –

    The stencil, a list of cells around the point of interest.

  • scheme (FDSchemes) –

    The finite difference scheme to use (CENTRAL or RIGHT_BIAS).

Returns:
  • ndarray

    The computed second derivative based on the selected scheme.

dx(values, cell_sub, scheme) method descriptor

Calculate the first derivative using precomputed function values at grid points.

Parameters:
  • values (ndarray) –

    Precomputed values of the function at the stencil points.

  • cell_sub (list of Cell) –

    The stencil, a list of cells around the point of interest.

  • scheme (FDSchemes) –

    The finite difference scheme to use (CENTRAL or RIGHT_BIAS).

Returns:
  • ndarray

    The computed first derivative based on the selected scheme.

d2x(values, cell_sub, scheme) method descriptor

Calculate the second derivative using precomputed function values at grid points.

Parameters:
  • values (ndarray) –

    Precomputed values of the function at the stencil points.

  • cell_sub (list of Cell) –

    The stencil, a list of cells around the point of interest.

  • scheme (FDSchemes) –

    The finite difference scheme to use (CENTRAL or RIGHT_BIAS).

Returns:
  • ndarray

    The computed second derivative based on the selected scheme.