[关闭]
@SuperMan 2016-06-17T02:37:45.000000Z 字数 3203 阅读 812

计算物理第十四次作业

作者:夏海峰 学号:2013301020094

用数值计算的方法模拟计算,并可视化波的传播

摘要

背景介绍:

(1)什么是波:

  • 机械波:机械波(Mechanical wave)是机械振动在空间中的传播,是波的一种。机械波的特点是必须通过介质来传播。另外有一些波,比如电磁波,引力波,不通过介质,而是在真空中传播(严格的讲,是通过场来传播),它们不是机械波。
  • 电磁波:电磁波,是由同相且互相垂直的电场与磁场在空间中衍生发射的震荡粒子波,是以波动的形式传播的电磁场,具有波粒二象性。电磁波是由同相振荡且互相垂直的电场与磁场在空间中以波的形式移动,其传播方向垂直于电场种电磁波在真空中速率固定,速度为光速。见麦克斯韦方程组。 电磁波伴随的电场方向,磁场方向,传播方向三者互相垂直,因此电磁波是横波。当其能阶跃迁过辐射临界点,便以光的形式向外辐射,此阶段波体为光子,太阳光是电磁波的一种可见的辐射形态,电磁波不依靠介质传播,在真空中的传播速度等同于光速。电磁辐射由低频率率到高频率,主要分为:无线电波、微波、红外线、可见光、紫外线、X射线和伽马射线。人眼可接收到的电磁波,称为可见光(波长380~780nm)。电磁辐射量与温度有关,通常高于绝对零度的物质或粒子都有电磁辐射,温度越高辐射量越大,但大多不能被肉眼观察到。 频率是电磁波的重要特性。按照频率的顺序把这些电磁波排列起来,就是电磁波谱。

(2)波的性质:

  • 叠加性原理:
    如果有两列以上的同类波在空间相遇,在共存的空间内,总的波是各个分波的矢量和(即相加时不仅考虑振幅,还考虑相位),而各个分波相互并不影响,分开后仍然保持各自的性质不变。叠加性的依据是,(线性)波的方程的几个解之和仍然是这个方程的解;这个原理称叠加原理。

解决波动问题的基本方法

  • 波动方程:
  • 着重研究弦上的波的传播问题:
    假设弦只会产生较小的位移,因此角度 是小量,因此,可以将弦的运动写为:

    利用近似:

    可以得到:

    做数值计算时,将横坐标划分为若干个点,做数值计算。



    y因此有如下关系式:

    因为\Delta t已知,且为定值,所以上式可化为:

    位于两端(,
  • "Gaussian pluck":

具体问题

  • 作业6.6
    An important feature Of a linear equation is that the sum of two solutions is also a solution. 0ne consequence Of this is that two wavepackets will travel independently Of cach other. An especially clear way to demonstrate this is to set up a string with an initial profile such that there are two Gaussian wavepackets located at different places at the string. These wavepackets (or components of them) may then propagate toward each other and collide. Show that the wavepackets are unaffected by these collisions. That is, show that two such wavepackets pass through each other without changing shape or speed.
    程序
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. from matplotlib import animation
  4. c=1
  5. l=1
  6. dt=1e-2
  7. dx=1e-2
  8. x0=0.3
  9. x1=l-x0
  10. r=c*dt/dx
  11. k=1000
  12. t=30
  13. N=int(t/dt)
  14. n=int(l/dx)+1
  15. class wave(object):
  16. """docstring for wave"""
  17. def __init__(self):
  18. self.x=np.linspace(0,1,n)
  19. self.y0=np.exp(-k*(self.x-x0)**2)+np.exp(-k*(self.x-x1)**2)
  20. self.y=[self.y0]
  21. self.temp_y=np.linspace(0,0,n)
  22. for j in range(n-2):
  23. self.temp_y[j+1]=2*(1-r**2)*self.y0[j+1]-self.y0[j+1]+r**2*(self.y0[j+2]+self.y0[j])
  24. self.y.append(self.temp_y)
  25. #print self.y0
  26. def update(self):
  27. self.new_y=np.linspace(0,0,n)
  28. for j in range(n-2):
  29. self.new_y[j+1]=2*(1-r**2)*self.y[-1][j+1]-self.y[-2][j+1]+r**2*(self.y[-1][j+2]+self.y[-1][j])
  30. def fire(self):
  31. while (len(self.y)<=(N+1)):
  32. self.update()
  33. self.y.append(self.new_y)
  34. Har=wave()
  35. Har.fire()
  36. print Har.y[1]
  37. fig = plt.figure(figsize=(6,6))
  38. ax = plt.axes(xlim=(0, l), ylim=(-1.5, 1.5))
  39. line, = ax.plot([], [], lw=2)
  40. def init():
  41. line.set_data([], [])
  42. return line,
  43. def animate(i):
  44. x = Har.x
  45. y = Har.y[i]
  46. line.set_data(list(x), list(y))
  47. return line,
  48. anim=animation.FuncAnimation(fig, animate, init_func=init, frames=100, interval=25)
  49. plt.show()

动态图像展示:
photo

结论

  • 波在传播过程中满足叠加性原理。
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注