33. fe — Finite Element Models in pyFormex.

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.

class fe.Model(coords, elems)

Contains all FE model data.

Create new model data.

coords is an array with nodal coordinates elems is either a single element connectivity array, or a list of such. In a simple case, coords and elems can be the arrays obtained by coords, elems = F.feModel(). This is however limited to a model where all elements have the same number of nodes. Then you can use the list of elems arrays. The ‘fe’ plugin has a helper function to create this list. E.g., if FL is a list of Formices (possibly with different plexitude), then fe.mergeModels([Fi.feModel() for Fi in FL]) will return the (coords,elems) tuple to create the Model.

The model can have node and element property numbers.

Model objects have the following methods:

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 maximum plexitude of the model.
splitElems(set)

Splits a set of element numbers over the element groups.

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, set)
Return the global element numbers for elements set in group
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.

It also provide the global and group element numbers, since they had to be calculated anyway.

renumber(old=None, new=None)

Renumber a set of nodes.

old and new are equally sized lists with unique node numbers, each smaller that 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 cooresponding with the old ones.

Functions defined in the module fe

fe.mergeNodes(nodes)

Merge all the nodes of a list of node sets.

Each item in nodes is a Coords array. The return value is a tuple with:

  • the coordinates of all unique nodes,
  • a list of indices translating the old node numbers to the new.
fe.mergeModels(femodels)

Merge all the nodes of a list of FE models.

Each item in femodels is a (coords,elems) tuple. The return value is a tuple with:

  • the coordinates of all unique nodes,
  • a list of elems corresponding to the input list, but with numbers referring to the new coordinates.
fe.checkUniqueNumbers(nrs, nmin=0, nmax=None, error=None)

Check that an array contains a set of unique integers in range.

nrs is an integer array with any shape. All integers should be unique and in the range(nmin,nmax). Beware: this means that nmin <= i < nmax ! Default nmax is unlimited. Set nmin to None to error is the value to return if the tests are not passed. By default, a ValueError is raised. On success, None is returned

fe.mergedModel()

Returns the fe Model obtained from merging individual models.

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

Documentation

Previous topic

32. mesh — mesh.py

Next topic

34. properties — General framework for attributing properties to geometrical elements.

This Page