Skip to main content

diff-soup: differentiable, sparse-oriented unified PDE suite

License: BSD 3-Clause Docs arXiv

diff-soup is a software package written in JAX for modeling, simulation, and inference of (stiff) dynamical systems governed by ODEs, DAEs, and PDEs.

For modeling:

  • a Recipe API that states equations in math-like notation on structured and unstructured domains;
  • finite difference, finite volume and finite element discretizations;
  • sparse Jacobians assembled by automatic differentiation with graph coloring.

For simulation:

  • three variable-step, variable-order stiff integrators written in JAX, JNDF, JBDF and JIDA, for ODEs and DAEs up to index one;
  • sparse direct solves with NVIDIA cuDSS on the GPU, and KLU or dense solves on the CPU;
  • forward and reverse mode differentiation of every solve, to second order;
  • batched solves, with data and model parallelism across GPUs and cluster nodes.

For inference:

  • parameter estimation using least squares estimation, maximum likelihood estimation (MLE), and maximum a posteriori (MAP) estimation;
  • physically-constrained deep learning using differentiable simulation, with neural networks embedded inside the physical model.

The three modules of diff-soup

The modeling, simulation and inference modules of diff-soup, and the JAX and GPU features they are built on.

Installation

pip install "diff-soup[cu13]"   # CUDA 13, driver 580 or newer
pip install "diff-soup[cu12]"   # CUDA 12, driver 525 or newer
pip install diff-soup           # CPU only

Requires Linux x86_64 and Python 3.12 or 3.13. The GPU backend needs an NVIDIA GPU of compute capability 8.0 or newer.

Turn on JAX's 64-bit mode with jax.config.update("jax_enable_x64", True) before building a problem.

Building from source is covered on the installation page.

Documentation

Available at https://stmorgenstern.github.io/diff-soup/.

Quick example

The two-dimensional Brusselator, a stiff reaction-diffusion system, on a 32 by 32 finite-volume grid with its walls held at the reaction steady state:

import diff_soup as ds
import jax
import jax.numpy as jnp

jax.config.update("jax_enable_x64", True)

n = 32
A, B, alpha = 1.0, 3.0, 1.0 / 50.0

spec = ds.problem("brusselator")
spec.domain("square", ds.domains.cartesian_grid_2d(n, n, 1.0, 1.0, method="fvm"))
spec.field("u", mass="differential",
           init=lambda x, y: A + jnp.sin(2 * jnp.pi * x) * jnp.sin(2 * jnp.pi * y))
spec.field("v", mass="differential", init=lambda x, y: jnp.full_like(x, B / A))

@spec.equations(writes=("u", "v"), reads=("u", "v"))
def brusselator(q):
    uuv = q.u**2 * q.v
    du = A + uuv - (B + 1.0) * q.u + alpha * q.ops.laplacian(q.u)
    dv = B * q.u - uuv + alpha * q.ops.laplacian(q.v)
    return {"u": du, "v": dv}

i, j = jnp.indices((n, n))
wall = ((i == 0) | (i == n - 1) | (j == 0) | (j == n - 1)).ravel()
spec.bc.dirichlet("u", on=wall, value=A)
spec.bc.dirichlet("v", on=wall, value=B / A)

problem = spec.build()
y0 = spec.assemble_state({})

sol = ds.pdesolve(problem, ds.JIDA(), (0.0, 10.0), y0)
u_end = sol.ys[-1][: n * n]
print(float(u_end.mean()))   # the average of u over the square at t = 10

The Brusselator solution

u and v of the same model on a 128 by 128 grid, from t = 0 to t = 10.

Acknowledgments

diff-soup builds on the following projects.

Time stepping
SUNDIALS: IDA and CVODE, whose step-size, error-weight and solver-reuse rules the integrators follow (Hindmarsh et al. 2005).
OrdinaryDiffEq.jl: the QNDF method the NDF integrator follows (Rackauckas and Nie 2017).
SciPy: BDF dense output and the bounded least-squares trust region.

Sparse direct solvers
SuiteSparse KLU: the CPU sparse LU (Davis and Palamadai Natarajan 2010).
SuperLU_MT: the threaded CPU sparse LU for source builds (Li 2005).
NVIDIA cuDSS: the GPU sparse direct solver.

JAX ecosystem
JAX: the array library and compiler diff-soup is written in.
Equinox: modules and PyTree tools.
Diffrax: the interfaces for saving output and events, which diff-soup mirrors.
jaxtyping: shape and dtype annotations.
Optax: first-order optimisers for the embedded neural networks.
BlackJAX: posterior sampling.

diff-soup is released under the BSD 3-Clause License, see LICENSE. Third-party licences and notices are listed in THIRD_PARTY_NOTICES.md.

Citation

If you use diff-soup, please cite the paper, arXiv:2610.37333.

@article{degnanmorgenstern2026diffsoup,
    title={diff-soup: {GPU}-native Differentiable Simulation and Inference for Large-scale Stiff Dynamical Systems},
    author={Samuel Degnan-Morgenstern and Martin Z. Bazant},
    journal={arXiv preprint arXiv:2610.37333},
    year={2026},
}

Metadata

Release files for diff-soup 1.1.0

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

Built distributions (wheels)

Table of built distributions (wheels) for diff-soup 1.1.0
File Interpreter ABI Platform Actions
diff_soup-1.1.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.26+ x86-64, Linux glibc 2.28+ x86-64 Details for diff_soup-1.1.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
diff_soup-1.1.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.26+ x86-64, Linux glibc 2.28+ x86-64 Details for diff_soup-1.1.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Total release size: 20.0 MB

Release files / diff_soup-1.1.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL diff_soup-1.1.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 10.0 MB
Tags CPython 3.13 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1d1b2443e72a54e0cda138e2abcf04ab1d01a1829120e18a2d78eedb3e015deb
BLAKE2b-256 checksum
How to use checksums
696d0f09c527b235367346c60a15b679304fc6f55a760937ca636972853dedbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / diff_soup-1.1.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL diff_soup-1.1.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 10.0 MB
Tags CPython 3.12 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
fde2199a3b3e579a4ee137ac441fa8d6694065090c048f065c7aeaf7d53a7d54
BLAKE2b-256 checksum
How to use checksums
a9af131c702b930cf5442acff1c1e6e25c35b5a175f8a3cadb47bfbfb659dc1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for diff-soup 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for diff_soup-1.1.0-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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