The Surface3D class

class pylife.mesh.Surface3D(pandas_obj)[source]

Determines nodes at the surface in a 3D mesh. It also computes the outward normal vectors of the surface.

Raises:
  • AttributeError – if at least one of the columns x, y, z is missing

  • AttributeError – if the index of the DataFrame is not a two level MultiIndex with the names node_id and element_id

is_at_surface()[source]

Determines for every point in the mesh if it is at the mesh’s surface.

Example usage:

# df_mesh is a pandas DataFrame with columns "x", "y", "z" and
# one row per node, indexed by a mult-index with levels
# "element_id" and "node_id".
is_at_surface_1 = df_mesh.surface_3D.is_at_surface()

# The result will be a series with values 0 or 1 for every node

Note

This function is slow for large meshes. A better approach would be to determine surface nodes in the commercial solver (Abaqus, Ansys).

Returns:

is_at_surface – A series with the same index as the given DataFrame, indicating whether the node is at a surface of the component or not.

Return type:

pd.Series

is_at_surface_with_normals()[source]

Determines for every point in the mesh if it is at the mesh’s surface, additionally calculate the outward normals.

Example usage:

# df_mesh is a pandas DataFrame with columns "x", "y", "z" and
# one row per node, indexed by a mult-index with levels
# "element_id" and "node_id".
is_at_surface_2 = df_mesh.surface_3D.is_at_surface_with_normals()

# The result will be a DataFrame with values 0 or 1 for every node

Note

This function is slow for large meshes. A better approach would be to determine surface nodes in the commercial solver (Abaqus, Ansys).

Returns:

is_at_surface – A DataFrame with the same index as the given DataFrame and columns “is_at_surface”, “normal_x”, “normal_y”, “normal_z”. The column is_at_surface determines whether the node is at a surface of the component or not. If at the surface, the other columns specify the outward normal vector at this point.

Return type:

pd.Series