Skip to main content

jxpinn

English | 中文

A general-purpose JAX-based Physics-Informed Neural Network (PINN) framework.

jxpinn lets you define a PDE problem, a neural-network architecture, and a training domain through a single Config object, then train with either Optax optimizers or jaxopt.LBFGS. It supports hard (analytical) boundary/initial conditions, inverse problems, and polygonal 2D domains out of the box.

Features

  • Built on JAX — JIT compilation, GPU support, and automatic differentiation.
  • Unified Config dataclass that wires together domain, problem, network, and optimizer.
  • Efficient derivative computation via chained JVPs instead of repeated jax.grad calls.
  • Hard boundary/initial condition enforcement via problem-specific constraining_fns.
  • Support for inverse problems (trainable problem parameters).
  • 2D polygon domains (L-shapes, stars, rings, etc.) using pure-JAX helpers.
  • Examples for harmonic oscillators, Burgers equation, wave equation, and Poisson problems.

Installation

Install from PyPI:

python -m pip install jxpinn

If you want to use the LBFGS optimizer, install the optional dependency:

python -m pip install "jxpinn[lbfgs]"

From source

Alternatively, clone the repository and install in editable mode:

git clone https://github.com/LBurny/jxpinn.git
cd jxpinn
python -m pip install -e .

With the LBFGS optimizer:

python -m pip install -e ".[lbfgs]"

Requirements

  • Python >= 3.9
  • JAX, NumPy, Matplotlib, SciPy, Optax
  • jaxopt (optional, required for optimiser="lbfgs")

See pyproject.toml for the full dependency list.

Quick start

import numpy as np

from jxpinn.config import Config
from jxpinn.domains import RectangularDomainND
from jxpinn.networks import FCN
from jxpinn.problems import HarmonicOscillator1D
from jxpinn.trainers import PINNTrainer

config = Config(
    run="harmonic_oscillator",
    domain=RectangularDomainND,
    domain_init_kwargs={"xmin": np.array([0.0]), "xmax": np.array([1.0])},
    problem=HarmonicOscillator1D,
    problem_init_kwargs={"d": 2, "w0": 20},
    network=FCN,
    network_init_kwargs={"layer_sizes": [1, 32, 1]},
    n_steps=5000,
    ns=((60,),),
    n_test=(200,),
    optimiser="adam",
    optimiser_kwargs={"learning_rate": 1e-3},
    show_figures=False,
)

trainer = PINNTrainer(config)
all_params = trainer.train()

Examples

The examples/ directory contains standalone training scripts:

Example Problem Notes
examples/train_burgers.py 1D viscous Burgers equation Hard IC/BC enforcement
examples/train_poisson_square.py 2D Poisson on a square Rectangular SDF support
examples/train_poisson_star.py 2D Poisson on a star polygon PolygonDomain2D

Run an example from the repository root:

python examples/train_poisson_star.py

Output figures and summaries are written to results/plots/ and results/summaries/ respectively (these directories are gitignored).

Running tests

Tests are plain Python scripts that can be run directly:

for f in test/test_*.py; do python "$f"; done

If you prefer pytest, install the dev extras and run:

python -m pip install -e ".[dev]"
pytest

Project structure

jxpinn/
├── jxpinn/           # Main package
│   ├── config.py      # Configuration dataclass
│   ├── domains.py     # Domain definitions (rectangular, polygonal)
│   ├── networks.py    # Neural network architectures
│   ├── problems.py    # PDE problems and constraints
│   ├── trainers.py    # Training loop and derivative machinery
│   └── util/          # Helpers (geometry, JAX utilities, I/O)
├── examples/          # Standalone training examples
├── test/              # Tests
├── research/          # Research notebooks and experiments
├── docs/              # Documentation and planning notes
└── results/           # Generated figures and summaries (gitignored)

License

This project is released under the MIT License. See LICENSE for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md and open an issue or pull request on GitHub.

Acknowledgments

This project was built with JAX, Optax, and Matplotlib.

Metadata

Release files for jxpinn 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 jxpinn 0.1.0
File Size Uploaded Provenance
jxpinn-0.1.0.tar.gz 50.6 kB With provenance Details

Built distribution (wheel)

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

Total release size: 94.2 kB

Release files / jxpinn-0.1.0.tar.gz

Download URL jxpinn-0.1.0.tar.gz
Size 50.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4813670f6b8f6da35416b83c8eaa092f52414bee6041f1b04d5218df8adea442
BLAKE2b-256 checksum
How to use checksums
31617b5c0a73a2bfe055188dcfc2117a1e9670c50369b40902a9afd8f2e428fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 9, 2026.

Transparency log

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

Download URL jxpinn-0.1.0-py3-none-any.whl
Size 43.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d2cadae43793ed3365086e1e8e86ce9dc70bf3ee70203d281c2e6e245d0f370
BLAKE2b-256 checksum
How to use checksums
0195c927569f18395f43740edd8156cc3afb5bdeae41c7e90aa34540d4b2c3e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 9, 2026.

Transparency log

Security for jxpinn 0.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jxpinn-0.1.0.tar.gz

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 Jul 9, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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