continuity#
This is a submodule which contains functions used to deal with continuity. This concerns connecting element boundaries together and generating continuity equations.
Functions used to connect elements together on edges or corners are
connect_corner_based()
and connect_edge_center()
for 0-forms,
and connect_edge_based()
for both 0- and 1-forms.
- mfv2d.continuity.connect_corner_based(mesh: Mesh, *pairs: tuple[int, ElementSide]) list[Constraint] [source]#
Create constraints for 0-forms on the corner.
- Parameters:
mesh (Mesh) – Mesh in which the elements are in.
*pairs (tuple of (int, ElementSide)) – Elements that should be connected as pairs of element and side that the corner is the beginning for.
- Returns:
Constraints which enforce continuity between the elements for 0-forms.
- Return type:
list of Constraints
- mfv2d.continuity.connect_edge_center(mesh: Mesh, e1: int, e2: int, side: ElementSide) list[Constraint] [source]#
Connect center of edges for two elements with 0-forms.
- Parameters:
mesh (Mesh) – Mesh in which the element is in.
e1 (int) – Index of the first element.
e2 (int) – Index of the second element.
side (ElementSide) – Side of the elements that is to be connected.
- Returns:
Constraints which enforce continuity between the two elements for 0-forms in the middle of the side.
- Return type:
list of Constraints
- mfv2d.continuity.connect_edge_based(elements: Mesh, e1: int, s1: ElementSide, e2: int, s2: ElementSide, form_order: UnknownFormOrder) list[Constraint] [source]#
Create constraints for 0-forms or 1-forms on edges.
- Parameters:
mesh (Mesh) – Mesh in which the element is in.
e1 (int) – Index of the first element.
s1 (ElementSide) – Side of the first element that is connected to the second.
e2 (int) – Index of the second element.
s2 (ElementSide) – Side of the second element that is connected to the second.
form_order (UnknownFormOrder) – Order of the unknown form to handle. Note that only 0-forms and 1-forms are valid, since 2-forms have no boundary DoFs.
- Returns:
Constraints which enforce continuity between the two elements for 0-forms or 1-forms.
- Return type:
list of Constraints
These are all used for innner element connectivity function
connect_element_inner()
.
- mfv2d.continuity.connect_element_inner(mesh: Mesh, element: int, form_order: UnknownFormOrder) list[Constraint] [source]#
Generate constraints for continuity within the element.
- Parameters:
mesh (Mesh) – Mesh in which the element is in.
element (int) – Index of element to deal with.
form_order (UnknownFormOrder) – Order of the form to use.
- Returns:
Constraints which enforce the continuity within the element.
- Return type:
list of Constraint
This all culminates in connect_elements()
, which generates all
constraints for mesh continuity.
- mfv2d.continuity.connect_elements(unknowns: UnknownOrderings, mesh: Mesh, leaf_index_mapping: Mapping[int, int], dof_offsets: npt.NDArray[np.uint32]) list[Constraint] [source]#
Generate constraints for all elements and unknowns.
- Parameters:
unknowns (UnknownOrderings) – Orders of unknown forms defined for all elements.
mesh (Mesh) – Mesh with primal and dual topology of root elements.
dof_offsets (FixedElementArray[np.uint32]) – Array of offsets for degrees of freedom in the elements.
- Returns:
List with constraints which enforce continuity between degrees of freedom for unknown forms defined between all elements.
- Return type:
list of Constraint
There is also a number of utility functions, since hierarchical layout of the elements means that recursive calls have to be ofter used.
- mfv2d.continuity._find_surface_boundary_id_node(mesh: Mesh, surf_idx: int, node_idx: int) ElementSide [source]#
Find what boundary begins with the node with a given index is in the surface.
- Parameters:
- Returns:
Side of the element which begins with the given node. If the node is not in the surface an exception is raised.
- Return type:
- mfv2d.continuity._get_corner_dof(mesh: Mesh, element: int, side: ElementSide, /) tuple[int, int] [source]#
Get element index and degree of freedom index for the corner of the element.
- Parameters:
mesh (Mesh) – Mesh in which the element is in.
element (int) – Element which to get DoF equations for.
side (ElementSide) – Side which begins with the corner that should be obtained.
- Returns:
element_id (int) – Index of the (leaf) element to which the corner belongs to.
dof_index (int) – Index of the (0-form) degree of freedom which is in that corner.
- mfv2d.continuity._get_side_dof_nodes(mesh: Mesh, element: int, side: ElementSide, order: UnknownFormOrder, /) list[ElementConstraint] [source]#
Get equations for obtaining DoFs on the side for the element.
- Parameters:
mesh (Mesh) – Mesh in which the element is in.
element (int) – Element which to get DoF equations for.
side (ElementSide) – Side of the element to get the DoFs for.
order (UnknownFormOrder) – Order of unknown forms for which to get the form orders from. It can only be
UnknownFormOrder.FORM_ORDER_0
orUnknownFormOrder.FORM_ORDER_1
, since 2-forms do not have any boundary DoFs.
- Returns:
constraints – Specifiecation of which leaf elements are involved. These are also ordered. The
coeff
member specifies positions of these in the element.- Return type:
- mfv2d.continuity._get_side_dofs(mesh: Mesh, element: int, side: ElementSide, form_order: UnknownFormOrder, output_order: int | None = None, /) tuple[Constraint, ...] [source]#
Get DoFs on the boundary in terms of leaf element DoFs.
- Parameters:
mesh (Mesh) – Mesh in which the element is in.
element (int) – Element which to get DoF equations for.
side (ElementSide) – Side of the element to get the DoFs for.
order (UnknownFormOrder) – Order of unknown forms for which to get the form orders from. It can only be
UnknownFormOrder.FORM_ORDER_0
orUnknownFormOrder.FORM_ORDER_1
, since 2-forms do not have any boundary DoFs.
- Returns:
Tuple of constraints, each of which specifies how the “normal” DoFs on the element’s boundary may be constructed from DoFs of the element.
- Return type:
tuple of Constraint