Skip to main content

DOI

AutoPDEx is a free open source partial differential equation (PDE) solver based on the automatic code transformation capabilities of JAX.

The idea of the project is to develop a modular and easily extendable environment for the solution of boundary and initial boundary value problems, which provides automatic sensitivity analysis, allows for good integration with machine learning algorithms and can be executed on accelerators such as GPUs.

The documentation with more examples is available here.

Installation

To install AutoPDEx, you can use the following command. Note, that it requires python>=3.11.

pip install --upgrade pip
pip install autopdex

or with optional dependencies:

pip install --upgrade pip
pip install autopdex[dev]

Example

This is a short example for solving Poisson's problem with homogeneous Dirichlet conditions on the domain $[0,1]\times[0,1]$ with the source term

$$b = 20 \left(\sin{\left(10\ \boldsymbol{x}\cdot\boldsymbol{x}\right)} - \cos{\left(10\ \left(\boldsymbol{x} - \boldsymbol{x}_2\right) \cdot \left(\boldsymbol{x} - \boldsymbol{x}_2\right)\right)}\right)$$

where $\boldsymbol{x}_2 = (1, 0.5)^T$.

Full high-level interface example notebook

First, we import the necessary packages and enable double precision.

import jax
import jax.numpy as jnp

from autopdex import SimState, dae, spaces

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

The weak form is provided as a compact SimState model. In output mode, the same model can also provide derived quantities for postprocessing.

def poisson_model(ctx: SimState.ModelContext):
    phi = ctx.trial_ansatz["phi"]
    x = ctx.trial_ansatz["physical coor"](ctx.x_int)

    def source_term(x):
        x2 = x - jnp.asarray([1.0, 0.5])
        return 20.0 * (jnp.sin(10.0 * x @ x) - jnp.cos(10.0 * x2 @ x2))

    if ctx.mode == "output":
        return {"source": source_term(x)}

    test = ctx.test_ansatz["phi"]
    grad_phi = jax.jacfwd(phi, 0)(ctx.x_int, ctx.t)
    grad_test = jax.jacfwd(test)(ctx.x_int)

    return grad_phi @ grad_test - source_term(x) * test(x)

Set up the simulation object, generate a structured mesh, register the model and impose homogeneous Dirichlet conditions on the outer boundary.

vertices = [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]
n_elements = (1000, 1000)

sim = SimState({"phi": spaces.H1(order=1, dim=2, field_dimension=1)})
sim.add_structured_mesh(n_elements, vertices, "quad")
sim.add_temporal_discretization({"phi": dae.NoTimeDerivative()})
sim.add_model("__all__", "weak form", poisson_model)

def on_outer_boundary(x):
    return jnp.logical_or(
        jnp.logical_or(jnp.isclose(x[0], 0.0), jnp.isclose(x[0], 1.0)),
        jnp.logical_or(jnp.isclose(x[1], 0.0), jnp.isclose(x[1], 1.0)),
    )

sim.add_strong_bc("phi", on_outer_boundary, lambda x, t: 0.0)
sim.set_postprocessing_policy(dae.SaveAllPolicy(), result_folder_name="./short_example.res")

Initialize the solver data and run the stationary problem. The result folder contains VTU/PVD files for ParaView.

sim.initialize(verbose=1)
sim.prepare()
sim = sim.run(dt0=1.0, time_span=1.0, num_time_steps=1)

Citation

If you found this library useful in academic research, please cite the JOSS paper:

@article{Bode_AutoPDEx_An_Automized_2025,
author = {Bode, Tobias},
doi = {10.21105/joss.07300},
journal = {Journal of Open Source Software},
month = apr,
number = {108},
pages = {7300},
title = {{AutoPDEx: An Automized Partial Differential Equation solver based on JAX}},
url = {https://joss.theoj.org/papers/10.21105/joss.07300},
volume = {10},
year = {2025}
}

Contributions

You are warmly invited to contribute to the project. For larger developments, please get in touch beforehand in order to circumvent double work.

For detailed information on how to contribute, please see our Contribution Guidelines

License

AutoPDEx is licensed under the GNU Affero General Public License, Version 3.

Metadata

Release files for autopdex 1.2.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 autopdex 1.2.0
File Size Uploaded Provenance Actions
autopdex-1.2.0.tar.gz 568.5 kB Without provenance Details for autopdex-1.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for autopdex 1.2.0
File Interpreter ABI Platform Actions
autopdex-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for autopdex-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
autopdex-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for autopdex-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
autopdex-1.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for autopdex-1.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Total release size: 2.7 MB

Release files / autopdex-1.2.0.tar.gz

Download URL autopdex-1.2.0.tar.gz
Size 568.5 kB
Tags Source
SHA-256 checksum
How to use checksums
eb0239ca5b8cf1348135a0ee2d68754038aea9ae3785dc86a25a124357beb71e
BLAKE2b-256 checksum
How to use checksums
845cebb44b0ef91df30de17101c8a7ab5702afc8d1d4da4b2fd6ba24a9adb747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / autopdex-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL autopdex-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 707.9 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4e3c2944a21db89c137770792a55cefe123b7822d6cbd949f4d421aa394fdc6a
BLAKE2b-256 checksum
How to use checksums
16bc0ced646f97d16d3e8e4666352a005f5b1f8257c319c53dc58ff5c44c50df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / autopdex-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL autopdex-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 707.9 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b02d6f26662d8908277adaf16fa86d0a57fbcfc516faa5bd0c047c00493449c2
BLAKE2b-256 checksum
How to use checksums
04304fc8b9cb8bc82083b13a067f9684fd6fae383949755c242b670e89679805
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / autopdex-1.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL autopdex-1.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 707.8 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
169586f287c364945cabaf792a94571dde92d8e763e7759e4a4d43cb7451dd48
BLAKE2b-256 checksum
How to use checksums
ae58b753b8a1ff8888655131723762647272d6a30728f0d2d637c1c3a13862df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for autopdex 1.2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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