pygeon.discretizations.vem.h1 module

Module for the discretizations of the H1 space.

class pygeon.discretizations.vem.h1.VLagrange1(keyword='unitary_data')[source]

Bases: Lagrange1

Discretization class for the virtual Lagrange1 method.

poly_order = 1

Polynomial degree of the basis functions

tensor_order = 0

Scalar-valued discretization

assemble_mass_matrix(sd, data=None)[source]

Assembles and returns the mass matrix.

Parameters:
  • sd (pg.Grid) – The grid.

  • data (dict | None) – Optional data for the assembly process.

Returns:

The sparse mass matrix obtained from the discretization.

Return type:

sps.csc_array

assemble_loc_mass_matrix(sd, cell, diam, nodes)[source]

Computes the local VEM mass matrix on a given cell according to the Hitchhiker’s (6.5)

Parameters:
  • sd (pg.Grid) – The grid object representing the computational domain.

  • cell (int) – The index of the cell on which to compute the mass matrix.

  • diam (float) – The diameter of the cell.

  • nodes (np.ndarray) – The array of nodes associated with the cell.

Returns:

The computed local VEM mass matrix.

Return type:

np.ndarray

assemble_loc_proj_to_mon(sd, cell, diam, nodes)[source]

Computes the local projection onto the monomials. Returns the coefficients \(\{a_i\}\) in the expansion

\[a_0 + \frac{1}{d}[a_1, a_2] \cdot (x - c)\]

for each VL1 basis function.

Parameters:
  • sd (pg.Grid) – The grid object representing the computational domain.

  • cell (int) – The index of the cell in which the projection is computed.

  • diam (float) – The diameter of the cell.

  • nodes (np.ndarray) – The coordinates of the nodes in the cell.

Returns:

The coefficients of the local projection onto the monomials.

Return type:

np.ndarray

assemble_loc_L2proj_lhs(sd, cell, diam, nodes)[source]

Returns the system G from the Hitchhiker’s (3.9)

Parameters:
  • sd (pg.Grid) – The grid object.

  • cell (int) – The index of the cell.

  • diam (float) – The diameter of the cell.

  • nodes (np.ndarray) – The array of node indices.

Returns:

The system matrix G.

Return type:

np.ndarray

assemble_loc_L2proj_rhs(sd, cell, diam, nodes)[source]

Returns the righthand side B from the Hitchhiker’s (3.14)

Parameters:
  • sd (pg.Grid) – The grid object.

  • cell (int) – The cell index.

  • diam (float) – The diameter of the cell.

  • nodes (np.ndarray) – The array of node indices.

Returns:

The righthand side B.

Return type:

np.ndarray

assemble_loc_monomial_mass(sd, cell, diam)[source]

Computes the inner products of the monomials

\[\left\{1, \frac{x - c}{d}, \frac{y - c}{d}\right\}\]

Reference: Hitchhiker’s (5.3)

Parameters:
  • sd (pg.Grid) – The grid object.

  • cell (int) – The index of the cell.

  • diam (float) – The diameter of the cell.

Returns:

The computed inner products matrix.

Return type:

np.ndarray

assemble_loc_dofs_of_monomials(sd, cell, diam, nodes)[source]

Returns the matrix D from the Hitchhiker’s (3.17)

Parameters:
  • sd (pg.Grid) – The grid object.

  • cell (int) – The index of the cell.

  • diam (float) – The diameter of the cell.

  • nodes (np.ndarray) – The array of node indices.

Returns:

The matrix D.

Return type:

np.ndarray

assemble_stiff_matrix(sd, data=None)[source]

Assembles and returns the stiffness matrix.

Parameters:
  • sd (pg.Grid) – The grid.

  • data (dict | None) – Optional data for the assembly process.

Returns:

The stiffness matrix obtained from the discretization.

Return type:

sps.csc_array

assemble_loc_stiff_matrix(sd, cell, diam, nodes)[source]

Computes the local VEM stiffness matrix on a given cell according to the Hitchhiker’s (3.25)

Parameters:
  • sd (pg.Grid) – The grid object representing the computational domain.

  • cell (int) – The index of the cell on which to compute the stiffness matrix.

  • diam (float) – The diameter of the cell.

  • nodes (np.ndarray) – The array of nodal values on the cell.

Returns:

The computed local VEM stiffness matrix.

Return type:

np.ndarray

get_range_discr_class(dim)[source]

Returns the range discretization class for the given dimension.

Parameters:

dim (int) – The dimension of the range.

Returns:

The range discretization class.

Return type:

pg.Discretization

Raises:

NotImplementedError – This method is not implemented and should be overridden in a subclass.