Skip to content

spectralDNS/jaxfun

Repository files navigation

jaxfun

Spectral / Galerkin / PINNs experimentation toolkit built on top of JAX for fast differentiable ODE/PDE prototyping, variational forms, and mixed spectral bases.

Status & Badges

Tests Linting License Python 3.12

The coverage badge will update once Codecov is fully configured.

Features

  • Orthogonal polynomial and Fourier bases (Chebyshev, Legendre, Jacobi, etc.)
  • Tensor product and direct sum spaces with boundary conditions
  • Assembly of bilinear / linear forms with symbolic (SymPy) coefficients
  • A SymPy-based form-language for describing PDEs
  • Curvilinear coordinates
  • JAX-backed forward/backward transforms and differentiation
  • Utilities for sparse conversion, preconditioning, and projection
  • A friendly interface for experimenting with PINNs

Installation

Using uv (recommended):

pip install uv  # if not already installed
uv add jaxfun   # when published

From source:

git clone https://github.com/spectralDNS/jaxfun.git
cd jaxfun
uv sync

Quickstart

from jaxfun.galerkin import Chebyshev, TensorProduct, TestFunction, TrialFunction, Div, Grad
from jaxfun.galerkin.inner import inner

C = Chebyshev.Chebyshev(16)
T = TensorProduct((C, C))
v = TestFunction(T)
u = TrialFunction(T)
A = inner(Div(Grad(u)) * v)

See the examples for more patterns.

Development

Run tests (excluding slow):

uv run pytest

Run full (including slow demos):

uv run pytest -m "slow or not slow"

Lint & format:

uv run pre-commit run --all-files

Contributing

See CONTRIBUTING and the Code of Conduct.

License

BSD 2-Clause – see LICENSE.

Authors

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages