Shape Function classes

This family of classes computes common shape functions in 1D (Lines), 2D (Quads and Triangles), and 3D (Bricks and Tetrahedron elements).

LineShapes are defined over a unit-interval \([0,1]\).

QuadShapes are defined over a bi-unit-square \([-1,1]\times[-1,1]\).

TriangleShapes are defined over a domain (triangular coordinates) \([0,1]\times[0,1]\times[0,1]\).

BrickShapes are defined over a tri-unit-cube \([-1,1]\times[-1,1]\times[-1,1]\).

TetraShapes are defined over a domain (tetrahedral coordinates) \([0,1]\times[0,1]\times[0,1]\times[0,1]\).

In its final form, they will support up to tri-quadratic shape functions, and up to 5th-order polynomials for lines.

Usage:

Integrating a bi-quadratic function g(s,t)*shape_function(s,t) over a quad-shaped domain, assuming a function Jacobian(s,t) is defined and returns the jacobian for the current location.

integrator    = QuadIntegration(order=2)
interpolation = QuadShapes()

# initialization
F = np.zeros((9,))  # 9-node quad

# integration loop
xis, wis = integrator.parameters()
for xi, wi in zip(xis, wis):
    # computing the array of nodal shape functions
    shape = interpolation.shape(  # requesting spage function array
                order=2,          # polynomial order per direction: quadratic
                s=xi[0], t=xi[1], # local coordinates for current position
                n=(0,0),          # n-th derivative with respect to (s,t)
                serendipity=False # if serendipity: "8 nodes" else: "9 nodes"
                )
    # adding to the integral
    F += g(xi[0], xi[1]) * shape * Jacobian(xi[0], xi[1]) * wi

print(f"Int_V g(s,t) Phi(s,t) dV = {F}")
Abstract Shape Function Class
class femedu.utilities.ShapeFunctions.ShapeFunctions(type)

Abstract parent class for shape functions or their n-th (mixed) derivative for various interpolation functions.

shape(order, *argvs, **kwargs)

interface function to gets shape functions or their n-th derivative for various interpolation functions.

Note

This is a virtual function that needs to be implemented by any subclass

Derived Classes
class femedu.utilities.LineShapes.LineShapes

Shape functions or their n-th derivative for one-dimensional domains \([0,+1]\).

Derivatives are with respect to the normalized coordinate and need to be scaled accordingly.

shape(order, xi, n=0, Le=1.0)
Parameters:
  • order – polynomial order of the shape functions. Options: 0,1,2,3,4,5

  • xi – normalized location on interval [0,1]

  • n – return n-th derivative of the requested shape function

  • Le – element length; needed to correct for rotational dof

Returns:

PHI: a list of shape function values

class femedu.utilities.TriangleShapes.TriangleShapes

Shape functions or their *n-th mixed derivative for the unit-triangle (two-dimensional domain \((s,t)\in[0,+1]\times[0,+1]\) with \(s+t\le +1\)).

Derivatives are with respect to the normalized coordinate and need to be scaled accordingly.

Triangle shape functions are commonly formulated in triangle coordinates \((\xi_1,\xi_2,\xi_3)\) where \(\xi_1+\xi_2+\xi_3=1\). This implementation uses \(s\to\xi_1\) and \(t\to\xi_2\). The third component is implicitly computed as \(\xi_3=1-\xi_1-\xi_2\). The derivatives are returned as

\[\begin{split}\begin{array}{rcl} \frac{\partial }{\partial s} &=& \frac{\partial }{\partial \xi_1} - \frac{\partial }{\partial \xi_3} \\[2ex] \frac{\partial }{\partial t} &=& \frac{\partial }{\partial \xi_2} - \frac{\partial }{\partial \xi_3} \end{array}\end{split}\]
shape(order, s, t, n=(0, 0))
Parameters:
  • order – polynomial order of the shape functions. Options: 0,1,2,

  • s (float or np.array) – first coordinate of point of interest on interval [-1,1]

  • t (float or np.array) – second coordinate location on interval [-1,1]

  • n – return n-th derivative of the requested shape function.

Returns:

PHI: a list of shape function values

class femedu.utilities.QuadShapes.QuadShapes

Shape functions or their *n-th mixed derivative for the bi-unit-square (two-dimensional domain \((s,t)\in[-1,+1]\times[-1,+1]\).

Derivatives are with respect to the normalized coordinate and need to be scaled accordingly.

shape(order, s, t, n=(0, 0), serendipity=False)
Parameters:
  • order – polynomial order of the shape functions. Options: 0,1,2,

  • s (float or np.array) – first coordinate of point of interest on interval [-1,1]

  • t (float or np.array) – second coordinate location on interval [-1,1]

  • n – return n-th derivative of the requested shape function.

  • serendipity (bool) – set to True for 8-node serendipity or False for bi-quadratic (9-node) quads.

Returns:

PHI: a list of shape function values

Note

This functionality is not yet available.

Note

This functionality is not yet available.