<jupyter_start><jupyter_text>Hands-on LH2: the multijunction launcher A tokamak a intrinsequally a pulsed machine. In order to perform long plasma discharges, it is necessary to drive a part of the plasma current, in order to limit (or ideally cancel) the magnetic flux consumption. Additional current drive systems are used for these. Among the current drive systems, _Lower Hybrid Current Drive_ (LHCD) systems have demonstrated the larger current drive efficiency. A Lower Hybrid launcher is generally made of numerous waveguides, stacked next to each other by their large sides. Since there is a phase shift between each waveguide in the toroidal direction, these launchers constitute a _phased array_. A phased array is an array of radiating elements in which the relative phases of the respective signals feeding these elements are varied in such a way that the effective radiation pattern of the array is reinforced in a desired direction and suppressed in undesired directions. A phased array is an example of N-slit diffraction. It may also be viewed as the coherent addition of N sources. In the case of LHCD launchers, the RF power is transmitted into a specific direction in the plasma through plasma waves. These waves will ultimately drive some additional plasma current in the tokamak.The total number of waveguides in a LHCD launcher increased with each launcher generation. From simple structures, made of two or four waveguides, today's LHCD launchers such as the Tore Supra ones have hundred of waveguides. With such a number of waveguides, it is not possible anymore to excite each waveguides separately. _Multijunctions_ have been designed to solve this challenge. They act as a power splitter while phasing the adjacent waveguides.The aim of this hands-on is to measure and characterize the RF performances of a multijunction structure, on a real Tore Supra C3 mock-up. From these relative measurements, you will have to analyse the performances of the multijunction and to deduce if the manufacturing tolerances affect them. Before or in parallel to making measurements, you will have to calculate what would be the ideal spectral power density (or _spectrum_) launched by such a multijunction. This will serve them for making comparison theory vs experimental and thus discuss about the performances one could expect.   1. LHCD launcher spectrum The objective of this section is to get you to understand the multiple requirements of a LHCD launcher.   2. RF Measurements Because of the non-standard dimensions of the waveguides, it is not possible to use commercial calibration toolkit, and thus to make an precise and absolute calibration of the RF measurements. However, relative comparisons are still relevant.  -----  Solution  This notebook illustrates a method to compute the power density spectrum of a phased array.<jupyter_code>%pylab
%matplotlib inline
from scipy.constants import c<jupyter_output>Using matplotlib backend: Qt5Agg
Populating the interactive namespace from numpy and matplotlib<jupyter_text>Phased array geometry A linear phased array with equal spaced elements is easiest to analyze. It is illustrated in the following figure, in which radiating elements are located at a $\Delta z$ distance between each other. These elements radiates with a phase shift $\Delta \Phi$.   Let's a rectangular waveguide phased array facing the plasma. The waveguides periodicity is $\Delta z=b+e$ where $b$ is the width of a waveguide and $e$ the thickness of the septum between waveguides and the phase shift between waveguides is $\Delta \Phi$. We will suppose here that the amplitude and the phase of the waves in a waveguide do not depend of the spatial direction $z$. Thus we have $\Delta\Phi=$. The geometry is illustrated in the figure below.      Ideal grill Let's make the hypothesis that the electric field at the interface antenna-plasma is not perturbed from the electric field in the waveguide. At the antenna-plasma interface, the total electric field is thus:    $$ E(z) = \sum_{n=1}^N E_n \Pi_n(z) = \sum_{n=1}^N A_n e^{j\Phi_n} \Pi_n(z) $$ where $\Pi_n(z)$ is a Heavisyde step function, equals to unity for $z$ corresponding to a waveguide $n$, and zero elsewhere. The power density spectrum is homogeneous to the square of the Fourier transform of the electric field, that is, to :$$ \tilde{E}(k_z) = \int E(z) e^{j k_z z} \, dz $$Where $k_z=n_z k_0$. If one calculates the modulus square of the previous expression, this should give:$$ dP(n_z) \propto sinc^2 \left( k_0 n_z \frac{b}{2} \right) \left( \frac{\sin(N \Phi/2)}{\sin\Phi/2} \right)^2 $$With $\Phi=k_0 n_z \Delta z + \Delta\Phi$. The previous expression is maximized for $\Phi=2 p \pi, p\in \mathbb{N}$. Assuming $p=0$, this leads to the condition :$$ n_{z0} = - \frac{\Delta\Phi}{k_0 \Delta z} $$ Let's define the following function:<jupyter_code>def ideal_spectrum(b,e,phi,N=6,f=3.7e9):
    nz = np.arange(-10,10,0.1)
    k0 = (2*pi*f)/c
    
    PHI = k0*nz*(b+e) + phi
    dP = sinc(k0*nz*b/2)*(sin(N*PHI/2)/sin(PHI/2))**2
    
    return(nz,dP)<jupyter_output><empty_output><jupyter_text>And trace the spectrum of an ideal launcher:<jupyter_code>nz, dP_ideal = ideal_spectrum(b=8e-3, e=2e-3, phi=pi/2, N=6)


plot(nz, abs(dP_ideal), lw=2)
xlabel('$n_z=k_z/k_0$');
ylabel('Power density [a.u.]');
title('Power density spectrum of an ideal LH grill launcher') 
grid('on')

plt.savefig('multijunction_ideal_spectrum.png', dpi=150)<jupyter_output>C:\Users\JH218595\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\cbook\__init__.py:424: MatplotlibDeprecationWarning: 
Passing one of 'on', 'true', 'off', 'false' as a boolean is deprecated; use an actual boolean (True/False) instead.
  warn_deprecated("2.2", "Passing one of 'on', 'true', 'off', 'false' as a "<jupyter_text>Realistic grill Let's illustrate this with a more realistic case. Below we define a function that generate the electric field along z for N waveguides, d-spaced and with a constant phase shift. The spacial precision can be set optionnaly.<jupyter_code>def generate_Efield(b,e,phi,N=6,dz=1e-4,A=1):
    # generate the z-axis, between [z_min, z_max[ by dz steps
    z_min = 0 - 0.01
    z_max = N*(b+e) + 0.01
    z = arange(z_min, z_max, dz)
    # construct the Efield (complex valued)
    E = zeros_like(z,dtype=complex)
    for idx in arange(N):
        E[ (z>=idx*(b+e)) & (z < idx*(b+e)+b) ] = A * exp(1j*idx*phi)
    return(z,E)<jupyter_output><empty_output><jupyter_text>Then we use this function to generate the electric field at the mouth of a 6 waveguide launcher, of waveguide width b=8mm, septum thickness e=2mm with a phase shift between waveguides of 90° ($\pi/2$) :<jupyter_code>z,E = generate_Efield(b=8e-3, e=2e-3,phi=pi/2)
fig, (ax1, ax2) = plt.subplots(2,1,sharex=True)
ax1.plot(z,abs(E), lw=2)
ax1.set_ylabel('Amplitude [a.u.]')
ax1.grid(True)
ax1.set_ylim((-0.1,1.1))

ax2.plot(z,angle(E)*180/pi,'g', lw=2)
ax2.set_xlabel('z [m]')
ax2.set_ylabel('Phase [deg]')
ax2.grid(True)
ax2.set_ylim((-200, 200))

fig.savefig('multijunction_ideal_excitation.png', dpi=150)<jupyter_output><empty_output><jupyter_text>Now, let's take the fourier transform of such a field (the source frequency is here f=3.7 GHz, the frequency of the Tore Supra LH system).<jupyter_code>def calculate_spectrum(z,E,f=3.7e9):
    k0 = 2*pi*f/c
    lambda0 = c/f
    # fourier domain points
    B = 2**18
    Efft = np.fft.fftshift(np.fft.fft(E,B))
    
    # fourier domain bins
    dz = z[1] - z[0] # assumes spatial period is constant
    df = 1/(B*dz)
    K = arange(-B/2,+B/2)
    # spatial frequency bins
    Fz= K*df
    # parallel index is kz/k0
    nz= (2*pi/k0)*Fz
    
    # ~ power density spectrum
    p = (dz)**2/lambda0 * (1/2*Efft*conj(Efft));
    
    return(nz,p)
nz,p = calculate_spectrum(z,E)
plot(nz,real(p),lw=2)
xlim((-10,10))
xlabel('$n_z=k_z/k_0$')
ylabel('Power density [a.u.]') 
title('Spectral power density of an ideal LH launcher')
grid('on')

plt.savefig('multijunction_ideal_spectrum.png', dpi=150)<jupyter_output><empty_output><jupyter_text>The main component of the spectrum seems located near $n_z$=2. Looking at the previous analytical formula, which expresses the extremum of the power density spectrum:<jupyter_code>f = 3.7e9 # frequency [Hz]
b = 8e-3 # waveguide width [m]
e = 2e-3 # septum width [m]
k0 = (2*pi*f) / c # wavenumber in vacuum
delta_phi = pi/2 # phase shift between waveguides<jupyter_output><empty_output><jupyter_text>$$n_{z0} = \frac{k_{z0}}{k_0} = \frac{\Delta \Phi}{k_0 \Delta z }$$<jupyter_code>nz0 = pi/2 / ((b+e) * k0) # main component of the spectrum
nz0<jupyter_output><empty_output><jupyter_text>Which is what we expected from the previous Figure.  Current Drive DirectionLet's assume that the plasma current is clockwise as seen from the top of a tokamak. Let's also define the positive direction of the toroidal magnetic field being in the same direction than the plasma current, i.e. :$$\mathbf{B}_0 = B_0 \mathbf{e}_\parallel$$and$$\mathbf{I}_p = I_p \mathbf{e}_\parallel$$Let be $\mathbf{J}_{LH}$ the current density created by the Lower Hybrid system. The current density is expressed as$$\mathbf{J}_{LH} = - n e v_\parallel \mathbf{e}_\parallel$$where $v_\parallel=c/n_\parallel$. As we want the current driven to be in the same direction than the plasma current, i.e.:$$\mathbf{J}_{LH}\cdot\mathbf{I}_p > 0$$one must have :$$n_\parallel < 0$$  RF Measurements of the multijunction<jupyter_code>import numpy as np
calibration = np.loadtxt('LH2_Multijunction_data/calibration.s2p', skiprows=5)
fwd1 = np.loadtxt('LH2_Multijunction_data/fwd1.s2p', skiprows=5)
fwd2 = np.loadtxt('LH2_Multijunction_data/fwd2.s2p', skiprows=5)
fwd3 = np.loadtxt('LH2_Multijunction_data/fwd3.s2p', skiprows=5)
fwd4 = np.loadtxt('LH2_Multijunction_data/fwd4.s2p', skiprows=5)
fwd5 = np.loadtxt('LH2_Multijunction_data/fwd5.s2p', skiprows=5)
fwd6 = np.loadtxt('LH2_Multijunction_data/fwd6.s2p', skiprows=5)
f = calibration[:,0]
S21_cal = calibration[:,3]
fig, ax = plt.subplots()
ax.plot(f/1e9, fwd1[:,3]-S21_cal)
ax.plot(f/1e9, fwd2[:,3]-S21_cal)
ax.plot(f/1e9, fwd3[:,3]-S21_cal)
ax.plot(f/1e9, fwd4[:,3]-S21_cal)
ax.plot(f/1e9, fwd5[:,3]-S21_cal)
#ax.plot(f/1e9, fwd6[:,3]-S21_cal)
ax.legend(('Forward wg#1', 'Forward wg#2','Forward wg#3','Forward wg#4','Forward wg#5'))
ax.grid(True)
ax.axvline(3.7, color='r', ls='--')
ax.axhline(10*np.log10(1/6), color='gray', ls='--')
ax.set_ylabel('S21 [dB]')
ax.set_xlabel('f [GHz]')
fwds = [fwd1, fwd2, fwd3, fwd4, fwd5, fwd6]
s21 = []

for fwd in fwds:
    s21.append(10**((fwd[:,3]-S21_cal)/20) * np.exp(1j*fwd[:,4]*np.pi/180))
s21 = np.asarray(s21)
# find the 3.7 GHz point
idx = np.argwhere(f == 3.7e9)
s21_3dot7 = s21[:,idx].squeeze()
fig, ax = plt.subplots(nrows=2)
ax[0].bar(np.arange(1,7), np.abs(s21_3dot7))
ax[1].bar(np.arange(1,7), 180/np.pi*np.unwrap(np.angle(s21_3dot7)))<jupyter_output><empty_output><jupyter_text>Clearly, the last waveguide measurements are strange...  Checking the power conservation<jupyter_code>fig, ax = plt.subplots()
plot(f/1e9, abs(s21**2).sum(axis=0))
ax.grid(True)
ax.axvline(3.7, color='r', ls='--')
ax.set_ylabel('$\sum |S_{21}|^2$ ')
ax.set_xlabel('f [GHz]')<jupyter_output><empty_output><jupyter_text>Clearly, the power conservation is far from being verified, because of the large incertitude of the measurement here.  CSS Styling<jupyter_code>from IPython.core.display import HTML
def css_styling():
    styles = open("../../styles/custom.css", "r").read()
    return HTML(styles)
css_styling()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1193939393939394, 'fraction_numerical': 0.027965367965367964, 'mean_word_length': 4.914490527393753, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '149837', 'license': 'MIT', 'n_tokens_mistral': 4172, 'n_tokens_neox': 3963, 'n_words': 1336, 'path': 'notebooks/TP Master Fusion/LH-Hands-on-multijunction.ipynb', 'repo_name': 'Hash--/documents', 'size': '11550'}