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_idindex. 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,yandzin mm and apandas.MultiIndexcontainingelement_idandnode_id.- Raises:
AttributeError – If at least one of the coordinate columns
xoryis missing.AttributeError – If the index of the DataFrame does not contain the levels
node_idandelement_id.
See also
pylife.mesh.gradient.Gradient3DCompute stress gradients used together with surface normals.
pylife.mesh.meshsignal.MeshDefine 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_idindex as the accessed mesh.Truemarks rows whosenode_idis on the surface of the component.- Return type:
Notes
The method requires coordinates
x,yandzin mm. The result has the full finite-element mesh index, not a node-averaged index, so duplicatednode_idvalues 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_idindex as the accessed mesh and the columnsis_at_surface,normal_x,normal_yandnormal_z. Normal components are unitless and describe the outward normal direction at surface rows; non-surface rows containNaNnormal components.- Return type:
Notes
Coordinates are interpreted in mm. The result retains the full finite-element mesh index, so a
node_idshared 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.