Skip to main content

Acoustic scattering from multiple n-spheres in NumPy / PyTorch

Project description

biem-helmholtz-sphere

CI Status Documentation Status Test coverage percentage

uv Ruff pre-commit

PyPI Version Supported Python versions License


Documentation: https://biem-helmholtz-sphere.readthedocs.io

Source Code: https://github.com/ultrasphere-dev/biem-helmholtz-sphere


Acoustic scattering from multiple n-spheres in NumPy / PyTorch

Open in Spaces

Installation

Install this via pip (or your favourite package manager):

pip install biem-helmholtz-sphere

Usage (GUI)

GUI

uvx biem-helmholtz-sphere serve

Usage

Boundary Integral Equation Method (BIEM) for the Helmholtz equation.

Let $d \in \mathbb{N} \setminus \lbrace 1 \rbrace$ be the dimension of the space, $k$ be the wave number, and $\mathbb{S}^{d-1} = \lbrace x \in \mathbb{R}^d \mid |x| = 1 \rbrace$ be a unit sphere in $\mathbb{R}^d$. Let $B := {0, ..., }$ be the index set of spheres, $c_b \in \mathbb{R}^d$ be the center of sphere $b \in B$, and $\rho_b > 0$ be the radius of sphere $b \in B$. Assume that the closure of spheres do not overlap, i.e.,

$$ \forall b, b' \in B, b \neq b', |c_b - c_b'| > \rho_b + \rho_b' $$

Asuume that $u_\text{in}$ is an incident wave satisfying the Helmholtz equation

$$ \Delta u_\text{in} + k^2 u_\text{in} = 0 $$

and scattered wave $u$ satisfies the following:

$$ \begin{cases} \Delta u + k^2 u = 0 \quad &x \in \mathbb{R}^d \setminus \overline{\mathbb{S}^{d-1}} \ \alpha u + \beta \nabla u \cdot n_x = -\alpha u_\text{in} -\beta \nabla u_\text{in} \cdot n_x \quad &x \in \mathbb{S}^{d-1} \ \lim_{|x| \to \infty} |x|^{\frac{d-1}{2}} \left( \frac{\partial u}{\partial |x|} - i k u \right) = 0 \quad &\frac{x}{|x|} \in \mathbb{S}^{d-1} \end{cases} $$

The following code assumes

$$ d = 3, k = 1, u_\text{in} (x) = e^{i k x_0}, c_0 = (0, 2, 0), c_1 = (0, -2, 0), \rho_0 = 1, \rho_1 = 1, \alpha = 1, \beta = 0 \quad \text{(Sound-soft)} $$

and computes the scattered wave at $(0, 0, 0)$.

>>> from array_api_compat import numpy as xp
>>> from biem_helmholtz_sphere import BIEMResultCalculator, biem, plane_wave
>>> from ultrasphere import create_from_branching_types
>>> c = create_from_branching_types("ba")
>>> uin, uin_grad = plane_wave(k=xp.asarray(1.0), direction=xp.asarray((1.0, 0.0, 0.0)))
>>> calc = biem(c, uin=uin, uin_grad=uin_grad, k=xp.asarray(1.0), n_end=6, eta=xp.asarray(1.0), centers=xp.asarray(((0.0, 2.0, 0.0), (0.0, -2.0, 0.0))), radii=xp.asarray((1.0, 1.0)), kind="outer")
>>> complex(xp.round(calc.uscat(xp.asarray((0.0, 0.0, 0.0))), 6))
(-0.741333-0.669657j)

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

Copier

This package was created with Copier and the browniebroke/pypackage-template project template.

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

biem_helmholtz_sphere-1.1.3.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

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

biem_helmholtz_sphere-1.1.3-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file biem_helmholtz_sphere-1.1.3.tar.gz.

File metadata

  • Download URL: biem_helmholtz_sphere-1.1.3.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for biem_helmholtz_sphere-1.1.3.tar.gz
Algorithm Hash digest
SHA256 296e80826a2d3be0fe67d5b5edf43f7d62ce5b6a97e4b80713bd4eaf4de1f5a6
MD5 ca1b0839d324f9b50048b09e7f70b13b
BLAKE2b-256 0956a2e88db6679991323d98968cf0295f47c344de966e4cfc4b7ca790592b2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for biem_helmholtz_sphere-1.1.3.tar.gz:

Publisher: ci.yml on ultrasphere-dev/biem-helmholtz-sphere

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biem_helmholtz_sphere-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for biem_helmholtz_sphere-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 384bdd3b911e5759942eed60f7d4d47ff7b9cc74b51b99664cf0044314ae1e1e
MD5 0f3d9530f6775ca24e19c2c3797a0ad7
BLAKE2b-256 2096b9c30c6b6ae19fbd935571d74c6566b7e21754d0b0f5566b1940ea8eb8ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for biem_helmholtz_sphere-1.1.3-py3-none-any.whl:

Publisher: ci.yml on ultrasphere-dev/biem-helmholtz-sphere

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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