mesh.py

Define functions for mesh handling.

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

Compute 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.

Parameters
  • edgesN (ndarray) – edges-nodes connectivity.

  • bfacesN (ndarray) – boundary-faces-nodes connectivity.

Returns

boundary-edges connectivity.

Return type

ndarray

petgem.mesh.computeBoundaryElements(elemsF, bFaces, nFaces)[source]

Compute boundary elements.

Parameters
  • elemsF (ndarray) – elements-faces connectivity.

  • bfaces (ndarray) – indexes of boundary faces.

  • nFaces (int) – number of faces in the mesh.

Returns

indexes of boundary elements.

Return type

ndarray

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

Compute boundary faces of a tetrahedral mesh.

Parameters
  • elemsF (ndarray) – elements-face connectivity.

  • facesN (ndarray) – faces-nodes connectivity.

Returns

nodal-connectivity and indexes of boundary-faces, number of boundary faces.

Return type

ndarray

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

Compute edges of a 3D tetrahedral mesh.

Parameters
  • elemsN (ndarray) – elements-nodes connectivity.

  • nElems (int) – number of tetrahedral elements in the mesh.

Returns

edges connectivity and edgesNodes connectivity.

Return type

ndarray

petgem.mesh.computeFacePlane(nodes, bFaces, bFacesN)[source]

Compute the plane id to which the boundary belongs.

Parameters
  • nodes (ndarray) – nodes coordinates.

  • bFaces (ndarray) – indexes of boundary-faces.

  • bFacesN (ndarray) – boundary-faces-nodes connectivity.

Returns

plane id to which the boundary belongs.

Return type

ndarray

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

Compute the element’s faces of a 3D tetrahedral mesh.

Parameters
  • matrix (ndarray) – elements-faces connectivity.

  • nElems (int) – number of elements in the mesh.

Returns

element/faces connectivity.

Return type

ndarray

Note

References:n 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.

petgem.mesh.computeFacesEdges(elemsF, elemsE, nFaces, nElems)[source]

Compute the edge’s faces connectivity

Parameters
  • elemsF (ndarray) – elements-faces connectivity.

  • elemsE (ndarray) – elements-edges connectivity.

  • nFaces (int) – number of faces in the mesh.

  • nElems (int) – number of elements in the mesh.

Returns

edges/faces connectivity.

Return type

ndarray.

petgem.mesh.unitary_test()[source]

Unitary test for mesh.py script.