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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autopdex-1.2.0.tar.gz (568.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

autopdex-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (707.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

autopdex-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (707.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

autopdex-1.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (707.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file autopdex-1.2.0.tar.gz.

File metadata

  • Download URL: autopdex-1.2.0.tar.gz
  • Upload date:
  • Size: 568.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for autopdex-1.2.0.tar.gz
Algorithm Hash digest
SHA256 eb0239ca5b8cf1348135a0ee2d68754038aea9ae3785dc86a25a124357beb71e
MD5 542f9aeafec58ea9b28443d9b1819b8d
BLAKE2b-256 845cebb44b0ef91df30de17101c8a7ab5702afc8d1d4da4b2fd6ba24a9adb747

See more details on using hashes here.

File details

Details for the file autopdex-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for autopdex-1.2.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4e3c2944a21db89c137770792a55cefe123b7822d6cbd949f4d421aa394fdc6a
MD5 9d490dddf1bfa81f2e47067bbc51ec04
BLAKE2b-256 16bc0ced646f97d16d3e8e4666352a005f5b1f8257c319c53dc58ff5c44c50df

See more details on using hashes here.

File details

Details for the file autopdex-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for autopdex-1.2.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b02d6f26662d8908277adaf16fa86d0a57fbcfc516faa5bd0c047c00493449c2
MD5 1f50cf604bdc25752c2c1baaf4f80400
BLAKE2b-256 04304fc8b9cb8bc82083b13a067f9684fd6fae383949755c242b670e89679805

See more details on using hashes here.

File details

Details for the file autopdex-1.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for autopdex-1.2.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 169586f287c364945cabaf792a94571dde92d8e763e7759e4a4d43cb7451dd48
MD5 ce1df4bf05b4014cd25984055223f9e5
BLAKE2b-256 ae58b753b8a1ff8888655131723762647272d6a30728f0d2d637c1c3a13862df

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.0 This release

4 files

1.1.4

2 files

1.1.1

2 files

1.1.0

2 files

1.0.5

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 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