Skip to main content

An elliptic PDE solver built with machine learning in mind

Project description

jaxhps

A JAX package implementing hardware acceleration for HPS methods in two and three dimensions.

See our preprint on arXiv: Hardware Acceleration for HPS Methods in Two and Three Dimensions

Installation

To install, you can use pip:

pip install jaxhps

The examples require additional packages matplotlib and h5py. If you want to install them automatically, use:

pip install jaxhps[examples]

Documentation

https://jaxhps.readthedocs.io/en/latest/

Examples

hp convergence on 2D problems with known solutions

Shows convergence using uniform quadtrees using both DtN matrices and ItI matrices.

python examples/hp_convergence_2D_problems.py --DtN --ItI

High-wavenumber scattering problem

First, run the matlab script examples/driver_gen_SD_matrices.m. This will generate and save exterior single and double-layer kernel matrices. These matrices are necessary to define a boundary integral equation for the scattering problem. Once in place, we can run the script:

python examples/wave_scattering_compute_reference_soln.py --scattering_potential gauss_bumps -k 100 --plot_utot

This will generate plots which looks like this, showing the scattering potential and real part and modulus of the total field:

Showing the scattering potential, a sum of randomly-placed Gaussian bumps. Showing the real part of the total wave field of a scattering problem where k=100 and the scattering potential is a sum of randomly-placed Gaussian bumps. Showing the absolute value of the total wave field of a scattering problem where k=100 and the scattering potential is a sum of randomly-placed Gaussian bumps.

Adaptive discretization on a 3D problem with known solution

We have a script for generating adaptive discretizations on the wavefront problem presented in our paper:

python examples/wavefront_adaptive_discretization_3D.py -p 10 --tol 1e-02 1e-05

This should produce an image showing the computed solution, generated grid, and error map:

Showing the computed solution, the adaptive grid, and the errors on a 2D slice of our 3D wavefont probelm.

Inverse wave scattering using automatic differentiation

We have an implementation of a low-dimensional optimization problem using automatic differentiation:

python examples/inverse_wave_scattering.py --n_iter 25

This is an inverse scattering problem where we try to recover the locations of four Gaussian bumps which make up the scattering potential. Running the code should produce plots showing the optimization variables converging at the centers of the Gaussian bumps in the scattering potential, as well as a plot showing the convergence of the objective function:

Showing the convergence of the objective function in our inverse scattering example. Showing the convergence of the iterates to the centers of the Gaussian bumps.

Linearized Poisson--Boltzmann equation

Our method can be used to solve the a linearized Poisson-Boltzmann equation, which models the electrostatic properties of a molecule in solution.

python examples/poisson_boltzmann_example.py --tol 1e-01 1e-03 -p 10 

Project details


Download files

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

Source Distribution

jaxhps-0.1.tar.gz (685.7 kB view details)

Uploaded Source

Built Distribution

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

jaxhps-0.1-py3-none-any.whl (123.8 kB view details)

Uploaded Python 3

File details

Details for the file jaxhps-0.1.tar.gz.

File metadata

  • Download URL: jaxhps-0.1.tar.gz
  • Upload date:
  • Size: 685.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for jaxhps-0.1.tar.gz
Algorithm Hash digest
SHA256 4b7acc4b212f8487ab90f8ee6b874d54d85606bc0937426c25259edcced62ec4
MD5 3236d14bc1fc793b8f21e2268a0b71e4
BLAKE2b-256 4e8b36228d703150d483d2daf828f2e5fc066102e053b6f50cb436928967c990

See more details on using hashes here.

File details

Details for the file jaxhps-0.1-py3-none-any.whl.

File metadata

  • Download URL: jaxhps-0.1-py3-none-any.whl
  • Upload date:
  • Size: 123.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for jaxhps-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68dc1d73bba26ccd2751a5bb192962ab8d942fd564964fe7c63180b1924684ff
MD5 b17d80280032d58310f09e98b63820af
BLAKE2b-256 854809a382637028b411c7aa19e7945330bbfd039e664181deee61f16ac6790b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page