Commit ba9c969b authored by Lucas Laplanche's avatar Lucas Laplanche
Browse files

maj

parent 0c100e6f
......@@ -139,15 +139,26 @@ def reflectivity_heatmap(bypass_dbr=True,
def electromagnetic_amplitude(bypass_dbr=False, electric_field=0., wavelength=850e-9):
def electromagnetic_amplitude(bypass_dbr=False, electric_field=0., wavelength=850e-9, algo='transmission'):
l_eam_clad = 15e-9
l_vcsel_clad = 10e-9
l_vcsel_clad = 15e-9
sl = st.structure_eam_vcsel(bypass_dbr=bypass_dbr, vcsel_only=True, grading_type='none', mqw_alloy_type='none', l_eam_clad = l_eam_clad, l_vcsel_clad=l_vcsel_clad)
sl = op.algaas_super_lattice_refractive_index(sl, electric_field, wavelength)
sl = pt.cut_in_equal_layers_thickness(sl, 5e-9)
em = op.em_amplitude_smm(sl, wavelength)
sl = pt.cut_in_equal_layers_thickness(sl, 1e-8)
# scattering matrix or transmission matrix for transfer method
if 'scattering' in algo:
em = op.em_amplitude_smm(sl, wavelength)
elif 'transmission' in algo:
em = op.em_amplitude_tmm(sl, wavelength)
elif 'potato' in algo:
em = op.em_amplitude_potato(sl, wavelength)
else:
em = op.em_amplitude_tmm(sl, wavelength)
# insert the electromagnetic amplitude within the super lattice
sl.insert(sl.shape[1], 'electromagnetic_amplitude', value=em)
plt.plot_refra_em(sl, ' - eam_clad=' +str(l_eam_clad) +' - alox_end=35nm - vcsel_clad=' +str(l_vcsel_clad))
plt.plot_refra_em(sl, ' - eam_clad=' +str(l_eam_clad) +' - alox_end=55nm - vcsel_clad=' +str(l_vcsel_clad))
def vcsel_electromagnetic_resonnance(electric_field=0.,
......
......@@ -347,68 +347,66 @@ def ioffe_algaas_permittivity(al, high_frequency=True):
def transmission_matrix(super_lattice, wavelength=850e-9):
# element matrix
m = np.identity(2)
def transmission_matrix(super_lattice, m, wavelength):
e = np.zeros(super_lattice.shape[0])
for k in range(super_lattice.shape[0] -1):
i, tm = interface_intensity(super_lattice, m, k)
m = np.matmul(tm, m)
i, m = interface_intensity(super_lattice, m, k)
i, tm = core_intensity(super_lattice, wavelength, m, k)
m = np.matmul(tm, m)
i, m = core_intensity(super_lattice, wavelength, m, k)
e[k] = i
return m
return e, m
def interface_intensity(super_lattice, m, idx):
n = np.real(super_lattice['refractive_index'].to_numpy(dtype=np.complex128))
rap = n[idx] / n[idx +1]
ra = n[idx] / n[idx +1]
di = np.array([
[0.5 * (1 + rap), 0.5 * (1 - rap)],
[0.5 * (1 - rap), 0.5 * (1 + rap)]
[0.5 * (1. + ra), 0.5 * (1. - ra)],
[0.5 * (1. - ra), 0.5 * (1. + ra)]
])
m = np.matmul(di, m)
m = di @ m
# electric field of the forward plane wave
ep = m[1, 0]
ep = m[0, 0]
# electric field of the backward plane wave
em = m[1, 1]
em = m[1, 0]
i = np.abs(ep + em)**2
i = np.abs(ep +em) ** 2
return i, m
def core_intensity(super_lattice, wavelength, m, idx):
n = np.real(super_lattice['refractive_index'].to_numpy(dtype=np.complex128))
l = super_lattice['thickness'].to_numpy(dtype=np.complex128)
n = np.real(super_lattice['refractive_index'].to_numpy(dtype=np.complex128))[idx + 1]
l = super_lattice['thickness'].to_numpy(dtype=float)[idx + 1]
dp = np.array([[np.exp(2j * np.pi * n[idx + 1] * l[idx + 1] / wavelength), 0.],
[0., np.exp(-2j * np.pi * n[idx + 1] * l[idx + 1] / wavelength)]
dp = np.array([
[np.exp(2j * np.pi * n * l / wavelength), 0.],
[0., np.exp(-2j * np.pi * n * l / wavelength)]
])
m = np.matmul(dp, m)
m = dp @ m
# electric field of the forward plane wave
ep = m[0, 0]
# electric field of the backward plane wave
em = m[1, 0]
i = np.abs(ep + em) ** 2
return i, m
def em_amplitude_tmm(super_lattice, wavelength):
def em_amplitude_tmm(super_lattice, wavelength, normalize=True):
# compute the amplitude of the electromagnetic field through the structure
# using transfer matrix method
# very likely to diverge
......@@ -421,33 +419,27 @@ def em_amplitude_tmm(super_lattice, wavelength):
n_ini = np.real(super_lattice.at[0, 'refractive_index'])
# injected power [W]
p_inj = 1.
# pump area[cm2]
# pump area [cm2]
p_area = 1.
# input field in [V/cm]
e_ini = np.sqrt(2. * p_inj / (EPS0 * C * n_ini * p_area))
# transmission matrix
tm = transmission_matrix(super_lattice, wavelength)
tm = np.array([[1.], [-tm[1, 0] / tm[1, 1]]])
i, tm = transmission_matrix(super_lattice, m, wavelength=wavelength)
tm = np.array([1., -tm[1, 0] / tm[1, 1]])
m_ini = e_ini * tm
a = np.matmul(m, m_ini)
e_forw = a[0, 0]
e_backw = a[1, 0]
# electric field intensity
e = np.array([np.abs(e_forw + e_backw) ** 2])
m = np.identity(2) * m_ini
for i in range(super_lattice.shape[0] -1):
# at the interface
e_tp, m = interface_intensity(super_lattice, m, i)
# electric field intensity
e, m = transmission_matrix(super_lattice, m, wavelength=wavelength)
e = np.append(e, e_tp)
# in the layer
e_tp, m = core_intensity(super_lattice, wavelength, m, i)
# normalize
if normalize:
e = e / np.max(e)
return e
......@@ -650,4 +642,86 @@ def concatenate_2x2x2x2_to_4x4(arr):
m = np.concatenate([m1, m2], axis=0)
return m
def em_amplitude_potato(sl, wavelength):
nb_adapt = 1000
p_in = 1.
a_in = 1.
lz = sl['thickness'].to_numpy(dtype=float)
n = sl['refractive_index'].apply(np.real).to_numpy(dtype=float)
n_in = n[0]
e_in = np.sqrt(2j * p_in / (EPS0 * C * a_in * n_in))
m = give_potato(lz, n, wavelength)
print('m = ', m)
c = 1
a = np.identity(2)
m_in = e_in * np.array([1., m[1, 0] / m[1, 1]])
a = a * m_in
e = np.array([])
e = np.append(e, np.abs(a[0, 0] + a[1, 0]) ** 2)
for k in range(len(n) -1):
r = n[k] / n[k +1]
di = np.array([
[0.5 * (1 + r), 0.5 * (1 - r)],
[0.5 * (1 - r), 0.5 * (1 + r)]
])
a = di @ a
e = np.append(e, np.abs(a[0, 0] + a[1, 0]) ** 2)
c += 1
dz = lz[k + 1] / nb_adapt
dp = np.array([
[np.exp(2j * np.pi * n[k +1] * dz / wavelength), 0.],
[0., np.exp(-2j * np.pi * n[k +1] * dz / wavelength)]
])
for cpt in range(nb_adapt):
a = dp @ a
e = e / np.max(e)
return e
def give_potato(lz, n, wavelength):
m = np.identity(2)
for k in range(len(n) -1):
r = n[k] / n[k +1]
di = np.array([
[0.5 * (1 + r), 0.5 * (1 - r)],
[0.5 * (1 - r), 0.5 * (1 + r)]
])
m = di @ m
dp = np.array([
[np.exp(2j * np.pi * n[k +1] * lz[k + 1] / wavelength), 0.],
[0., np.exp(-2j * np.pi * n[k +1] * lz[k + 1] / wavelength)]
])
m = dp @ m
return m
\ No newline at end of file
......@@ -657,7 +657,7 @@ def structure_middle_contact(bypass_dbr = False,
def structure_alox(period = 10,
alox_thickness = 30e-9,
end_thickness = 35e-9,
end_thickness = 55e-9,
alox_mean_al = 0.98,
low_al = 0.9,
high_al = 1.,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment