pygeon.discretizations.fem.hcurl module
Module for the discretizations of the H(curl) space.
- class pygeon.discretizations.fem.hcurl.Nedelec0(keyword='unitary_data')[source]
Bases:
DiscretizationDiscretization class for the Nedelec of the first kind of lowest order. Each degree of freedom is the integral over a mesh edge in 3D.
While intended for three-dimensional grids, the space is generalized to 2D, where it corresponds to a rotated RT0.
- poly_order = 1
Polynomial degree of the basis functions
- tensor_order = 1
Vector-valued discretization
- ndof(sd)[source]
Returns the number of degrees of freedom associated to the method. In this case, it returns the number of ridges in the given grid.
- Parameters:
sd (pg.Grid) – The grid for which the number of degrees of freedom is calculated.
- Returns:
The number of degrees of freedom.
- Return type:
- proj_to_PwPolynomials(sd)[source]
Constructs the projection matrix to the VecPwLinears space via Nedelec1.
- Parameters:
sd (pg.Grid) – The grid object.
- Returns:
A sparse array in CSC format representing the projection from the current space to VecPwLinears.
- Return type:
sps.csc_array
- assemble_lumped_matrix(sd, data=None)[source]
Assembles the lumped mass matrix given by the row sums on the diagonal.
- Parameters:
sd (pg.Grid) – Grid object or a subclass.
data (dict | None) – Dictionary with physical parameters for scaling.
- Returns:
The lumped mass matrix.
- Return type:
sps.csc_array
- assemble_diff_matrix(sd)[source]
Assembles the differential matrix for the given grid.
- Parameters:
sd (pg.Grid) – The grid for which the differential matrix is assembled.
- Returns:
The assembled differential matrix.
- Return type:
sps.csc_array
- assemble_nat_bc(sd, func, b_faces)[source]
Assembles the natural boundary condition matrix for the given grid and function.
- Parameters:
sd (pg.Grid) – The grid on which to assemble the matrix.
func (Callable) – The function defining the natural boundary condition.
b_faces (np.ndarray) – The array of boundary faces.
- Returns:
The assembled natural boundary condition 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 space.
- Returns:
The range discretization class for the given grid.
- Return type:
pg.Discretization
- interpolate(sd, func)[source]
Interpolates a given function onto the grid using the hcurl discretization.
- Parameters:
sd (pg.Grid) – The grid on which to interpolate the function.
func (Callable) – The function to be interpolated.
- Returns:
The interpolated values on the grid.
- Return type:
np.ndarray
- proj_to_Ne1(sd)[source]
Project the solution to the Nedelec of the second kind.
- Parameters:
sd (pg.Grid) – The grid object representing the discretization.
- Returns:
The projection matrix to the Nedelec of the second kind.
- Return type:
sps.csc_array
- class pygeon.discretizations.fem.hcurl.Nedelec1(keyword='unitary_data')[source]
Bases:
DiscretizationDiscretization class for the Nedelec of the second kind of lowest order. Each degree of freedom is a first moment over a mesh edge in 3D.
While intended for three-dimensional grids, the space is generalized to 2D, where it corresponds to a rotated BDM1.
- poly_order = 1
Polynomial degree of the basis functions
- tensor_order = 1
Vector-valued discretization
- ndof(sd)[source]
Return the number of degrees of freedom associated to the method. In this case, it returns twice the number of ridges in the given grid.
- Parameters:
sd (pg.Grid) – The grid or a subclass.
- Returns:
The number of degrees of freedom.
- Return type:
- proj_to_PwPolynomials(sd)[source]
Constructs the projection matrix from the current finite element space to the VecPwLinears space.
- Parameters:
sd (pg.Grid) – The grid object.
- Returns:
A sparse array in CSC format representing the projection from the current space to VecPwLinears.
- Return type:
sps.csc_array
- proj_to_Ne0(sd)[source]
Project the solution to the Nedelec of the first kind.
- Parameters:
sd (pg.Grid) – The grid object representing the discretization.
- Returns:
The projection matrix to the Nedelec of the first kind.
- Return type:
sps.csc_array
- assemble_diff_matrix(sd)[source]
Assembles the differential matrix for the H(curl) finite element space.
- Parameters:
sd (pg.Grid) – The grid on which the finite element space is defined.
- Returns:
The assembled differential matrix.
- Return type:
sps.csc_array
- interpolate(sd, func)[source]
Interpolates the given function func over the specified grid sd.
- Parameters:
sd (pg.Grid) – The grid over which to interpolate the function.
func (Callable) – The function to be interpolated.
- Returns:
The interpolated values.
- Return type:
np.ndarray
- assemble_nat_bc(sd, func, b_faces)[source]
- Assembles the natural boundary condition for the given grid, function, and
boundary faces.
- Parameters:
sd (pg.Grid) – The grid on which to assemble the natural boundary condition.
func (Callable) – The function defining the natural boundary condition.
b_faces (np.ndarray) – The array of boundary faces.
- Returns:
The assembled natural boundary condition.
- Return type:
np.ndarray