porepy.utils.tangential_normal_projection module
Geometric projections related to the tangential and normal spaces of a set of vectors.
- class TangentialNormalProjection(normals, dim=None)[source]
Bases:
object
Represent a set of projections into tangent and normal vectors.
The spaces are defined by the normal vector (see __init__ documentation). The basis for the tangential space is arbitrary (arbitrary direction in 2d, rotation angle in 3d). The basis for the tangential is stored in the attribute tangential_basis.
- tangential_basis (np.array, size
dim x dim-1 x num_vec): Basis vectors for the tangential space.
- projection
Projection matrices onto the tangential and normal space. The first dim-1 rows represent projection to the tangential space, the final row is the normal component.
- Type
np.array, size dim x dim x num_vecs
- normals
Unit normal vectors.
- Type
np.array, size dim x num_vecs
- local_projection(ind=None)[source]
Get the local projection matrix (reference)
- Parameters
ind (
int, optional
) – Index (referring to the order of the normal vectors provided to __init__) of the basis to return. Defaults to the first one.- Returns
- Local projection matrix. Multiplication
gives projection to the tangential space (first self.dim - 1 rows) and normal space (last)
- Return type
np.array (self.dim x self.dim)
- project_normal(num=None)[source]
Define a projection matrix of a specific size onto the normal space.
The intended usage is to project a grid-based vector variable onto the normal space of the grid, with the tacit understanding that there is a single normal vector shared for all the cells (or faces) in the grid.
The method can also create projection matrix based on unequal normal vectors. One projection will be generated per column in self.normal. To activate this behavior, set num=None.
- Parameters
num (
int, optional
) – Number of (equal) projections to be generated. Will correspond to the number of cells / faces in the grid. The projection matrix will have num * self.dim columns. If not specified (default), one projection will be generated per vector in self.normals. NOTE: If self.num_vecs > 1, but num is not None, only the first given normal vector will be used to generate the normal space.- Returns
- Tangential projection matrix, structure as a block
diagonal matrix. The first 1 x dim block projects onto the first tangent space, etc. size: num x (self.dim * num). If num is not None. size: num_vecs x (self.dim * num_vecs) els.
- Return type
- project_tangential(num=None)[source]
Define a projection matrix of a specific size onto the tangent space.
The intended usage is to project a grid-based vector variable onto the tangent space of the grid, with the tacit understanding that there is a single normal vector shared for all the cells (or faces) in the grid.
The method can also create projection matrix based on unequal normal vectors. One projection will be generated per column in self.normal. To activate this behavior, set num=None.
- Parameters
num (
int, optional
) – Number of (equal) projections to be generated. Will correspond to the number of cells / faces in the grid. The projection matrix will have num * self.dim columns. If not specified (default), one projection will be generated per vector in self.normals. NOTE: If self.num_vecs > 1, but num is not None, only the first given normal vector will be used to generate the tangential space.- Returns
- Tangential projection matrix, structure as a block
diagonal matrix. The first (dim-1) x dim block projects onto the first tangent space, etc. size: ((self.dim - 1) * num) x (self.dim * num). If num is not None, size: ((self.dim - 1) * num_vecs) x (self.dim * num_vecs)
- Return type
- project_tangential_normal(num=None)[source]
Define a projection matrix to decompose a matrix into tangential and normal components.
The intended usage is to decompose a grid-based vector variable into the tangent and normal spaces of the grid, with the tacit understanding that there is a single normal vector shared for all the cells (or faces) in the grid.
The method can also create projection matrix based on unequal normal vectors. One projection will be generated per column in self.normal. To activate this behavior, set num=None.
- Parameters
num (
int, optional
) – Number of (equal) projections to be generated. Will correspond to the number of cells / faces in the grid. The projection matrix will have num * self.dim columns. If not specified (default), one projection will be generated per vector in self.normals. NOTE: If self.num_vecs > 1, but num is not None, only the first given normal vector will be used to generate the tangential space.- Returns
- Projection matrix, structure as a block
diagonal matrix, with block size dim x dim. For each block, the first dim-1 rows projects onto the tangent space, the final row projects onto the normal space. size: ((self.dim * num) x (self.dim * num). If num is not None, size: ((self.dim * num_vecs) x (self.dim * num_vecs)
- Return type