The HotSpot class#
- class pylife.mesh.HotSpot(pandas_obj)[source]#
Find connected hotspot regions on finite-element meshes.
A hotspot is a connected region of high scalar values, for example damage or stress in MPa, on a pyLife finite-element mesh. Connectivity is taken from the
element_idandnode_idlevels of the mesh index.- Parameters:
pandas_obj (pandas.DataFrame) – Mesh DataFrame with coordinate columns
xandyand apandas.MultiIndexcontainingelement_idandnode_id. The scalar field used for clustering must be stored in an additional column.
See also
pylife.mesh.meshsignal.MeshDefine the finite-element mesh signal contract used by this accessor.
- calc(value_key, limit_frac=0.9, artefact_threshold=None)[source]#
Calculate connected hotspots of a scalar field.
The method labels all connected regions whose value is at least
limit_fractimes the relevant maximum. Regions are connected if rows share anode_idor anelement_idin the full meshpandas.MultiIndex.- Parameters:
value_key (str) – Column name of the scalar field used for hotspot clustering, for example damage or stress in MPa. Values must be defined for every row of the accessed mesh.
limit_frac (float, optional) – Fraction of the maximum field value used as hotspot threshold. With
limit_frac=0.9, all connected rows with values greater than or equal to 90 percent of the maximum are labeled. Default is0.9.artefact_threshold (float, optional) – Upper cutoff for calculating the maximum. Values above
artefact_thresholdremain in the mesh but are ignored when the reference maximum is determined. Use this to suppress numerical artefacts that would otherwise hide physically relevant hotspots. Default isNone.
- Returns:
Integer hotspot labels with the same
element_id/node_idindex as the accessed mesh.0marks rows below the threshold; positive integers identify connected hotspot regions and can be used for grouping, plotting or selecting critical areas.- Return type:
Notes
The threshold value is
\[v_\mathrm{limit} = \mathrm{limit\_frac} \cdot \max(v_i)\]or the same maximum after removing values above
artefact_threshold. Starting from the remaining maximum row, the algorithm repeatedly adds all above-threshold rows sharing anelement_idornode_iduntil the connected component is complete, then continues with the next component.The algorithm assumes node-based values. Integration-point values should be extrapolated or averaged to the node-element mesh rows before calling this method.