sphereElectrostatic_example.py 文件源码

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

项目:em_examples 作者: geoscixyz 项目源码 文件源码
def Plot_ChargesDensity(XYZ, sig0, sig1, R, E0, ax):

    xr, yr, zr = np.unique(XYZ[:, 0]), np.unique(XYZ[:, 1]), np.unique(XYZ[:, 2])
    xcirc = xr[np.abs(xr) <= R]

    Et, Ep, Es = get_ElectricField(XYZ, sig0, sig1, R, E0)
    rho = get_ChargesDensity(XYZ, sig0, sig1, R, Et, Ep)

    ax.set_xlim([xr.min(), xr.max()])
    ax.set_ylim([yr.min(), yr.max()])
    ax.set_aspect('equal')
    Cplot = ax.pcolor(xr, yr, rho.reshape(xr.size, yr.size))
    cb1 = plt.colorbar(Cplot, ax=ax)
    cb1.set_label(label= 'Charge Density ($C/m^2$)', size=ftsize_label) #weight='bold')
    cb1.ax.tick_params(labelsize=ftsize_axis)
    ax.plot(xcirc, np.sqrt(R**2-xcirc**2), '--k', xcirc, -np.sqrt(R**2-xcirc**2), '--k')
    ax.set_ylabel('Y coordinate ($m$)', fontsize=ftsize_label)
    ax.set_xlabel('X coordinate ($m$)', fontsize=ftsize_label)
    ax.tick_params(labelsize=ftsize_axis)
    ax.set_title('Charges Density', fontsize=ftsize_title)

    return ax
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号