
pyCAFE: A Finite Element Framework for Solving Acoustic Problems in Python
Abstract
pyCAFE is an open-source Python framework for the numerical solution of two-dimensional, frequency domain acoustic problems governed by the Helmholtz equation using the Finite Element Method (FEM). The software implements an explicit assembly of global acoustic stiffness and mass matrices from element-level contributions using four- and eight-node (CQUAD4 - CQUAD8) quadrilateral elements. It supports prescribed pressure, prescribed normal velocity, impedance, and rigid boundary conditions, and provides both direct frequency domain solvers and a modal solver based on a sparse generalised eigenvalue problem. pyCAFE operates on two-dimensional meshes generated with Gmsh and follows a matrix-based workflow conceptually aligned with commercial finite element software, exposing the discretised system operators directly to the user. The framework includes an automated test suite covering element-level properties, boundary condition enforcement, and solver accuracy, together with a GitHub Actions continuous integration pipeline verified on Python 3.10-3.12. Analytical validation against closed-form eigenfrequencies for a rigid rectangular cavity demonstrates extremely good agreement with the CQUAD8 discretisation. Originally developed as a MATLAB code, the framework has been ported to Python to improve accessibility and integration with open scientific libraries for research and teaching in computational acoustics.
© 2026 Daniele Fabbri, Fabio Bruzzone, Carlo Rosso, published by Ubiquity Press
This work is licensed under the Creative Commons Attribution 4.0 License.