pillar_x=pillar_x, pillar_y=pillar_y,
                        material_bkg=materials.materials_dict["Vacuum"],            # background
                        material_a=Si_110,                        # rib
                        material_b=materials.materials_dict["SiO2_2015_Van_Laer"],  # slab
                        material_c=materials.materials_dict["SiO2_2015_Van_Laer"],  # pillar
                        lc_bkg=1, lc_refine_1=800.0, lc_refine_2=500.0)

# Expected effective index of fundamental guided mode.
n_eff = wguide.material_a.n-0.1

# Calculate Electromagnetic Modes
sim_EM_pump = wguide.calc_EM_modes(num_modes_EM_pump, wl_nm, n_eff)
sim_EM_Stokes = mode_calcs.fwd_Stokes_modes(sim_EM_pump)

plotting.plot_mode_fields(sim_EM_pump, ivals=[EM_ival_pump],
                         xlim_min=0.4, xlim_max=0.4, ylim_min=0.4, ylim_max=0.2, 
                         EM_AC='EM_E', prefix_str=prefix_str, pdf_png='png')

# Print the wavevectors of EM modes.
print('k_z of EM modes \n', np.round(np.real(sim_EM_pump.Eig_values), 4))

# Calculate the EM effective index of the waveguide.
n_eff_sim = np.real(sim_EM_pump.Eig_values[0]*((wl_nm*1e-9)/(2.*np.pi)))

k_AC = 5
shift_Hz = 8e9

# Calculate Acoustic Modes
sim_AC = wguide.calc_AC_modes(num_modes_AC, k_AC, EM_sim=sim_EM_pump, shift_Hz=shift_Hz)

plotting.plot_mode_fields(sim_AC, EM_AC='AC', prefix_str=prefix_str, pdf_png='png')
Esempio n. 2
0
print("starting EM pump modes")
sim_EM_pump = wguide.calc_EM_modes(num_modes_EM_pump, wl_nm, n_eff=n_eff, debug=True)
#np.savez('wguide_data', sim_EM_pump=sim_EM_pump)
# npzfile = np.load('wguide_data.npz', allow_pickle=True)
# sim_EM_pump = npzfile['sim_EM_pump'].tolist()

print("starting EM Stokes modes")
sim_EM_Stokes = mode_calcs.fwd_Stokes_modes(sim_EM_pump)
# np.savez('wguide_data2', sim_EM_Stokes=sim_EM_Stokes)
# npzfile = np.load('wguide_data2.npz', allow_pickle=True)
# sim_EM_Stokes = npzfile['sim_EM_Stokes'].tolist()

print("starting EM field plotting ")
plotting.plot_mode_fields(sim_EM_pump, xlim_min=0.4, xlim_max=0.4, 
                         ivals=[EM_ival_pump,EM_ival_Stokes], 
                         ylim_min=0.435, ylim_max=0.435, EM_AC='EM_E', num_ticks=3,
                         prefix_str=prefix_str, pdf_png='png', ticks=True,
                         decorator=emdecorate, quiver_points=20, 
                         comps=('Ex','Ey', 'Ez','Eabs','Et'), n_points=2000, colorbar=True)

plotting.plot_mode_fields(sim_EM_pump, xlim_min=0.4, xlim_max=0.4, 
                         ivals=[EM_ival_pump,EM_ival_Stokes], 
                         ylim_min=0.435, ylim_max=0.435, EM_AC='EM_H', num_ticks=3,
                         prefix_str=prefix_str, pdf_png='png', ticks=True,
                         decorator=emdecorate, quiver_points=20, 
                         comps=('Hx','Hy', 'Hz','Habs','Ht'), n_points=2000, colorbar=True)

# Print the wavevectors of EM modes.
print('k_z of EM modes \n', np.round(np.real(sim_EM_pump.Eig_values), 4))

# Calculate the EM effective index of the waveguide.
n_eff_sim = np.real(sim_EM_pump.Eig_values*((wl_nm*1e-9)/(2.*np.pi)))
Esempio n. 3
0
# sys.exit("We interrupt your regularly scheduled computation to bring you something completely different... for now")

#calculate the EM modes for the Stokes
sim_EM_Stokes = mode_calcs.fwd_Stokes_modes(sim_EM_pump)

# Generate images for the EM modes involved in the calculation
# note: use EM_AC='EM_H' for magnetic H field
print("Plotting EM fields ")
plotting.plot_mode_fields(sim_EM_pump,
                          ivals=[EM_ival_pump],
                          EM_AC='EM_E',
                          num_ticks=3,
                          xlim_min=0.4,
                          xlim_max=0.4,
                          ylim_min=0.4,
                          ylim_max=0.4,
                          prefix_str=prefix_str,
                          pdf_png='png',
                          ticks=True,
                          quiver_points=40,
                          comps=['Et', 'Eabs'],
                          n_points=1000,
                          colorbar=True)

# Specify an acoustic wavevector that is sufficiently close to zero and print
k_AC = 5
print('\n AC wavenumber (1/m) = ', np.round(k_AC, 4))

# Calculate Acoustic Modes
sim_AC = wguide.calc_AC_modes(num_modes_AC, k_AC, EM_sim=sim_EM_pump)
# which specify the fraction of the axis to remove from the plot.
# For instance xlim_min=0.4 will remove 40% of the x axis from the left outer edge
# to the center. xlim_max=0.4 will remove 40% from the right outer edge towards the center.
# This leaves just the inner 20% of the unit cell displayed in the plot.
# The ylim variables perform the equivalent actions on the y axis.

# Let's plot fields for only the fundamental (ival = 0) mode.
#decorator=plotting.Decorator()
#decorator.set_multiplot_axes_property('subplots_wspace',.4)

plotting.plot_mode_fields(sim_EM_pump,
                          xlim_min=0.4,
                          xlim_max=0.4,
                          ylim_min=0.4,
                          ylim_max=0.4,
                          ivals=[EM_ival_pump],
                          contours=True,
                          EM_AC='EM_E',
                          prefix_str=prefix_str,
                          ticks=True,
                          comps=['Ex', 'Ey', 'Ez', 'Et'])

#Repeat this plot in pdf output format
plotting.plot_mode_fields(sim_EM_pump,
                          xlim_min=0.4,
                          xlim_max=0.4,
                          ylim_min=0.4,
                          ylim_max=0.4,
                          ivals=[EM_ival_pump],
                          contours=True,
                          EM_AC='EM_E',
# Expected effective index of fundamental guided mode.
n_eff = wguide.material_a.n-0.1

# Calculate the Electromagnetic modes of the pump field.
if not reuse_fields:
  sim_EM_pump = wguide.calc_EM_modes(num_modes_EM_pump, wl_nm, n_eff)
  np.savez('wguide_data', sim_EM_pump=sim_EM_pump)
else:
  npzfile = np.load('wguide_data.npz', allow_pickle=True)
  sim_EM_pump = npzfile['sim_EM_pump'].tolist()

sim_EM_pump.analyse_symmetries(PointGroup.C2V)
sim_EM_pump.set_r0_offset(3.0e-6, -2.250e-6)

plotting.plot_mode_fields(sim_EM_pump, xlim_min=0.2, xlim_max=0.2, ivals=[EM_ival_pump], 
                         ylim_min=0.2, ylim_max=0.2, EM_AC='EM_E', num_ticks=3, ticks=True,
                         prefix_str=prefix_str)

if not reuse_fields:
  sim_EM_Stokes = mode_calcs.bkwd_Stokes_modes(sim_EM_pump)
  np.savez('wguide_data2', sim_EM_Stokes=sim_EM_Stokes)
else:
  npzfile = np.load('wguide_data2.npz', allow_pickle=True)
  sim_EM_Stokes = npzfile['sim_EM_Stokes'].tolist()

# Print the wavevectors of EM modes.
v_kz=sim_EM_pump.kz_EM_all()
print('\n k_z of EM modes [1/m]:')
for (i, kz) in enumerate(v_kz): print('{0:3d}  {1:.4e}'.format(i, np.real(kz)))

                        material_a=Si_110,
                        material_b=Si_110, symmetry_flag=False,
                        lc_bkg=1, lc_refine_1=2000.0, lc_refine_2=1000.0)
# Expected effective index of fundamental guided mode.
n_eff = wguide.material_a.n-0.1

# Calculate Electromagnetic Modes
sim_EM_pump = wguide.calc_EM_modes(num_modes_EM_pump, wl_nm, n_eff=n_eff)
# np.savez('wguide_data', sim_EM_pump=sim_EM_pump)
# npzfile = np.load('wguide_data.npz')
# sim_EM_pump = npzfile['sim_EM_pump'].tolist()

sim_EM_Stokes = mode_calcs.fwd_Stokes_modes(sim_EM_pump)

plotting.plot_mode_fields(sim_EM_pump, xlim_min=0.4, xlim_max=0.4, ivals=[EM_ival_pump], 
                         ylim_min=0.3, ylim_max=0.3, EM_AC='EM_E', num_ticks=3,
                         prefix_str=prefix_str, pdf_png='png')

# Print the wavevectors of EM modes.
print('k_z of EM modes \n', np.round(np.real(sim_EM_pump.Eig_values), 4))

# Calculate the EM effective index of the waveguide.
n_eff_sim = np.real(sim_EM_pump.Eig_values*((wl_nm*1e-9)/(2.*np.pi)))
print("n_eff = ", np.round(n_eff_sim, 4))

k_AC = 5

shift_Hz = 2e9

# Calculate Acoustic Modes
sim_AC = wguide.calc_AC_modes(num_modes_AC, k_AC, EM_sim=sim_EM_pump, shift_Hz=shift_Hz)
  sim_EM_Stokes = npzfile['sim_EM_Stokes'].tolist()

# Display the wavevectors of EM modes.
v_kz=sim_EM_pump.kz_EM_all()
print('\n k_z of EM modes [1/m]:')
for (i, kz) in enumerate(v_kz): print('{0:3d}  {1:.4e}'.format(i, np.real(kz)))

# Calculate the EM effective index of the waveguide.
n_eff_sim = np.real(sim_EM_pump.neff(0))
print("n_eff", np.round(n_eff_sim, 4))

# # Plot the E fields of the EM modes fields - specified with EM_AC='EM_E'.
# # Zoom in on the central region (of big unitcell) with xlim_, ylim_ args.
# # Only plot fields of fundamental (ival = 0) mode.
plotting.plot_mode_fields(sim_EM_pump, xlim_min=0.3, xlim_max=0.3, ylim_min=0.3,
                         ylim_max=0.3, ivals=[0], contours=True, EM_AC='EM_E', 
                         prefix_str=prefix_str, ticks=True, quiver_points=20, comps=['Et'])

plotting.plot_mode_fields(sim_EM_pump, xlim_min=0.3, xlim_max=0.3, ylim_min=0.3,
                         ylim_max=0.3, ivals=[0], contours=True, EM_AC='EM_H', 
                         prefix_str=prefix_str, ticks=True, quiver_points=20, comps=['Ht'])

# Acoustic wavevector
k_AC = np.real(sim_EM_pump.kz_EM(EM_ival_pump) - sim_EM_Stokes.kz_EM(EM_ival_Stokes))

# Calculate Acoustic modes.
if new_calcs:
  sim_AC = wguide.calc_AC_modes(num_modes_AC, k_AC, EM_sim=sim_EM_pump)
  np.savez('wguide_data_AC', sim_AC=sim_AC)
else:
  npzfile = np.load('wguide_data_AC.npz', allow_pickle=True)
Esempio n. 8
0
if doem:
  # Calculate Electromagnetic Modes
  if new_calcs:
    sim_EM_pump = wguide.calc_EM_modes(num_modes_EM_pump, wl_nm, n_eff=n_eff)
    np.savez(prefix_str+'wguide_data', sim_EM_pump=sim_EM_pump)
  else:
    npzfile = np.load(prefix_str+'wguide_data.npz', allow_pickle=True)
    sim_EM_pump = npzfile['sim_EM_pump'].tolist()
  
  sim_EM_Stokes = mode_calcs.fwd_Stokes_modes(sim_EM_pump)
  np.savez(prefix_str+'wguide_data2', sim_EM_Stokes=sim_EM_Stokes)
  #npzfile = np.load(prefix_str+'wguide_data2.npz', allow_pickle=True)
  #sim_EM_Stokes = npzfile['sim_EM_Stokes'].tolist()
  
  plotting.plot_mode_fields(sim_EM_pump, xlim_min=0.43, xlim_max=0.43, ivals=[EM_ival_pump], 
                           ylim_min=0.43, ylim_max=0.43, EM_AC='EM_E', 
                           n_points=2000, quiver_points=10, prefix_str=prefix_str, pdf_png='png', 
                           ticks=True, comps=('Ex', 'Eabs', 'Et'), decorator=emdecorate)
  
  # Print the wavevectors of EM modes.
  print('k_z of EM modes \n', np.round(np.real(sim_EM_pump.Eig_values), 4))
  
  # Calculate the EM effective index of the waveguide.
  n_eff_sim = np.real(sim_EM_pump.Eig_values*((wl_nm*1e-9)/(2.*np.pi)))
  print("n_eff = ", np.round(n_eff_sim, 4))
  

if doac:
  k_AC = 5 # close but not quite zero
  
  # Calculate Acoustic Modes
  if new_calcs:
Esempio n. 9
0
# Expected effective index of fundamental guided mode.
n_eff = wguide.material_a.n-0.1

# Calculate Electromagnetic Modes
sim_EM_pump = wguide.calc_EM_modes(num_modes_EM_pump, wl_nm, n_eff=n_eff)
# np.savez('wguide_data', sim_EM_pump=sim_EM_pump)
# npzfile = np.load('wguide_data.npz')
# sim_EM_pump = npzfile['sim_EM_pump'].tolist()

sim_EM_Stokes = mode_calcs.fwd_Stokes_modes(sim_EM_pump)
# np.savez('wguide_data2', sim_EM_Stokes=sim_EM_Stokes)
# npzfile = np.load('wguide_data2.npz')
# sim_EM_Stokes = npzfile['sim_EM_Stokes'].tolist()

plotting.plot_mode_fields(sim_EM_pump, xlim_min=0.45, xlim_max=0.45, 
                         ivals=[EM_ival_pump], ylim_min=0.45, ylim_max=0.45, 
                         EM_AC='EM_E', n_points=1500, 
                         prefix_str=prefix_str, pdf_png='png')

# Print the wavevectors of EM modes.
print('k_z of EM modes \n', np.round(np.real(sim_EM_pump.Eig_values), 4))

# Calculate the EM effective index of the waveguide.
n_eff_sim = np.real(sim_EM_pump.Eig_values*((wl_nm*1e-9)/(2.*np.pi)))
print("n_eff = ", np.round(n_eff_sim, 4))

k_AC = 5 # close but not quite zero

# Calculate Acoustic Modes
sim_AC = wguide.calc_AC_modes(num_modes_AC, k_AC, EM_sim=sim_EM_pump)
# np.savez('wguide_data_AC', sim_AC=sim_AC)
# npzfile = np.load('wguide_data_AC.npz')
    if new_calcs:
        sim_EM_pump = wguide.calc_EM_modes(num_modes_EM_pump,
                                           wl_nm,
                                           n_eff=n_eff)
        np.savez('wguide_data_florez', sim_EM_pump=sim_EM_pump)
    else:
        npzfile = np.load('wguide_data_florez.npz', allow_pickle=True)
        sim_EM_pump = npzfile['sim_EM_pump'].tolist()
    sim_EM_Stokes = mode_calcs.bkwd_Stokes_modes(sim_EM_pump)

    plotting.plot_mode_fields(sim_EM_pump,
                              xlim_min=0.3,
                              xlim_max=0.3,
                              ivals=[EM_ival_pump],
                              ylim_min=0.3,
                              ylim_max=0.3,
                              EM_AC='EM_E',
                              prefix_str=prefix_str,
                              pdf_png='png',
                              ticks=True,
                              decorator=emdecorate,
                              quiver_points=20)

    # Print the wavevectors of EM modes.
    print('k_z of EM modes \n', np.round(np.real(sim_EM_pump.Eig_values), 4))

    # Calculate the EM effective index of the waveguide.
    n_eff_sim = np.real(sim_EM_pump.Eig_values * ((wl_nm * 1e-9) /
                                                  (2. * np.pi)))
    print("n_eff = ", np.round(n_eff_sim, 4))

if not doac: sys.exit(0)