Indices = np.flipud(
    np.argsort(SIGMA_M))  # find indices for sorting in decreasing order
Sorted_Sigmas = SIGMA_M[Indices]  # Sort all the sigmas
Phi_M = PHI_M[:, Indices]  # Sorted Spatial Structures Matrix
Psi_M = Psi_M[:, Indices]  # Sorted Temporal Structures Matrix
Sigma_M = Sorted_Sigmas  # Sorted Amplitude Matrix

# Show some exemplary modes for mPOD.

for j in range(1, 6):
    plt.close(fig='all')
    fig, ax3 = plt.subplots(figsize=(5, 7))
    ax = plt.subplot(2, 1, 1)
    V_X = Phi_M[0:nxny, j - 1]
    V_Y = Phi_M[nxny::, j - 1]
    Plot_Field(X_S, Y_S, V_X, V_Y, True, 2, 0.8)
    ax.set_aspect('equal')  # Set equal aspect ratio
    ax.set_xticks(np.arange(0, 40, 10))
    ax.set_yticks(np.arange(10, 30, 5))
    ax.set_xlim([0, 35])
    ax.set_ylim([10, 29])
    ax.invert_yaxis()  # Invert Axis for plotting purpose
    String_y = '$\phi_{\mathcal{P}' + str(j) + '}$'
    plt.title(String_y, fontsize=18)
    # plt.tight_layout(pad=1, w_pad=0.5, h_pad=1.0)

    ax = plt.subplot(2, 1, 2)
    Signal = Psi_M[:, j - 1]
    s_h = np.abs((np.fft.fft(Signal - Signal.mean())))
    Freqs = np.fft.fftfreq(int(n_t)) * Fs
    plt.plot(Freqs * (4 / 1000) / 6.5, s_h, '-', linewidth=1.5)
Exemplo n.º 2
0
# Save as numpy array all the data
np.savez('Data',D=D,t=t,dt=dt,n_t=n_t,\
         Xg=Xg,Yg=Yg,X_S=X_S,Y_S=Y_S)


# For a stationary test case like this, you might want to remove the mean  
D_MEAN=np.mean(D,1) # Temporal average (along the columns)
D_Mr=D-np.array([D_MEAN,]*n_t).transpose() # Mean Removed

# Check the mean flow
nxny=int(nxny)
V_X_m=D_MEAN[0:nxny]
V_Y_m=D_MEAN[nxny::]
fig, ax = plt.subplots(figsize=(8, 5)) # This creates the figure
# Put both components as fields in the grid
_,_,Vxg,Vyg,Magn=Plot_Field(X_S,Y_S,V_X_m,V_Y_m,True,2,None)
ax.set_aspect('equal') # Set equal aspect ratio
ax.set_xlabel('$x[mm]$',fontsize=16)
ax.set_ylabel('$y[mm]$',fontsize=16)
ax.set_title('Mean Velocity Field via TR-PIV',fontsize=18)
ax.set_xticks(np.arange(0,40,10))
ax.set_yticks(np.arange(10,30,5))
ax.set_xlim([0,35])
ax.set_ylim([10,29])
ax.invert_yaxis() # Invert Axis for plotting purpose
 
NameOUT='Mean_FLOW.png'
plt.savefig(NameOUT, dpi=100)   


Exemplo n.º 3
0
Indices = np.flipud(
    np.argsort(SIGMA_M))  # find indices for sorting in decreasing order
Sorted_Sigmas = SIGMA_M[Indices]  # Sort all the sigmas
Phi_M = PHI_M[:, Indices]  # Sorted Spatial Structures Matrix
Psi_M = Psi_M[:, Indices]  # Sorted Temporal Structures Matrix
Sigma_M = Sorted_Sigmas  # Sorted Amplitude Matrix

# Show some exemplary modes for mPOD.

for j in range(1, 12):
    plt.close(fig='all')
    fig, ax3 = plt.subplots(figsize=(5, 7))
    ax = plt.subplot(2, 1, 1)
    V_X = Phi_M[0:nxny, j - 1]
    V_Y = Phi_M[nxny::, j - 1]
    Plot_Field(X_S, Y_S, V_X, V_Y, True, 1, 1.5)
    ax.set_aspect('equal')  # Set equal aspect ratio
    ax.set_xticks(np.arange(0, 40, 10))
    ax.set_yticks(np.arange(10, 30, 5))
    ax.set_xlim([0, 35])
    ax.set_ylim([10, 29])
    ax.invert_yaxis()  # Invert Axis for plotting purpose
    String_y = '$\phi_{\mathcal{M}' + str(j) + '}$'
    plt.title(String_y, fontsize=18)
    # plt.tight_layout(pad=1, w_pad=0.5, h_pad=1.0)

    ax = plt.subplot(2, 1, 2)
    Signal = Psi_M[:, j - 1]
    s_h = np.abs((np.fft.fft(Signal - Signal.mean())))
    Freqs = np.fft.fftfreq(int(n_t)) * Fs
    plt.plot(Freqs * (4 / 1000) / 6.5, s_h, '-', linewidth=1.5)