pygeon.discretizations.fem.vec_l2 module

Module for the discretizations of the vector L2 space.

class pygeon.discretizations.fem.vec_l2.VecPwPolynomials(keyword='unitary_data')[source]

Bases: VecDiscretization

A class representing an abstract vector piecewise polynomial discretization.

base_discr

The scalar discretization method.

local_dofs_of_cell(sd, c, ambient_dim=-1)[source]

Compute the local degrees of freedom (DOFs) of a cell in a vector-valued finite element discretization.

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

  • c (int) – The index of the cell for which the local DOFs are to be computed. ambient_dim (int, optional): The ambient dimension of the space. If not provided, it defaults to the dimension of the grid (sd.dim).

Returns:

An array containing the local DOFs of the specified cell, adjusted for the vector-valued nature of the discretization.

Return type:

np.ndarray

ndof_per_cell(sd)[source]

Computes the number of degrees of freedom (DOF) per cell for the given grid.

This method calculates the total number of DOFs per cell by multiplying the number of DOFs per cell from the base discretization by the spatial dimension of the grid.

Parameters:

sd (pg.Grid) – The grid object representing the spatial discretization.

Returns:

The total number of degrees of freedom per cell.

Return type:

int

get_range_discr_class(dim)[source]

Returns the discretization class for the range of the differential.

Parameters:

dim (int) – The dimension of the range space.

Returns:

The discretization class for the range of the differential.

Return type:

pg.Discretization

assemble_nat_bc(sd, func, b_faces)[source]

Assembles the natural boundary condition vector, equal to zero.

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

  • func (Callable[[np.ndarray], np.ndarray]) – The function defining the natural boundary condition.

  • b_faces (np.ndarray) – The array of boundary faces.

Returns:

The assembled natural boundary condition vector.

Return type:

np.ndarray

proj_to_higher_PwPolynomials(sd)[source]

Projects the discretization to +1 order discretization.

Parameters:

sd (pg.Grid) – The grid object.

Returns:

The projection matrix.

Return type:

sps.csc_array

proj_to_lower_PwPolynomials(sd)[source]

Projects the discretization to -1 order discretization.

Parameters:

sd (pg.Grid) – The grid object.

Returns:

The projection matrix.

Return type:

sps.csc_array

class pygeon.discretizations.fem.vec_l2.VecPwConstants(keyword='unitary_data')[source]

Bases: VecPwPolynomials

A class representing the discretization using vector piecewise constant functions.

poly_order = 0

Polynomial degree of the basis functions

tensor_order = 1

Vector-valued discretization

__init__(keyword='unitary_data')[source]

Initialize the vector discretization class. The base discretization class is pg.PwConstants.

Parameters:

keyword (str) – The keyword for the vector discretization class. Default is pg.UNITARY_DATA.

Returns:

None

class pygeon.discretizations.fem.vec_l2.VecPwLinears(keyword='unitary_data')[source]

Bases: VecPwPolynomials

A class representing the discretization using vector piecewise linear functions.

poly_order = 1

Polynomial degree of the basis functions

tensor_order = 1

Vector-valued discretization

__init__(keyword='unitary_data')[source]

Initialize the vector discretization class. The base discretization class is pg.PwLinears.

Parameters:

keyword (str) – The keyword for the vector discretization class. Default is pg.UNITARY_DATA.

Returns:

None

class pygeon.discretizations.fem.vec_l2.VecPwQuadratics(keyword='unitary_data')[source]

Bases: VecPwPolynomials

A class representing the discretization using vector piecewise quadratic functions.

poly_order = 2

Polynomial degree of the basis functions

tensor_order = 1

Vector-valued discretization

__init__(keyword='unitary_data')[source]

Initialize the vector discretization class. The base discretization class is pg.PwQuadratics.

Parameters:

keyword (str) – The keyword for the vector discretization class. Default is pg.UNITARY_DATA.

Returns:

None