sources.py 文件源码

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

项目:rswarp 作者: radiasoft 项目源码 文件源码
def compute_crossing_fraction(cathode_temp, phi, zmesh):
    """
    Returns the % of particles expected to cross the gap

    Arguments:
        cathode_temp    (float) : cathode temperature in K
        phi             (scipy) : Interpolation (scipy.interpolate.interpolate.interp1d) of Phi from initial solve
        zmesh          (ndArray) : 1D array with positions of the z-coordinates of the grid

    Returns:
        e_frac          (float) : fraction of beam that overcomes the peak potential barrier phi
    """ 

    # Conditions at cathode edge
    var_xy = kb_J*cathode_temp/m  # Define the variance of the distribution in the x,y planes
    var_z = 2*kb_J*cathode_temp/m  # Variance in z plane is twice that in the horizontal

    #Phi is in eV
    vz_phi = np.sqrt(2.*e*np.max(phi(zmesh))/m_e) 

    #cumulative distribution function for a Maxwellian
    CDF_Maxwell = lambda v, a: erf(v/(np.sqrt(2)*a)) - np.sqrt(2./np.pi)*v*np.exp(-1.*v**2/(2.*a**2))/a

    e_frac = CDF_Maxwell(vz_phi,np.sqrt(var_z)) #fraction with velocity below vz_phi

    return (1.-e_frac)*100. #Multiply by 100 to get % value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号