import numpy as np
import matplotlib.pyplot as plt

Lx=120.0
Ly=40.0
X=np.linspace(0,3071,3072)
Y=np.linspace(0,1023,1024)
x=X/3072.0 * Lx -60
y=Y/1024.0 * Ly -20

data_B=[],[],[]
file_B='B_cycle'+str(13000)+'.vtk'
f_B=open(file_B)
lines_B=f_B.readlines()
f_B.close()
    
for line_B in lines_B[9:]:
    for i in enumerate(line_B.split()):
        data_B[i[0]].append(float(i[1]))
Bx_total,By_total,Bz_total=data_B
Bx=np.array(Bx_total).reshape(1024,3072)
By=np.array(By_total).reshape(1024,3072)
Bz=np.array(Bz_total).reshape(1024,3072)

fig=plt.figure()

ax=fig.add_subplot(111)
ax.set_ylabel('Y/di',fontsize=25)
ax.set_xlabel('X/di',fontsize=25)
picture=ax.contourf(x,y,Bz)
strmline=ax.streamplot(x,y,Bx,By,color=(0,0,0,0.7),linewidth=0.3,arrowstyle='-')

fig.savefig('Hall_magnetic_filed.jpg')
