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


nu=1./1000;
# node coordinates (cell center)
x = np.loadtxt("x.dat")

# node coordinates (cell center)
z = np.loadtxt("z.dat")

# node coordinates (cell center)
y_half = np.loadtxt("y_half.dat")
y=y_half

# face coordinates
yc= np.loadtxt("yc_half.dat")

ni=len(x)
nk=len(z)
nj=len(y_half)

# read u1 & transform u1 to a 3D array
uvw = sio.loadmat('u3d_re1000.mat')
tt=uvw['u3d']
u3d= np.reshape(tt,(ni,nj,nk))
uvw = sio.loadmat('v3d_re1000.mat')
tt=uvw['v3d']
v3d= np.reshape(tt,(ni,nj,nk))
uvw = sio.loadmat('w3d_re1000.mat')
tt=uvw['w3d']
w3d= np.reshape(tt,(ni,nj,nk))
uvw = sio.loadmat('p3d_re1000.mat')
tt=uvw['p3d']
p3d= np.reshape(tt,(ni,nj,nk))

# x coordinate direction = index i, first index
# y coordinate direction = index j, second index
# z coordinate direction = index k, third index

umean=np.mean(u3d, axis=(0,2))

####################### U
fig1 = plt.figure("Figure 1")
plt.plot(umean,y,'b-')
plt.ylabel("$y$")
plt.xlabel("$U^+$")

plt.axis([0, 25, 0, 1])

plt.savefig('umean_python.eps')


