Linear static solution (pyfe3d.solver.static)#
solve() solves a sparse linear system, raising an error for a singular
matrix, and linear_static() is the linear static analysis based on it,
with the outputs of Analysis.static(). The linear and non-linear
static analyses of a model given by callables are done with
Analysis.
- pyfe3d.solver.static.linear_static(K, fext)#
Linear static analysis
Solves
K @ u = fextwithsolve()and returns the solution with the outputs ofAnalysis.static(), a single increment of load factor1.. A symmetricKmust be positive definite, which is checked with its factorization, see_solve_linear_static().- Parameters:
- Ksparse_matrix
Stiffness matrix of the free degrees-of-freedom, shape
(n, n). It should include the constant terms that apply, e.g. a constant geometric stiffness matrix of a preload or an aerodynamic matrix. It may be unsymmetric, e.g.KC0 + KFfor a follower load affine in the displacements on a geometrically linear structure, whose load stiffness isKF = -dfext/du.- fextnp.ndarray
External force vector, 1-D array of size
n.
- Returns:
- incrementslist
[1.], the load factor of the solution.- cslist
List with the solution vector, 1-D array of size
n.
- Raises:
- numpy.linalg.LinAlgError
When
Kis singular, seesolve(), or when it is symmetric and not positive definite, with the likely causes: insufficient boundary conditions, a mechanism, distorted elements, e.g. re-entrant quadrilaterals, or a preload beyond the buckling load inK, see_solve_linear_static().
Notes
The system solved is \(\boldsymbol{K} \boldsymbol{u} = \boldsymbol{F}_{ext}\), the first Newton-Raphson iteration of the non-linear problem from \(\boldsymbol{u} = \boldsymbol{0}\), where the tangent stiffness matrix is the linear constitutive stiffness matrix \(\boldsymbol{K}_{C0}\). For a follower load affine in the displacements, \(\boldsymbol{F}(\boldsymbol{u}) = \boldsymbol{F}_0 - \boldsymbol{K}_F \boldsymbol{u}\), the linear solution is that of \((\boldsymbol{K}_{C0} + \boldsymbol{K}_F) \boldsymbol{u} = \boldsymbol{F}_0\).
Examples
Two springs in series along \(x\), fixed at the first node, with the force
10.at the last one:>>> import numpy as np >>> from scipy.sparse import csr_matrix >>> from pyfe3d.solver import linear_static >>> k = 1000. >>> KC0 = csr_matrix([[k, -k, 0.], [-k, 2*k, -k], [0., -k, k]]) >>> fext = np.array([0., 0., 10.]) >>> bu = np.array([False, True, True]) >>> increments, cs = linear_static(KC0[bu, :][:, bu], fext[bu]) >>> print(increments, cs[0]) [1.0] [0.01 0.02]
- pyfe3d.solver.static.solve(A, b, **kwargs)#
Solve a linear system, raising an error for a singular matrix
The system is solved with the LU factorization of
scipy.sparse.linalg.splu().Amust have only the free degrees-of-freedom, e.g.KC0uu = KC0[bu, :][:, bu]: a null row or column, seecheck_null_rows_cols(), and an exactly singular matrix raise an error instead of giving a solution with NaN values, asscipy.sparse.linalg.spsolve()does with itsscipy.sparse.linalg.MatrixRankWarning. The system is solved as given: in a finite element model the known displacements are partitioned out beforehand, and a null row or column ofAis a degree-of-freedom without stiffness, i.e. a modelling error, which is reported instead of being removed.- Parameters:
- Asparse_matrix or np.ndarray
Square matrix, shape
(n, n). It may be unsymmetric, e.g. with the load stiffness of a follower load, since the factorization is an LU factorization.- bnp.ndarray
Right-hand side, real or complex, 1-D array of size
n.- kwargskeyword arguments, optional
Passed to
scipy.sparse.linalg.splu(), e.g.permc_spec.
- Returns:
- xnp.ndarray
Solution, 1-D array of size
n.
- Raises:
- numpy.linalg.LinAlgError
When
Ahas a null row or column, with the indices of these degrees-of-freedom, seecheck_null_rows_cols(), or when it is exactly singular, i.e. whenscipy.sparse.linalg.splu()raises aRuntimeError.
See also
linear_staticthe linear static analysis based on it.