Skip to content

add point source with far-field directivity of circular piston #156

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

fietew
Copy link
Member

@fietew fietew commented Nov 21, 2019

Adds new source type with far-field directivity of circular piston radiator

import sfs
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = 8, 4.5  # inch

x0 = 1.5, 1, 0
n0 = 0, -1, 0
R = 1.0  # meters
f = 500  # Hz
omega = 2 * np.pi * f

normalization_point = 4 * np.pi

grid = sfs.util.xyz_grid([-2, 3], [-1, 2], 0, spacing=0.02)

p = sfs.fd.source.point_circular_piston(omega, x0, n0, grid, R)
sfs.plot2d.amplitude(p * normalization_point, grid)
plt.title("Circular Piston Radiator at {} m".format(x0))

@mgeier
Copy link
Member

mgeier commented Dec 16, 2019

The machine is complaining:

$ python3 -m pycodestyle sfs/fd/source.py
sfs/fd/source.py:227:1: E302 expected 2 blank lines, found 1
sfs/fd/source.py:254:39: W291 trailing whitespace
sfs/fd/source.py:257:9: W291 trailing whitespace
$ python3 -m pycodestyle sfs/util.py
sfs/util.py:580:1: E302 expected 2 blank lines, found 1

And https://travis-ci.org/sfstoolbox/sfs-python/jobs/615577318 contains:

/home/travis/build/sfstoolbox/sfs-python/sfs/fd/source.py:docstring of sfs.fd.source.point_circular_piston:20: WARNING: Explicit markup ends without a blank line; unexpected unindent.

Note that the line number is meant within the docstring.
I guess the problem is a missing blank line before Returns.

G(\x-\x_0,\w) = \frac{1}{2\pi}
\frac{J_1(\wc R \sin(\Theta))}{\wc R \sin(\Theta)}
\frac{\e{-\i\wc|\x-\x_0|}}{|\x-\x_0|}
with :math:`\Theta` more conveniently defined by its cosine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sfs/fd/source.py:docstring of sfs.fd.source.point_circular_piston:20: WARNING: Explicit markup ends without a blank line; unexpected unindent.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants