42. plugins.fe — Finite Element Models in pyFormex. — pyFormex 1.0.5 documentation

# 42. `plugins.fe` — Finite Element Models in pyFormex.

Finite element models are geometrical models that consist of a unique set of nodal coordinates and one of more sets of elements.

## 42.1. Classes defined in module plugins.fe

class `plugins.fe.` `Model`(coords=None, elems=None, meshes=None, fuse=True)

  Contains all FE model data.

  `meshes`()

    Return the parts as a list of meshes

  `nnodes`()

    Return the number of nodes in the model.

  `nelems`()

    Return the number of elements in the model.

  `ngroups`()

    Return the number of element groups in the model.

  `mplex`()

    Return the plexitude of all the element groups in the model.

    Returns a list of integers.

  `splitElems`(elems)

    Splits a set of element numbers over the element groups.

    Parameters:

    - elems: a list of element numbers in the range 0..self.nelems()

    Returns two lists of element sets, the first in global numbering, the second in group numbering. Each item contains the element numbers from the given set that belong to the corresponding group.

  `elemNrs`(group, elems=None)

    Return the global element numbers for elements in group

    Parameters:

    - group: group number
    - elems: list of local element numbers. If omitted, the list of all the elements in that group is used.

    Returns a list with corresponding global element numbers.

  `getElems`(sets)

    Return the definitions of the elements in sets.

    sets should be a list of element sets with length equal to the number of element groups. Each set contains element numbers local to that group.

    As the elements can be grouped according to plexitude, this function returns a list of element arrays matching the element groups in self.elems. Some of these arrays may be empty.

  `renumber`(old=None, new=None)

    Renumber a set of nodes.

    old and new are equally sized lists with unique node numbers, all smaller than the number of nodes in the model. The old numbers will be renumbered to the new numbers. If one of the lists is None, a range with the length of the other is used. If the lists are shorter than the number of nodes, the remaining nodes will be numbered in an unspecified order. If both lists are None, the nodes are renumbered randomly.

    This function returns a tuple (old,new) with the full renumbering vectors used. The first gives the old node numbers of the current numbers, the second gives the new numbers corresponding with the old ones.

class `plugins.fe.` `FEModel`(meshes)

  A Finite Element Model.

  This class is intended to collect all data concerning a Finite Element Model. In due time it may replace the Model class. Currently it only holds geometrical data, but will probably be expanded later to include a property database holding material data, boundary conditions, loading conditions and simulation step data.

  While the Model class stores the geometry in a single coords block and multiple elems blocks, the new FEModel class uses a list of Meshes. The Meshes do not have to be compact though, and thus all Meshes in the FEModel could used the same coords block, resulting in an equivalent model as the old Model class. But the Meshes may also use different coords blocks, allowing to accomodate better to versatile applications.

  `nelems`()

    Return the number of elements in the model.

## 42.2. Functions defined in module plugins.fe

`plugins.fe.` `mergedModel`(meshes, **kargs)

  Returns the fe Model obtained from merging individual meshes.

  The input arguments are (coords,elems) tuples. The return value is a merged fe Model.

`plugins.fe.` `sortElemsByLoadedFace`(ind)

  Sort a set of face loaded elements by the loaded face local number

  ind is a (nelems,2) array, where ind[:,0] are element numbers and ind[:,1] are the local numbers of the loaded faces

  Returns a dict with the loaded face number as key and a list of element numbers as value.

  For a typical use case, see the FePlast example.