_20151005_AnalysisFunctions.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:TurbPlasma 作者: tulasinandan 项目源码 文件源码
def tfps(beta=0.6, ca=1., de2=0.000545, theta=0., kk=1.):
   """
      beta: Total plasma beta,
      ca: Alfven speed based on mean field, 
      de2: me/mi, 
      theta: Angle of propagation as fraction of pi/2), 
      kk: Wavenumber of interest in units of kdi

      Output is frequencies of the roots and the phase speeds w/k
      The roots are w[0]:Fast/Whistler, w[1]:Alfven/KAW, w[2]: Slow/Cyclotron
   """
#  theta=float(raw_input("Angle of propagation as fraction of pi/2: ")) 
#  kk=float(raw_input("What k value? "))
#  ca = float(raw_input("Alfven Speed: "))
#  beta=float(raw_input("Total plasma beta?: "))
#  de2= float(raw_input("me/mi : "))

   ct = cos(theta*pi/2)
   st = sin(theta*pi/2)
   tt = st/ct
   cs=sqrt(beta/2.)*ca
   di =1.
   caksq=cos(theta*pi/2.)**2*ca**2
   cmsq=ca**2 + cs**2

   pcs=np.zeros(4)
   D = 1 + kk**2*de2
   # Find out the root of the quadratic dispersion relation
   pcs[0] = 1.
   pcs[1] = -(ca**2/D + cs**2 + caksq*(1+kk**2*di**2/D)/D)*kk**2
   pcs[2] = caksq*kk**4*(ca**2/D + cs**2 + cs**2*(1+kk**2*di**2/D))/D
   pcs[3] = -(cs**2*kk**6*caksq**2)/D**2
   w2 = np.roots(pcs); w = sqrt(w2)
   speeds= w/kk
   return w,speeds
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号