Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Bessel function use in the definition of the incident field #158

Open
nazalli-choucha opened this issue May 23, 2022 · 2 comments
Open

Bessel function use in the definition of the incident field #158

nazalli-choucha opened this issue May 23, 2022 · 2 comments

Comments

@nazalli-choucha
Copy link

Hello,

I'm trying to define an incident acoustic field with a directivity function :

from scipy.special import j1
k = 2.
R = 0.1
@bempp.api.complex_callable
def p_inc_callable(x, n, domain_index, result):
    r = np.sqrt(np.power(x[0],2)+np.power(x[1],2)+np.power(x[2]-1,2))
    rho = np.sqrt(np.power(x[0],2) + np.power(x[1],2))
    val = k * R * rho / r
    d = j1(val) / val
    theta = np.arcsin(rho / r)
    result[0] = (np.exp(-1j * k * r) / r) * directivity * np.cos(rho / r)

I got the following error :

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'j1': Cannot determine Numba type of <class 'numpy.ufunc'>

File "../../tmp/ipykernel_4292/2670867267.py", line 62:
<source missing, REPL/exec in use?>
@evantwout
Copy link
Collaborator

The Numba library does not recognise all special functions. You can switch off the Numba JIT acceleration:
@bempp.api.complex_callable(jit=False)
See http://bempp.com/handbook/api/grid_functions.html#disabling-just-in-time-compilation

The code runs fine with Numba disabled (also change d in directivity).

@nazalli-choucha
Copy link
Author

nazalli-choucha commented May 23, 2022

Thank you for your help. It worked fine.

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

No branches or pull requests

2 participants