The Surface3D class#

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

Determine surface nodes and normals of a 3D solid mesh.

The accessor works on pyLife finite-element meshes with coordinates in mm and an element_id/node_id index. It produces per-row information that can be joined to stress and stress-gradient data for FKM nonlinear assessments.

Parameters:

pandas_obj (pandas.DataFrame) – Mesh DataFrame with coordinate columns x, y and z in mm and a pandas.MultiIndex containing element_id and node_id.

Raises:
  • AttributeError – If at least one of the coordinate columns x or y is missing.

  • AttributeError – If the index of the DataFrame does not contain the levels node_id and element_id.

See also

pylife.mesh.gradient.Gradient3D

Compute stress gradients used together with surface normals.

pylife.mesh.meshsignal.Mesh

Define the finite-element mesh signal contract.

Notes

Surface detection sums the solid angle contributions around each node_id. Interior nodes of a closed volume reach approximately

\[\sum \Omega_i = 4\pi\]

whereas nodes with a smaller angle sum are classified as surface nodes.

The implementation is intended for 3D solid meshes and can be slow for large industrial models. If possible, determine surface nodes and normals in the FE solver and import them with the result data.

is_at_surface()[source]#

Determine whether each mesh row lies on the component surface.

Returns:

Boolean series with the same element_id/node_id index as the accessed mesh. True marks rows whose node_id is on the surface of the component.

Return type:

pandas.Series

Notes

The method requires coordinates x, y and z in mm. The result has the full finite-element mesh index, not a node-averaged index, so duplicated node_id values can occur for nodes shared by several elements.

This calculation is slow for large meshes. Prefer importing surface flags from the FE solver when they are available.

is_at_surface_with_normals()[source]#

Determine surface membership and outward normal vectors.

Returns:

DataFrame with the same element_id/node_id index as the accessed mesh and the columns is_at_surface, normal_x, normal_y and normal_z. Normal components are unitless and describe the outward normal direction at surface rows; non-surface rows contain NaN normal components.

Return type:

pandas.DataFrame

Notes

Coordinates are interpreted in mm. The result retains the full finite-element mesh index, so a node_id shared by several elements can appear multiple times.

This calculation is slow for large meshes. Prefer importing surface normal vectors from the FE solver when they are available.