The mesh
module
Overview
Helper to process mesh based data
Data that is distributed over a geometrical body, e.g. a stress tensor distribution on a component, is usually transported via a mesh. The meshes are a list of items (e.g. nodes or elements of a FEM mesh), each being described by the geometrical coordinates and the local data values, like for example the local stress tensor data.
In a plain mesh (see PlainMesh
) there is no further
relation between the items is known, whereas a complete FEM mesh (see
Mesh
) there is also information on the connectivity
of the nodes and elements.
Examples
Read in a mesh from a vmap file:
>>> df = (vm = pylife.vmap.VMAPImport('demos/plate_with_hole.vmap')
.make_mesh('1', 'STATE-2')
.join_variable('STRESS_CAUCHY')
.join_variable('DISPLACEMENT')
.to_frame())
>>> df.head()
x y z S11 S22 S33 S12 S13 S23 dx dy dz
element_id node_id
1 1734 14.897208 5.269875 0.0 27.080811 6.927080 0.0 -13.687358 0.0 0.0 0.005345 0.000015 0.0
1582 14.555333 5.355806 0.0 28.319006 1.178649 0.0 -10.732705 0.0 0.0 0.005285 0.000003 0.0
1596 14.630658 4.908741 0.0 47.701195 5.512213 0.0 -17.866833 0.0 0.0 0.005376 0.000019 0.0
4923 14.726271 5.312840 0.0 27.699907 4.052865 0.0 -12.210032 0.0 0.0 0.005315 0.000009 0.0
4924 14.592996 5.132274 0.0 38.010101 3.345431 0.0 -14.299768 0.0 0.0 0.005326 0.000013 0.0
Get the coordinates of the mesh.
>>> df.plain_mesh.coordinates.head()
x y z
element_id node_id
1 1734 14.897208 5.269875 0.0
1582 14.555333 5.355806 0.0
1596 14.630658 4.908741 0.0
4923 14.726271 5.312840 0.0
4924 14.592996 5.132274 0.0
Now the same with a 2D mesh:
>>> df.drop(columns=['z']).plain_mesh.coordinates.head()
x y
element_id node_id
1 1734 14.897208 5.269875
1582 14.555333 5.355806
1596 14.630658 4.908741
4923 14.726271 5.312840
4924 14.592996 5.132274