def update_aero_prop(self): assert hasattr(self,'conn_glob'),\ 'Run "update_derived_params" before generating files' n_surfaces = self.n_surfaces num_node_surf = self.num_node_surf num_node_tot = self.num_node_tot num_elem_surf = self.num_elem_surf num_elem_tot = self.num_elem_tot ### Generate aerofoil profiles. Only on surf 0. Airfoils_surf = [] if n_surfaces == 2: for inode in range(num_node_surf): eta = inode / num_node_surf Airfoils_surf.append( np.column_stack( geo_utils.interpolate_naca_camber( eta, self.root_airfoil_M, self.root_airfoil_P, self.tip_airfoil_M, self.tip_airfoil_P))) airfoil_distribution_surf = self.conn_surf airfoil_distribution = np.concatenate([ airfoil_distribution_surf, airfoil_distribution_surf[::-1, [1, 0, 2]] ]) if n_surfaces == 1: num_node_half = (num_node_surf + 1) // 2 for inode in range(num_node_half): eta = inode / num_node_half Airfoils_surf.append( np.column_stack( geo_utils.interpolate_naca_camber( eta, self.root_airfoil_M, self.root_airfoil_P, self.tip_airfoil_M, self.tip_airfoil_P))) airfoil_distribution_surf = self.conn_surf[:num_elem_surf // 2, :] airfoil_distribution = np.concatenate([ airfoil_distribution_surf[::-1, [1, 0, 2]], airfoil_distribution_surf ]) self.Airfoils_surf = Airfoils_surf self.airfoil_distribution = airfoil_distribution ### others self.aero_node = np.ones((num_node_tot, ), dtype=bool) self.surface_m = self.M * np.ones((n_surfaces, ), dtype=int) self.twist = np.zeros((num_elem_tot, 3)) self.chord = self.main_chord * np.ones((num_elem_tot, 3)) self.elastic_axis = self.main_ea * np.ones(( num_elem_tot, 3, ))
def interpolate_naca_camber(eta, M00, P00, M01, P01): """ Warnings: This function is now located in sharpy.utils.geo_utils Interpolate aerofoil camber at non-dimensional coordinate eta in (0,1), where (M00,P00) and (M01,P01) define the camber properties at eta=0 and eta=1 respectively. Notes: For two surfaces, eta can be in (-1,1). In this case, the root is eta=0 and the tips are at eta=+-1. """ warnings.warn( 'Deprecated utility function location. Use the one in sharpy.utils.geo_utils instead', stacklevel=2) x_vec, y_vec = new_geo_utils.interpolate_naca_camber( eta, M00, P00, M01, P01) # # define domain # eta = np.abs(eta) # assert np.max(eta) < 1. + 1e-16, 'eta exceeding +/- 1!' # # # define reference # x00, y00 = generate_naca_camber(M00, P00) # x01, y01 = generate_naca_camber(M01, P01) # # # interpolate # x_vec = x00 * (1. - eta) + x01 * eta # y_vec = y00 * (1. - eta) + y01 * eta return x_vec, y_vec
def update_aero_prop(self): assert hasattr(self, 'conn_glob'), \ 'Run "update_derived_params" before generating files' n_surfaces = self.n_surfaces num_node_surf = self.num_node_surf num_node_tot = self.num_node_tot num_elem_surf = self.num_elem_surf num_elem_tot = self.num_elem_tot pct_flap = self.pct_flap control_surface = self.control_surface ### Generate aerofoil profiles. Only on surf 0. Airfoils_surf = [] if n_surfaces == 2: for inode in range(num_node_surf): eta = inode / num_node_surf Airfoils_surf.append( np.column_stack( geo_utils.interpolate_naca_camber( eta, self.root_airfoil_M, self.root_airfoil_P, self.tip_airfoil_M, self.tip_airfoil_P))) # if inode >= num_node_surf // 2: ws_elem = 0 for i_surf in range(2): print('Surface' + str(i_surf)) for i_elem in range(num_elem_surf): for i_local_node in range(self.num_node_elem): if i_elem >= int(num_elem_surf *(1- pct_flap)): if i_surf == 0: control_surface[ws_elem + i_elem, i_local_node] = 0 # Right flap else: control_surface[ws_elem + i_elem, i_local_node] = 0 # Left flap ws_elem += num_elem_surf # control_surface[i_elem, i_local_node] = 0 airfoil_distribution_surf = self.conn_surf airfoil_distribution = np.concatenate([airfoil_distribution_surf, airfoil_distribution_surf[::-1, [1, 0, 2]]]) control_surface[-num_elem_surf:] = control_surface[-num_elem_surf:, :][::-1] if n_surfaces == 1: num_node_half = (num_node_surf + 1) // 2 for inode in range(num_node_half): eta = inode / num_node_half Airfoils_surf.append( np.column_stack( geo_utils.interpolate_naca_camber( eta, self.root_airfoil_M, self.root_airfoil_P, self.tip_airfoil_M, self.tip_airfoil_P))) airfoil_distribution_surf = self.conn_surf[:num_elem_surf // 2, :] airfoil_distribution = np.concatenate([ airfoil_distribution_surf[::-1, [1, 0, 2]], airfoil_distribution_surf]) self.Airfoils_surf = Airfoils_surf self.airfoil_distribution = airfoil_distribution ### others self.aero_node = np.ones((num_node_tot,), dtype=bool) self.surface_m = self.M * np.ones((n_surfaces,), dtype=int) self.twist = np.zeros((num_elem_tot, 3)) self.chord = self.main_chord * np.ones((num_elem_tot, 3)) self.elastic_axis = self.main_ea * np.ones((num_elem_tot, 3,)) self.control_surface = control_surface