Skip to content

Element Type Definition

Eric Kerfoot edited this page Mar 9, 2017 · 10 revisions

This section describes the notion of element type which all meshes must use to describe geometry and basis. Every topology is defined with the name of an element type, eg. Tri1NL for linear triangles, Tet1NL for tetrahedra, Hex1NL for hexahedra, etc.

All meshes are composed of elements which are mathematically defined in terms of shape, basis functions, and order. An element's data is represented by nodes which equate to spatial positions in n-dimensional space or values in an n-dimensional field. Elements are therefore composed of discrete data points and their type definition describing how data is represented continuously.

The simplest element is a 0-dimensional point representing data at a discrete location. This element has no shape nor dimension thus no interpolation scheme is necessary and its type definition is trivial.

A line is a 1-dimensional object projected into some n-dimensional space. The simplest is a linear (order 1) line defined by two data points and a linear interpolation basis function. Given a value xi from 0 to 1 representing the 1-dimensional interpolation between the line nodes a and b, the basis functions are B(xi) = [(1-xi),xi].

An element's topology defines the relationship between the data points in an element. For a linear line this states which point is the start of the line a and which is the end b. Node ordering in an element definition is important because the order of basis functions is fixed. The ordering for a linear line is simply the first data point is the node at the start of the line and second at the end, higher order lines are similarly defined from first to last node.

Nodes in elements of higher dimensions are ordered by their xi space coordinates in ascending component precedence (ie. sort first by last xi coordinate component), with vertices given first. Indices are sorted first by xi2 values, then by xi1, then by xi0, with vertices given in this order first followed by non-vertex control points. This arranges the xi values for the non-vertex control points of an element in a spatially sorted order with the dimensions in an ascending order of significance. This also implies that the vertices for an element always are first in the index ordering, therefore the indices for the vertices does not change between elements of the same shape and basis but with different order.

The following gives the order and xi value of each node in a linear and quadratic example of a line, triangle, and quadrilateral:

Shape, Basis Functions, Order

An element type definition has a shape which defines the basic geometric shape and topology. Eidolon defines the following shapes for element type definitions:

  • Point
  • Line (Line)
  • Triangle (Tri)
  • Quadrilateral (Quad)
  • Tetrahedron (Tet)
  • Hexahedron (Hex)

The basis functions define how nodes of an element are weighted when summed in the interpolation process. Eidolon defines the Nodal Lagrange basis functions for the above geometries, as well as a few more specialized ones including Catmull-Rom for quadrilaterals and hexahedra only.

The order of an element defines the order of the basis functions. This meaning varies by basis function type. For Nodal Lagrange this affects what power xi values are raised to in the definition as well as how many nodes an element will have.

These three components together define the shape of an element, how many nodes if will have, the ordering of these nodes in xi space, and the basis functions and interpolation scheme. Eidolon internally creates these definitions as needed and names them in a standard way: [Geom][Order][Basis]. For example, a quadratic Nodal Lagrange tetrahedron definition is named Tet2NL.

The most commonly encountered element types are described here:

  • Line1NL : Simple 1D line composed of a start and end node
  • Tri1NL : Triangles defined by 3 vertices
  • Tet1NL : Tetrahedron defined by 4 vertices
  • Tet2NL : Tetrahedron defined by 4 vertices and 4 edge nodes
  • Hex1NL : Hexahedron defined by 8 vertices
  • Hex2NL : Hexahedron defined by 8 vertices and 19 median nodes

Python Implementation

Eidolon defines element types in terms of routines which create instances of ElemTypeDef. The enum object BasisGenFuncs associates a routine with the name of a basis function, eg. associates NL with the routine nodalLagrangeType which will return an object defining the Nodal Lagrange element type. The enum object ElemType uses this to create element type objects on demand for valid combinations of geometry, order, and basis functions.

For example, creating a linear triangle element type object then printing the xi coordinates of its nodes is done as follows:

>>> et=ElemType.Tri1NL
>>> print et.xis
[(0.0, 0.0), (1.0, 0.0), (0.0, 1.0)]

Like all other enum objects, the name alone can be retrieved by adding an underscore to the member:

>>> print ElemType._Tri1NL
Tri1NL

This is used when constructing an index matrix storing the topology for a mesh:

inds=IndexMatrix('triind',ElemType._Tri1NL,2,3)
inds[0]=(0,1,2) # index list for triangle 1
inds[1]=(0,3,1) # index list for triangle 2

A dataset containing the entire mesh can be constructed from the vertex and index matrices:

nodes=Vec3Matrix('nodes',4)
nodes[:]=(vec3(0,0,0),vec3(1,0,0),vec3(0.5,0,0.866),vec3(0.5,0,-0.866))
ds=PyDataSet('TriDS',nodes,[inds])

Finally a MeshSceneObject is created from this and added to the scene, representing a mesh of 2 triangles:

obj=MeshSceneObject('Tri',ds)
mgr.addSceneObject(obj)
Clone this wiki locally