FEM.Elements package#

Elements structures

Subpackages#

Submodules#

FEM.Elements.Element module#

Element class

class FEM.Elements.Element.Element(coords: ndarray, _coords: ndarray, gdl: ndarray, border: bool = False, fast: bool = False)#

Bases: object

Generates a generic element.

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

  • _coords (np.ndarray) – Vertical coordinates matrix for graphical interfaces

  • gdl (np.ndarray) – Degree of freedom matrix. Each row is a variable.

  • border (bool) – True if the element is part of the border domain of another element.

J(z: ndarray) ndarray#

Calculate the jacobian matrix over a set of natural coordinates

Parameters:

z (np.ndarray) – Natural coordinates matrix. Each row is a dimension, each column is a point.

Returns:

Jacobian’s matrices and shape function derivatives

Return type:

np.ndarray

T(z: ndarray) ndarray#

Give the global coordinates of given natural coordiantes over element

Parameters:

z (np.ndarray) – Natural coordinates matrix. Each row is a dimension, each column is a point.

Returns:

Global coordinates matrix and shape functions

Return type:

np.ndarray

TS(z)#

Returns the transformation of a given set of points in the element. This method is used for border elements

Parameters:

z (np.ndarray) – Natural coordinates matrix. Each row is a dimension, each column is a point.

Returns:

Global coordinates matrix

Return type:

np.ndarray

giveSolution(SVSolution: bool = False, domain: str = 'domain') ndarray#

Calculate the interpolated solution over element domain

Parameters:
  • SVSolution (bool, optional) – To calculate second variable solutions. Defaults to False.

  • domain (str, optional) – Where to give the solution [‘domain’ or ‘gauss-points’]. Defaults to ‘domain’.

Returns:

Arrays of coordinates, solutions and second variables solutions.

Return type:

np.ndarray

giveSolutionPoint(Z: ndarray, SVSolution: bool = False) ndarray#

Calculate the interpolated solution over given set of points

Parameters:
  • Z (np.ndarray) – Natural coordintas to extract the solution

  • SVSolution (bool, optional) – To calculate second variable solution. Defaults to False.

Returns:

Arrays of coordinates, solutions and second variables solutions.

Return type:

np.ndarray

integrate(f: Callable) float#

Calculate the integral of f function over element domain

Parameters:

f (function) – Function to be integrated

Returns:

Integral value

Return type:

float

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

restartMatrix() None#

Sets all element matrices and vectors to 0

setUe(U: ndarray) None#

Assing element local solution

Parameters:

U (np.ndarray) – Global solution