pygeon.numerics.innerproducts module

This module contains functions for computing the inner-products operators.

pygeon.numerics.innerproducts.cell_mass(mdg, discr=None, **kwargs)[source]

Compute the mass matrix for the piecewise constants on a (MD-)grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • discr (pg discretization object)

Returns:

sps.csc_array, num_cells x num_cells

pygeon.numerics.innerproducts.face_mass(mdg, discr=None, **kwargs)[source]

Compute the mass matrix for discretization defined on the faces of a (MD-)grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • discr (pg.RT0 or pg.MVEM)

Returns:

sps.csc_array, num_faces x num_faces

pygeon.numerics.innerproducts.ridge_mass(mdg, discr=None, **kwargs)[source]

Compute the mass matrix for discretization defined on the ridges of a (MD-)grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • discr (pg discretization object)

Returns:

sps.csc_array, num_ridges x num_ridges

pygeon.numerics.innerproducts.peak_mass(mdg, discr=None, **kwargs)[source]

Compute the mass matrix for discretization defined on the peaks of a (MD-)grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • discr (pg discretization object)

Returns:

sps.csc_array, num_peaks x num_peaks

pygeon.numerics.innerproducts.default_discr(sd, n_minus_k, **kwargs)[source]

Construct the default discretization operator depending on n_minus_k. These correspond to the Whitney forms.

Parameters:
  • sd (pg.Grid) – Grid on which the discretization is defined.

  • n_minus_k (int) – Difference between space dimension and form order.

Returns:

One of:

  • pg.PwConstants: if n_minus_k == 0.

  • pg.RT0: if n_minus_k == 1.

  • pg.Lagrange1: if n_minus_k == sd.dim.

  • pg.Nedelec0: if n_minus_k == 2 (valid for sd.dim == 3).

Return type:

pg.Discretization

Raises:

ValueError – If n_minus_k is not supported for the given grid dimension.

pygeon.numerics.innerproducts.local_matrix(sd, n_minus_k, discr, d_sd, **kwargs)[source]

Compute the local matrix for a given spatial domain.

Parameters:
  • sd (pg.Grid) – The spatial domain.

  • n_minus_k (int) – The number of basis functions minus the number of constraints.

  • discr (pg.Discretization) – The discretization scheme.

  • d_sd (dict) – Additional parameters for the spatial domain.

  • **kwargs – Additional keyword arguments.

Returns:

The computed local matrix.

Return type:

sps.csc_array

pygeon.numerics.innerproducts.mass_matrix(mdg, n_minus_k, discr=None, local_matrix=<function local_matrix>, **kwargs)[source]

Compute the mass matrix on a mixed-dimensional grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • n_minus_k (int) – The difference between the dimension and the order of the differential.

  • discr (pg discretization object)

  • data (dict) – The data object associated to the grid.

  • local_matrix (function) – Function that generates the local mass matrix on a grid.

  • kwargs

    Optional parameters:

    • as_bmat: In case of mixed-dimensional, return the matrix as sparse sub-blocks. Default False.

Returns:

sps.csc_array, num_dofs x num_dofs

pygeon.numerics.innerproducts.lumped_cell_mass(mdg, discr=None, **kwargs)[source]

Compute the lumped mass matrix for the piecewise constants on a (MD-)grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • discr (pg discretization object)

Returns:

sps.csc_array, num_cells x num_cells

pygeon.numerics.innerproducts.lumped_face_mass(mdg, discr=None, **kwargs)[source]

Compute the lumped mass matrix for discretization defined on the faces of a (MD-)grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • discr (pg.RT0 or pg.MVEM)

Returns:

sps.csc_array, num_faces x num_faces

pygeon.numerics.innerproducts.lumped_ridge_mass(mdg, discr=None, **kwargs)[source]

Compute the lumped mass matrix for discretization defined on the ridges of a (MD-)grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • discr (pg discretization object)

Returns:

sps.csc_array, num_ridges x num_ridges

pygeon.numerics.innerproducts.lumped_peak_mass(mdg, discr=None, **kwargs)[source]

Compute the lumped mass matrix for discretization defined on the peaks of a (MD-)grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • discr (pg discretization object)

Returns:

sps.csc_array, num_peaks x num_peaks

pygeon.numerics.innerproducts.lumped_mass_matrix(mdg, n_minus_k, discr=None, **kwargs)[source]

Compute the mass-lumped mass matrix on a mixed-dimensional grid.

Parameters:
  • mdg (pg.MixedDimensionalGrid)

  • n_minus_k (int) – The difference between the dimension and the order of the differential.

  • discr (pg discretization object)

  • kwargs

    Optional parameters:

    • as_bmat: In case of mixed-dimensional, return the matrix as sparse sub-blocks. Default False.

Returns:

sps.csc_array, num_dofs x num_dofs