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_id and node_id levels of the mesh index.

Parameters:

pandas_obj (pandas.DataFrame) – Mesh DataFrame with coordinate columns x and y and a pandas.MultiIndex containing element_id and node_id. The scalar field used for clustering must be stored in an additional column.

See also

pylife.mesh.meshsignal.Mesh

Define 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_frac times the relevant maximum. Regions are connected if rows share a node_id or an element_id in the full mesh pandas.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 is 0.9.

  • artefact_threshold (float, optional) – Upper cutoff for calculating the maximum. Values above artefact_threshold remain 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 is None.

Returns:

Integer hotspot labels with the same element_id/node_id index as the accessed mesh. 0 marks rows below the threshold; positive integers identify connected hotspot regions and can be used for grouping, plotting or selecting critical areas.

Return type:

pandas.Series

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 an element_id or node_id until 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.