boundary#
This submodule contains types that describe strong boundary condtitions. For now, only steady boundary conditions are used, though there are already types for the unsteady ones.
Boundary Condition Types#
The main class that would be in use at the moment would be
BoundaryCondition2DSteady
. It is derived from
BoundaryCondition2D
, which is also the parent for
BoundaryCondition2DUnsteady
, but these are not (yet) supported,
so they are not exported by the module.
- class mfv2d.boundary.BoundaryCondition2DSteady(form: KFormUnknown, indices: array_like, func: Function2D)[source]#
Boundary condition for a 2D problem with no time dependence.
These boundary conditions specifiy values of differential forms on the the given indices directly. These are enforced “strongly” by adding a Lagrange multiplier to the system.
- Parameters:
form (KFormUnknown) – Form for which the value is to be prescribed.
indices (array_like) – One dimensional array of edges on which this is prescribed. Note that 0-based indexing is used, since orientation does not matter.
func ((array, array) -> array_like) – Function that can be evaluated to obtain values of differential forms at those points. For 1-froms it should return an array_like with an extra last dimension, which contains the two vector components.
- form: KFormUnknown#
- func: Function2D#
- class mfv2d.boundary.BoundaryCondition2DUnsteady(form: KFormUnknown, indices: npt.ArrayLike, func: Callable[[npt.ArrayLike, npt.ArrayLike], npt.NDArray[np.float64]])[source]#
Unsteady boundary condition for a 2D problem.
- form: KFormUnknown#
- func: Function2D#
- class mfv2d.boundary.BoundaryCondition2D(form: KFormUnknown, indices: array_like)[source]#
Base class for 2D boundary conditions.
- form: KFormUnknown#
Boundary Condition Construction#
There are also functions used to construct boundary condition constraints and evalue contributions of weak boundary conditions.
- mfv2d.boundary._element_weak_boundary_condition(mesh: Mesh, element_idx: int, side: ElementSide, unknown_orders: UnknownOrderings, unknown_index: int, leaf_order_mapping: Mapping[int, int], dof_offsets: npt.NDArray[np.uint32], weak_terms: Sequence[tuple[float, KBoundaryProjection]], basis_cache: FemCache) tuple[ElementConstraint, ...] [source]#
Compute boundary conditions contributions the side of the element.
- Parameters:
mesh (Mesh) – Mesh in which the element is in.
element_idx (int) – Index of the element to compute the contributions on.
side (ElementSide) – Side on which the boundary conditions should be computed.
unknown_orders (UnknownOrderings) – Ordering of the unknown degrees of freedom.
dof_offsets (FixedElementArray of uint32) – Offsets of the degrees of freedom in the element.
weak_terms (Sequence of (float, KBoundaryProjection)) – Pairs of boundary projection terms and their scaling coefficients.
basis_cache (FemCache) – Cache from which to get basis from.
- Returns:
Tuple with
ElementConstraint
objects that contain the indices of equations where to apply in thedofs
member and contributions of boundary terms in thecoeffs
member.- Return type:
- mfv2d.boundary._element_strong_boundary_condition(mesh: Mesh, element_idx: int, side: ElementSide, unknown_orders: UnknownOrderings, unknown_index: int, leaf_order_mapping: Mapping[int, int], dof_offsets: npt.NDArray[np.uint32], strong_bc: BoundaryCondition2DSteady, basis_cache: FemCache, skip_first: bool, skip_last: bool) tuple[ElementConstraint, ...] [source]#
Compute strong boundary condition constraints on the side of the element.
- Parameters:
mesh (Mesh) – Mesh in which the element is in.
element_idx (int) – Index of the element to compute the degrees of freedom on.
side (ElementSide) – Side on which the boundary conditions should be computed.
unknown_orders (UnknownOrderings) – Ordering of the unknown degrees of freedom.
dof_offsets (FixedElementArray of uint32) – Offsets of the degrees of freedom in the element.
strong_bc (BoundaryCondition2DStrong) – Boundary condition to compute.
basis_cache (FemCache) – Cache from which to get basis from.
skip_first (bool) – Should the first node on the edge not be constrained for a 0-form.
skip_last (bool) – Should the last node on the edge not be constrained for a 0-form.
- Returns:
Tuple with
ElementConstraint
objects that contain the degrees of freedom to constraindofs
member and their respective values in thecoeffs
member.- Return type:
- mfv2d.boundary.mesh_boundary_conditions(evaluatable_terms: Sequence[KSum], unknown_order: UnknownOrderings, mesh: Mesh, leaf_order_mapping: Mapping[int, int], dof_offsets: npt.NDArray[np.uint32], strong_bcs: Sequence[Sequence[BoundaryCondition2DSteady]], basis_cache: FemCache) tuple[tuple[ElementConstraint, ...], tuple[ElementConstraint, ...]] [source]#
Compute boundary condition contributions and constraints.
- Parameters:
evaluatable_terms (Sequence of KSum) – Right sides of equations that contain boundary projections to be evaluated. Must be ordered according to weights.
unknown_order (UnknownOrderings) – Orders of unknown forms.
mesh (Mesh) – Mesh in which the element is in.
dof_offsets (FixedElementArray[np.uint32]) – Offsets of DoFs within each element.
strong_bcs (Sequence of Sequence of BoundaryCondition2DSteady) – Boundary conditions grouped per weight functions and correctly ordered to match the order of weight functions in the system.
caches (FemCache) – Cache to use for basis functions.
- Returns:
strong (tuple of ElementConstraint) – Strong boundary conditions in a specific notation. Each of these means that for element given by
ElementConstraint.i_e
, all dofs with indicesElementConstraint.dofs
should be constrained to valueElementConstraint.coeffs
.weak (tuple of ElementConstraint) – Weak boundary conditions in a specific notation. Each of these means that for element given by
ElementConstraint.i_e
, all equations with indicesElementConstraint.dofs
should have the valueElementConstraint.coeffs
added to them.