diff --git a/FlowMeters/DoubleElbow/Ultrasonic_diametral_1_31.npz b/FlowMeters/DoubleElbow/Ultrasonic_diametral_1_31.npz new file mode 100644 index 0000000000000000000000000000000000000000..b98ee42c5e0821493c08efb05588c18e992e58b6 Binary files /dev/null and b/FlowMeters/DoubleElbow/Ultrasonic_diametral_1_31.npz differ diff --git a/FlowMeters/SingleElbow/Ultrasonic_diametral_0_32.npz b/FlowMeters/SingleElbow/Ultrasonic_diametral_0_32.npz new file mode 100644 index 0000000000000000000000000000000000000000..cdc2f3129cca341ca9823cb7c11aa406ca416f1e Binary files /dev/null and b/FlowMeters/SingleElbow/Ultrasonic_diametral_0_32.npz differ diff --git a/FlowMeters/SingleElbow/Ultrasonic_diametral_1_29.npz b/FlowMeters/SingleElbow/Ultrasonic_diametral_1_29.npz new file mode 100644 index 0000000000000000000000000000000000000000..cdeabd042d4287bf2d4a664e29926e99cdeb9667 Binary files /dev/null and b/FlowMeters/SingleElbow/Ultrasonic_diametral_1_29.npz differ diff --git a/FlowMeters/SingleElbow/Ultrasonic_diametral_1_32.npz b/FlowMeters/SingleElbow/Ultrasonic_diametral_1_32.npz new file mode 100644 index 0000000000000000000000000000000000000000..666c4be3f47f7109a77f8a9dc719cfa09d285c4b Binary files /dev/null and b/FlowMeters/SingleElbow/Ultrasonic_diametral_1_32.npz differ diff --git a/Flow_class.py b/Flow_class.py index 1ca58c1bbf1589f5f8fc7cdba488b0e39a0ef153..685f094ba040b24f02b376bfa8ff67372c7e367d 100644 --- a/Flow_class.py +++ b/Flow_class.py @@ -223,14 +223,16 @@ class Elbow_profile(): A = self.regint_A((Rk,dl,dist)) # for reconstruction of u, reshape A, flatten all dimension other than # the last A.shape[-1] which is the number of modes + adim = A.shape[0:-1] A = A.reshape(-1,self.Nmodes) # reconstruct the velocities u = do_reconstruct(A,self.modes,umean = self.umean ) - # restore the tree velocity components - u = u.reshape(3,-1) + # restore the three velocity components + u = u.reshape(*adim,3,-1) # restore the dimensions of A - if np.ndim(Rk) > 0 : - u = u.reshape(u.shape[0],*Rk.shape) + # if adim: #np.ndim(Rk) > 0 : + # #u = u.reshape(u.shape[0],*Rk.shape) + # u = u.reshape(u.shape[0],*adim) if asmat: # reshape to have the polar coordinates r and phi in seperate dimensions u = u.reshape(*u.shape[0:-1],*self.xm.shape) @@ -247,49 +249,34 @@ class Elbow_profile(): D = 2*R # for interpolation dist must be strictly increasing #if reverse: dist = dist[::-1] - A_ux = np.array([int_i((Rk,dist)) for int_i in self.regint_ux] ).T - A_uy = np.array([int_i((Rk,dist)) for int_i in self.regint_uy] ).T - A_uz = np.array([int_i((Rk,dist)) for int_i in self.regint_uz] ).T - # - # print("this is A for path-- dist = " + str(dist) + " and Rk = " + str(Rk) + ":") - # print(A_uz) - # A_ux = A_ux.reshape(-1,A_ux.shape[-1]) - # A_uy = A_uy.reshape(-1,A_uy.shape[-1]) - # A_uz = A_uz.reshape(-1,A_uz.shape[-1]) - # print(A_ux.shape) - #print("this is shape of A: --") - #print(A_uz.shape) + A = self.regint_A((Rk,dist)) # now reconstruct the velocities - modes_ux_mat = self.modes_ux.reshape(*self.r.shape,-1) - modes_uy_mat = self.modes_uy.reshape(*self.r.shape,-1) - modes_uz_mat = self.modes_uz.reshape(*self.r.shape,-1) + # mx,my,mz = self.modes.reshape(3,*self.r.shape,-1) + modemat = self.modes.reshape(3,*self.r.shape,-1) + + # modes_ux_mat = self.modes_ux.reshape(*self.r.shape,-1) + # modes_uy_mat = self.modes_uy.reshape(*self.r.shape,-1) + # modes_uz_mat = self.modes_uz.reshape(*self.r.shape,-1) if reverse: - # A_ux = A_ux[::-1] - # A_uy = A_uy[::-1] - # A_uz = A_uz[::-1] - # change the modes to be reverse to fit to the coeffMatrix A - modes_ux_mat = modes_ux_mat[:,::-1,:] - modes_uy_mat = modes_uy_mat[:,::-1,:] - modes_uz_mat = modes_uz_mat[:,::-1,:] # - ux = do_reconstruct_path(A_ux, modes_ux_mat, umean = self.ux_mean.reshape(self.Nphi,self.Nr)[:,::-1]) - uy = do_reconstruct_path(A_uy, modes_uy_mat, umean = self.uy_mean.reshape(self.Nphi,self.Nr)[:,::-1]) - uz = do_reconstruct_path(A_uz, modes_uz_mat, umean = self.uz_mean.reshape(self.Nphi,self.Nr)[:,::-1]) + modemat = modemat[:,:,::-1,:] + # + u = do_reconstruct_path(A, modemat, umean = self.umean.reshape(3,self.Nphi,self.Nr)[:,:,::-1]) # calculate the weighting factors for the secondary flow components wx = -D*np.cos(self.phi) wy = -D*np.sin(self.phi) # print("mode.shape") # if not reversed else: - ux = do_reconstruct_path(A_ux, modes_ux_mat, umean = self.ux_mean.reshape(self.Nphi,self.Nr))#[::-1] - uy = do_reconstruct_path(A_uy, modes_uy_mat, umean = self.uy_mean.reshape(self.Nphi,self.Nr))#[::-1] - uz = do_reconstruct_path(A_uz, modes_uz_mat, umean = self.uz_mean.reshape(self.Nphi,self.Nr))#[::-1] + u = do_reconstruct_path(A, modemat, umean = self.umean.reshape(3,self.Nphi,self.Nr)) + # calculate the weights wx = D*np.cos(self.phi) wy = D*np.sin(self.phi) # if the dimensions of a is larger: # b1 = bla.reshape(*bla.shape[0:-1],self.xm.shape) if addfully: - uz += self.u_fully + u[2] += self.u_fully + # test plots to check if the profile is valid # if dist[0] == 0: # print("Reverse is " + str(reverse)) # print("wx") @@ -297,7 +284,7 @@ class Elbow_profile(): # print("wy") # print(wy[:,0]) # return the radial velocity part and the axial velocity - return (wx*ux + wy*uy,uz) + return (wx*u[0] + wy*u[1],u[2]) def get_path_profile_diam_de(self,Rk,dl,dist,reverse =False, addfully = False,R = 1): # returns the velocity profile at a certain distance and coordinates x,y, (if given) @@ -306,50 +293,34 @@ class Elbow_profile(): # D = 2*R # for interpolation dist must be strictly increasing - #if reverse: dist = dist[::-1] - A_ux = np.array([int_i((Rk,dl,dist)) for int_i in self.regint_ux] ).T - A_uy = np.array([int_i((Rk,dl,dist)) for int_i in self.regint_uy] ).T - A_uz = np.array([int_i((Rk,dl,dist)) for int_i in self.regint_uz] ).T - # - # print("this is A for path-- dist = " + str(dist) + " and Rk = " + str(Rk) + ":") - # print(A_uz) - # A_ux = A_ux.reshape(-1,A_ux.shape[-1]) - # A_uy = A_uy.reshape(-1,A_uy.shape[-1]) - # A_uz = A_uz.reshape(-1,A_uz.shape[-1]) - # print(A_ux.shape) - #print("this is shape of A: --") - #print(A_uz.shape) + A = self.regint_A((Rk,dl,dist)) # now reconstruct the velocities - modes_ux_mat = self.modes_ux.reshape(*self.r.shape,-1) - modes_uy_mat = self.modes_uy.reshape(*self.r.shape,-1) - modes_uz_mat = self.modes_uz.reshape(*self.r.shape,-1) + # mx,my,mz = self.modes.reshape(3,*self.r.shape,-1) + modemat = self.modes.reshape(3,*self.r.shape,-1) + + # modes_ux_mat = self.modes_ux.reshape(*self.r.shape,-1) + # modes_uy_mat = self.modes_uy.reshape(*self.r.shape,-1) + # modes_uz_mat = self.modes_uz.reshape(*self.r.shape,-1) if reverse: - # A_ux = A_ux[::-1] - # A_uy = A_uy[::-1] - # A_uz = A_uz[::-1] - # change the modes to be reverse to fit to the coeffMatrix A - modes_ux_mat = modes_ux_mat[:,::-1,:] - modes_uy_mat = modes_uy_mat[:,::-1,:] - modes_uz_mat = modes_uz_mat[:,::-1,:] # - ux = do_reconstruct_path(A_ux, modes_ux_mat, umean = self.ux_mean.reshape(self.Nphi,self.Nr)[:,::-1]) - uy = do_reconstruct_path(A_uy, modes_uy_mat, umean = self.uy_mean.reshape(self.Nphi,self.Nr)[:,::-1]) - uz = do_reconstruct_path(A_uz, modes_uz_mat, umean = self.uz_mean.reshape(self.Nphi,self.Nr)[:,::-1]) + modemat = modemat[:,:,::-1,:] + # + u = do_reconstruct_path(A, modemat, umean = self.umean.reshape(3,self.Nphi,self.Nr)[:,:,::-1]) # calculate the weighting factors for the secondary flow components wx = -D*np.cos(self.phi) wy = -D*np.sin(self.phi) # print("mode.shape") # if not reversed else: - ux = do_reconstruct_path(A_ux, modes_ux_mat, umean = self.ux_mean.reshape(self.Nphi,self.Nr))#[::-1] - uy = do_reconstruct_path(A_uy, modes_uy_mat, umean = self.uy_mean.reshape(self.Nphi,self.Nr))#[::-1] - uz = do_reconstruct_path(A_uz, modes_uz_mat, umean = self.uz_mean.reshape(self.Nphi,self.Nr))#[::-1] + u = do_reconstruct_path(A, modemat, umean = self.umean.reshape(3,self.Nphi,self.Nr)) + # calculate the weights wx = D*np.cos(self.phi) wy = D*np.sin(self.phi) # if the dimensions of a is larger: # b1 = bla.reshape(*bla.shape[0:-1],self.xm.shape) if addfully: - uz += self.u_fully + u[2] += self.u_fully + # test plots to check if the profile is valid # if dist[0] == 0: # print("Reverse is " + str(reverse)) # print("wx") @@ -357,8 +328,7 @@ class Elbow_profile(): # print("wy") # print(wy[:,0]) # return the radial velocity part and the axial velocity - return (wx*ux + wy*uy,uz) - + return (wx*u[0] + wy*u[1],u[2]) def make_fully(self,Re = 5e4,ks=0.0,ret=False,r = np.array([0])): # generating fully uvol = 1 @@ -465,7 +435,7 @@ class Elbow_profile(): def get_pathint_allphi_se(self,dz,dL,wz,Rc,L,makeplot=False): # only for singleElbow case - Int = 0 #np.zeros(dz[0].shape[1]) + Int = 0 #np.zeros(dz[0].shape[1]) ind0 = np.where(self.phi[:,0] == 0)[0][0] # 40 # index where phi==0 for ipath in range(dz[0].shape[0]): # now reconstruct the profiles from the POD coeffs and integrate them