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) plane.update_dfield().update_dtfsf() metal.update(plane) plane.update_efield(metal).update_epbc() plane.update_bfield().update_btfsf() plane.update_hfield().update_hpbc() plane.imshow_hz("result/grating-slit/hz/grating-slit-%.4d.png"%t) plane.save()
deltax = 10 ** -9 deltat = deltax / (2 * c) freq = 6 * 10 ** 15 plane = DispersivePlane(XTFSFPlane(UPMLPlane(PBCPlane(Plane((length, length)))))) plane.pbcx = False plane.pbcy = False # plane.pmly = False plane.pml_thick = 13 plane.set_pml() plane.teinc.enter = 2 plane.ytfsf = [25, 176] plane.xtfsf = [25, 176] for t in range(0, 300): plane.teinc.update(sin(2 * pi * freq * t * deltat)) plane.update_hpbc() plane.update_dfield().update_dtfsf() plane.update_efield() plane.update_epbc() plane.update_bfield().update_btfsf() plane.update_hfield() hdf5.require_group("timeline/" + str(t)) hdf5["timeline"][str(t)]["ez"] = plane.hzfield print t hdf5.close()