General-purpose finite element solver - pyfe3d#
The pyfe3d module is a general-purpose finite element solver for structural
analysis and optimization based on Python and Cython. The main principles
guiding the development of pyfe3d are: simplicity, efficiency and
compatibility. The aimed level of compatibility allows one to run this solver
in any platform, including the Google Colab environment.
With pyfe3d you can build models of:
Shells, with the quadrilaterals
Quad4andQuad4Rand the trianglesTria3DSGandTria3R, and laminated or isotropic properties,ShellPropBeams, with the Timoshenko elements
BeamCandBeamLR, trusses,Truss, and springs,Spring, with the sectional stiffness matrices of composite beams computed by the cross-sectional analysis ofpyfe3d.vabs, see Cross-sectional analysis of beams
all with six degrees of freedom per node, whose element matrices are written
into sparse arrays: the linear constitutive stiffness matrix, the
non-linear constitutive and geometric stiffness matrices, the mass matrix
and, for the quadrilaterals, the aerodynamic matrices of the piston theory.
With the solvers of pyfe3d.solver you can run:
Linear static analyses, \(\boldsymbol{K}_{C0} \boldsymbol{u} = \boldsymbol{f}\), with
solve()orAnalysisLinear static analyses of unsupported structures with inertia relief, balancing the loads with the inertia forces of the rigid-body acceleration, with
apply_inertia_relief(), see Inertia reliefLinear buckling analyses, \((\boldsymbol{K}_{C0} + \lambda \boldsymbol{K}_G) \boldsymbol{u} = \boldsymbol{0}\), with
linear_buckling()Natural frequency analyses, \((\boldsymbol{K}_{C0} - \omega_n^2 \boldsymbol{M}) \boldsymbol{u} = \boldsymbol{0}\), with
natural_frequency(), and complex frequencies of damped systems, \((\lambda^2 \boldsymbol{M} + \lambda \boldsymbol{C} + \boldsymbol{K}) \boldsymbol{u} = \boldsymbol{0}\), withcomplex_frequency()Geometrically non-linear static analyses with
Analysis, using the Newton-Raphson method or the arc-length methods of Riks and of Crisfield, with Crisfield’s convergence criterion, configuration-dependent loads and prescribed displacements, and with large rotations through the element-independent co-rotational formulation ofpyfe3d.corotational
The eigenvalue solvers verify their results and use a dense solver only as a last resort, see Eigenvalue solvers and their verification.
Code repository#
User guide#
- Overview and workflow
- How the documentation is organised
- Conventions
- Choosing an element
- Shell properties
- Shell elements: kinematics and formulation
- Quad4: assumed transverse shear strains (MITC4)
- Quad4R: one-point integration and hourglass control
- Tria3DSG: the discrete shear gap triangle
- Tria3R: discrete shear gap with the Allman membrane
- Drilling rotations
- Mass matrices of the shells
- Beam theory and the beam elements
- Beam properties
- Truss and spring elements
- Co-rotational formulation for large rotations
- Cross-sectional analysis of beams
Analyses and solvers#
- Boundary conditions and prescribed displacements
- Linear static analyses
- Inertia relief
- Non-linear static analyses
- The Newton-Raphson method
- Arc-length methods
- Convergence criteria
- Load- and configuration-dependent loads
- Linear buckling and natural frequencies
- Eigenvalue solvers and their verification
Worked examples
- Linear static analysis of a plate
- Linear static analysis of beams and frames
- Linear buckling analysis of a plate
- Linear buckling analysis of a column
- Linear buckling analysis of a cylinder under torsion
- Natural frequency analysis of a plate
- Natural frequency analysis of a cylinder
- Non-linear static analysis with pyfe3d.solver
Tutorials
- Tutorial: Ply tailoring using GA for a simply-supported plate under normal load
- Tutorial: Ply tailoring using SLSQP for a simply-supported plate under normal load
- Tutorial: topology optimisation using pyfe3d
- Tutorial: Timoshenko beam benchmarks with BeamC and BeamLR
- Tutorial: lumped mass matrices of the shells with an offset
- Benchmark: MacNeal-Harder standard problems for the shell elements
- Benchmark: shell obstacle course
- Tutorial: geometrically non-linear benchmarks with pyfe3d.solver
- Tutorial: large rotations with the co-rotational kinematics
- 1. Cantilever under an end shear force (Section 3.1)
- 2. Cantilever rolled up into a circle (Section 3.2)
- 3. Hinged cylindrical roof, 12.7 thick (Section 3.8)
- Tutorial: prescribed displacement at the tip of a cantilever
- Tutorial: shells pressed down by a prescribed displacement, Riks’ method
- 1. The clamped spherical cap (NAFEMS)
- 2. The hinged shallow spherical shell (Leicester)
- Tutorial: NAFEMS spherical cap restricted to axisymmetric deformations
- The benchmark
- The polar mesh
- The restriction to axisymmetric deformations
- The path, the mesh and the radius
- Comparison with COMSOL and with an independent axisymmetric shell
- The unrestricted quarter model
- Tutorial: static analysis with inertia relief
- Tutorial: inertia relief of a stick aircraft model, MSC Nastran example HA144A
pyfe3d API#
- API reference
- Finite elements for 3D problems in Python/Cython
- Finite elements
- Properties
- Co-rotational kinematics, EICR (
pyfe3d.corotational) CorotationalBeamCorotationalModelCorotationalShellCorotationalSpringCorotationalTrussHmat()Lambda()Lmat()axial()dLambdaT_m()expso3()logso3()spin()- Solvers (
pyfe3d.solver) - Linear static solution (
pyfe3d.solver.static) linear_static()solve()- Static analysis with inertia relief (
pyfe3d.solver.inertia_relief) apply_inertia_relief()- Static analyses of a model given by callables (
pyfe3d.solver.analysis) AnalysisFreeDofs- Convergence criteria of the non-linear solvers (
pyfe3d.solver.convergence) CRITERIAROUNDOFF_FACTORcheck_convergence()crisfield_weights()crisfield_zeta()roundoff_floor()scaled_norm()- Newton-Raphson solver (
pyfe3d.solver.newton_raphson) DIVERGENCE_FACTORINC_CUT_FACTORINC_GROWTH_FACTORLINE_SEARCH_ALPHANUM_ITER_BEFORE_DIVERGENCE_CHECKTOO_SLOW_WINDOW_NR_iterations()_abs_matrix()_check_divergence()_log_iteration()_norm()_solver_NR()_weights()- Arc-length solvers (
pyfe3d.solver.arc_length) DESIRED_NUM_ITERMAX_GROWTH_FACTORMAX_NUM_STEPSMETHODSMIN_GROWTH_FACTORPSI_solver_arc_length()- Calls to the callables of the non-linear solvers (
pyfe3d.solver.callbacks) accepts_kwarg()calc_fint()calc_kT()calc_load_vector()is_load_configuration_dependent()is_load_factor_dependent()- Eigenvalue analyses (
pyfe3d.solver.eigen) DenseFallbackWarningcheck_eigenpairs()complex_frequency()diagonal_preconditioner()estimate_cayley_sigma()is_positive_definite()linear_buckling()natural_frequency()- Utilities for ARPACK, against the Intel MKL bug of
dsteqr(pyfe3d.solver.arpackutils) ARPACK_MAX_NCVDSTEQR_MAX_SIZEMKL_FAULTY_VERSIONS_arpack_takes_rng()_auto_max_ncv()_deflation_shift()_lapack_name_from_config()_parse_mkl_version()_rayleigh_ritz()arpack_max_ncv()arpack_ncv()capped_eigsh()deflated_eigsh()dsteqr_is_faulty()lapack_is_mkl()mkl_version()release_memory()start_kwargs()start_vector()- Utilities for sparse matrices (
pyfe3d.solver.sparseutils) NUM_LISTED_DOFScheck_null_rows_cols()is_symmetric()- Log messages of the solvers (
pyfe3d.solver.logger) msg()warn()
Installing pyfe3d#
Install the distributed binaries by simply doing:
python -m pip install pyfe3d
or, from the source code, with a C++ compiler:
python -m pip install .
See Installation and building for building in place, running the tests and building this documentation, and Repository structure for the layout of the repository.
Changelog
License#
Copyright (c) 2021-2026, Saullo G. P. Castro (S.G.P.Castro@tudelft.nl)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Citing this library#
Saullo G. P. Castro. (2026). General-purpose finite element solver based on Python and Cython (Version 0.12.2). Zenodo. DOI: https://doi.org/10.5281/zenodo.6573489.
The DOI represents all the versions and resolves to the latest one. The
repository also has a CITATION.cff file with the same data.