sfepy.mesh.meshutils module¶
Finite element mesh utilites.
-
exception
sfepy.mesh.meshutils.MeshUtilsWarning[source]¶ Not necessarily error, but some strange thing happened.
-
class
sfepy.mesh.meshutils.bound[source]¶ Handles all physical entities <= mshmodelnum.
This class is optionaly filled in mesh.readmsh() by calling the method bound.handle2(). It extracts only the node numbers of the entity. All entities are stored in self.f dictionary (key is the entity number).
Has methods to get the node numbers in PMD notation: (1 2 4 1 2 3 4 8 9 10 -> 1:4 8:10) ie. it removes any repeating numbers and shortens the list using ”:”
Has method to find elements from a given list, which lie on the boundary formed by nodes (also returns appropriate side of elements).
So - all boundary conditions should be done using this class.
-
associateelements_key(key, elements)[source]¶ Finds the elements under the key
keyinelements.This is a regular (very slow, but bullet proof) version.
-
associateelements_key_fast(key, elements)[source]¶ Finds the elements under the key
keyinelements.This is a fast version, which assumes an undocumented feature, that all the elements which gmsh exports are in exactly the same order both in the entity key and mshmodelnum.
-
findelements(key, elements)[source]¶ Returns element numbers (in a list), which lies at the boundary determined by self.nodes.
Also returns the side of element. Currently only support triangles and quadrangles.
-
readpmd(filename)[source]¶ Loads internal dictionary from ‘filename’.
Format must be the same as from write()
-
-
class
sfepy.mesh.meshutils.mesh[source]¶ -
-
readGMV(filename, what=2)[source]¶ Reads GMV file.
- what ... 0 read only mesh
- ... 1 read only data ... 2 read both
-
readmsh(filename, b=None, symmetric=False, associateelements=True)[source]¶ Reads mesh from filename (*.msh).
it will read the physical entity “mshmodelnum” (default 100), which must contain every node (which will be used) and every element.
Optional parameter b of type bound will be filled with all other physical (!=mshmodelnum) nodes.
- example:
gmsh exports these physical entities: 100,1,2,101,200
then readmsh will read 100 into self.elements and self.nodes, and optionally fills “b” with entities 1,2,101 and 200. The assumption is, that entity 100 will contain every node and element used in entities 1,2,101 and 200. Also the nodes and elements in 100 must be consecutively sorted (use mshsort for this purpose)
it will convert msh types to PMD types, so that self.elements only contains PMD types
symmetric.... is the problem rot symmetric? if yes, readmsh() will automatically convert triangles to rottriangles and quadrangles to rotquadrangles.
-
readmsh2(filename, b=None, symmetric=False, associateelements=True)[source]¶ Reads mesh from filename (*.msh). Version 2.0
it will read the physical entity “mshmodelnum” (default 100), which must contain every node (which will be used) and every element.
Optional parameter b of type bound will be filled with all other physical (!=mshmodelnum) nodes.
- example:
gmsh exports these physical entities: 100,1,2,101,200
then readmsh will read 100 into self.elements and self.nodes, and optionally fills “b” with entities 1,2,101 and 200. The assumption is, that entity 100 will contain every node and element used in entities 1,2,101 and 200. Also the nodes and elements in 100 must be consecutively sorted (use mshsort for this purpose)
it will convert msh types to PMD types, so that self.elements only contains PMD types
symmetric.... is the problem rot symmetric? if yes, readmsh() will automatically convert triangles to rottriangles and quadrangles to rotquadrangles.
-
readpmd(filename)[source]¶ Read the mesh from filename (*.I1).
Can read I1, which was produced by writepmd().
Should be able to read some hand written I1s from PMD Example Manual. Sometimes you will have to tweak the parser to read your syntax.
I suggest to only use the writepmd() I1 syntax. This is easily readable/writable.
-
writeBC(filename, verbose=True)[source]¶ self.faces contain triplets (p1,p2,p3) which are triangles of tetrahedrons on the boundary. We need to find the number of each corresponding tetrahedron and it’s side.
-
writescalarspos(filename, infotext='PMD_scalars')[source]¶ Writes self.scalars to *.pos.
Optional parameter infotext specifies the name of the view in the pos file.
- Associates a scalar with every node, so gmsh shows points.
- Associates a scalar with every node of all elements, so gmsh fills the whole element (triangle, quadrangle, tetrahedra, ... etc.) with an extrapolated color.
You can set visibility in gmsh (only points, only triangles...).
-
writescalarspos2(filename, scaltime, infotext='PMD_scalars', dt=1.0)[source]¶ Writes self.scalars to *.pos.
Optional parameter infotext specifies the name of the view in the pos file.
- Associates a scalar with every node, so gmsh shows points.
- Associates a scalar with every node of all elements, so gmsh fills the whole element (triangle, quadrangle, tetrahedra, ... etc.) with an extrapolated color.
You can set visibility in gmsh (only points, only triangles...).
-
writestresspos(filename, infotext='PMD_stress')[source]¶ Writes scalars together with nodes and elements to filename.
Optional parameter infotext specifies the name of the view in the pos file.
1) Associates a scalar with every node, so gmsh shows points. 2) Associates a scalar with every node of all elements, so gmsh fills the whole element (triangle, quadrangle etc.) with an extrapolated color.
You can set visibility in gmsh (only points, only triangles...).
-
writevectorspos(filename, infotext='PMD_vectors')[source]¶ Writes scalars together with nodes and elements to filename.
Optional parameter infotext specifies the name of the view in the pos file.
1) Associates a scalar with every node, so gmsh shows points. 2) Associates a scalar with every node of all elements, so gmsh fills the whole element (triangle, quadrangle etc.) with an extrapolated color.
You can set visibility in gmsh (only points, only triangles...).
-

