import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import welch
plt.rcParams.update({'font.size': 22})

plt.interactive(True)

# ***** read u

data = np.genfromtxt("u_v_time_4nodes_re1000.dat",comments="%")


u1=data[:,0]   #v_1 at point 1
u2=data[:,2]   #v_1 at point 2
u3=data[:,4]   #v_1 at point 3
u4=data[:,6]   #v_1 at point 4

v1=data[:,1]   #w_1 at point 1
v2=data[:,3]   #w_1 at point 2
v3=data[:,5]   #w_1 at point 3
v4=data[:,7]   #w_1 at point 4


# time step
dt=8.177E-04;
t_tot=dt*len(u1)
t = np.linspace(0,t_tot,len(u1))

# %%%%%%%%%%%%%%%% plotting section %%%%%%%%%%%%%%%%%%%%%%%%%%
# plot u
fig1 = plt.figure("Figure 1")

plt.plot(t,u1,'b--')
plt.plot(t,u4,'r-')
plt.xlabel("t")
plt.ylabel("u")

plt.savefig('u_time_python.png')

####################### # zoom
fig2 = plt.figure("Figure 2")
plt.plot(t,u1,'b--')
plt.plot(t,u4,'r-')
plt.xlabel("t")
plt.ylabel("u")

plt.axis([6, 7, -2, 10])

plt.savefig('u_time_zoom_python.png')

