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.
- 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:
- assemble_mass_matrix(sd, data=None)[source]
Computes the mass matrix for a lowest-order Nedelec discretization
- Parameters:
sd (pg.Grid) – Grid, or a subclass, with geometry fields computed.
data (dict | None) – Dictionary to store the data. See self.matrix_rhs for required contents.
- Returns:
Matrix obtained from the discretization.
- Return type:
sps.csc_array
- eval_basis_at_node(sd, ridges_loc)[source]
Compute the local basis function for the Nedelec0 finite element space.
- Parameters:
sd (pg.Grid) – The grid object.
ridges_loc (np.ndarray) – The local ridges.
- Returns:
The local mass matrix.
- Return type:
np.ndarray
- 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
- eval_at_cell_centers(sd)[source]
Evaluate the function at the cell centers of the given grid.
- Parameters:
sd (pg.Grid) – The grid object representing the discretization.
- Returns:
The evaluated function values at the cell centers.
- Return type:
sps.csc_array
- proj_to_PwPolynomials(sd)[source]
Returns the inclusion matrix that projects the finite element space onto the lowest order piecewise polynomial space without loss of information.
- Parameters:
sd (pg.Grid) – The grid.
- Returns:
The inclusion 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
- 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.
- 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:
- assemble_mass_matrix(sd, data=None)[source]
Assembles the mass matrix for the given grid and data.
- Parameters:
sd (pg.Grid) – The grid for which the mass matrix is to be assembled.
data (dict | None) – Additional data required for the assembly process.
- Returns:
The assembled mass matrix.
- Return type:
sps.csc_array
- assemble_lumped_matrix(sd, data=None)[source]
Assembles the lumped matrix for the given grid and data.
- Parameters:
sd (pg.Grid) – The grid object.
data (dict | None) – Additional data. Defaults to None.
- Returns:
The assembled lumped matrix.
- 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
- eval_at_cell_centers(sd)[source]
Evaluate the basis functions at the cell centers and construct the global matrices.
- Parameters:
sd (pg.Grid) – The grid object representing the mesh.
- Returns:
The global matrices constructed from the basis functions evaluated at the cell centers.
- Return type:
sps.csc_array
- 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
- proj_to_PwPolynomials(sd)[source]
Returns the inclusion matrix that projects the finite element space onto the lowest order piecewise polynomial space without loss of information.
- Parameters:
sd (pg.Grid) – The grid.
- Returns:
The inclusion matrix.
- Return type:
sps.csc_array