silex_lib_tet4_python
TET4 finite-element routines implemented in pure Python.
- SILEXlight.silex_lib_tet4_python.det33_ligne_de_un(a)[source]
Compute the determinant of a 3x3 matrix with first row fixed to ones.
- Parameters:
a (numpy.ndarray) – Array of shape
(2, 3)corresponding to rows 2 and 3 of the matrix where row 1 is assumed to be[1, 1, 1].- Returns:
Determinant value.
- Return type:
float
- SILEXlight.silex_lib_tet4_python.det44_ligne_de_un(a)[source]
Compute the determinant of a 4x4 matrix with first row fixed to ones.
- Parameters:
a (numpy.ndarray) – Array of shape
(3, 4)corresponding to rows 2 to 4 of the matrix where row 1 is assumed to be[1, 1, 1, 1].- Returns:
Determinant value.
- Return type:
float
- SILEXlight.silex_lib_tet4_python.stiffnessmatrix(nodes, elements, material)[source]
Assemble TET4 stiffness coefficients in sparse triplet format.
- Parameters:
nodes (numpy.ndarray) – Nodal coordinates with shape
(n_nodes, 3).elements (numpy.ndarray) – Element connectivity with shape
(n_elem, 4)using 1-based node ids.material (array-like) – Elastic material properties
[Young, nu].
- Returns:
(Ik, Jk, Vk)where each array has size12*12*n_elem.IkandJkare dof indices andVkcontains stiffness values.- Return type:
tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]
Notes
The output is designed for sparse assembly, for example with
scipy.sparse.coo_matrix((Vk, (Ik, Jk))).
- SILEXlight.silex_lib_tet4_python.massmatrix(nodes, elements, rho)[source]
Assemble TET4 consistent mass coefficients in sparse triplet format.
- Parameters:
nodes (numpy.ndarray) – Nodal coordinates with shape
(n_nodes, 3).elements (numpy.ndarray) – Element connectivity with shape
(n_elem, 4)using 1-based node ids.rho (float) – Material density.
- Returns:
(Ik, Jk, Vk)where each array has size12*12*n_elem.- Return type:
tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]
- SILEXlight.silex_lib_tet4_python.forceonsurface(nodes, elements, press, direction)[source]
Assemble equivalent nodal forces on triangular surface elements.
- Parameters:
nodes (numpy.ndarray) – Nodal coordinates with shape
(n_nodes, 3).elements (numpy.ndarray) – Surface triangular connectivity with shape
(n_face, 3)using 1-based node ids.press (float) – Pressure/traction magnitude.
direction (array-like) – Load direction vector. If its norm is near zero, local outward normal is used per face.
- Returns:
Global force vector of size
3*n_nodes.- Return type:
numpy.ndarray
- SILEXlight.silex_lib_tet4_python.compute_stress_strain_error(nodes, elements, material, QQ)[source]
Compute TET4 stress, strain and error estimators from displacements.
- Parameters:
nodes (numpy.ndarray) – Nodal coordinates with shape
(n_nodes, 3).elements (numpy.ndarray) – Element connectivity with shape
(n_elem, 4)using 1-based node ids.material (array-like) – Elastic material properties
[Young, nu].QQ (numpy.ndarray) – Global displacement vector of size
3*n_nodes.
- Returns:
(sigma, sig_smooth, EpsilonElem, EpsilonNodes, ErrElem, ErrGlob).- Return type:
tuple
Notes
sigmaandsig_smoothstore 7 components per row:[sxx, syy, szz, syz, sxz, sxy, von_mises].