def percentThickness(self, percent): leadingedge = self.contour.getLeadingEdge() trailingedge = self.contour.getTrailingEdge() # initialise the surface matrices #surf = ones(self.resolution)*nan #*self.thick width = self.contour.getWidth() height = self.contour.getHeight() x_axis = linspace(0,width,self.resolution[0]) y_axis = linspace(0,height,self.resolution[1]) # interpolate the edges to fit the grid leading_edge = interpolate(leadingedge[:,1],leadingedge[:,0],y_axis,len(leadingedge[:,1]),self.resolution[1]) trailing_edge = interpolate(trailingedge[:,1],trailingedge[:,0],y_axis,len(trailingedge[:,1]),self.resolution[1]) chordlength = trailing_edge - leading_edge thick = chordlength * float(percent) self.set_basethickness(thick[0]) return thick
def gen_surface(self, exponConstant): """ generate the 3D surface of the fin """ leadingedge = self.contour.getLeadingEdge() trailingedge = self.contour.getTrailingEdge() # initialise the surface matrices #surf = ones(self.resolution)*nan #*self.thick width = self.contour.getWidth() height = self.contour.getHeight() x_axis = linspace(0,width,self.resolution[0]) y_axis = linspace(0,height,self.resolution[1]) # interpolate the edges to fit the grid leading_edge = interpolate(leadingedge[:,1],leadingedge[:,0],y_axis,len(leadingedge[:,1]),self.resolution[1]) trailing_edge = interpolate(trailingedge[:,1],trailingedge[:,0],y_axis,len(trailingedge[:,1]),self.resolution[1]) # rescale to grid dx = width / self.resolution[0] leading_edge_grid = (leading_edge / dx).round() trailing_edge_grid = (trailing_edge / dx).round() # generate the profiles and surface if exponConstant == 0: thick = self.thickness(height) elif exponConstant < 0: thick = self.percentThickness(-exponConstant) else: thick = self.exponentialThickness(exponConstant) surf = make_surface(self.resolution[0],leading_edge_grid,trailing_edge_grid,thick,self.resolution[1]) #print surf self.surf = surf self.x_axis = x_axis self.y_axis = y_axis