Multiscale finite element calculations in Python using sfepy. (English) Zbl 1433.65005

Summary: SfePy (simple finite elements in Python) is a software for solving various kinds of problems described by partial differential equations in one, two, or three spatial dimensions by the finite element method. Its source code is mostly (85%) Python and relies on fast vectorized operations provided by the NumPy package. For a particular problem, two interfaces can be used: a declarative application programming interface (API), where problem description/definition files (Python modules) are used to define a calculation, and an imperative API, that can be used for interactive commands, or in scripts and libraries. After outlining the SfePy package development, the paper introduces its implementation, structure, and general features. The components for defining a partial differential equation are described using an example of a simple heat conduction problem. Specifically, the declarative API of SfePy is presented in the example. To illustrate one of SfePy’s main assets, the framework for implementing complex multiscale models based on the theory of homogenization, an example of a two-scale piezoelastic model is presented, showing both the mathematical description of the problem and the corresponding code.


65-04 Software, source code, etc. for problems pertaining to numerical analysis
65M60 Finite element, Rayleigh-Ritz and Galerkin methods for initial value and initial-boundary value problems involving PDEs
74-04 Software, source code, etc. for problems pertaining to mechanics of deformable solids
65N30 Finite element, Rayleigh-Ritz and Galerkin methods for boundary value problems involving PDEs
65Y05 Parallel numerical computation
65Y15 Packaged methods for numerical algorithms
74S05 Finite element methods applied to problems in solid mechanics
74F15 Electromagnetic effects in solid mechanics
35Qxx Partial differential equations of mathematical physics and other areas of application
Full Text: DOI arXiv


[1] Abdulle, A.; Nonnenmacher, A., A short and versatile finite element multiscale code for homogenization problems, Comput. Methods Appl. Mech. Eng., 198, 2839-2859, (2009) · Zbl 1229.74125
[2] Allaire, G., Homogenization and two-scale convergence, SIAM J. Math. Anal., 23, 1482-1518, (1992) · Zbl 0770.35005
[3] Alnaes, M.S., Blechta, J., Hake, J., Johansson, A., Kehlet, B., Logg, A., Richardson, C., Ring, J., Rognes, M.E., Wells, G.N.: The FEniCS project version 1.5. Arch. Numer. Softw. 3, 9-23. https://doi.org/10.11588/ans.2015.100.20553 (2015)
[4] Alowayyed, S.; Groen, D.; Coveney, PV; Hoekstra, AG, Multiscale computing in the exascale era, J. Comput. Sci., 22, 15-25, (2017)
[5] Amaya, M., Morten, J.P., Boman, L.: A low-rank approximation for large-scale 3D controlled-source electromagnetic gauss-newton inversion. Geophysics 81(3), 211-225. https://doi.org/10.1190/geo2015-0079.1 (2016)
[6] Balay, S., Abhyankar, S., Adams, M., Brown, J., Brune, P., Buschelman, K., Dalcin, L., Dener, A., Eijkhout, V., Gropp, W., Kaushik, D., Knepley, M., May, D., Curfman McInnes, L., Mills, R., Munson, T., Rupp, K., Sanan, P., Smith, B., Zampini, S., Zhang, H., Zhang, H.: PETSc users manual. Tech. Rep. ANL-95/11 - Revision 3.10, Argonne National Laboratory. http://www.mcs.anl.gov/petsc, accessed 25 September 2018 (2018)
[7] Balzani, D., Gandhi, A., Klawonn, A., Lanser, M., Rheinbach, O., Schröder, J: One-way and fully-coupled FE2 methods for heterogeneous elasticity and plasticity problems: parallel scalability and an application to thermo-elastoplasticity of dual-phase steels. In: Bungartz, H.J., Neumann, P., Nagel, W.E. (eds.) Software for Exascale Computing - SPPEXA 2013-2015, Springer International Publishing, Lecture Notes in Computational Science and Engineering, pp 91-112 (2016)
[8] Borden, MJ; Scott, MA; Evans, JA; Hughes, TJR, Isogeometric finite element data structures based on Bezier extraction of NURBS, Int. J. Numer. Meth. Eng., 87, 15-47, (2011) · Zbl 1242.74097
[9] Borgdorff, J.; Mamonski, M.; Bosak, B.; Kurowski, K.; Ben Belgacem, M.; Chopard, B.; Groen, D.; Coveney, PV; Hoekstra, AG, Distributed multiscale computing with muscle 2, the multiscale coupling library and environment, J. Comput. Sci., 5, 719-731, (2014)
[10] Bradshaw, R., Behnel, S., Seljebotn, D.S., Ewing, G., et al.: The Cython compiler. http://cython.org, Accessed 25 September 2018 (2018)
[11] Brough, DB; Wheeler, D.; Kalidindi, SR, Materials knowledge systems in python—a data science framework for accelerated development of hierarchical materials, Integ. Mater. Manuf. Innov., 6, 36-53, (2017)
[12] Chopard, B.; Borgdorff, J.; Hoekstra, AG, A framework for multi-scale modelling, Philos. Trans. R. Soc. A Math. Phys. Eng. Sci., 372, 20130378, (2014)
[13] Cimrman, R.: Enhancing sfepy with isogeometric analysis. arXiv:http://arXiv.org/abs/1412.6407 (2014)
[14] Cimrman, R., Lukeš, V.: SfePy 2018.3 sources and heat conduction examples demonstrating declarative and imperative APIs of SfePy. https://zenodo.org/record/1434071. https://doi.org/10.5281/zenodo.1434071 (2018)
[15] Cimrman, R.; Rohan, E., On modelling the parallel diffusion flow in deforming porous media, Math. Comput. Simul., 76, 34-43, (2007) · Zbl 1132.76052
[16] Cimrman, R.; Rohan, E., Two-scale modeling of tissue perfusion problem using homogenization of dual porous media, Int. J. Multiscale. Com., 8, 81-102, (2010)
[17] Cimrman, R.; Novák, M.; Kolman, R.; Tůma, M.; Plešek, P.; Vackář, J., Convergence study of isogeometric analysis based on Bézier extraction in electronic structure calculations, Appl. Math. Comput., 319, 138-152, (2018) · Zbl 1426.78032
[18] Cimrman, R.; Novák, M.; Kolman, R.; Tůma, M.; Vackář, J., Isogeometric analysis in electronic structure calculations, Math. Comput. Simulat., 145, 125-135, (2018) · Zbl 1426.78032
[19] Cioranescu, D., Donato, P.: An introduction to homogenization. No. 17 in Oxford Lecture Series in mathematics and its applications. Oxford University Press, Oxford (1999)
[20] Cioranescu, D.; Damlamian, A.; Griso, G., The periodic unfolding method in homogenization, SIAM J. Math. Anal., 40, 1585-1620, (2008) · Zbl 1167.49013
[21] Cottrell, J.A., Hughes, T.J.R., Bazilevs, Y.: Isogeometric analysis: toward integration of CAD and FEA. New York, Wiley (2009) · Zbl 1378.65009
[22] Dalcin, L.; Paz, R.; Kler, P.; Cosimo, A., Parallel distributed computing using Python, Adv. Water Resour., 34, 1124-1139, (2011)
[23] Dalcin, L., Collier, N., Vignal, P., Cortes, A., Calo, V.: Petiga: a framework for high-performance isogeometric analysis. Comput. Method Appl. M, 308(C), 151-181. https://doi.org/10.1016/j.cma.2016.05.011 (2016)
[24] Dalcin, LD; Paz, RR; Kler, PA; Cosimo, A., Parallel distributed computing using Python, Adv. Water Resour., 34, 1124-1139, (2011)
[25] Davis, TA, Algorithm 832: UMFPACK, an unsymmetric-pattern multifrontal method, ACM T Math. Softw., 30, 196-199, (2004) · Zbl 1072.65037
[26] Falcone, JL; Chopard, B.; Hoekstra, A., MML: towards a multiscale modeling language, Procedia Comput. Sci., 1, 819-826, (2010)
[27] Geers, M.G.D., Kouznetsova, V.G., Matouš, K., Yvonnet, J.: Homogenization Methods and Multiscale Modeling: Nonlinear Problems, Wiley, Ltd, p. 1-34. https://doi.org/10.1002/9781119176817.ecm2107 (2017)
[28] Geus, R., Wheeler, D., Orban, D.: Pysparse documentation. http://pysparse.sourceforge.net, Accessed 25 September 2018 (2018)
[29] Geus, TWJ; Vondřejc, J.; Zeman, J.; Peerlings, RHJ; Geers, MGD, Finite strain fft-based non-linear solvers made simple, Comput. Methods Appl. Mech. Eng., 318, 412-430, (2017)
[30] git: The git project web site. https://git-scm.com, Accessed 25 September 2018 (2018)
[31] github: Github web site. https://github.com, Accessed 25 September 2018 (2018)
[32] Group TH: Hierarchical data format version 5. http://www.hdfgroup.org/HDF5, Accessed 25 September 2018 (2018)
[33] Henderson, A.: ParaView guide, a parallel visualization application. Kitware Inc, New York (2007)
[34] Hunter, JD, Matplotlib: A 2D graphics environment, Comput. Sci. Eng., 9, 90-95, (2007)
[35] Jones, E., Oliphant, T.E., Peterson, P., et al.: SciPy: open source scientific tools for Python. http://www.scipy.org, Accessed 25 September 2018 (2018)
[36] Kitware, Inc: The Visualization Toolkit User’s Guide. Kitware, Inc. Publishers., iSBN 1-930934-18-1 (2010)
[37] Kochová, P.; Cimrman, R.; Stengl, M.; Ošťádal, B.; Tonar, Z., A mathematical model of the carp heart ventricle during the cardiac cycle, J. Theor. Bio., 373, 12-25, (2015) · Zbl 1314.92023
[38] Kondov, I., Surmann, G. (eds.): Multiscale modelling methods for applications in materials science: CECAM tutorial, 16 - 20 September 2013, Forschungszentrum Jülich; lecture notes. Schriften des Forschungszentrums Jülich IAS series, Forschungszentrum, Zentralbibliothek (2013)
[39] Logg, A., Efficient representation of computational meshes, Int. J. Comput. Sci. Eng., 4, 283-295, (2009)
[40] Matouš, K.; Geers, MG; Kouznetsova, VG; Gillman, A., A review of predictive nonlinear theories for multiscale modeling of heterogeneous materials, J. Comput. Phys., 330, 192-220, (2017)
[41] Meurer, A.; Smith, CP; Paprocki, M.; Čertík, O.; Kirpichev, SB; Rocklin, M.; Kumar, A.; Ivanov, S.; Moore, JK; Singh, S.; Rathnayake, T.; Vig, S.; Granger, BE; Muller, RP; Bonazzi, F.; Gupta, H.; Vats, S.; Johansson, F.; Pedregosa, F.; Curry, MJ; Terrel, AR; Roučka, Š.; Saboo, A.; Fernando, I.; Kulal, S.; Cimrman, R.; Scopatz, A., Sympy: symbolic computing in Python, Peer J. Comput. Sci., 3, e103, (2017)
[42] Miller, RE; Tadmor, EB, A unified framework and performance benchmark of fourteen multiscale atomistic/continuum coupling methods, Model. Simul. Mater. Sci. Eng., 17, 053001, (2009)
[43] Mosby, M.; Matouš, K., Hierarchically parallel coupled finite strain multiscale solver for modeling heterogeneous layers: hierarchically parallel multiscale solver, Int. J. Numer. Methods Eng., 102, 748-765, (2015) · Zbl 1352.74033
[44] Moulinec, H.; Suquet, P., A fast numerical method for computing the linear and nonlinear mechanical properties of composites, Comptes Rendus de l’Académie des Sciences, 318, 1417-1423, (1994) · Zbl 0799.73077
[45] Muntean, A., Chalupecky, V.: Homogenization Method and Multiscale Modeling MI Lecture Note Series, Faculty of Mathematics, Kyushu University (2011) · Zbl 1271.74002
[46] Oliphant, TE, Python for scientific computing, Comput. Sci. Eng., 9, 10-20, (2007)
[47] Patzák, B.; Rypl, D.; Kruis, J., Mupif – a distributed multi-physics integration tool, Adv. Eng. Softw., 60-61, 89-97, (2013)
[48] pytables: Pytables web site. https://www.pytables.org, Accessed 25 September 2018 (2018)
[49] Ramachandran, P.; Varoquaux, G., Mayavi: 3d visualization of scientific data, Comput. Sci. Eng., 13, 40-51, (2011)
[50] Rathgeber, F.; Ham, D.; Mitchell, L.; Lange, M.; Luporini, F.; Mcrae, A.; Bercea, GT; Markall, G.; Kelly, P., Firedrake: automating the finite element method by composing abstractions, ACM T Math. Softw., 43, 24:1-24:27, (2016) · Zbl 1396.65144
[51] Rohan, E.; Cimrman, R., Multiscale FE simulation of diffusion-deformation processes in homogenized dual-porous media, Math Comput. Simul., 82, 1744-1772, (2012) · Zbl 1298.76071
[52] Rohan, E., Lukeš, V.: Homogenization of the vibro – acoustic transmission on perforated plates. arXiv:http://arXiv.org/abs/1901.00202 [physics.comp-ph] (2019)
[53] Rohan, E.; Lukeš, V., Homogenization of the acoustic transmission through a perforated layer, J. Comput. Appl. Math, 234, 1876-1885, (2010) · Zbl 1407.76142
[54] Rohan, E.; Lukeš, V., Homogenization of the fluid-saturated piezoelectric porous media, Int. J. Solids Struct., 147, 110-125, (2018)
[55] Rohan, E.; Miara, B., Band gaps and vibration of strongly heterogeneous Reissner-Mindlin elastic plates, C R Math, 349, 777-781, (2011) · Zbl 1225.35021
[56] Rohan, E.; Cimrman, R.; Lukeš, V., Numerical modelling and homogenized constitutive law of large deforming fluid saturated heterogeneous solids, Comput. Struct., 84, 1095-1114, (2006)
[57] Rohan, E., Cimrman, R., Naili, S., Lemaire, T.: Multiscale modelling of compact bone based on homogenization of double porous medium. In: Computational plasticity x - fundamentals and applications (2009a)
[58] Rohan, E.; Miara, B.; Seifrt, F., Numerical simulation of acoustic band gaps in homogenized elastic composites, Int. J. Eng. Sci., 47, 573-594, (2009) · Zbl 1213.74310
[59] Rohan, E.; Naili, S.; Cimrman, R.; Lemaire, T., Hierarchical homogenization of fluid saturated porous solid with multiple porosity scales, C R Mecanique, 340, 688-694, (2012)
[60] Rohan, E.; Naili, S.; Cimrman, R.; Lemaire, T., Multiscale modeling of a fluid saturated medium with double porosity: relevance to the compact bone, J. Mech. Phys. Solids, 60, 857-881, (2012)
[61] Schneider, M.; Ospald, F.; Kabel, M., Computational homogenization of elasticity on a staggered grid, Int. J. Numer. Methods Eng., 105, 693-720, (2016)
[62] scikit-umfpack: skikit-umfpack web site. https://github.com/scikit-umfpack/scikit-umfpack, Accessed 25 September 2018 (2018)
[63] sfepy: The SfePy project web site. http://sfepy.org, Accessed 25 September 2018 (2018)
[64] Solin, P., Segeth, K., Dolezel, I.: Higher-order finite element methods. CRC Press, Boca Raton (2003)
[65] sphinx: Sphinx web site. http://www.sphinx-doc.org, Accessed 25 September 2018 (2018)
[66] Talebi, H.; Silani, M.; Bordas, SPA; Kerfriden, P.; Rabczuk, T., A computational library for multiscale modeling of material failure, Comput. Mech., 53, 1047-1071, (2014)
[67] travis-ci: Travis-ci web site. https://travis-ci.org, Accessed 25 September 2018 (2018)
[68] Vackář, J., Čertík, O., Cimrman, R., Novák, M., Šipr, O., Plešek, J.: Advances in the Theory of Quantum Systems in Chemistry and Physics. Prog. T. Chem, vol. 22, Springer, chap Finite Element Method in Density Functional Theory Electronic Structure Calculations, pp. 199-217. https://doi.org/10.1007/978-94-007-2076-3_12 (2011)
[69] Wang, K.; Sun, W., A multiscale multi-permeability poroplasticity model linked by recursive homogenizations and deep learning, Comput. Methods Appl. Mech. Eng., 334, 337-380, (2018)
[70] Weinan, E., Engquist, B.: The heterogeneous multi-scale method for homogenization problems. In: Engquist, B., Runborg, O., Lötstedt, P. (eds.) Multiscale Methods in Science and Engineering, Springer Berlin Heidelberg, Lecture Notes in Computational Science and Engineering, pp 89-110 (2005) · Zbl 1086.65521
[71] Wheeler, D., Brough, D., Fast, T., Kalidindi, S., Reid, A.: PYMKS: materials knowledge system in Python. https://doi.org/10.6084/m9.figshare.1015761.v2. https://figshare.com/articles/pymks/1015761 (2014)
[72] Wu, B.; Du, X.; Tan, H., A three-dimensional FE nonlinear analysis of membranes, Comput. Struct., 59, 601-605, (1996) · Zbl 0918.73169
[73] Zeman, J.; Geus, TWJ; Vondřejc, J.; Peerlings, RHJ; Geers, MGD, A finite element perspective on nonlinear FFT-based micromechanical simulations, Int. J. Numer. Methods Eng., 111, 903-926, (2017)
[74] Zemčík, R.; Rolfes, R.; Rose, M.; Tessmer, J., High-performance 4-node shell element with piezoelectric coupling, Mech. Adv. Mater Struct., 13, 393-401, (2006) · Zbl 1194.74488
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.