Skip to main content

Python API for Fluid-solid interaction FEM simulations

Project description

description

LoudPy Beta

LoudPy is an open-source Python API dedicated to loudspeaker finite element simulation, released under the GPL-3.0 license.

⚠️ Beta version — The API is still under active development. Proper documentation will be provided soon.

Overview

Designing a loudspeaker with FEM means choosing between complex general-purpose tools that require deep expertise, or expensive commercial software. LoudPy is a free, Python-based alternative built specifically for loudspeaker/transducer engineers and researchers.

Starting from a CAD file of your loudspeaker, LoudPy lets you:

  • run harmonic frequency-domain simulations (structural, acoustic, or fully coupled FSI)
  • extract eigenfrequencies and mode shapes of the mechanical structure
  • simulate nonlinear behaviour
  • post-process results directly as NumPy arrays and plot them

The finite element formulations are entirely custom — this project does not depend on any external FEM library. Numerical computations rely exclusively on NumPy, SciPy, and Numba, while meshing is handled by Gmsh.

This project was developed by Romain Degraeve as part of the IMDEA Master's programme in Acoustics (International Master Degree in Acoustics).

Installation

The easiest way to install LoudPy is via pip:

pip install loudpy

For development installation, see the Developer Setup section below.

Examples

The LoudPy_exemples/ folder contains ready-to-run scripts:

Example Description
Frequency_study/FSI Coupled structural–acoustic frequency sweep
Frequency_study/Meca Mechanical-only frequency sweep
Eigen_study Complex eigenfrequency analysis
Time_study/Single_tone Nonlinear time-domain simulation, single tone
Time_study/Multitone Nonlinear time-domain simulation, multi-tone

Publication

LoudPy will be presented at Acousticum 2026 — (ref. 226).

Contributing

If you want to contribute to this open-source project, feel free to reach out:


Technical Details

Workflow

LoudPy handles 2D axisymmetric geometries. The full pipeline is:

  1. Import — a STEP file is loaded and converted to BREP format by LoudPy
  2. Physical entity assignment — the Gmsh standalone app is used to assign named physical groups: closed curve loops define subdomains, individual curves define boundaries. This produces two paired files: a .brep (geometry) and a .geo (named entities)
  3. Meshing — LoudPy loads both files, links named entities to materials and boundary conditions, and generates the mesh via the Gmsh Python API (bundled — no separate install needed)
  4. Solve — the chosen study assembles and solves the FEM system
  5. Export — results are saved to HDF5 (.h5) files; fields and coordinates are stored as NumPy arrays and reloaded with the built-in reader classes

Solvers

Study Class Description
Frequency-domain FSI FreqStudy Coupled structural–acoustic harmonic solver
Frequency-domain meca FreqStudy Mechanical-only harmonic solver
Complex eigenvalue EigenStudy Complex eigenfrequency analysis (mechanical domain)
Nonlinear time-domain TimeStudy Geometrically nonlinear transient solver

Physics

  • Structural domain — 2D axisymmetric linear elasticity, T6 elements
  • Acoustic domain — pressure-based formulation, T6 elements
  • Fluid-structure couplingInterfaceAcouMeca coupling assembled automatically
  • Damping — Rayleigh (α, β) and hysteretic (η), both supporting non-proportional formulations
  • Radiation — Perfectly Matched Layer (PML) for free-field acoustic radiation

Material Library

Built-in materials (materials.json): Polypropylene, Paper, Copper, Rubber, Kapton, PhenolicCloth, Air, SolidGlue. Custom materials can be added to the JSON file or defined directly in the study script.

Post-processing

  • FreqReader / EigenReader / TimeReader — context-managed HDF5 readers
  • extract_subdomain(snap, name, field) — field values restricted to a named subdomain
  • extract_interface(snap, name, field) — field values along a coupling interface
  • Built-in plotting: SPL sweeps, field maps, deformed interface, mechanical sweeps

Developer Setup

LoudPy uses PDM for package management.

Install PDM via pipx (recommended — keeps PDM isolated):

pipx install pdm

Or via uv:

uv pip install pdm

Verify:

pdm --version

Install LoudPy in editable mode:

pdm install -e .

LoudPy is developed under Python 3.13. To install it with uv:

uv python install 3.13

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loudpy-0.0.8.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loudpy-0.0.8-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

Details for the file loudpy-0.0.8.tar.gz.

File metadata

  • Download URL: loudpy-0.0.8.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.7 CPython/3.13.9 Darwin/25.5.0

File hashes

Hashes for loudpy-0.0.8.tar.gz
Algorithm Hash digest
SHA256 0b5af9d2cdbf8573f0b701372d54029a2371dd43dc71be5dd7d10c85e2b9e522
MD5 ad6f3165f2cb7ab85ac2867e276c65ea
BLAKE2b-256 51288b03ede4a55f4de89f6f41e5417ffafc82907563f99d59dc539100cd8b7a

See more details on using hashes here.

File details

Details for the file loudpy-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: loudpy-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.7 CPython/3.13.9 Darwin/25.5.0

File hashes

Hashes for loudpy-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b6d52ef09831c0acbbb95bee72a9f50ed7a7cd9eb7a3515a590b66696b7b9547
MD5 a112b272414510a509e956201ef1edc3
BLAKE2b-256 d2112eaf938a71c72754aa94f0fa2ebd925814bc6fe20e7de160078a5919cb01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page