def phi_magnetic_i_te(radial, theta, phi, wave_number_k): """ Computes the phi component of inciding magnetic field in TE mode. """ result = 0 n = 1 # Due to possible singularity near origin, we approximate null radial # component to a small value. radial = radial or 1E-16 riccati_bessel_list = _riccati_bessel_j(get_max_it(radial), wave_number_k * radial) d_riccati_bessel = riccati_bessel_list[1] max_it = get_max_it(radial) while n <= max_it: for m in DEGREES: increment = m \ * plane_wave_coefficient(n, wave_number_k) \ * beam_shape_g(n, m, mode='TE') \ * d_riccati_bessel[n] \ * legendre_pi(n, abs(m), np.cos(theta)) \ * np.exp(1j * m * phi) result += increment n += 1 return 1j * result / radial
def radial_electric_tm_increment(max_it, radial, theta=np.pi / 2, phi=0, wave_number_k=WAVE_NUMBER): result = 0 riccati_bessel_list = _riccati_bessel_j(get_max_it(radial), wave_number_k * radial) riccati_bessel = riccati_bessel_list[0] for n in range(1, max_it): for m in DEGREES: increment = plane_wave_coefficient(n, wave_number_k) \ * beam_shape_g(n, m, mode='TM') \ * (d2_riccati_bessel_j(n, wave_number_k * radial) \ + riccati_bessel[n]) \ * legendre_p(n, abs(m), np.cos(theta)) \ * np.exp(1j * m * phi) result += increment return abs(wave_number_k * result)
def radial_magnetic_i_te(radial, theta, phi, wave_number_k): """ Computes the radial component of inciding magnetic field in TE mode. """ result = 0 n = 1 riccati_bessel_list = _riccati_bessel_j(get_max_it(radial), wave_number_k * radial) riccati_bessel = riccati_bessel_list[0] while n <= get_max_it(radial): for m in DEGREES: increment = plane_wave_coefficient(n, wave_number_k) \ * beam_shape_g(n, m, mode='TE') \ * (d2_riccati_bessel_j(n, wave_number_k * radial) \ + riccati_bessel[n]) \ * legendre_p(n, abs(m), np.cos(theta)) \ * np.exp(1j * m * phi) result += increment n += 1 return wave_number_k * result
def test_increment_decay(): from glmt.specials import _riccati_bessel_j, d2_riccati_bessel_j, legendre_p from glmt.glmt import plane_wave_coefficient, beam_shape_g max_it = 1000 r = np.linspace(0, 100E-6, 5) wave_number_k = WAVE_NUMBER theta = np.pi/2 phi = 0 for radial in r: riccati_bessel_list = _riccati_bessel_j(max_it, wave_number_k * radial) riccati_bessel = riccati_bessel_list[0] s = [] result = 0 n = 1 print(radial) while n < max_it: for m in [-1, 1]: increment = plane_wave_coefficient(n, wave_number_k) \ * beam_shape_g(n, m, mode='TM') \ * (d2_riccati_bessel_j(n, wave_number_k * radial) \ + riccati_bessel[n]) \ * legendre_p(n, abs(m), np.cos(theta)) \ * np.exp(1j * m * phi) result += increment s.append(abs(wave_number_k * result)) n += 1 plt.plot(range(1, max_it), s) plt.title("%s micrômetros" % (radial / 1E-6)) plt.xlabel('N') plt.ylabel('|E| [V/m]') N = get_max_it(radial) plt.plot(N, s[N], 'rx', label='N(r) = %s' % N) plt.legend() print(result) plt.show()