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:
>>> from pylife.vmap import VMAPImport
>>> df = (
... VMAPImport('demos/plate_with_hole.vmap')
... .make_mesh('1', 'STATE-2')
... .join_coordinates()
... .join_variable('STRESS_CAUCHY')
... .join_variable('DISPLACEMENT')
... .to_frame()
... )
>>> df.head()
x y z ... dx dy dz
element_id node_id ...
1 1734 14.897208 5.269875 0.0 ... 0.005345 0.000015 0.0
1582 14.555333 5.355806 0.0 ... 0.005285 0.000003 0.0
1596 14.630658 4.908741 0.0 ... 0.005376 0.000019 0.0
4923 14.726271 5.312840 0.0 ... 0.005315 0.000009 0.0
4924 14.592996 5.132274 0.0 ... 0.005326 0.000013 0.0
[5 rows x 12 columns]
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