FEM.Elements.E3D package#

Collection of 3D Elements

Submodules#

FEM.Elements.E3D.Brick module#

BRICK ELEMENTS#

Defines the lagrangian first order and second order brick elements

https://raw.githubusercontent.com/ZibraMax/FEM/master/docs/source/Bricks.png

Brick (8 nodes) and BrickO2 (20 nodes). (Reddy, 2005)#

Brick#

First order 8 node brick element

Shape Functions#
\[\begin{split}\Psi_i=\frac{1}{8}\left[\begin{matrix}\left(1 - x\right) \left(1 - y\right) \left(1 - z\right)\\\left(1 - y\right) \left(1 - z\right) \left(x + 1\right)\\\left(1 - z\right) \left(x + 1\right) \left(y + 1\right)\\\left(1 - x\right) \left(1 - z\right) \left(y + 1\right)\\\left(1 - x\right) \left(1 - y\right) \left(z + 1\right)\\\left(1 - y\right) \left(x + 1\right) \left(z + 1\right)\\\left(x + 1\right) \left(y + 1\right) \left(z + 1\right)\\\left(1 - x\right) \left(y + 1\right) \left(z + 1\right)\end{matrix}\right]\end{split}\]
Shape Functions Derivatives#
\[\begin{split}\frac{\partial \Psi_i}{\partial x_j}=\frac{1}{8}\left[\begin{matrix}\left(1 - z\right) \left(y - 1\right) & \left(1 - z\right) \left(x - 1\right) & - \left(1 - x\right) \left(1 - y\right)\\\left(1 - y\right) \left(1 - z\right) & \left(1 - z\right) \left(- x - 1\right) & - \left(1 - y\right) \left(x + 1\right)\\\left(1 - z\right) \left(y + 1\right) & \left(1 - z\right) \left(x + 1\right) & - \left(x + 1\right) \left(y + 1\right)\\\left(1 - z\right) \left(- y - 1\right) & \left(1 - x\right) \left(1 - z\right) & - \left(1 - x\right) \left(y + 1\right)\\\left(1 - y\right) \left(- z - 1\right) & - \left(1 - x\right) \left(z + 1\right) & \left(1 - x\right) \left(1 - y\right)\\\left(1 - y\right) \left(z + 1\right) & - \left(x + 1\right) \left(z + 1\right) & \left(1 - y\right) \left(x + 1\right)\\\left(y + 1\right) \left(z + 1\right) & \left(x + 1\right) \left(z + 1\right) & \left(x + 1\right) \left(y + 1\right)\\- \left(y + 1\right) \left(z + 1\right) & \left(1 - x\right) \left(z + 1\right) & \left(1 - x\right) \left(y + 1\right)\end{matrix}\right]\end{split}\]

BrickO2#

Second order 20 node brick element

Shape Functions#
\[\begin{split}\Psi_i = \frac{1}{8}\left[\begin{matrix}\left(1 - x\right) \left(1 - y\right) \left(1 - z\right) \left(- x - y - z - 2\right)\\\left(1 - y\right) \left(1 - z\right) \left(x + 1\right) \left(x - y - z - 2\right)\\\left(1 - z\right) \left(x + 1\right) \left(y + 1\right) \left(x + y - z - 2\right)\\\left(1 - x\right) \left(1 - z\right) \left(y + 1\right) \left(- x + y - z - 2\right)\\\left(1 - x\right) \left(1 - y\right) \left(z + 1\right) \left(- x - y + z - 2\right)\\\left(1 - y\right) \left(x + 1\right) \left(z + 1\right) \left(x - y + z - 2\right)\\\left(x + 1\right) \left(y + 1\right) \left(z + 1\right) \left(x + y + z - 2\right)\\\left(1 - x\right) \left(y + 1\right) \left(z + 1\right) \left(- x + y + z - 2\right)\\\left(1 - y\right) \left(1 - z\right) \left(2 - 2 x^{2}\right)\\\left(1 - y^{2}\right) \left(1 - z\right) \left(2 x + 2\right)\\\left(1 - z\right) \left(2 - 2 x^{2}\right) \left(y + 1\right)\\\left(1 - y^{2}\right) \left(1 - z\right) \left(2 - 2 x\right)\\\left(1 - y\right) \left(1 - z^{2}\right) \left(2 - 2 x\right)\\\left(1 - y\right) \left(1 - z^{2}\right) \left(2 x + 2\right)\\\left(1 - z^{2}\right) \left(2 x + 2\right) \left(y + 1\right)\\\left(1 - z^{2}\right) \left(2 - 2 x\right) \left(y + 1\right)\\\left(1 - y\right) \left(2 - 2 x^{2}\right) \left(z + 1\right)\\\left(1 - y^{2}\right) \left(2 x + 2\right) \left(z + 1\right)\\\left(2 - 2 x^{2}\right) \left(y + 1\right) \left(z + 1\right)\\\left(1 - y^{2}\right) \left(2 - 2 x\right) \left(z + 1\right)\end{matrix}\right]\end{split}\]
Shape Functions Derivatives#
\[\begin{split}\frac{\partial \Psi_i}{\partial x_j} = \frac{1}{8}\left[\begin{matrix}- \left(1 - x\right) \left(1 - y\right) \left(1 - z\right) + \left(1 - z\right) \left(y - 1\right) \left(- x - y - z - 2\right) & - \left(1 - x\right) \left(1 - y\right) \left(1 - z\right) + \left(1 - z\right) \left(x - 1\right) \left(- x - y - z - 2\right) & - \left(1 - x\right) \left(1 - y\right) \left(1 - z\right) - \left(1 - x\right) \left(1 - y\right) \left(- x - y - z - 2\right)\\\left(1 - y\right) \left(1 - z\right) \left(x + 1\right) + \left(1 - y\right) \left(1 - z\right) \left(x - y - z - 2\right) & - \left(1 - y\right) \left(1 - z\right) \left(x + 1\right) + \left(1 - z\right) \left(- x - 1\right) \left(x - y - z - 2\right) & - \left(1 - y\right) \left(1 - z\right) \left(x + 1\right) - \left(1 - y\right) \left(x + 1\right) \left(x - y - z - 2\right)\\\left(1 - z\right) \left(x + 1\right) \left(y + 1\right) + \left(1 - z\right) \left(y + 1\right) \left(x + y - z - 2\right) & \left(1 - z\right) \left(x + 1\right) \left(y + 1\right) + \left(1 - z\right) \left(x + 1\right) \left(x + y - z - 2\right) & - \left(1 - z\right) \left(x + 1\right) \left(y + 1\right) - \left(x + 1\right) \left(y + 1\right) \left(x + y - z - 2\right)\\- \left(1 - x\right) \left(1 - z\right) \left(y + 1\right) + \left(1 - z\right) \left(- y - 1\right) \left(- x + y - z - 2\right) & \left(1 - x\right) \left(1 - z\right) \left(y + 1\right) + \left(1 - x\right) \left(1 - z\right) \left(- x + y - z - 2\right) & - \left(1 - x\right) \left(1 - z\right) \left(y + 1\right) - \left(1 - x\right) \left(y + 1\right) \left(- x + y - z - 2\right)\\- \left(1 - x\right) \left(1 - y\right) \left(z + 1\right) + \left(1 - y\right) \left(- z - 1\right) \left(- x - y + z - 2\right) & - \left(1 - x\right) \left(1 - y\right) \left(z + 1\right) - \left(1 - x\right) \left(z + 1\right) \left(- x - y + z - 2\right) & \left(1 - x\right) \left(1 - y\right) \left(z + 1\right) + \left(1 - x\right) \left(1 - y\right) \left(- x - y + z - 2\right)\\\left(1 - y\right) \left(x + 1\right) \left(z + 1\right) + \left(1 - y\right) \left(z + 1\right) \left(x - y + z - 2\right) & - \left(1 - y\right) \left(x + 1\right) \left(z + 1\right) - \left(x + 1\right) \left(z + 1\right) \left(x - y + z - 2\right) & \left(1 - y\right) \left(x + 1\right) \left(z + 1\right) + \left(1 - y\right) \left(x + 1\right) \left(x - y + z - 2\right)\\\left(x + 1\right) \left(y + 1\right) \left(z + 1\right) + \left(y + 1\right) \left(z + 1\right) \left(x + y + z - 2\right) & \left(x + 1\right) \left(y + 1\right) \left(z + 1\right) + \left(x + 1\right) \left(z + 1\right) \left(x + y + z - 2\right) & \left(x + 1\right) \left(y + 1\right) \left(z + 1\right) + \left(x + 1\right) \left(y + 1\right) \left(x + y + z - 2\right)\\- \left(1 - x\right) \left(y + 1\right) \left(z + 1\right) - \left(y + 1\right) \left(z + 1\right) \left(- x + y + z - 2\right) & \left(1 - x\right) \left(y + 1\right) \left(z + 1\right) + \left(1 - x\right) \left(z + 1\right) \left(- x + y + z - 2\right) & \left(1 - x\right) \left(y + 1\right) \left(z + 1\right) + \left(1 - x\right) \left(y + 1\right) \left(- x + y + z - 2\right)\\- 4 x \left(1 - y\right) \left(1 - z\right) & \left(2 - 2 x^{2}\right) \left(z - 1\right) & \left(2 - 2 x^{2}\right) \left(y - 1\right)\\2 \left(1 - y^{2}\right) \left(1 - z\right) & - 2 y \left(1 - z\right) \left(2 x + 2\right) & \left(2 x + 2\right) \left(y^{2} - 1\right)\\- 4 x \left(1 - z\right) \left(y + 1\right) & \left(1 - z\right) \left(2 - 2 x^{2}\right) & \left(2 - 2 x^{2}\right) \left(- y - 1\right)\\- 2 \left(1 - y^{2}\right) \left(1 - z\right) & - 2 y \left(1 - z\right) \left(2 - 2 x\right) & \left(2 - 2 x\right) \left(y^{2} - 1\right)\\- 2 \left(1 - y\right) \left(1 - z^{2}\right) & \left(2 - 2 x\right) \left(z^{2} - 1\right) & - 2 z \left(1 - y\right) \left(2 - 2 x\right)\\2 \left(1 - y\right) \left(1 - z^{2}\right) & \left(2 x + 2\right) \left(z^{2} - 1\right) & - 2 z \left(1 - y\right) \left(2 x + 2\right)\\2 \left(1 - z^{2}\right) \left(y + 1\right) & \left(1 - z^{2}\right) \left(2 x + 2\right) & - 2 z \left(2 x + 2\right) \left(y + 1\right)\\- 2 \left(1 - z^{2}\right) \left(y + 1\right) & \left(1 - z^{2}\right) \left(2 - 2 x\right) & - 2 z \left(2 - 2 x\right) \left(y + 1\right)\\- 4 x \left(1 - y\right) \left(z + 1\right) & \left(2 - 2 x^{2}\right) \left(- z - 1\right) & \left(1 - y\right) \left(2 - 2 x^{2}\right)\\2 \left(1 - y^{2}\right) \left(z + 1\right) & - 2 y \left(2 x + 2\right) \left(z + 1\right) & \left(1 - y^{2}\right) \left(2 x + 2\right)\\- 4 x \left(y + 1\right) \left(z + 1\right) & \left(2 - 2 x^{2}\right) \left(z + 1\right) & \left(2 - 2 x^{2}\right) \left(y + 1\right)\\- 2 \left(1 - y^{2}\right) \left(z + 1\right) & - 2 y \left(2 - 2 x\right) \left(z + 1\right) & \left(1 - y^{2}\right) \left(2 - 2 x\right)\end{matrix}\right]\end{split}\]
class FEM.Elements.E3D.Brick.Brick(coords: ndarray, gdl: ndarray, n: int = 3, **kargs)#

Bases: Element3D, BrickScheme

Creates a 3D brick element

Parameters:
  • coords (np.ndarray) – Node coordinates matrix

  • gdl (np.ndarray) – Degrees of freedom matrix

  • n (int, optional) – Number of gauss points used for integration. Defaults to 3.

dpsis(_z: ndarray) ndarray#

Calculates the shape functions derivatives of a given natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix

Returns:

Shape function derivatives evaluated in Z points

Return type:

np.ndarray

psis(_z: ndarray) ndarray#

Calculates the shape functions of a given natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix

Returns:

Shape function evaluated in Z points

Return type:

np.ndarray

class FEM.Elements.E3D.Brick.BrickO2(coords: ndarray, gdl: ndarray, n: int = 3, **kargs)#

Bases: Element3D, BrickScheme

Creates a 3D second order brick element.

Parameters:
  • coords (np.ndarray) – Node coordinates matrix

  • gdl (np.ndarray) – Degrees of freedom matrix

  • n (int, optional) – Number of gauss points used for integration. Defaults to 3.

dpsis(_z: ndarray) ndarray#

Calculates the shape functions derivatives of a given natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix

Returns:

Shape function derivatives evaluated in Z points

Return type:

np.ndarray

psis(_z: ndarray) ndarray#

Calculates the shape functions of a given natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix

Returns:

Shape function evaluated in Z points

Return type:

np.ndarray

FEM.Elements.E3D.BrickScheme module#

Define the brick scheme used by brick elements

class FEM.Elements.E3D.BrickScheme.BrickScheme(n: int, **kargs)#

Bases: object

Generate a brick integration scheme

Parameters:

n (int) – Number of gauss points

FEM.Elements.E3D.Element3D module#

Defines a general 2D element

class FEM.Elements.E3D.Element3D.Element3D(coords: ndarray, _coords: ndarray, gdl: ndarray, **kargs)#

Bases: Element

Create a 3D element

Parameters:
  • coords (np.ndarray) – Element coordinate matrix

  • _coords (np.ndarray) – Element coordinate matrix for graphical interface purposes

  • gdl (np.ndarray) – Degree of freedom matrix

draw() None#

Create a graph of element

isInside(x: ndarray) ndarray#

Test if a given points is inside element domain

Parameters:

x (np.ndarray) – Point to be tested

Returns:

Boolean array of test result

Return type:

np.ndarray

jacobianGraph() None#

Create the determinant jacobian graph

FEM.Elements.E3D.Tetrahedral module#

TETRAHEDRAL ELEMENTS#

Defines the lagrangian first order and second order tetrahedral elements

https://raw.githubusercontent.com/ZibraMax/FEM/master/docs/source/Tetrahedrals.png

Tetrahedral (4 nodes) and TetrahedralO2 (10 nodes). (Reddy, 2005)#

Tetrahedral#

First order 4 node tetrahedral element

Shape Functions#
\[\begin{split}\Psi_i=\left[\begin{matrix}- x - y - z + 1\\x\\y\\z\end{matrix}\right]\end{split}\]
Shape Functions Derivatives#
\[\begin{split}\frac{\partial \Psi_i}{\partial x_j}=\left[\begin{matrix}-1 & -1 & -1\\1 & 0 & 0\\0 & 1 & 0\\0 & 0 & 1\end{matrix}\right]\end{split}\]

TetrahedralO2#

Second order 10 node tetrahedral element

Shape Functions#
\[\begin{split}\Psi_i=\left[\begin{matrix}\left(- 2 x - 2 y - 2 z + 1\right) \left(- x - y - z + 1\right)\\x \left(2 x - 1\right)\\y \left(2 y - 1\right)\\z \left(2 z - 1\right)\\x \left(- 4 x - 4 y - 4 z + 4\right)\\4 x y\\4 y \left(- x - y - z + 1\right)\\z \left(- 4 x - 4 y - 4 z + 4\right)\\4 x z\\4 y z\end{matrix}\right]\end{split}\]
Shape Functions Derivatives#
\[\begin{split}\frac{\partial \Psi_i}{\partial x_j}=\left[\begin{matrix}4 x + 4 y + 4 z - 3 & 4 x + 4 y + 4 z - 3 & 4 x + 4 y + 4 z - 3\\4 x - 1 & 0 & 0\\0 & 4 y - 1 & 0\\0 & 0 & 4 z - 1\\- 8 x - 4 y - 4 z + 4 & - 4 x & - 4 x\\4 y & 4 x & 0\\- 4 y & - 4 x - 8 y - 4 z + 4 & - 4 y\\- 4 z & - 4 z & - 4 x - 4 y - 8 z + 4\\4 z & 0 & 4 x\\0 & 4 z & 4 y\end{matrix}\right]\end{split}\]
class FEM.Elements.E3D.Tetrahedral.Tetrahedral(coords: ndarray, gdl: ndarray, n: int = 3, **kargs)#

Bases: Element3D, TetrahedralScheme

Creates a 3D tetrahedral element

Parameters:
  • coords (np.ndarray) – Node coordinates matrix

  • gdl (np.ndarray) – Degrees of freedom matrix

  • n (int, optional) – Number of gauss points used for integration. Defaults to 3.

dpsis(_z: ndarray) ndarray#

Calculates the shape functions derivatives of a given natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix

Returns:

Shape function derivatives evaluated in Z points

Return type:

np.ndarray

inverseMapping(x0: ndarray, n: int = 100) ndarray#

Give the natural coordinates of given global coordinates over elements using Newton’s method

Parameters:
  • x0 (np.ndarray) – Global coordinates matrix

  • n (int, optional) – Máximun number of iterations. Defaults to 100.

Returns:

Natural coordinates matrix

Return type:

np.ndarray

psis(_z: ndarray) ndarray#

Calculates the shape functions of a given natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix

Returns:

Shape function evaluated in Z points

Return type:

np.ndarray

class FEM.Elements.E3D.Tetrahedral.TetrahedralO2(coords: ndarray, gdl: ndarray, n: int = 3, **kargs)#

Bases: Element3D, TetrahedralScheme

Creates a 3D second order tetrahedral element

Parameters:
  • coords (np.ndarray) – Node coordinates matrix

  • gdl (np.ndarray) – Degrees of freedom matrix

  • n (int, optional) – Number of gauss points used for integration. Defaults to 3.

dpsis(_z: ndarray) ndarray#

Calculates the shape functions derivatives of a given natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix

Returns:

Shape function derivatives evaluated in Z points

Return type:

np.ndarray

inverseMapping(x0: ndarray, n: int = 100) ndarray#

Give the natural coordinates of given global coordinates over elements using Newton’s method

Parameters:
  • x0 (np.ndarray) – Global coordinates matrix

  • n (int, optional) – Máximun number of iterations. Defaults to 100.

Returns:

Natural coordinates matrix

Return type:

np.ndarray

psis(_z: ndarray) ndarray#

Calculates the shape functions of a given natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix

Returns:

Shape function evaluated in Z points

Return type:

np.ndarray

FEM.Elements.E3D.TetrahedralScheme module#

Define the tetrahedral scheme used by tetrahedral elements

class FEM.Elements.E3D.TetrahedralScheme.TetrahedralScheme(n: int, **kargs)#

Bases: object

Generate a tetrahedral integration scheme

Parameters:

n (int) – Number of gauss points