Easy to use finite element assemblers and the related tools.
This library fills an important gap in the spectrum of finite element codes. The library is lightweight meaning that it has minimal dependencies. It contains no compiled code meaning that it's easy to install and use on all platforms that support NumPy. Despite being fully interpreted, the code has a reasonably good performance.
In the following snippet, we create a tetrahedral mesh with over 1 million elements and assemble a discrete Laplace operator, all in just a few seconds.
from skfem import *
import numpy as np
mesh = MeshTet.init_tensor(*((np.linspace(0, 1, 60),) * 3))
basis = InteriorBasis(mesh, ElementTetP1())
@BilinearForm
def laplace(u, v, w):
from skfem.helpers import dot, grad
return dot(grad(u), grad(v))
A = asm(laplace, basis)
More examples can be found in the documentation.
The most recent release can be installed simply by pip install scikit-fem
.
For more cutting edge features, you can clone this repository.
The latest user documentation corresponding to the master branch can be found online.
This project was started while working under a grant from the Finnish Cultural Foundation. The approach used in the finite element assembly has been inspired by the work of A. Hannukainen and M. Juntunen.
The library has been used in the preparation of the following scientific works:
- Gustafsson, T., Stenberg, R., & Videman, J. (2019). Nitsche's Master-Slave Method for Elastic Contact Problems. arXiv:1912.08279.
- McBain, G. D., Mallinson, S. G., Brown, B. R., Gustafsson, T. (2019). Three ways to compute multiport inertance. The ANZIAM Journal, 60, C140–C155. Open access.
- Gustafsson, T., Stenberg, R., & Videman, J. (2019). On Nitsche's method for elastic contact problems. arXiv preprint arXiv:1902.09312.
- Gustafsson, T., Stenberg, R., & Videman, J. (2019). Error analysis of Nitsche's mortar method. Numerische Mathematik, 142(4), 973–994. Open access.
- Gustafsson, T., Stenberg, R., & Videman, J. (2019). Nitsche's method for unilateral contact problems. Port. Math. 75, 189–204. arXiv preprint arXiv:1805.04283.
- Gustafsson, T., Stenberg, R. & Videman, J. (2018). A posteriori estimates for conforming Kirchhoff plate elements. SIAM Journal on Scientific Computing, 40(3), A1386–A1407. arXiv preprint arXiv:1707.08396.
- Gustafsson, T., Rajagopal, K. R., Stenberg, R., & Videman, J. (2018). An adaptive finite element method for the inequality-constrained Reynolds equation. Computer Methods in Applied Mechanics and Engineering, 336, 156–170. arXiv preprint arXiv:1711.04274.
- Gustafsson, T., Stenberg, R., & Videman, J. (2018). A stabilised finite element method for the plate obstacle problem. BIT Numerical Mathematics, 59(1), 97–124. arXiv preprint arXiv:1711.04166.
- Gustafsson, T., Stenberg, R., & Videman, J. (2017). Nitsche’s Method for the Obstacle Problem of Clamped Kirchhoff Plates. In European Conference on Numerical Mathematics and Advanced Applications, 407–415. Springer.
- Gustafsson, T., Stenberg, R., & Videman, J. (2017). A posteriori analysis of classical plate elements. Rakenteiden Mekaniikka, 50(3), 141–145. Open access.
In case you want to cite the library, you can use the DOI provided by Zenodo.
- Tom Gustafsson (Author)
- Geordie McBain
By contributing code to scikit-fem, you are agreeing to release it under BSD-3-Clause, see LICENSE.md.