Muscat.MeshContainers.ElementsDescription module

CheckIntegrity(GUI: bool = False)[source]

CheckIntegrity function. Tests

Parameters:

GUI (bool, optional) – if True, generate (in some case) an output on a new window, by default False

Returns:

ok if all ok

Return type:

str

class ElementDescription(name, geoSupport)[source]

Bases: object

Class to store information about the different type of elements.

degree: int

the higher degree of the polynomial

dimension: int

Dimensionality 0,1,2,3

facesL1: List[Tuple[ElementType, List[int]]]

First level faces. (triangles for a tetra for example) A list containing a tuples of the elements name and the local connectivity

facesL2: List[Tuple[ElementType, List[int]]]

Second level faces. (bars for a tetra for example) A list containing a tuples of the elements name and the local connectivity

facesL3: List[Tuple[ElementType, List[int]]]

third level faces. (points for a tetra for example) A list containing a tuples of the elements name and the local connectivity

geoSupport

the geometrical support of this element

linear: bool

true if the the jacobian matrix is constant in the element

mirrorPermutation: List[int]

Permutation of index to make a valid element again after a mirror operation

name

Element Name

numberOfNodes

number of nodes of this elements

class ElementType(*values)[source]

Bases: Enum

Bar_2 = 1
Bar_3 = 2
Element_NA = 0
Hexahedron_20 = 3
Hexahedron_27 = 4
Hexahedron_8 = 5
Point_1 = 6
Pyramid_13 = 7
Pyramid_14 = 8
Pyramid_5 = 9
Quadrangle_4 = 10
Quadrangle_8 = 11
Quadrangle_9 = 12
Tetrahedron_10 = 13
Tetrahedron_4 = 14
Triangle_3 = 15
Triangle_6 = 16
Wedge_15 = 17
Wedge_18 = 18
Wedge_6 = 19
ElementsInfo: Dict[str | ElementType, ElementDescription] = {ElementType.Bar_2: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Bar_3: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Hexahedron_20: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Hexahedron_27: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Hexahedron_8: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Point_1: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Pyramid_13: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Pyramid_14: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Pyramid_5: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Quadrangle_4: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Quadrangle_8: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Quadrangle_9: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Tetrahedron_10: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Tetrahedron_4: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Triangle_3: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Triangle_6: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Wedge_15: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Wedge_18: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>, ElementType.Wedge_6: <Muscat.MeshContainers.ElementsDescription.ElementDescription object>}

Dictionary with with the description for all elements.

This dictionary contain for every element type ElementDescription singleton with the information about the elements.

class GeoProp(name, dimensionality)[source]

Bases: NamedTuple

dimensionality: int

Alias for field number 1

name: str

Alias for field number 0

class GeoSupport(*values)[source]

Bases: Enum

GeoBar = ('GeoBar', 1)

dimensionality = 1

Type:

Bar geometrical support

GeoHex = ('GeoHex', 3)

dimensionality = 3

Type:

Hexahedral geometrical support

GeoPoint = ('GeoPoint', 0)

dimensionality = 0

Type:

Point geometrical support

GeoPyr = ('GeoPyr', 3)

dimensionality = 3

Type:

Pyramidal (square base) geometrical support

GeoQuad = ('GeoQuad', 2)

dimensionality = 2

Type:

Quadrangle geometrical support

GeoTet = ('GeoTet', 3)

dimensionality = 3

Type:

Tetrahedral geometrical support

GeoTri = ('GeoTri', 2)

dimensionality = 2

Type:

Triangle geometrical support

GeoWed = ('GeoWed', 3)

dimensionality = 3

Type:

Wedge geometrical support

property dimensionality
GetElementDescription(elementType: str | ElementType) → ElementDescription[source]

Return an instance of ElementDescription for the element type elementType

Parameters:

elementType (ElementTypeLike) – Element type

Returns:

instance of ElementDescription with the information of the element

Return type:

ElementDescription

dataBaseQuad2Lin: Dict[ElementType, Tuple[ElementType, int]] = {ElementType.Bar_2: (ElementType.Bar_2, 2), ElementType.Bar_3: (ElementType.Bar_2, 2), ElementType.Hexahedron_20: (ElementType.Hexahedron_8, 8), ElementType.Hexahedron_27: (ElementType.Hexahedron_8, 8), ElementType.Hexahedron_8: (ElementType.Hexahedron_8, 8), ElementType.Point_1: (ElementType.Point_1, 1), ElementType.Pyramid_13: (ElementType.Pyramid_5, 5), ElementType.Pyramid_14: (ElementType.Pyramid_5, 5), ElementType.Pyramid_5: (ElementType.Pyramid_5, 5), ElementType.Quadrangle_4: (ElementType.Quadrangle_4, 4), ElementType.Quadrangle_8: (ElementType.Quadrangle_4, 4), ElementType.Quadrangle_9: (ElementType.Quadrangle_4, 4), ElementType.Tetrahedron_10: (ElementType.Tetrahedron_4, 4), ElementType.Tetrahedron_4: (ElementType.Tetrahedron_4, 4), ElementType.Triangle_3: (ElementType.Triangle_3, 3), ElementType.Triangle_6: (ElementType.Triangle_3, 3), ElementType.Wedge_15: (ElementType.Wedge_6, 6), ElementType.Wedge_18: (ElementType.Wedge_6, 6), ElementType.Wedge_6: (ElementType.Wedge_6, 6)}

(linear element type, number of nodes to keep)

Type:

Conversion to linear elements by keeping only the corners

dataBaseQuad2LinSubdivide: Dict[ElementType, Tuple[ElementType, List[List[int]]]] = {ElementType.Bar_2: (ElementType.Bar_2, [[0, 1]]), ElementType.Bar_3: (ElementType.Bar_2, [[0, 2], [2, 1]]), ElementType.Hexahedron_20: (ElementType.Hexahedron_8, [[0, 1, 2, 3, 4, 5, 6, 7]]), ElementType.Hexahedron_27: (ElementType.Hexahedron_8, [[0, 8, 24, 11, 16, 22, 26, 20], [8, 1, 9, 24, 22, 17, 21, 26], [24, 9, 2, 10, 26, 21, 18, 23], [11, 24, 10, 3, 20, 26, 23, 19], [16, 22, 26, 20, 4, 12, 25, 15], [22, 17, 21, 26, 12, 5, 13, 25], [26, 21, 18, 23, 25, 13, 6, 14], [20, 26, 23, 19, 15, 25, 14, 7]]), ElementType.Hexahedron_8: (ElementType.Hexahedron_8, [[0, 1, 2, 3, 4, 5, 6, 7]]), ElementType.Point_1: (ElementType.Point_1, [[0]]), ElementType.Pyramid_13: (ElementType.Pyramid_5, [[0, 1, 2, 3, 4]]), ElementType.Pyramid_14: (ElementType.Pyramid_5, [[0, 5, 13, 8, 9], [5, 1, 6, 13, 10], [13, 6, 2, 7, 11], [8, 13, 7, 3, 12], [9, 4, 10, 5, 13], [10, 4, 11, 6, 13], [11, 4, 12, 7, 13], [12, 4, 9, 8, 13]]), ElementType.Pyramid_5: (ElementType.Pyramid_5, [[0, 1, 2, 3, 4]]), ElementType.Quadrangle_4: (ElementType.Quadrangle_4, [[0, 1, 2, 3]]), ElementType.Quadrangle_8: (ElementType.Quadrangle_4, [[0, 1, 2, 3]]), ElementType.Quadrangle_9: (ElementType.Quadrangle_4, [[0, 4, 8, 7], [4, 1, 5, 8], [8, 5, 2, 6], [7, 8, 6, 3]]), ElementType.Tetrahedron_10: (ElementType.Tetrahedron_4, [[0, 4, 6, 7], [1, 5, 4, 8], [2, 6, 5, 9], [7, 8, 9, 3], [4, 5, 6, 7], [4, 5, 7, 8], [5, 6, 7, 9], [5, 7, 8, 9]]), ElementType.Tetrahedron_4: (ElementType.Tetrahedron_4, [[0, 1, 2, 3]]), ElementType.Triangle_3: (ElementType.Triangle_3, [[0, 1, 2]]), ElementType.Triangle_6: (ElementType.Triangle_3, [[0, 3, 5], [3, 1, 4], [3, 4, 5], [5, 4, 2]]), ElementType.Wedge_15: (ElementType.Wedge_6, [[0, 1, 2, 3, 4, 5]]), ElementType.Wedge_18: (ElementType.Wedge_6, [[0, 6, 8, 12, 15, 17], [6, 1, 7, 15, 13, 16], [7, 2, 8, 16, 14, 17], [6, 7, 8, 15, 16, 17], [12, 15, 17, 3, 9, 11], [15, 13, 16, 9, 4, 10], [16, 14, 17, 10, 5, 11], [15, 16, 17, 9, 10, 11]]), ElementType.Wedge_6: (ElementType.Wedge_6, [[0, 1, 2, 3, 4, 5]])}

(linear element type, list of local connectivities). By default only the corners are kept (one linear element). Elements without enough nodes to be subdivided (Quadrangle_8, Pyramid_13, …) are converted to one linear element so the final mesh can have lonely nodes

Type:

Conversion to linear elements by subdivision

linearToQuadratic: Dict[ElementType, ElementType] = {ElementType.Bar_2: ElementType.Bar_3, ElementType.Bar_3: ElementType.Bar_3, ElementType.Hexahedron_20: ElementType.Hexahedron_27, ElementType.Hexahedron_27: ElementType.Hexahedron_27, ElementType.Hexahedron_8: ElementType.Hexahedron_27, ElementType.Point_1: ElementType.Point_1, ElementType.Pyramid_13: ElementType.Pyramid_14, ElementType.Pyramid_14: ElementType.Pyramid_14, ElementType.Pyramid_5: ElementType.Pyramid_14, ElementType.Quadrangle_4: ElementType.Quadrangle_9, ElementType.Quadrangle_8: ElementType.Quadrangle_9, ElementType.Quadrangle_9: ElementType.Quadrangle_9, ElementType.Tetrahedron_10: ElementType.Tetrahedron_10, ElementType.Tetrahedron_4: ElementType.Tetrahedron_10, ElementType.Triangle_3: ElementType.Triangle_6, ElementType.Triangle_6: ElementType.Triangle_6, ElementType.Wedge_15: ElementType.Wedge_18, ElementType.Wedge_18: ElementType.Wedge_18, ElementType.Wedge_6: ElementType.Wedge_18}

Quadratic element type to use when converting a mesh to a quadratic mesh

linearizedMiddlePoints: Dict[ElementType, Tuple[Tuple[Tuple[int, ...], int], ...]] = {ElementType.Bar_3: (((0, 1), 2),), ElementType.Hexahedron_20: (((0, 1), 8), ((1, 2), 9), ((2, 3), 10), ((3, 0), 11), ((4, 5), 12), ((5, 6), 13), ((6, 7), 14), ((7, 4), 15), ((0, 4), 16), ((1, 5), 17), ((2, 6), 18), ((3, 7), 19)), ElementType.Hexahedron_27: (((0, 1), 8), ((1, 2), 9), ((2, 3), 10), ((3, 0), 11), ((4, 5), 12), ((5, 6), 13), ((6, 7), 14), ((7, 4), 15), ((0, 4), 16), ((1, 5), 17), ((2, 6), 18), ((3, 7), 19), ((3, 0, 4, 7, 11, 16, 15, 19), 20), ((1, 2, 6, 5, 9, 18, 13, 17), 21), ((0, 1, 5, 4, 8, 17, 12, 16), 22), ((2, 3, 7, 6, 10, 19, 14, 18), 23), ((0, 3, 2, 1, 11, 10, 9, 8), 24), ((4, 5, 6, 7, 12, 13, 14, 15), 25), ((0, 1, 2, 3, 4, 5, 6, 7), 26)), ElementType.Pyramid_13: (((0, 1), 5), ((1, 2), 6), ((2, 3), 7), ((3, 0), 8), ((0, 4), 9), ((1, 4), 10), ((2, 4), 11), ((3, 4), 12)), ElementType.Pyramid_14: (((0, 1), 5), ((1, 2), 6), ((2, 3), 7), ((3, 0), 8), ((0, 4), 9), ((1, 4), 10), ((2, 4), 11), ((3, 4), 12), ((0, 3, 2, 1, 8, 7, 6, 5), 13)), ElementType.Quadrangle_8: (((0, 1), 4), ((1, 2), 5), ((2, 3), 6), ((3, 0), 7)), ElementType.Quadrangle_9: (((0, 1), 4), ((1, 2), 5), ((2, 3), 6), ((3, 0), 7), ((0, 1, 2, 3), 8)), ElementType.Tetrahedron_10: (((0, 1), 4), ((1, 2), 5), ((2, 0), 6), ((0, 3), 7), ((1, 3), 8), ((2, 3), 9)), ElementType.Triangle_6: (((0, 1), 3), ((1, 2), 4), ((2, 0), 5)), ElementType.Wedge_15: (((0, 1), 6), ((1, 2), 7), ((2, 0), 8), ((3, 4), 9), ((4, 5), 10), ((5, 3), 11), ((0, 3), 12), ((1, 4), 13), ((2, 5), 14)), ElementType.Wedge_18: (((0, 1), 6), ((1, 2), 7), ((2, 0), 8), ((3, 4), 9), ((4, 5), 10), ((5, 3), 11), ((0, 3), 12), ((1, 4), 13), ((2, 5), 14), ((0, 1, 4, 3, 6, 13, 9, 12), 15), ((0, 3, 5, 2, 12, 11, 14, 8), 17), ((2, 5, 4, 1, 14, 10, 13, 7), 16))}

Rules to move the non corner nodes of a quadratic element to obtain a geometrically linear element. Each rule is (nodes to average, node to compute). The rules must be applied in order (edges, then face centers, then volume center), because the centers average nodes computed by the previous rules.

tetrahedron10CentralSubdivisions = array([[[4, 5, 6, 7],         [4, 5, 7, 8],         [5, 6, 7, 9],         [5, 7, 8, 9]],         [[4, 5, 6, 9],         [4, 6, 7, 9],         [4, 7, 8, 9],         [4, 8, 5, 9]],         [[4, 5, 6, 8],         [4, 6, 7, 8],         [6, 7, 9, 8],         [6, 9, 5, 8]]])

The 3 possible subdivisions (one per diagonal) of the central octahedron of a Tetrahedron_10

tetrahedron10EdgeVertices = array([[0, 1],        [1, 2],        [2, 0],        [0, 3],        [1, 3],        [2, 3]])

End nodes of the 6 edges of a Tetrahedron_10

validPermutations: Dict[ElementType, List[List[int]]] = {ElementType.Bar_2: [[0, 1]], ElementType.Quadrangle_4: [[0, 1, 2, 3], [1, 2, 3, 0], [2, 3, 0, 1], [3, 0, 1, 2]], ElementType.Tetrahedron_4: [[0, 1, 2, 3], [0, 2, 3, 1], [0, 3, 1, 2], [2, 1, 3, 0], [3, 1, 0, 2], [1, 3, 2, 0], [3, 0, 2, 1], [1, 2, 0, 3], [2, 0, 1, 3], [1, 0, 3, 2], [2, 3, 0, 1], [3, 2, 1, 0]], ElementType.Triangle_3: [[0, 1, 2], [1, 2, 0], [2, 0, 1]]}

Renumbering of the nodes giving the same element (the normal must point to the same direction). Bars do not have permutations because the normal changes in 2D.