Commit 8f6a815d authored by Lucas Laplanche's avatar Lucas Laplanche
Browse files

bientôt le champ électromag

parent 44db9726
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (eam-vcsel)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (eam-vcsel)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.9 (eam-vcsel)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.8 (eam-vcsel)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
......@@ -507,46 +507,65 @@ def em_amplitude_smm(super_lattice, wavelength):
v_global = np.matmul(q_global, np.linalg.inv(eigen_g))
# initialize global scattering matrix
s_global = scattering_matrix_global()
s_global = np.array([scattering_matrix_global()])
# empty electromagnetic field
e = np.array([])
e = np.zeros(super_lattice.shape[0])
# empty matrices
eigen_i = np.array([])
v_i = np.array([])
# main loop through layers
# loop forward through layers
for i in tqdm(range(super_lattice.shape[0])):
# calculate parameters for layer i
k_zt_i = super_lattice.at[i, 'refractive_index']
l = super_lattice.at[i, 'thickness']
k_z_i = k_0 * k_zt_i
eigen_i = 1j * k_zt_i * np.identity(2)
eigen_i = np.append([eigen_i, 1j * k_zt_i * np.identity(2)])
q_i = np.array([[0., k_zt_i**2],
[-k_zt_i**2, 0.]])
v_i = np.matmul(q_i, np.linalg.inv(eigen_i))
v_i = np.append([v_i, np.matmul(q_i, np.linalg.inv(eigen_i[i]))])
x_i = expm(1j * k_z_i * l * np.identity(2))
# calculate scattering matrix for layer i
s_i = scattering_matrix_layer(v_i, v_global, x_i)
s_i = scattering_matrix_layer(v_i[i], v_global, x_i)
# update global scattering matrix
s_global = redheffer_star_product(s_global, s_i)
s_global = np.append(s_global, redheffer_star_product(s_global[i], s_i))
# w for external mode coefficients
wv_g = np.array([[np.identity(2)], [np.identity(2)],
[v_global], [-v_global]])
# loop backward through layers
for i in tqdm(range(super_lattice.shape[0])):
# iterator from n to 0
di = super_lattice.shape[0] -i -1
wv_i = np.array([[np.identity(2)], [np.identity(2)],
[v_i[di]], [-v_i[di]]])
el_i = np.array([[], [],
[], []])
# external mode coefficients
c_ip = np.invert(s_global[di][0][1]) @ (c_ref -s_global[i][0][0] * c_inc)
c_im = s_global[i][1][0] * c_inc +
mc_e = np.array([[c_ip],
[c_im]])
# compute reflection side scattering matrix
# s_reflection =
# internal mode coefficients
# compute transmission side scattering matrix
# s_transmission =
mc_i = np.invert(wv_i) @ wv_g @
# update global scattering matrix
# s_global = redheffer_star_product(s_reflection, s_global)
# s_global = redheffer_star_product(s_global, s_transmission)
# compute source
# compute reflected and transmitted fields
return e
......
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