def __init__(self, config, size_in=200, size_out=(200, 20, 3), suffix=''): super(PGLLoftedBladeSurface, self).__init__() self._dry_run = False if not _PGL_installed: self._dry_run = True self.add_param('blade_length', 1.) names = [ 's', 'x', 'y', 'z', 'rot_x', 'rot_y', 'rot_z', 'chord', 'rthick', 'p_le' ] for name in names: self.add_param(name + suffix, np.zeros(size_in)) self._suffix = suffix self.add_output('blade_surface' + suffix, np.zeros(size_out)) self.add_output('blade_surface_norm' + suffix, np.zeros(size_out)) # for i in range(size_in[1]): # self.add_param('base_af%02d' % i, np.zeros(size_in[0], 2)) # configuration variables for PGL's LoftedBladeSurface class self.config = {} self.config['base_airfoils'] = [] self.config['blend_var'] = np.array([]) self.config['user_surface'] = np.array([]) self.config['user_surface_file'] = '' self.config['user_surface_shape'] = () self.config['ni_chord'] = size_out[0] self.config['chord_nte'] = 0 self.config['redistribute_flag'] = False self.config['x_chordwise'] = np.array([]) self.config['minTE'] = 0. self.config['interp_type'] = 'rthick' self.config['surface_spline'] = 'pchip' self.config['dist_LE'] = np.array([]) self.config['gf_heights'] = np.array([]) for k, v in config.iteritems(): if k in self.config.keys(): self.config[k] = v else: print 'unknown config key %s' % k self.rot_order = np.array([2, 1, 0]) if not self._dry_run: self.pgl_surf = LoftedBladeSurface(**self.config) self._pgl_config_called = False
read_bladestructure, \ write_bladestructure PATH = pkg_resources.resource_filename('fusedwind', 'turbine/test') # --- 2 --- # generate a lofted blade surface using PGL pf = read_blade_planform(os.path.join(PATH, 'data/DTU_10MW_RWT_blade_axis_prebend.dat')) s_st = np.linspace(0, 1, 20) pf = redistribute_planform(pf, s=s_st) d = LoftedBladeSurface() d.pf = pf # redistribute in the chordwise direction # with 200 nodes, open TE (chord_nte=0) # and open TE of cross sections with TE # thickness less 2 cm d.redistribute_flag = True d.chord_ni = 200 d.chord_nte = 0 d.minTE = 0.000232 # privide base airfoils as function of relative thickess d.blend_var = [0.241, 0.301, 0.36, 0.48, 1.0] for f in [os.path.join(PATH, 'data/ffaw3241.dat'), os.path.join(PATH, 'data/ffaw3301.dat'),