Skip to main content

jaxdiffmodal

arXiv

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

Metadata

Release files for jaxdiffmodal 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jaxdiffmodal 0.1.0
File Size Uploaded
jaxdiffmodal-0.1.0.tar.gz 15.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for jaxdiffmodal 0.1.0
File Interpreter ABI Platform
jaxdiffmodal-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 MB

Release files / jaxdiffmodal-0.1.0.tar.gz

Download URL jaxdiffmodal-0.1.0.tar.gz
Size 15.2 MB
Tags Source
SHA-256 checksum
How to use checksums
bd57aea9e81e180b0efd16fc6b62f47b4d9b4470dabdb9700c358a8e90650936
BLAKE2b-256 checksum
How to use checksums
a05814b4e6d21f7beaccc2df2a5327f0f3d00b23536bc335de8d532137efb9df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / jaxdiffmodal-0.1.0-py3-none-any.whl

Download URL jaxdiffmodal-0.1.0-py3-none-any.whl
Size 63.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0eb19c87cf14424d4030e857fe85b6ae2833964022869c3fc279b5f40148862f
BLAKE2b-256 checksum
How to use checksums
596d154272470f8dd80d49c19efe5ce5b46f6c5e579593991b2cf176f227ceab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page