Hotspot calculation demo

This notebook detects and classifies hotspots of the von Mises stress in a connected FEM mesh. Each element/node entry of the mesh receives a number of the hotspot it is member of. “0” means the element/node is not part of any hotspots. “1” means that the element/node is part of the hotspot with the highes peak, “2” the same for the second highest peak and so forth.

See module documentation further details.

[1]:
import numpy as np
import pylife
import pandas as pd
import scipy.stats as stats
import pylife.stress.equistress
import pylife.strength.meanstress
import pylife.mesh.meshsignal
import pylife.mesh.hotspot
import pylife.vmap

import pyvista as pv
[2]:
vm_mesh = pylife.vmap.VMAPImport("two_notched_beam.vmap")
mesh = (vm_mesh.make_mesh('beam', 'STATE-1')
        .join_coordinates()
        .join_variable('STRESS_CAUCHY')
        .join_variable('DISPLACEMENT')
        .to_frame())

Equivalent stress calculation

[3]:
mesh['mises'] = mesh.equistress.mises()

Hot spot Calculation

[4]:
threshold = .3 # factor of the maximum local value
mesh['hotspot'] = mesh.hotspot.calc("mises", threshold)
display(mesh[['x', 'y', 'z', 'mises', 'hotspot']])
x y z mises hotspot
element_id node_id
1 352 -43.969048 23.989227 0.0 1296.278948 0
359 -42.955109 24.005196 0.0 1296.278948 0
215 -43.000000 25.000000 0.0 1296.278948 0
216 -44.000000 25.000000 0.0 1296.278948 0
1271 -43.969048 23.989227 1.0 1296.278948 0
... ... ... ... ... ... ...
8340 9186 -35.655140 17.474123 9.0 1508.430170 0
10106 -36.133118 17.862680 10.0 1508.430170 0
9903 -36.538712 17.142405 10.0 1508.430170 0
9796 -35.728638 16.920214 10.0 1508.430170 0
10105 -35.655140 17.474123 10.0 1508.430170 0

66720 rows × 5 columns

[5]:
print("%d hotspots found over the threshold" % mesh['hotspot'].max())
3 hotspots found over the threshold
[6]:
grid = pv.UnstructuredGrid(*mesh.mesh.vtk_data())
plotter = pv.Plotter()
plotter.add_mesh(grid, scalars=mesh.groupby('element_id')['hotspot'].first().to_numpy(), show_edges=True)
plotter.add_scalar_bar()
plotter.show()

Hotspots

[7]:
first_hotspot = mesh[mesh['hotspot'] == 1]
display(first_hotspot)
x y z S11 S22 S33 S12 S13 S23 dx dy dz mises hotspot
element_id node_id
11 11 -29.798346 15.728621 0.0 6272.631348 2563.831787 451.533936 -180.307007 -238.394638 134.026550 1.154036e-07 -1.756874e-07 4.878709e-08 5135.465212 1
293 -30.003225 15.085076 0.0 6272.631348 2563.831787 451.533936 -180.307007 -238.394638 134.026550 6.027405e-08 -1.652169e-07 3.857556e-08 5135.465212 1
298 -29.560358 14.704604 0.0 6272.631348 2563.831787 451.533936 -180.307007 -238.394638 134.026550 4.464848e-08 -1.967865e-07 3.022250e-08 5135.465212 1
294 -29.171230 15.177115 0.0 6272.631348 2563.831787 451.533936 -180.307007 -238.394638 134.026550 8.558990e-08 -2.332368e-07 3.184098e-08 5135.465212 1
930 -29.798346 15.728621 1.0 6272.631348 2563.831787 451.533936 -180.307007 -238.394638 134.026550 1.209642e-07 -1.854055e-07 3.053447e-08 5135.465212 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
8305 8564 -30.003225 15.085076 9.0 3100.241699 3297.122559 107.299477 309.390259 -129.906067 -215.895401 5.984818e-08 -1.767131e-07 -2.791749e-08 3172.277492 1
10016 -30.398149 15.265852 10.0 3100.241699 3297.122559 107.299477 309.390259 -129.906067 -215.895401 7.019130e-08 -1.394186e-07 -3.904580e-08 3172.277492 1
9487 -30.526169 14.907959 10.0 3100.241699 3297.122559 107.299477 309.390259 -129.906067 -215.895401 4.688527e-08 -1.422961e-07 -3.277479e-08 3172.277492 1
10022 -30.299625 14.657948 10.0 3100.241699 3297.122559 107.299477 309.390259 -129.906067 -215.895401 3.804261e-08 -1.504318e-07 -2.902902e-08 3172.277492 1
9483 -30.003225 15.085076 10.0 3100.241699 3297.122559 107.299477 309.390259 -129.906067 -215.895401 6.027405e-08 -1.652169e-07 -3.857556e-08 3172.277492 1

1296 rows × 14 columns

[8]:
second_hotspot = mesh[mesh['hotspot'] == 2]
display(second_hotspot)
x y z S11 S22 S33 S12 S13 S23 dx dy dz mises hotspot
element_id node_id
9 376 -32.057991 10.855629 0.0 -4764.971191 22.753010 -25.855721 329.925690 -65.013237 15.423181 -1.413637e-07 -1.010070e-07 -2.588431e-08 4799.154854 2
307 -33.038311 10.866936 0.0 -4764.971191 22.753010 -25.855721 329.925690 -65.013237 15.423181 -1.208426e-07 -7.387519e-08 -2.458061e-08 4799.154854 2
263 -33.000000 10.000000 0.0 -4764.971191 22.753010 -25.855721 329.925690 -65.013237 15.423181 -1.472568e-07 -8.075897e-08 -3.334923e-08 4799.154854 2
54 -32.000000 10.000000 0.0 -4764.971191 22.753010 -25.855721 329.925690 -65.013237 15.423181 -1.743098e-07 -1.092242e-07 -3.636057e-08 4799.154854 2
1295 -32.057991 10.855629 1.0 -4764.971191 22.753010 -25.855721 329.925690 -65.013237 15.423181 -1.405872e-07 -1.109971e-07 -1.996358e-08 4799.154854 2
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
7943 8578 -33.038311 10.866936 9.0 -3235.834717 12.813469 -20.089951 846.806335 9.251723 -42.739223 -1.200192e-07 -8.246292e-08 1.906615e-08 3550.335991 2
9566 -32.057991 10.855629 10.0 -3235.834717 12.813469 -20.089951 846.806335 9.251723 -42.739223 -1.413637e-07 -1.010070e-07 2.588431e-08 3550.335991 2
9658 -32.109859 11.699945 10.0 -3235.834717 12.813469 -20.089951 846.806335 9.251723 -42.739223 -1.036564e-07 -9.417452e-08 1.589893e-08 3550.335991 2
9997 -33.070908 11.748685 10.0 -3235.834717 12.813469 -20.089951 846.806335 9.251723 -42.739223 -9.047081e-08 -7.002545e-08 1.569840e-08 3550.335991 2
9497 -33.038311 10.866936 10.0 -3235.834717 12.813469 -20.089951 846.806335 9.251723 -42.739223 -1.208426e-07 -7.387519e-08 2.458061e-08 3550.335991 2

1504 rows × 14 columns

[9]:
third_hotspot = mesh[mesh['hotspot'] == 3]
display(third_hotspot)
x y z S11 S22 S33 S12 S13 S23 dx dy dz mises hotspot
element_id node_id
99 26 -6.500000 16.000000 0.0 3004.292725 521.134766 64.611237 -880.206421 60.812458 -0.974387 2.934005e-07 -0.000003 2.286925e-08 3137.434391 3
481 -6.711311 15.297429 0.0 3004.292725 521.134766 64.611237 -880.206421 60.812458 -0.974387 2.026713e-07 -0.000003 1.759673e-08 3137.434391 3
117 -5.611419 14.901155 0.0 3004.292725 521.134766 64.611237 -880.206421 60.812458 -0.974387 1.590093e-07 -0.000003 1.773502e-08 3137.434391 3
27 -5.526631 15.597612 0.0 3004.292725 521.134766 64.611237 -880.206421 60.812458 -0.974387 2.583925e-07 -0.000003 2.423010e-08 3137.434391 3
945 -6.500000 16.000000 1.0 3004.292725 521.134766 64.611237 -880.206421 60.812458 -0.974387 2.902192e-07 -0.000003 1.753467e-08 3137.434391 3
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
7606 8298 -5.526631 15.597612 9.0 3324.102539 357.891479 100.239151 -170.086090 44.371521 -26.944239 2.571436e-07 -0.000003 -1.762701e-08 3118.319462 3
9307 -5.611419 14.901155 10.0 3324.102539 357.891479 100.239151 -170.086090 44.371521 -26.944239 1.590093e-07 -0.000003 -1.773502e-08 3118.319462 3
9792 -4.326275 14.848801 10.0 3324.102539 357.891479 100.239151 -170.086090 44.371521 -26.944239 1.620271e-07 -0.000003 -1.573879e-08 3118.319462 3
9218 -4.473369 15.597612 10.0 3324.102539 357.891479 100.239151 -170.086090 44.371521 -26.944239 2.813164e-07 -0.000003 -2.211096e-08 3118.319462 3
9217 -5.526631 15.597612 10.0 3324.102539 357.891479 100.239151 -170.086090 44.371521 -26.944239 2.583925e-07 -0.000003 -2.423010e-08 3118.319462 3

160 rows × 14 columns

[ ]: