sfepy.discrete.fem.mappings module

Finite element reference mappings.

class sfepy.discrete.fem.mappings.FEMapping(coors, conn, poly_space=None, gel=None, order=1)[source]

Base class for finite element mappings.

eval_basis(coors, diff=False, grad_axes=None)[source]

Evaluate basis functions or their gradients in given coordinates.

get_geometry()[source]

Return reference element geometry as a GeometryElement instance.

get_mapping(qp_coors, weights, bf=None, poly_space=None, ori=None, transform=None, is_face=False, fc_bf_map=None, extra=(None, None, None))[source]

Get the mapping for given quadrature points, weights, and polynomial space.

Parameters:
qp_coors: numpy.ndarray

The coordinates of the integration points.

weights:

The integration weights.

bf: numpy.ndarray

The basis functions.

poly_space: PolySpace instance

The PolySpace instance.

ori: numpy.ndarray

Element orientation, used by hierarchical basis.

transform: numpy.ndarray

The transformation matrix applied to the basis functions.

is_face: bool

Is it the boundary of a region?

fc_bf_map: tuple

The additional info to remap face derivatives of wedge elements: - fc_bf_map[0]: id of face group (triangle or quad) - fc_bf_map[1]: position of inplane derivatives (xy-axes)

extra: tuple

The extra data for surface derivatives: - the derivatives of the field boundary basis functions with

respect to the reference coordinates

  • the boundary connectivity

  • the derivatives of the domain boundary basis functions with respect to the reference coordinates

Returns:
pycmap: PyCMapping instance

The domain mapping data.

get_physical_qps(qp_coors)[source]

Get physical quadrature points corresponding to given reference element quadrature points.

Returns:
qpsarray

The physical quadrature points ordered element by element, i.e. with shape (n_el, n_qp, dim).

set_basis_indices(indices)[source]

Set indices to cell-based basis that give the facet-based basis.

sfepy.discrete.fem.mappings.eval_mapping_data_in_qp(coors, conn, bf_g, weights, ebf_g=None, is_face=False, eps=1e-15, se_conn=None, se_bf_bg=None, ecoors=None)[source]

Evaluate mapping data.

Parameters:
coors: numpy.ndarray

The nodal coordinates.

conn: numpy.ndarray

The element connectivity.

bf_g: numpy.ndarray

The derivatives of the domain basis functions with respect to the reference coordinates.

weights: numpy.ndarray

The weights of the quadrature points.

ebf_g: numpy.ndarray

The derivatives of the field basis functions with respect to the reference coordinates.

is_face: bool

Is it the boundary of a region?

eps: float

The tolerance for the normal vectors calculation.

se_conn: numpy.ndarray

The connectivity for the calculation of surface derivatives.

se_bf_bg: numpy.ndarray

The surface basis function derivatives with respect to the reference coordinates.

ecoors: numpy.ndarray

The element nodal coordinates.

Returns:
det: numpy.ndarray

The determinant of the mapping evaluated in integration points.

volume: numpy.ndarray

The element (volume or surface) volumes in integration points.

bfg: numpy.ndarray

The derivatives of the basis functions with respect to the spatial coordinates. Can be evaluated either for surface elements if bf_g, se_conn, and se_bf_bg are given.

normal: numpy.ndarray

The normal vectors for the surface elements in integration points.

sfepy.discrete.fem.mappings.tranform_coors_to_lower_dim(coors, to_dim)[source]

Transform element coordinates into XY plane.

See:

https://math.stackexchange.com/questions/1167717/transform-a-plane-to-the-xy-plane https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle