Commit 3ce1432be43d0624dce01ca82b665fa1335623f3

put source at center
  
1010# program start
1111
1212new_efield = grid.Plane(shape=(301,301), timestep=1, spacestep=2*3*10**8)
13new_efield.eps[180:,0:] *= 2
1314new_hfield = grid.Plane(shape=(301,301), timestep=1, spacestep=2*3*10**8)
15new_hfield.eps[180:,0:] *= 2
1416
1517
16for step in range(1,30):
17 new_efield.y[151,151] += float(mpmath.sin(step*mpmath.pi/6.125))*2
18for step in range(1,600):
19 new_efield.y[150,150] += float(mpmath.sin(step*mpmath.pi/6.125))*2
1820 new_efield = update_efield( new_efield, new_hfield )
19 new_hfield.z[151,151] += float(mpmath.sin(step*mpmath.pi/6.125))*2
21 new_hfield.z[150,150] += float(mpmath.sin(step*mpmath.pi/6.125))*2
2022 new_hfield = update_hfield( new_efield, new_hfield )
2123
2224
3030 pylab.imshow( h, interpolation="quadric", norm=matplotlib.colors.Normalize(-0.3,0.3,True) )
3131 pylab.colorbar()
3232 pylab.grid(True)
33 pylab.savefig("result/fdtd_plane-%s.png" % str(step))
33 pylab.savefig("result/fdtd_plane-%.3d.png" % step)
3434 pylab.clf()
3535
36 d = numpy.array(new_hfield.z[0:,151], dtype="float")
37 print d[140:159]
36 d = numpy.array(new_hfield.z[0:,150], dtype="float")
37
3838 for i in xrange(1,len(d)-1):
3939 if i%2==0:
4040 d[i] = ( d[i-1] + d[i+1] ) / 2
41 print d[140:159]
41
4242 pylab.plot( d )
4343 pylab.ylim((-0.3,0.3))
4444 pylab.grid(True)