Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0827a44

Browse files
committed
Added normal vector of secondary sources to arguments of various functions
1 parent fccaaa7 commit 0827a44

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

examples/horizontal_plane_arrays.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def compute_and_plot_soundfield(title):
3030
print('Computing ', title)
3131

3232
twin = tapering(a, talpha)
33-
p = sfs.mono.synthesized.generic(omega, x0, d * twin * a0, grid,
33+
p = sfs.mono.synthesized.generic(omega, x0, n0, d * twin * a0, grid,
3434
source=sourcetype)
3535

3636
plt.figure(figsize=(15, 15))

examples/sound_field_synthesis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
twin = sfs.tapering.tukey(a,.3)
7373

7474
# === compute synthesized sound field ===
75-
p = sfs.mono.synthesized.generic(omega, x0, d * twin * a0 , grid,
75+
p = sfs.mono.synthesized.generic(omega, x0, n0, d * twin * a0 , grid,
7676
source=sfs.mono.source.point)
7777

7878

examples/soundfigures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
d = sfs.mono.soundfigure.wfs_3d_pw(omega, x0, n0, figure, npw=npw)
4444

4545
# compute synthesized sound field
46-
p = sfs.mono.synthesized.generic(omega, x0, d * a0, grid,
46+
p = sfs.mono.synthesized.generic(omega, x0, n0, d * a0, grid,
4747
source=sfs.mono.source.point)
4848

4949
# plot and save synthesized sound field

sfs/mono/source.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import numpy as np
44
from scipy import special
5-
from numpy.core.umath_tests import inner1d # element-wise inner product
65
from .. import util
76

87

@@ -12,7 +11,7 @@ def point(omega, x0, n0, grid, c=None):
1211
::
1312
1413
1 e^(-j w/c |x-x0|)
15-
G(x-xs, w) = --- -----------------
14+
G(x-x0, w) = --- -----------------
1615
4pi |x-x0|
1716
1817
"""
@@ -32,7 +31,7 @@ def line(omega, x0, n0, grid, c=None):
3231
::
3332
3433
(2)
35-
G(x-xs, w) = -j/4 H0 (w/c |x-x0|)
34+
G(x-x0, w) = -j/4 H0 (w/c |x-x0|)
3635
3736
"""
3837
k = util.wavenumber(omega, c)
@@ -47,19 +46,27 @@ def line(omega, x0, n0, grid, c=None):
4746
if len(gridshape) > 2:
4847
p = np.tile(p, [1, 1, gridshape[2]])
4948
return np.squeeze(p)
50-
49+
5150

5251
def line_dipole(omega, x0, n0, grid, c=None):
5352
"""Line source with dipole characteristics parallel to the z-axis.
5453
54+
Note: third component of x0 is ignored.
55+
56+
::
57+
58+
(2)
59+
G(x-x0, w) = jk/4 H1 (w/c |x-x0|) cos(phi)
60+
5561
5662
"""
5763
k = util.wavenumber(omega, c)
5864
x0 = util.asarray_1d(x0)
59-
#x0 = x0[:2] # ignore z-component
65+
x0 = x0[:2] # ignore z-component
66+
n0 = n0[:2]
6067
grid = util.asarray_of_arrays(grid)
61-
dx = grid - x0
62-
r = np.linalg.norm(dx[:2])
68+
dx = grid[:2] - x0
69+
r = np.linalg.norm(dx)
6370
p = 1j*k/4 * special.hankel2(1, k * r) * np.inner(dx, n0) / r
6471
# If necessary, duplicate in z-direction:
6572
gridshape = np.broadcast(*grid).shape

0 commit comments

Comments
 (0)