Skip to content

[FEATURE] add pytta.analytic with Green's functions, plane waves and a sphere - #103

Open
aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-analytic
Open

aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-analytic

Conversation

@aguirreSL

Copy link
Copy Markdown

Adds pytta.analytic, analytic sound fields as the Monopole tools of the ITA-Toolbox (ita_analytic_green_function, ita_analytic_plane_wave and ita_analytic_plane_wave_on_sphere):

  1. green(f, source, points): the free-field Green's function exp(-jkr) / (4πr).
  2. green_impedance_plane(f, source, points, Z): a point source over the plane z = 0 of surface impedance Z. It is the free field plus the image source weighted by the plane-wave reflection factor at the specular angle, R = (Z cos θ - ρc) / (Z cos θ + ρc). This is the usual approximation. It is exact for a rigid or a pressure-release plane, and it leaves out the ground wave of the exact solution. The docstring states this.
  3. plane_wave(f, direction, points, origin): exp(-jk u·(r - r0)).
  4. plane_wave_on_sphere(f, radius, points, admittance=0, max_order=80): the field scattered by a sphere of normalized surface admittance β, with the incident field. It uses the series of Mechel (Formulas of Acoustics), which ita_analytic_plane_wave_on_sphere also uses: p_scat = Σ (2m + 1)(-j)^m D_m P_m(cos θ) h_m(kr), with D_m set by the boundary condition dp/dr = jkβp at r = a.

The time dependence is exp(jωt), so outgoing waves go as exp(-jkr) and use the spherical Hankel function h_m = j_m - j y_m.

The tests in tests/test_analytic.py print the measured differences:

  1. The Green's function has magnitude 1 / (4πr) and phase -kr (2.2e-17), and it is reciprocal. A plane wave has unit magnitude and phase -k u·r.
  2. On a rigid plane the image doubles the free field, and on a pressure-release plane the pressure is zero. Straight above the source, the image carries R = (Z - ρc) / (Z + ρc).
  3. The total field around the sphere meets its boundary condition on the surface, by a one-sided difference in r: a zero normal derivative for a rigid sphere (3.2e-10) and dp/dr = jkβp for β = 0.5 + 0.2j (5.0e-10).
  4. Points inside the sphere are rejected.

Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of development (3 in test_h5io.py, 4 in test_pyttasave.py) are the same with and without this change.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

…a sphere

pytta.analytic gives analytic sound fields, as the Monopole tools of the
ITA-Toolbox: the free-field Green's function, a point source over an
impedance plane (image source with the plane-wave reflection factor), a
plane wave, and a plane wave scattered by a sphere of given surface
admittance (series of Mechel, Formulas of Acoustics).

Tests check the form and reciprocity of the Green's function, the rigid
and pressure-release limits of the impedance plane and its reflection
at normal incidence, and that the field around the sphere meets its
boundary condition for a rigid and an absorbing sphere.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant