af_extrap1 = af.extrapolate(cdmax) # a second example using the optional inputs AR = 17 # blade aspect ratio. If provided, cdmax is estimated using the aspect ratio. cdmin = 0.001 # minimum drag coefficient. Viterna's method can occasionally produce # negative drag coefficients. A minimum is used to prevent unphysical data. # The passed in value is used to override the default. af_extrap2 = af.extrapolate(cdmax, AR=AR, cdmin=cdmin) # 5 --------- # 6 --------- # create new airfoil that uses the same angles of attack at each Reynolds number af_common1 = af.interpToCommonAlpha() # default approach uses a union of all defined angles of attack # alternatively, specify the exact angles to use alpha = np.arange(-180, 180) af_common2 = af.interpToCommonAlpha(alpha) # 6 --------- # 7 --------- # extract a data grid from airfoil alpha, Re, cl, cd = af.createDataGrid() # cl[i, j] is the lift coefficient for alpha[i] and Re[j]
def solve_nonlinear(self, params, unknowns, resids): # determine aspect ratio = (rotor radius / chord_75% radius)\ # if provided, cdmax is computed from AR' bl = params['blade_length'] dr = params['rotor_diameter'] hr = 0.5 * dr - bl rotor_radius = 0.5 * dr chord = params['chord_st'] * bl s = params['s_st'] r = (s * bl + hr) / rotor_radius chord_75 = np.interp(0.75, r, chord) AR = rotor_radius / chord_75 # write aerodyn files af_name_base = 'cs_' af_name_suffix = '_aerodyn' tcs = params['cs_polars_tc'] n_cs_alpha = params['n_cs_alpha'] pol = params['cs_polars'] nmet = 0 # TODO: blend polars determined with different methods for i, tc in enumerate(self.blend_var): af_name = af_name_base + \ '%03d_%04d' % (i, tc * 1000) + af_name_suffix re_polars = [] for nre, re in enumerate(self.res): # create polar object p = Polar(re, pol[:n_cs_alpha[i, nre, nmet], 0, i, nre, nmet], pol[:n_cs_alpha[i, nre, nmet], 1, i, nre, nmet], pol[:n_cs_alpha[i, nre, nmet], 2, i, nre, nmet], pol[:n_cs_alpha[i, nre, nmet], 3, i, nre, nmet]) # extrapolate polar if tc < self.tc_max: p_extrap = p.extrapolate(self.cdmax, AR, self.cdmin, self.nalpha) else: p_extrap = p.extrapolate_as_cylinder() p_extrap.useCM = self.useCM re_polars.append(p_extrap) # TODO: output as HAWC2/FAST format # See if HAWC can take several af tables with different Re # numbers ''' unknowns['airfoildata:aoa%02d' % i] = p_extrap.alpha unknowns['airfoildata:cl%02d' % i] = p_extrap.cl unknowns['airfoildata:cd%02d' % i] = p_extrap.cd unknowns['airfoildata:cm%02d' % i] = p_extrap.cm ''' # create airfoil object af = Airfoil(re_polars) af.interpToCommonAlpha() af.writeToAerodynFile(af_name + '.dat') if self.plot_polars: figs = af.plot(single_figure=True) titles = ['cl', 'cd', 'cm'] for (fig, title) in zip(figs, titles): fig.savefig(af_name + '_' + title + '.png', dpi=400) fig.savefig(af_name + '_' + title + '.pdf') self._get_unknowns(unknowns)