mesh.py

Define functions for mesh handling.

petgem.mesh.computeBoundaries(dof_connectivity, dof_edges, dof_faces, bEdges, bFaces, Nord)[source]

This function computes the indexes of dofs boundaries and internal dofs.

Parameters
  • dof_connectivity (ndarray) – local/global dofs list for elements

  • dof_edges (ndarray) – dofs index on edges

  • dof_faces (ndarray) – dofs index on faces

  • bEdges (ndarray) – boundary-edges connectivity with dimensions = (number_boundary_edges,1)

  • bfaces (ndarray) – indexes of boundary-faces = (number_boundary_faces, 1)

  • Nord (int) – polynomial order of nedelec basis functions

Returns

indexes of internal dofs and indexes of boundary dofs

Return type

ndarray

petgem.mesh.computeBoundaryEdges(edgesN, bfacesN)[source]

Compute boundary edges of a tetrahedral mesh. :param ndarray edgesN: edges-nodes connectivity. :param ndarray bfacesN: boundary-faces-nodes connectivity. :return: boundary-edges connectivity. :rtype: ndarray

petgem.mesh.computeBoundaryFaces(elemsF, facesN)[source]

Compute boundary faces of a tetrahedral mesh. :param ndarray elemsF: elements-face connectivity. :param ndarray facesN: faces-nodes connectivity. :return: nodal-connectivity and indexes of boundary-faces. :rtype: ndarray

petgem.mesh.computeEdges(elemsN, nElems)[source]

Compute edges of a 3D tetrahedral mesh. :param ndarray elemsN: elements-nodes connectivity. :param int nElems: number of tetrahedral elements in the mesh. :return: edges connectivity and edgesNodes connectivity. :rtype: ndarray

petgem.mesh.computeFaces(elemsN, nElems)[source]

Compute the element’s faces of a 3D tetrahedral mesh. :param ndarray matrix: elements-nodes connectivity. :param int nElems: number of elements in the mesh. :return: element/faces connectivity. :rtype: ndarray

Note

References:

Rognes, Marie E., Robert Cndarray. Kirby, and Anders Logg. “Efficient assembly of H(div) and H(curl) conforming finite elements.” SIAM Journal on Scientific Computing 31.6 (2009): 4130-4151.

class petgem.mesh.gmshObject(mshfilename)[source]

Class for mesh of type Gmsh. This class provides methods to parse .msh files to python format.

addElementsRule(condition, action)[source]

Add (append) an user rule to list of elements in the gmshObject. :param str condition: function or condition to be added. :param str action: action to be executed. :return: None.

addNodesRule(condition, action)[source]

Add (append) an user rule to list of nodes in the gmshObject. :param str condition: function or condition to be added. :param str action: action to be executed. :return: None.

cleanRules()[source]

Clean rules in the gmshObject.

edge_4_node = 26
edge_5_node = 27
edge_6_node = 28
gmshParser()[source]

Parser nodesRules and nodesElements in an gmshObject.

hexahedron_125_node = 93
hexahedron_20_node = 17
hexahedron_27_node = 12
hexahedron_64_node = 92
hexahedron_8_node = 5
line_2_node = 1
line_3_node = 8
np = <module 'numpy' from '/home/ocastillo/.local/lib/python3.6/site-packages/numpy/__init__.py'>
point_1_node = 15
printNumberElements()[source]

Print number of elements of a gmshObject. :return: None.

printNumberNodes()[source]

Print number of nodes of a gmshObject. :return: None.

printNumberPhysicalGroups()[source]

Print number of physical groups of a gmshObject. :return: None.

prism_15_node = 18
prism_18_node = 13
prism_6_node = 6
pyramid_13_node = 19
pyramid_14_node = 14
pyramid_5_node = 7
quadrangle_4_node = 3
quadrangle_8_node = 16
quadrangle_9_node = 10
tetrahedron_10_node = 11
tetrahedron_20_node = 29
tetrahedron_35_node = 30
tetrahedron_4_node = 4
tetrahedron_56_node = 31
triangle_10_node = 21
triangle_12_node_incomplete = 22
triangle_15_node = 23
triangle_15_node_incomplete = 24
triangle_21_node = 25
triangle_3_node = 2
triangle_6_node = 9
triangle_9_node_incomplete = 20
petgem.mesh.readGmshConnectivity(mesh_file)[source]

Read a mesh connectivity from a Gmsh file. :param str mesh_file: mesh file to be readed. :return: mesh connectivity (elemsN) and number of elements. :rtype: ndarray, int.

petgem.mesh.readGmshNodes(mesh_file)[source]

Read a mesh nodes from a Gmsh file. :param str mesh_file: mesh file to be readed. :return: nodes coordinates and number of nodes. :rtype: ndarray, int.

petgem.mesh.readGmshPhysicalGroups(mesh_file)[source]

Read conductivity model from a mesh in Gmsh format. :param str mesh_file: mesh file to be readed. :return: conductivity model (elemsS) and number of elements. :rtype: ndarray, int.

petgem.mesh.unitary_test()[source]

Unitary test for mesh.py script.