Bessel function use in the definition of the incident field
nazalli-choucha opened this issue · 2 comments
nazalli-choucha commented
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 commented
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 commented
Thank you for your help. It worked fine.