).dx( 5e-9 ).frequency( # 1.5e14 6e14 ).save_attrs() plane.rectangle_e(center=[151,351], xlen=70, ylen=710, value=8.9) plane.rectangle_e(center=[151,351], xlen=70, ylen=8, value=1) plane.rectangle_e(center=[126,251], xlen=20, ylen=8, value=1) plane.rectangle_e(center=[126,451], xlen=20, ylen=8, value=1) plane.rectangle_e(center=[126,151], xlen=20, ylen=8, value=1) plane.rectangle_e(center=[126,551], xlen=20, ylen=8, value=1) metal = PolarDPlane(plane.shape, a=(1.757*10**16)**2, b=0, c=3.0786*10**14, d=1, dt=plane.dt()).set_factor() metal.rectangle(center=[151,351], xlen=70, ylen=710, value=1) metal.rectangle(center=[151,351], xlen=70, ylen=8, value=0) metal.rectangle(center=[126,251], xlen=20, ylen=8, value=0) metal.rectangle(center=[126,451], xlen=20, ylen=8, value=0) metal.rectangle(center=[126,151], xlen=20, ylen=8, value=0) metal.rectangle(center=[126,551], xlen=20, ylen=8, value=0) dt = plane.dt() freq = plane.frequency() for t in range(0,7000): stdout.write("\b\b\b\b%d"%t) plane.t = t plane.teinc.update(cos(2*pi*freq*t*dt)*gaussian(t*dt, 800*dt, 150*dt))#.plot_e("result/grating-slit/teinc/teinc-%.4d.png"%t)
length = 201 deltax = 10**(-9) deltat = deltax/(2*c) freq = 5*10**14 plane = DispersivePlane(YTFSFPlane(UPMLPlane(PBCPlane(Plane((length,length)))))) plane.pbcy = False plane.pmlx = False plane.pml_thick = 20 plane.set_pml() plane.tminc.enter = 2 plane.xtfsf = [None, None] plane.ytfsf = [25,176] # metal = PolarDPlane(plane.shape, a=(1.25663*10**16)**2, b=0, c=5.7*10**13, d=1, dt=deltat) metal = PolarDPlane(plane.shape, a=(9.39*10**15)**2, b=0, c=3.14*10**13, d=1, dt=deltat) metal.set_factor() metal.mask[:,50:80] = 1 for t in range(0,3000): print t plane.tminc.update(sin(2*pi*freq*t*deltat)) # print plane.tminc.inspect() plane.update_hpbc() plane.update_dfield().update_dtfsf() metal.update(plane) plane.update_efield(metal) plane.update_epbc() plane.update_bfield().update_btfsf()
deltax = 10**-9 deltat = deltax/(2*c) freq = 5*10**14 plane = DispersivePlane(YTFSFPlane(UPMLPlane(PBCPlane(Plane((length,length)))))) plane.pbcx = False plane.pbcy = False # plane.pmly = False plane.pml_thick = 10 plane.set_pml() plane.tminc.enter = 2 plane.xtfsf = [50,251] plane.ytfsf = [50,251] metal = PolarDPlane(plane.shape, a=(9.39*10**15)**2, b=0, c=3.14*10**13, d=1, dt=deltat) metal.set_factor() circle(metal.mask, [121,151], 25, 1) circle(metal.mask, [181,151], 25, 1) for t in range(0,2000): plane.tminc.update(sin(2*pi*freq*t*deltat)) plane.update_hpbc() plane.update_dfield().update_dtfsf() metal.update(plane) plane.update_efield(metal) plane.update_epbc() plane.update_bfield().update_btfsf() plane.update_hfield()
) plane.pbc( x = False, y = True ) plane.tfsf( xtfsf = [50, length-50], ytfsf = [50, length-50], enter = 2 ) plane.circle_e([151,151], 25, 8.926) plane.open("result/%s/%s.hdf5" % (plane.name, plane.name)) plane.wavelength(347.5*10**-9).dx(10**-9).save_attrs() # metal = PolarDPlane(plane.shape, a=(9.39*10**15)**2, b=0, c=3.14*10**13, d=1, dt=plane.attrs["dt"]) metal = PolarDPlane(plane.shape, a=(1.757*10**16)**2, b=0, c=3.0786*10**14, d=1, dt=plane.attrs["dt"]) metal.set_factor() metal.circle([151,151], 25) prepare("result/%s/ex" % plane.name) prepare("result/%s/ey" % plane.name) prepare("result/%s/hz" % plane.name) for t in range(0,4500): plane.t = t plane.teinc.update(sin(2*pi*plane.attrs["frequency"]*t*plane.attrs["dt"])) plane.update_hpbc() plane.update_dfield().update_dtfsf() metal.update(plane) plane.update_efield(metal)