A collection of vibration models (e.g. von Kármán plates, tension-modulated and stiff strings) implemented in JAX for fast, differentiable simulations
Project description
jaxdiffmodal
Fast, differentiable, and GPU-accelerated simulation framework for modelling the dynamics of strings, membranes, and plates using modal methods implemented in JAX.
Features
- Differentiable implementation using JAX
- Simulates linear and nonlinear models:
- Tension-modulated string (Kirchhoff–Carrier)
- Tension-modulated membrane (Berger model)
- von Kármán nonlinear plate
- Fast GPU-accelerated time integration
- Designed for real-time synthesis, inverse modelling, and dataset generation
- Includes example notebooks to reproduce results from the paper
Installation for Development
It is recommended to use the uv package manager to install the environment and dependencies.
uv sync --extra dev --extra benchmark
Otherwise you can create a virtual environment and install the dependencies manually:
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Testing
The project includes comprehensive tests to validate the Python implementation against MATLAB reference code. Tests follow the MATLAB-Python cross-validation pattern documented in CLAUDE.md.
Running Tests
Prerequisites: The tests use pytest and require scipy for eigenvalue computations.
Run all tests from the project root directory:
python -m pytest tests/ -v
Run specific test modules:
# Test K and M matrix assembly with MATLAB comparison
python -m pytest tests/test_K_M_matlab_comparison.py -v
# Test integral functions (int1, int2, int4)
python -m pytest tests/test_intx_matlab_comparison.py -v
# Test matrix integration functions (i_mat)
python -m pytest tests/test_imat_matlab_comparison.py -v
Generating MATLAB Reference Data
To regenerate MATLAB reference data (requires MATLAB installation):
cd tests
matlab -batch test_K_M_matlab_reference
matlab -batch test_intx_matlab_reference_fixed
matlab -batch test_imat_matlab_reference
Test Coverage
- K, M matrix assembly: Perfect match with MATLAB (1e-8 tolerance)
- Airy stress coefficients: Validated using MATLAB eigenvalues/eigenvectors as input (1e-6 tolerance)
- Integral functions: Comprehensive parameter space validation
- Basic functionality: Matrix properties, dimensions, and mathematical consistency
See CLAUDE.md for detailed testing methodology and patterns.
Examples
The nbs/examples directory includes:
- Synthetic and real-world inverse modelling experiments for strings and plates
- Optimisation of nonlinear parameters and coupling tensors
- Scripts to reproduce figures from the paper
The benchmark directory includes comparisons against:
- An optimised C++ implementation using Eigen and BLAS
- A JIT-compiled PyTorch implementation (GPU)
- A MATLAB baseline
We plan to add more benchmarks, examples, and real-time synthesis demos in future updates.
Acknowledgements
- Mode processing adapted from VKPlate
- Plate mode computation using magpie-python
- Coupling coefficient implementation based on VKGong
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jaxdiffmodal-0.1.0.tar.gz.
File metadata
- Download URL: jaxdiffmodal-0.1.0.tar.gz
- Upload date:
- Size: 15.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd57aea9e81e180b0efd16fc6b62f47b4d9b4470dabdb9700c358a8e90650936
|
|
| MD5 |
580d0073cc8b27e2d6e433fbad6ab2e0
|
|
| BLAKE2b-256 |
a05814b4e6d21f7beaccc2df2a5327f0f3d00b23536bc335de8d532137efb9df
|
File details
Details for the file jaxdiffmodal-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jaxdiffmodal-0.1.0-py3-none-any.whl
- Upload date:
- Size: 63.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eb19c87cf14424d4030e857fe85b6ae2833964022869c3fc279b5f40148862f
|
|
| MD5 |
d796f65601e28d8f967dd87f0ff8bd1d
|
|
| BLAKE2b-256 |
596d154272470f8dd80d49c19efe5ce5b46f6c5e579593991b2cf176f227ceab
|