diff --git a/Flow_class.py b/Flow_class.py index 1e37fe19e14c1474a475a0744127b279f7cd8e22..66799bae17c1730b97ea1a8e6015e3f9acde31e8 100644 --- a/Flow_class.py +++ b/Flow_class.py @@ -98,21 +98,29 @@ def do_reconstruct_add(A,phi,Nmodes,u_tilde,umean = 0): return umean + np.real(u_tilde) -def loadPODres(): - data_path = os.path.abspath("./POD_res/SingleElbow") +def loadPODres(case): + data_path = os.path.abspath("./POD_res/"+case +"/") # - with open(os.path.join(data_path,"ux_PODres_Elbow.json")) as json_file: - ux = json.load(json_file) - with open(os.path.join(data_path,"uy_PODres_Elbow.json")) as json_file: - uy = json.load(json_file) - with open(os.path.join(data_path,"uz_PODres_Elbow.json")) as json_file: - uz = json.load(json_file) - # make numpy arrays from the lists - keys = list(uz.keys()) - for key in keys: - ux[key] = np.array(ux[key]) - uy[key] = np.array(uy[key]) - uz[key] = np.array(uz[key]) + if case == "SingleElbow": + # the single elbow data are in json format + with open(os.path.join(data_path,"ux_PODres_Elbow.json")) as json_file: + ux = json.load(json_file) + with open(os.path.join(data_path,"uy_PODres_Elbow.json")) as json_file: + uy = json.load(json_file) + with open(os.path.join(data_path,"uz_PODres_Elbow.json")) as json_file: + uz = json.load(json_file) + # make numpy arrays from the lists + keys = list(uz.keys()) + for key in keys: + ux[key] = np.array(ux[key]) + uy[key] = np.array(uy[key]) + uz[key] = np.array(uz[key]) + else: + # the other POD res files are in npz-format + ux = np.load(data_path+"/Ux_POD_DE.npz") + uy = np.load(data_path+"/Ux_POD_DE.npz") + uz = np.load(data_path+"/Ux_POD_DE.npz") + # return ux, uy, uz @@ -124,7 +132,9 @@ def loadPODres(): class Elbow_profile(): def loadCoordinates(self,case,delete_last=False): - coord_file = os.path.abspath("./Dist_Coords.json") + + coord_file = os.path.abspath("./POD_res/"+ case + "/Dist_Coords.json") + with open(coord_file) as json_file: coords = json.load(json_file) # @@ -139,7 +149,7 @@ class Elbow_profile(): if delete_last: self.r_wall = self.r[:,-1] self.phi_wall = self.phi[:,-1] - self.x_wall,self.y_wal = pol2cart(self.r_wall,self.phi_wall) + self.x_wall,self.y_wall = pol2cart(self.r_wall,self.phi_wall) # self.r = self.r[:,0:-1] self.phi = self.phi[:,0:-1] @@ -155,35 +165,54 @@ class Elbow_profile(): # N0 = 3 # len(flownames) self.Nphi = self.r.shape[0] self.Nr = self.r.shape[1] + + if "dl" in coords.keys(): + self.dl = np.array(coords["dl"])/self.D + else: + self.dl = np.array([0]) + return 1 - def __init__(self,case="singleElbow"): + def __init__(self,case="SingleElbow"): # load the flow profiles behind the elbows # ------------------------------------------------------------ self.loadCoordinates(case) # - Nx = self.x.size - Ndist = self.dist.size - Nrk = self.Rk.size - Nt = self.dist.size * self.Rk.size + # Nx = self.x.size + # Ndist = self.dist.size + # Nrk = self.Rk.size + # Nt = self.dist.size * self.Rk.size # - pod_x,pod_y,pod_z = loadPODres() + pod_x,pod_y,pod_z = loadPODres(case) self.Nmodes = pod_x["modes"].shape[-1] # - # save the modes in local variables and add zeros at the wall coordinates - self.modes_ux = np.concatenate((pod_x["modes"].reshape(self.Nphi,self.Nr-1,self.Nmodes),np.zeros((self.Nphi,1,self.Nmodes))),axis=1).reshape(-1,self.Nmodes) - self.modes_uy = np.concatenate((pod_y["modes"].reshape(self.Nphi,self.Nr-1,self.Nmodes),np.zeros((self.Nphi,1,self.Nmodes))),axis=1).reshape(-1,self.Nmodes) - self.modes_uz = np.concatenate((pod_z["modes"].reshape(self.Nphi,self.Nr-1,self.Nmodes),np.zeros((self.Nphi,1,self.Nmodes))),axis=1).reshape(-1,self.Nmodes) - # the mean profiles - self.ux_mean = np.concatenate((pod_x["umean"].reshape(self.Nphi,self.Nr-1),np.zeros((self.Nphi,1))),axis=1).ravel() - self.uy_mean = np.concatenate((pod_y["umean"].reshape(self.Nphi,self.Nr-1),np.zeros((self.Nphi,1))),axis=1).ravel() - self.uz_mean = np.concatenate((pod_z["umean"].reshape(self.Nphi,self.Nr-1),np.zeros((self.Nphi,1))),axis=1).ravel() - # - # - pod_x["coeffs"] = pod_x["coeffs"].reshape((len(self.Rk),len(self.dist),self.Nmodes)) - pod_y["coeffs"] = pod_y["coeffs"].reshape((len(self.Rk),len(self.dist),self.Nmodes)) - pod_z["coeffs"] = pod_z["coeffs"].reshape((len(self.Rk),len(self.dist),self.Nmodes)) + if case=="SingleElbow": + # save the modes in local variables and add zeros at the wall coordinates + self.modes_ux = np.concatenate((pod_x["modes"].reshape(self.Nphi,self.Nr-1,self.Nmodes),np.zeros((self.Nphi,1,self.Nmodes))),axis=1).reshape(-1,self.Nmodes) + self.modes_uy = np.concatenate((pod_y["modes"].reshape(self.Nphi,self.Nr-1,self.Nmodes),np.zeros((self.Nphi,1,self.Nmodes))),axis=1).reshape(-1,self.Nmodes) + self.modes_uz = np.concatenate((pod_z["modes"].reshape(self.Nphi,self.Nr-1,self.Nmodes),np.zeros((self.Nphi,1,self.Nmodes))),axis=1).reshape(-1,self.Nmodes) + # the mean profiles + self.ux_mean = np.concatenate((pod_x["umean"].reshape(self.Nphi,self.Nr-1),np.zeros((self.Nphi,1))),axis=1).ravel() + self.uy_mean = np.concatenate((pod_y["umean"].reshape(self.Nphi,self.Nr-1),np.zeros((self.Nphi,1))),axis=1).ravel() + self.uz_mean = np.concatenate((pod_z["umean"].reshape(self.Nphi,self.Nr-1),np.zeros((self.Nphi,1))),axis=1).ravel() + # + # + # pod_x["coeffs"] = pod_x["coeffs"].reshape((len(self.Rk),len(self.dist),self.Nmodes)) + # pod_y["coeffs"] = pod_y["coeffs"].reshape((len(self.Rk),len(self.dist),self.Nmodes)) + # pod_z["coeffs"] = pod_z["coeffs"].reshape((len(self.Rk),len(self.dist),self.Nmodes)) + else: + self.modes_ux = pod_x["modes"] + self.modes_uy = pod_y["modes"] + self.modes_uz = pod_z["modes"] + # the mean profiles + self.ux_mean = pod_x["umean"] + self.uy_mean = pod_y["umean"] + self.uz_mean = pod_z["umean"] + # + coeffs_x = pod_x["coeffs"].reshape((len(self.Rk),len(self.dl),len(self.dist),self.Nmodes)) + coeffs_y = pod_y["coeffs"].reshape((len(self.Rk),len(self.dl),len(self.dist),self.Nmodes)) + coeffs_z = pod_z["coeffs"].reshape((len(self.Rk),len(self.dl),len(self.dist),self.Nmodes)) # # plot for test # indrk = 7 @@ -196,19 +225,26 @@ class Elbow_profile(): # utest = do_reconstruct(A_test,pod_z["modes"],self.Nmodes,self.uz_mean ).ravel() # nicecontour(self.x,self.y,utest) - polydeg = 3 - self.splineint_ux = [] - self.splineint_uy = [] - self.splineint_uz = [] + #polydeg = 3 + self.regint_ux = [] + self.regint_uy = [] + self.regint_uz = [] # the spline interpolation attention it can only evaluate ordered input arrays for i in range(0,self.Nmodes): - self.splineint_ux.append(interpol.RectBivariateSpline(self.dist,self.Rk,pod_x["coeffs"][:,:,i].T,kx= polydeg,ky=polydeg )) - self.splineint_uy.append(interpol.RectBivariateSpline(self.dist,self.Rk,pod_y["coeffs"][:,:,i].T,kx= polydeg,ky=polydeg )) - self.splineint_uz.append(interpol.RectBivariateSpline(self.dist,self.Rk,pod_z["coeffs"][:,:,i].T,kx= polydeg,ky=polydeg )) - + # self.splineint_ux.append(interpol.RectBivariateSpline(self.dist,self.Rk,self.dl,pod_x["coeffs"][:,:,i].T,kx= polydeg,ky=polydeg )) + # self.splineint_uy.append(interpol.RectBivariateSpline(self.dist,self.Rk,self.dl,pod_y["coeffs"][:,:,i].T,kx= polydeg,ky=polydeg )) + # self.splineint_uz.append(interpol.RectBivariateSpline(self.dist,self.Rk,self.dl,pod_z["coeffs"][:,:,i].T,kx= polydeg,ky=polydeg )) + self.regint_ux.append(interpol.RegularGridInterpolator((self.Rk,self.dl,self.dist), coeffs_x[:,:,:,i] )) + self.regint_uy.append(interpol.RegularGridInterpolator((self.Rk,self.dl,self.dist), coeffs_y[:,:,:,i])) + self.regint_uz.append(interpol.RegularGridInterpolator((self.Rk,self.dl,self.dist), coeffs_z[:,:,:,i])) + # + # del pod_x del pod_y del pod_z + del coeffs_x + del coeffs_y + del coeffs_z # self.int_weights = int2d.get_int_weights(x=self.x,y=self.y,method="tri") @@ -218,16 +254,16 @@ class Elbow_profile(): # # end Init - def get_profile(self,dist,Rk,x=None,y=None,addfully = False,asmat = True): + def get_profile(self,Rk,dl,dist,x=None,y=None,addfully = False,asmat = True): # returns the velocity profile at a certain distance and coordinates x,y, (if given) # to evaluate the spline interpolation and get the coefficient matrix at the desired # values of dist and Rk - A_ux = np.array([splineint_i(dist,Rk) for splineint_i in self.splineint_ux] ).T - A_uy = np.array([splineint_i(dist,Rk) for splineint_i in self.splineint_uy] ).T - A_uz = np.array([splineint_i(dist,Rk) for splineint_i in self.splineint_uz] ).T + 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 dist = " + str(dist) + " and Rk = " + str(Rk) + ":") - #print(A_uz) + # print("this is A for 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]) @@ -251,7 +287,7 @@ class Elbow_profile(): # return ux,uy,uz - def get_path_profile_diam(self,dist,Rk,reverse =False, addfully = False,R = 1): + def get_path_profile_diam(self,Rk,dl,dist,reverse =False, addfully = False,R = 1): # returns the velocity profile at a certain distance and coordinates x,y, (if given) # to evaluate the spline interpolation and get the coefficient matrix at the desired # values of dist and Rk @@ -259,9 +295,9 @@ class Elbow_profile(): D = 2*R # for interpolation dist must be strictly increasing #if reverse: dist = dist[::-1] - A_ux = np.array([splineint_i(dist,Rk) for splineint_i in self.splineint_ux] ).T - A_uy = np.array([splineint_i(dist,Rk) for splineint_i in self.splineint_uy] ).T - A_uz = np.array([splineint_i(dist,Rk) for splineint_i in self.splineint_uz] ).T + 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) @@ -403,20 +439,20 @@ class Elbow_profile(): return (dz0,dz1), L, wz, (dl0,dl1) - def get_pathint_allphi(self,dz,dl,wz,Rc,L,makeplot=False): + def get_pathint_allphi(self,dz,dL,wz,Rc,dl,L,makeplot=False): 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 - upaths_r0, upaths_z0 = self.get_path_profile_diam(dist = dz[0][ipath],Rk = Rc,reverse=True) - upaths_r1, upaths_z1 = self.get_path_profile_diam(dist = dz[1][ipath],Rk = Rc) + upaths_r0, upaths_z0 = self.get_path_profile_diam(Rk = Rc,dl = dl , dist = dz[0][ipath],reverse=True) + upaths_r1, upaths_z1 = self.get_path_profile_diam(Rk = Rc,dl = dl , dist = dz[1][ipath],) # integrate the velocities along the paths # the radial velocity is already weighted # the integrals of the half-paths until the center point #upaths_r0 = 0 #upaths_r1 = 0 - Int0 = np.trapz(upaths_r0 + upaths_z0*wz , x = dl[0][ipath]) - Int1 = np.trapz(upaths_r1 + upaths_z1*wz , x = dl[1][ipath]) + Int0 = np.trapz(upaths_r0 + upaths_z0*wz , x = dL[0][ipath]) + Int1 = np.trapz(upaths_r1 + upaths_z1*wz , x = dL[1][ipath]) # the integral over the whole path Int_path = Int0 + np.concatenate((Int1[ind0:-1],Int1[0:ind0+1])) @@ -436,10 +472,10 @@ class Elbow_profile(): if np.mod(ipath,2): uzpath = np.concatenate((uzpath[ind0:-1,:],uzpath[0:ind0+1,:]),axis=0) plt.figure() - plt.plot(np.concatenate((dl[0][ipath],dl[1][ipath])), uzpath[60],':*') - # plt.plot(dl[0][ipath],upaths_z0[60],'+:') + plt.plot(np.concatenate((dL[0][ipath],dL[1][ipath])), uzpath[60],':*') + # plt.plot(dL[0][ipath],upaths_z0[60],'+:') # upaths_z1 = np.concatenate((upaths_z1[ind0:-1,:],upaths_z1[0:ind0+1,:])) - # plt.plot(dl[1][ipath],upaths_z1[60],'o:') + # plt.plot(dL[1][ipath],upaths_z1[60],'o:') # plot over the radius coordinates # self.ax_meter.plot(1-flow.r[0][::-1],upaths_z0[0],'*:') # self.ax_meter.plot(1+flow.r[0],upaths_z1[0],'<:') @@ -454,25 +490,27 @@ class Elbow_profile(): Int /= L*wz return Int - def get_pathint(self, fm,R=1,dists=None,Rcs = None,makeplot = False): + def get_pathint(self, fm,R=1,Rcs = None,dls = None,dists=None,makeplot = False): # calculates the diametrical pathintegrals - # for all angles distances and curvature radii + # for all angles, distances, curvature radii and inbetween dists dl # fm is an instance of flow_meter_class # # if no distnces and Rcs given it will calculate them for all # the sampled distances and Rc if dists == None: dists = self.dist if Rcs == None: Rcs = self.Rk + if dls == None: dls = self.dl # get the distances and length of the us-paths - dz, L, weights,dl = self.get_US_pathdist(reflections = int(fm.selectedOptions[2]) ,alpha = float(fm.selectedOptions[3])/180*pi,R=1) + dz, L, weights,dL = self.get_US_pathdist(reflections = int(fm.selectedOptions[2]) ,alpha = float(fm.selectedOptions[3])/180*pi,R=1) print("this is L " + str(L)) - print("this is dl " + str(dl[-1][-1,-1])) + print("this is dL " + str(dL[-1][-1,-1])) # run through all distances - Int = np.zeros((len(Rcs),len(dists),self.Nphi)) + Int = np.zeros((len(Rcs),len(dls),len(dists),self.Nphi)) for i,rci in enumerate(Rcs): - for j,distj in enumerate(dists): - #run through all the path reflections and integrate them for all angles - Int[i,j] = self.get_pathint_allphi(dz + distj,dl,weights,rci,L,makeplot=makeplot) + for k,dlk in enumerate(dls): + for j,distj in enumerate(dists): + #run through all the path reflections and integrate them for all angles + Int[i,k,j] = self.get_pathint_allphi(dz + distj,dL,weights,rci,dlk,L,makeplot=makeplot) return Int # end flow class # diff --git a/GUI_Elbow.py b/GUI_Elbow.py index 443016432d8e620cdb22286f10acd48b71056fdf..dfa3a3dce29bff3878a6b6528dc4843db8c6fa36 100644 --- a/GUI_Elbow.py +++ b/GUI_Elbow.py @@ -156,6 +156,7 @@ class mainPanel(wx.Panel): #vbox_uncertainty_sliders = wx.BoxSizer(wx.VERTICAL) # prepare figure0 the contours #make_figure(0) + # create Figures for the profile illustration --------------------- self.fig0 = Figure(figsize=(1,1) ) self.ax0 = self.fig0.add_subplot() self.cb = 0 @@ -165,7 +166,7 @@ class mainPanel(wx.Panel): self.minval = 0.5 self.maxval = 1.35 # - # prepare figure1 the linieprofile + # prepare figure1 the line profile #make_figure(0) self.fig1 = Figure(figsize=(6,3) ) self.ax1 = self.fig1.add_subplot() @@ -178,12 +179,14 @@ class mainPanel(wx.Panel): # and add the hbox with the Figures to the vbox vbox_main.Add(hbox_figures, 1, wx.EXPAND) # set the variables ---------------------------------------------- + self.dl = 1 self.dist = 10 self.Rc = 2 self.phi = 0 # this is just the index of the phi in flow.phi in 0,81 self.Re = 5e4 self.ks = 0 # and its uncertainties + self.dl_u = 0 self.dist_u = 0 self.Rc_u = 0 self.phi_u = 0 # this is just the index of the phi in flow.phi in 0,81 @@ -198,6 +201,7 @@ class mainPanel(wx.Panel): b = 5 # # set the bounds of the values for the interpolation: + self.bounds_dl = [flow.dl[0],flow.dl[-1]] # flow.dl[0],flow.dl[-1] self.bounds_Rc = [flow.Rk[0],flow.Rk[-1]] self.bounds_dist = [flow.dist[0],flow.dist[-1]] self.bounds_phi = [-180,180] @@ -205,6 +209,7 @@ class mainPanel(wx.Panel): self.bounds_ks = [0.0,1e-1] # # make the float slider for the parameters + sliderbox_dl, self.sld_dl, self.slider_label_dl_value, self.txtbox_dl_u = self.float_slider("inbetween distance in D",self.dl,flow.dl.min(),flow.dl.max(),factor=100) sliderbox_Rc, self.sld_Rc, self.slider_label_Rc_value, self.txtbox_Rc_u = self.float_slider("Curvature Radius in D",self.Rc,flow.Rk.min(),flow.Rk.max(),factor=1000) sliderbox_dist, self.sld_dist, self.slider_label_dist_value,self.txtbox_dist_u = self.float_slider("Distance in D",self.dist,flow.dist.min(),flow.dist.max(),factor=1) sliderbox_phi, self.sld_phi, self.slider_label_phi_value, self.txtbox_phi_u = self.float_slider("Angle in grad",0,-180,180,factor= 1) @@ -213,18 +218,21 @@ class mainPanel(wx.Panel): #sliderbox_alpha,self.sld_alpha,self.slider_label_alpha_value, self.txtbox_Rc_u = self.float_slider("Roughness ks/D",self.ks,*self.bounds_ks,factor= 1e4) # # reference an event to each slider BINDINGS ------------------------------------ + self.sld_dl.Bind(wx.EVT_SLIDER, self.OnSliderScroll_dl) self.sld_dist.Bind(wx.EVT_SLIDER, self.OnSliderScroll_dist) self.sld_Rc.Bind(wx.EVT_SLIDER, self.OnSliderScroll_Rc) self.sld_phi.Bind(wx.EVT_SLIDER, self.OnSliderScroll_phi) self.sld_Re.Bind(wx.EVT_SLIDER, self.OnSliderScroll_Re) self.sld_ks.Bind(wx.EVT_SLIDER, self.OnSliderScroll_ks) # events for the textboxes + self.slider_label_dl_value.Bind(wx.EVT_TEXT,self.OnKeyTyped) self.slider_label_Rc_value.Bind(wx.EVT_TEXT,self.OnKeyTyped) self.slider_label_dist_value.Bind(wx.EVT_TEXT,self.OnKeyTyped) self.slider_label_phi_value.Bind(wx.EVT_TEXT,self.OnKeyTyped) self.slider_label_Re_value.Bind(wx.EVT_TEXT,self.OnKeyTyped) self.slider_label_ks_value.Bind(wx.EVT_TEXT,self.OnKeyTyped) # events for the uncertainty textboxes + self.txtbox_dl_u.Bind(wx.EVT_TEXT,self.OnKeyTyped_u) self.txtbox_Rc_u.Bind(wx.EVT_TEXT,self.OnKeyTyped_u) self.txtbox_dist_u.Bind(wx.EVT_TEXT,self.OnKeyTyped_u) self.txtbox_phi_u.Bind(wx.EVT_TEXT,self.OnKeyTyped_u) @@ -253,7 +261,8 @@ class mainPanel(wx.Panel): vbox_slider.Add(hbox_check,1, flag = wx.EXPAND | wx.TOP, border = 1) # # add all sliderboxes to the vbox - vbox_slider.Add(sliderbox_Rc ,1, wx.EXPAND | wx.BOTTOM, b) + vbox_slider.Add(sliderbox_dl ,1, wx.EXPAND | wx.ALL, b) + vbox_slider.Add(sliderbox_Rc ,1, wx.EXPAND | wx.ALL, b) vbox_slider.Add(sliderbox_dist,1, wx.EXPAND | wx.ALL, b) vbox_slider.Add(sliderbox_phi, 1, wx.EXPAND | wx.ALL, b) vbox_slider.Add(sliderbox_Re ,1, wx.EXPAND | wx.ALL, b) @@ -433,11 +442,11 @@ class mainPanel(wx.Panel): print(fm.options[0][fm.selectedOptions[0]] + ', ' + fm.options[1][fm.selectedOptions[1]] + ', ' + fm.selectedOptions[2] + ', ' + fm.selectedOptions[3]) # # calculate the flow meter integrals for all paths distances and curvature radii - self.pathint = flow.get_pathint(fm, R=1, dists=None,Rcs = None,makeplot = False) + self.pathint = flow.get_pathint(fm, R=1, Rcs = None,dls= None, dists=None,makeplot = False) print("pathint shape") print(self.pathint.shape) # a regular grid interpolator for the flow meter values - self.regint_fm = interpol.RegularGridInterpolator((flow.Rk,flow.dist,flow.phi[:,0]),self.pathint) + self.regint_fm = interpol.RegularGridInterpolator((flow.Rk,flow.dl,flow.dist,flow.phi[:,0]),self.pathint) self.draw_meter() # now integrate the paths with the weights ... tomorrow #pdb.set_trace() @@ -495,6 +504,7 @@ class mainPanel(wx.Panel): obj = e.GetEventObject() if obj.GetValue(): try: + self.dl = np.clip(float(self.slider_label_dl_value.GetValue()),*self.bounds_dl) self.Rc = np.clip(float(self.slider_label_Rc_value.GetValue()),*self.bounds_Rc) self.dist = np.clip(float(self.slider_label_dist_value.GetValue()),*self.bounds_dist) self.phi = np.clip(float(self.slider_label_phi_value.GetValue()),*self.bounds_phi)/180*pi @@ -517,6 +527,7 @@ class mainPanel(wx.Panel): if obj.GetValue(): try: #print(obj.getValue()) + self.dl_u = float(self.txtbox_dl_u.GetValue()) self.Rc_u = float(self.txtbox_Rc_u.GetValue()) self.dist_u = float(self.txtbox_dist_u.GetValue()) self.phi_u = float(self.txtbox_phi_u.GetValue())/180*pi @@ -543,31 +554,30 @@ class mainPanel(wx.Panel): def onChecked_uncert(self,e): # do nothing.. a=1119 - def OnSliderScroll_dist(self, e): - obj = e.GetEventObject() - self.dist = obj.GetValue() - self.slider_label_dist_value.SetValue(str(self.dist)) - self.draw() + + def OnSliderScroll_dl(self,e): + obj = e.GetEventObject() + self.dl = obj.GetValue() + self.slider_label_dl_value.SetValue(str(self.dl)) + #self.draw() + def OnSliderScroll_dist(self, e): + obj = e.GetEventObject() + self.dist = obj.GetValue() + self.slider_label_dist_value.SetValue(str(self.dist)) + #self.draw() def OnSliderScroll_Rc(self, e): - obj = e.GetEventObject() - self.Rc = obj.GetValue()/1000 - # self.SliderValue = self.slider.GetValue() - self.slider_label_Rc_value.SetValue(str(self.Rc)) - tx,ty,self.u_plane = flow.get_profile(self.dist, self.Rc,addfully= not self.diffcheck ) - self.getPath = interpol.interp1d(flow.phi[:,0], self.u_plane,axis=0) - #self.draw() - # if a flow meter has been selected - # if self.pathint.any(): - # self.draw_meter() + obj = e.GetEventObject() + self.Rc = obj.GetValue()/1000 + self.slider_label_Rc_value.SetValue(str(self.Rc)) + # tx,ty,self.u_plane = flow.get_profile(self.dist, self.Rc,addfully= not self.diffcheck ) + # self.getPath = interpol.interp1d(flow.phi[:,0], self.u_plane,axis=0) + # def OnSliderScroll_phi(self, e): - obj = e.GetEventObject() - tempphi = obj.GetValue() - self.slider_label_phi_value.SetValue(str(tempphi)) - self.phi = tempphi/180*pi - #self.draw() - # if a flow meter has been selected - # if self.pathint.any(): - # self.draw_meter() + obj = e.GetEventObject() + tempphi = obj.GetValue() + self.slider_label_phi_value.SetValue(str(tempphi)) + self.phi = tempphi/180*pi + # def OnSliderScroll_Re(self, e): obj = e.GetEventObject() self.Re = obj.GetValue() @@ -590,9 +600,10 @@ class mainPanel(wx.Panel): self.fm_mean = np.zeros_like(self.pathint) self.fm_std = np.zeros_like(self.pathint) for i,rc in enumerate(flow.Rk): - for j,dist in enumerate(flow.dist): - for k,phi in enumerate(flow.phi[:,0]): - self.fm_mean[i,j,k], self.fm_std [i,j,k] = self.get_uncertainty(rc,dist,phi) + for j,dl in enumerate(flow.dl): + for k,dist in enumerate(flow.dist): + for p,phi in enumerate(flow.phi[:,0]): + self.fm_mean[i,j,k,p], self.fm_std [i,j,k] = self.get_uncertainty(rc,dl,dist,phi) # # print(rc) @@ -690,7 +701,9 @@ class mainPanel(wx.Panel): levels = MaxNLocator(nbins = Nbins).tick_values(self.minval, self.maxval) # - ux,uy,uz = flow.get_profile( self.dist, self.Rc, addfully = not self.diffcheck ) + ux,uy,uz = flow.get_profile(self.Rc,self.dl,self.dist, addfully = not self.diffcheck ) + print("uz.shape") + print(uz.shape) # uz = uz.reshape(flow.xm.shape) # cs = self.ax0.contourf(flow.xm,flow.ym, uz ,cmap= "jet",levels=levels, extend='both') @@ -933,16 +946,42 @@ class mainPanel(wx.Panel): class Main(wx.Frame): def __init__(self): + + + wx.Frame.__init__(self, parent = None,id = wx.ID_ANY, title = "Flowmeter behind Elbow", size = (1400,1000)) # #splitter = wx.SplitterWindow(self) self.mypanel = mainPanel(self) + + + # create a menu bar ------------------------------------------ + menubar = wx.MenuBar() + fileMenu = wx.Menu() + + fileItem_se = fileMenu.Append(wx.ID_ANY, 'Single Elbow', 'load the single 90 degree Elbow') + fileItem_de = fileMenu.Append(wx.ID_ANY, 'Double Elbow', 'load the double 90 degree Elbow Out-Of-Plane') + fileItem_q = fileMenu.Append(wx.ID_EXIT, 'Quit', 'Quit application') + + menubar.Append(fileMenu, '&File') + self.SetMenuBar(menubar) + self.Bind(wx.EVT_MENU, self.OnQuit, fileItem_q) + self.Bind(wx.EVT_MENU, self.OnLoad_SE, fileItem_se) + self.Bind(wx.EVT_MENU, self.OnLoad_DE, fileItem_de) + # ---------------------------------------------------------- # bottom = BottomPanel(splitter, top) # splitter.SplitHorizontally(top, bottom) # splitter.SetMinimumPaneSize(400) #mypanel.draw() - - + def OnQuit(self, e): + self.Close() + # + def OnLoad_SE(self,e): + flow = Elbow_profile('SingleElbow') + wx.Frame.__init__(self, parent = None,id = wx.ID_ANY, title = "Flowmeter behind Elbow", size = (1400,1000)) + def OnLoad_DE(self,e): + flow = Elbow_profile('DoubleElbow') + wx.Frame.__init__(self, parent = None,id = wx.ID_ANY, title = "Flowmeter behind Elbow", size = (1400,1000)) # temp_dist = 10 @@ -952,7 +991,7 @@ class Main(wx.Frame): if __name__ == "__main__": # - flow = Elbow_profile() + flow = Elbow_profile('DoubleElbow') fm = FlowMeter() globdz = 0 # diff --git a/POD_res/DoubleElbow/POD_A.npz b/POD_res/DoubleElbow/POD_A.npz deleted file mode 100644 index b733170fb1e5bc77cc4d4916176b99de2f3fe780..0000000000000000000000000000000000000000 Binary files a/POD_res/DoubleElbow/POD_A.npz and /dev/null differ diff --git a/POD_res/DoubleElbow/POD_phi.npz b/POD_res/DoubleElbow/POD_phi.npz deleted file mode 100644 index a3ed46e3e11352251339fdfd5ff304e492981fdd..0000000000000000000000000000000000000000 Binary files a/POD_res/DoubleElbow/POD_phi.npz and /dev/null differ diff --git a/POD_res/DoubleElbow/POD_umean.npz b/POD_res/DoubleElbow/POD_umean.npz deleted file mode 100644 index 2971082dc66bf95cd8104266506347038c606cae..0000000000000000000000000000000000000000 Binary files a/POD_res/DoubleElbow/POD_umean.npz and /dev/null differ diff --git a/Dist_Coords.json b/POD_res/SingleElbow/Dist_Coords.json similarity index 100% rename from Dist_Coords.json rename to POD_res/SingleElbow/Dist_Coords.json