def test_faraday_rotation(self): L, zsrc, zout = 12.0, -4.5, 4.0 freq, tmax = 0.8, 100.0 resolution = 24 ## Test gyrotropic Lorentzian medium epsn, f0, gamma, sn, b0 = 1.5, 1.0, 1e-3, 0.1, 0.15 susc = [mp.GyrotropicLorentzianSusceptibility(frequency=f0, gamma=gamma, sigma=sn, bias=mp.Vector3(0, 0, b0))] mat = mp.Medium(epsilon=epsn, mu=1, E_susceptibilities=susc) k = kgyro_lorentzian(freq, epsn, f0, gamma, sn, b0) print('=' * 24) print("Testing Faraday rotation for gyrotropic Lorentzian model...") self.check_rotation(mat, L, freq, zsrc, resolution, tmax, zout, k) ## Test gyrotropic Drude medium susc = [mp.GyrotropicDrudeSusceptibility(frequency=f0, gamma=gamma, sigma=sn, bias=mp.Vector3(0, 0, b0))] mat = mp.Medium(epsilon=epsn, mu=1, E_susceptibilities=susc) k = kgyro_drude(freq, epsn, f0, gamma, sn, b0) print('=' * 24) print("Testing Faraday rotation for gyrotropic Drude model...") self.check_rotation(mat, L, freq, zsrc, resolution, tmax, zout, k) ## Test Landau-Lifshitz-Gilbert medium alpha = 1e-5 susc = [mp.GyrotropicSaturatedSusceptibility(frequency=f0, gamma=gamma, sigma=sn, alpha=alpha, bias=mp.Vector3(0, 0, 1.0))] mat = mp.Medium(epsilon=epsn, mu=1, E_susceptibilities=susc) k = kgyro_llg(freq, epsn, f0, gamma, sn, alpha) print('=' * 24) print("Testing Faraday rotation for Landau-Lifshitz-Gilbert model...") self.check_rotation(mat, L, freq, zsrc, resolution, tmax, zout, k)
cell = mp.Vector3(sx,sy,0) dpml=0.5 pml_layers=[mp.PML(dpml)] vertwaveguide=mp.Block(size=mp.Vector3(4,sy,0), center=mp.Vector3(0,0,0)) metal1=mp.Block(size=mp.Vector3(sx/2-2,sy,0), center=mp.Vector3(-((sx/2-2)/2+2), 0,0), material=mp.metal) metal2=mp.Block(size=mp.Vector3(sx/2-2,sy,0), center=mp.Vector3((sx/2-2)/2+2, 0,0), material=mp.metal) metal3=mp.Block(size=mp.Vector3(sx,3,0),center=mp.Vector3(0,sy/2-1.5,0), material=mp.metal) horizwaveguide=mp.Block(size=mp.Vector3(sx,4,0), center=mp.Vector3(0,sy/2-5,0)) mu_r=2.8 f0, gamma, sn, b0 = 6 , 35e-3/(2*np.pi), 1, 10 fcen, df, alpha= 6.68, 8.268, 0.22 susc=[mp.GyrotropicSaturatedSusceptibility(frequency=f0, gamma=gamma, sigma=sn, alpha=alpha, bias=mp.Vector3(0,0,b0))] mat=mp.Medium(epsilon=1, mu=mu_r, H_susceptibilities=susc) #gyro=mp.Cylinder(radius=1, material=mat, center=mp.Vector3(0,sy/2-5,0)) sourcelocation=-6 #beam_x0, beam_kdir, beam_w0, beam_E0 = mp.Vector3(0,sourcelocation,0), mp.Vector3(0,1,0), 1e-15, mp.Vector3(1,0,0) source=mp.Source(mp.GaussianSource(frequency=fcen,width=1/fcen), center=mp.Vector3(0,sourcelocation, 0), component=mp.Hz, size=mp.Vector3(1,0,0)) geometry=[vertwaveguide, metal1,metal2,metal3, horizwaveguide] sim=mp.Simulation(cell_size=cell, boundary_layers=pml_layers, geometry=geometry, sources=[source], resolution=resolution ) nfreq=100 infrontofsrc_fr=mp.FluxRegion(center=mp.Vector3(0, sourcelocation+0.5,0), size=mp.Vector3(4*2,0,0)) infrontofsrc=sim.add_flux(fcen, df, nfreq, infrontofsrc_fr)