femlabpy.elements.solids#
Three-dimensional solid element kernels for tetrahedra and hexahedra.
Workflow role#
This module contains the 3D structural kernels used when the model carries three translational degrees of freedom per node. It covers both simplex and brick topologies and includes stiffness, internal-force, and mass-matrix construction at element and assembled levels.
Public entry points#
keT4eandqeT4eoperate on one tetrahedral element.keh8eandqeh8eoperate on one hexahedral brick.kT4e,qT4e,kh8e, andqh8eassemble those responses globally.meT4e,mT4e,meh8e, andmh8eprovide the dynamic mass terms.
Functions#
|
Compute the stiffness matrix for a 4-node tetrahedral solid element. |
|
Compute the stiffness matrix for an 8-node hexahedral solid element. |
|
Assemble T4 solid element stiffness contributions into the global matrix. |
|
Assemble H8 solid element stiffness contributions into the global matrix. |
|
Compute the element mass matrix for a 4-node tetrahedral solid element. |
|
Compute the element mass matrix for an 8-node hexahedral solid element. |
|
Assemble T4 element mass matrices into the global mass matrix. |
|
Assemble H8 element mass matrices into the global mass matrix. |
|
Recover stress and strain for one tetrahedral solid element. |
|
Recover stress and strain at the eight H8 Gauss points. |
|
Recover T4 solid stresses and assemble internal forces. |
|
Recover H8 solid stresses and assemble internal forces. |
Function Reference#
- femlabpy.elements.solids.keT4e(Xe, Ge)[source]#
Compute the stiffness matrix for a 4-node tetrahedral solid element.
- Parameters:
- Xe:
Tetrahedral nodal coordinates with shape
(4, 3).- Ge:
Material row
[E, nu].
- Returns:
- ndarray
12 x 12element stiffness matrix.
- femlabpy.elements.solids.keh8e(Xe, Ge)[source]#
Compute the stiffness matrix for an 8-node hexahedral solid element.
- Parameters:
- Xe:
Hexahedral nodal coordinates with shape
(8, 3).- Ge:
Material row
[E, nu].
- Returns:
- ndarray
24 x 24element stiffness matrix integrated with2 x 2 x 2Gauss quadrature.
- femlabpy.elements.solids.kT4e(K, T, X, G)[source]#
Assemble T4 solid element stiffness contributions into the global matrix.
- Parameters:
- K:
Global stiffness matrix.
- T:
Topology table
[n1, n2, n3, n4, mat_id].- X:
Nodal coordinates.
- G:
Material table.
- Returns:
- ndarray or sparse matrix
Updated global stiffness matrix.
- femlabpy.elements.solids.kh8e(K, T, X, G)[source]#
Assemble H8 solid element stiffness contributions into the global matrix.
- Parameters:
- K:
Global stiffness matrix.
- T:
Topology table
[n1, ..., n8, mat_id].- X:
Nodal coordinates.
- G:
Material table.
- Returns:
- ndarray or sparse matrix
Updated global stiffness matrix.
- femlabpy.elements.solids.meT4e(Xe, Ge, *, lumped: bool = False)[source]#
Compute the element mass matrix for a 4-node tetrahedral solid element.
- Consistent (12x12) — analytical formula:
- M = (rho * V / 20) * [[2I, I, I, I],
[I, 2I, I, I], [I, I, 2I, I], [I, I, I, 2I]]
- Lumped (diagonal):
M = (rho * V / 4) * I_12
- Parameters:
- Xearray_like, shape (4, 3)
Nodal coordinates.
- Gearray_like
Material row
[E, nu, rho]. Ifrhois omitted, defaults to 1.- lumpedbool
If True, return diagonally lumped mass.
- Returns:
- Mendarray, shape (12, 12)
- femlabpy.elements.solids.meh8e(Xe, Ge, *, lumped: bool = False)[source]#
Compute the element mass matrix for an 8-node hexahedral solid element.
- Consistent (24x24) via 2x2x2 Gauss quadrature:
M = sum_gp rho * N^T N * det(J) * w
Lumped via HRZ (diagonal scaling to preserve total mass).
- Parameters:
- Xearray_like, shape (8, 3)
Nodal coordinates.
- Gearray_like
Material row
[E, nu, rho].- lumpedbool
If True, return diagonally lumped mass.
- Returns:
- Mendarray, shape (24, 24)
- femlabpy.elements.solids.mT4e(M, T, X, G, *, lumped: bool = False)[source]#
Assemble T4 element mass matrices into the global mass matrix.
- Parameters:
- Mndarray or sparse, shape (ndof, ndof)
Global mass matrix (modified in place).
- Tarray_like, shape (nel, 5)
Topology
[n1, n2, n3, n4, mat_id].- Xarray_like, shape (nn, 3)
Nodal coordinates.
- Garray_like
Material table
[E, nu, rho].- lumpedbool
If True, assemble lumped mass.
- Returns:
- Mndarray or sparse
Updated global mass matrix.
- femlabpy.elements.solids.mh8e(M, T, X, G, *, lumped: bool = False)[source]#
Assemble H8 element mass matrices into the global mass matrix.
- Parameters:
- Mndarray or sparse, shape (ndof, ndof)
Global mass matrix (modified in place).
- Tarray_like, shape (nel, 9)
Topology
[n1, ..., n8, mat_id].- Xarray_like, shape (nn, 3)
Nodal coordinates.
- Garray_like
Material table
[E, nu, rho].- lumpedbool
If True, assemble lumped mass.
- Returns:
- Mndarray or sparse
Updated global mass matrix.
- femlabpy.elements.solids.qeT4e(Xe, Ge, Ue)[source]#
Recover stress and strain for one tetrahedral solid element.
- Parameters:
- Xe:
Tetrahedral nodal coordinates with shape
(4, 3).- Ge:
Material row
[E, nu].- Ue:
Element displacement vector.
- Returns:
- tuple[ndarray, ndarray, ndarray]
Element internal-force vector, stress vector, and strain vector.
- femlabpy.elements.solids.qeh8e(Xe, Ge, Ue)[source]#
Recover stress and strain at the eight H8 Gauss points.
- Parameters:
- Xe:
Hexahedral nodal coordinates with shape
(8, 3).- Ge:
Material row
[E, nu].- Ue:
Element displacement vector.
- Returns:
- tuple[ndarray, ndarray, ndarray]
Element internal-force vector, Gauss-point stresses, and Gauss-point strains.
- femlabpy.elements.solids.qT4e(q, T, X, G, u)[source]#
Recover T4 solid stresses and assemble internal forces.
- Parameters:
- q:
Global internal-force vector.
- T:
Topology table
[n1, n2, n3, n4, mat_id].- X:
Nodal coordinates.
- G:
Material table.
- u:
Global displacement vector.
- Returns:
- tuple[ndarray, ndarray, ndarray]
Updated internal-force vector, element stresses, and element strains.
- femlabpy.elements.solids.qh8e(q, T, X, G, u)[source]#
Recover H8 solid stresses and assemble internal forces.
- Parameters:
- q:
Global internal-force vector.
- T:
Topology table
[n1, ..., n8, mat_id].- X:
Nodal coordinates.
- G:
Material table.
- u:
Global displacement vector.
- Returns:
- tuple[ndarray, ndarray, ndarray]
Updated internal-force vector, flattened Gauss-point stresses, and flattened Gauss-point strains.