Skip to main content

PyHelmholtz is a framework for benchmarking absorbing boundary methods for 2D Helmholtz equation.

Project description

PyHelmholtz

A Python package for solving the 2D Helmholtz equation and benchmarking absorbing boundary methods.

Features

  • Fast frequency-domain wave propagation modeling.
  • Support for standard sparse direct solvers via SciPy.
  • Optional high-performance nested dissection algorithms via SuiteSparse.
  • Optional parallel direct solver acceleration via MUMPS.

Installation

PyHelmholtz provides three installation tiers depending on your performance needs and platform.

1. Standard Installation (Recommended)

If you only need standard solvers using SciPy's spsolve(), you can install PyHelmholtz instantly with no external C-library or compiler requirements:

pip install pyhelmholtz

2. With Nested Dissection Support (Optional)

To enable advanced nested dissection algorithms, the package requires scikit-sparse. Because this depends on underlying SuiteSparse C-libraries, it is highly recommended to install the dependencies via Conda first to avoid compilation issues (especially on Windows):

# Install the C-libraries and pre-compiled wrapper via Conda
conda install -c conda-forge scikit-sparse

# Install PyHelmholtz with the optional suitesparse feature flag
pip install pyhelmholtz[suitesparse]

3. With MUMPS Acceleration (Optional, Linux only)

For large-scale problems requiring parallel direct solvers, PyHelmholtz interfaces with MUMPS via PyMUMPS.

Because this relies on compiled Fortran, MPI, and BLAS/LAPACK binaries, you must install the system MUMPS libraries first before installing the Python package:

# Install system MUMPS and MPI development libraries (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install libmumps-dev

# Install PyHelmholtz with the optional mumps feature flag
pip install pyhelmholtz[mumps]

Quick Start

Here is a quick example of how to use PyHelmholtz to solve the Helmholtz equation using the default parameters:

  • homogeneous domain of size [-1,1]x[-1,1] m2 with wave speed of 38 m/s and grid spacing of 1 cm
  • point source of frequency 29 Hz located at the center of the domain
  • the second-order Engquist-Majda absorbing boundary condition is used to prevent boundary reflections
  • second-order finite-difference (FD) schemes are used
import pyhelmholtz as ph
ho = ph. Helmholtz () # create an Helmholtz object with default parameters
ho. solve ()          # SciPy ’s spsolve () is used by default as the sparse linear solver
ho. viz ()            # visualize the real part of the wave field u

Here is another example in which several parameters were manually set. These include the grid spacing h = 10 m, the horizontal and vertical domain limits = [0,1000], [0,500], respectively, the wave speed = 1000 m/s, the point source frequency = 10 Hz and location = [500, 250]. In addition, the perfectly matched layer (PML) is used as the absorbing boundary method, and the fourth-order FD schemes are used in the calculation.

import pyhelmholtz as ph
domain = ph.Domain(h=10, limits=[0,1000,0,500], v=1000)
source = ph.PointSource(freq=10, xs=500, ys=250)
ho = ph.Helmholtz(domain=domain, abm=ph.PML(), source=source, fd=ph.FD(4))
ho.solve()
ho.viz()

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

pyhelmholtz-0.1.8.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

pyhelmholtz-0.1.8-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file pyhelmholtz-0.1.8.tar.gz.

File metadata

  • Download URL: pyhelmholtz-0.1.8.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.19

File hashes

Hashes for pyhelmholtz-0.1.8.tar.gz
Algorithm Hash digest
SHA256 048854dd55f80a802b456e5d5b054f189d3beba11c182539910db720f5aab524
MD5 a79f78b7c337099b484e17b715a84883
BLAKE2b-256 7365e99c874cdfac5e0ef554ca8af5def2e1e38551a9ca6f21b2f2e6ed1824f2

See more details on using hashes here.

File details

Details for the file pyhelmholtz-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: pyhelmholtz-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.19

File hashes

Hashes for pyhelmholtz-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6add5e4ca6dca43ddb0f06099953246fad01cc651e55f0c3fc4678d107b9658c
MD5 5aa58c806524d12665dcebda6153fee8
BLAKE2b-256 2ab51e6a04445d4284784d7fdace44d85abda7bc90fa571660f3144b0374a2df

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