def test_extrap1_w_airfoil(self): cdmax = 1.29 af = Airfoil([self.polar2]) newaf = af.extrapolate(cdmax=cdmax) newpolar = newaf.polars[0] alpha_extrap = [ -180, -170, -160, -150, -140, -130, -120, -110, -100, -90, -80, -70, -60, -50, -40, -30, -20, -10.1, -8.2, -6.1, -4.1, -2.1, 0.1, 2, 4.1, 6.2, 8.1, 10.2, 11.3, 12.1, 13.2, 14.2, 15.3, 16.3, 17.1, 18.1, 19.1, 20.1, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180 ] cl_extrap = [ 0.0000, 0.2299, 0.4597, 0.4907, 0.5053, 0.4805, 0.4102, 0.2985, 0.1565, 0.0000, -0.1565, -0.2985, -0.4102, -0.4805, -0.5053, -0.4907, -0.4637, -0.6300, -0.5600, -0.6400, -0.4200, -0.2100, 0.0500, 0.3000, 0.5400, 0.7900, 0.9000, 0.9300, 0.9200, 0.9500, 0.9900, 1.0100, 1.0200, 1.0000, 0.9400, 0.8500, 0.7000, 0.6600, 0.7010, 0.7219, 0.6864, 0.5860, 0.4264, 0.2235, 0.0000, -0.1565, -0.2985, -0.4102, -0.4805, -0.5053, -0.4907, -0.4597, -0.2299, 0.0000 ] cd_extrap = [ 0.1770, 0.2132, 0.3173, 0.4758, 0.6686, 0.8708, 1.0560, 1.1996, 1.2818, 1.2900, 1.2818, 1.1996, 1.0560, 0.8708, 0.6686, 0.4758, 0.3158, 0.0390, 0.0233, 0.0131, 0.0134, 0.0119, 0.0122, 0.0116, 0.0144, 0.0146, 0.0162, 0.0274, 0.0303, 0.0369, 0.0509, 0.0648, 0.0776, 0.0917, 0.0994, 0.2306, 0.3142, 0.3186, 0.4758, 0.6686, 0.8708, 1.0560, 1.1996, 1.2818, 1.2900, 1.2818, 1.1996, 1.0560, 0.8708, 0.6686, 0.4758, 0.3173, 0.2132, 0.1770 ] cm_extrap = np.linspace(0, 0, len(cd_extrap)) # re-interpolate b/c angles of attack are different cl = np.interp(alpha_extrap, newpolar.alpha, newpolar.cl) cd = np.interp(alpha_extrap, newpolar.alpha, newpolar.cd) cm = np.interp(alpha_extrap, newpolar.alpha, newpolar.cm) # test equality np.testing.assert_allclose(cl, cl_extrap, atol=1.5e-4) np.testing.assert_allclose(cd, cd_extrap, atol=1.5e-4) np.testing.assert_allclose(cm, cm_extrap, atol=5e-3)
def test_extrap1_w_airfoil(self): cdmax = 1.29 af = Airfoil([self.polar]) newaf = af.extrapolate(cdmax=cdmax) newpolar = newaf.polars[0] alpha_extrap = [-180, -170, -160, -150, -140, -130, -120, -110, -100, -90, -80, -70, -60, -50, -40, -30, -20, -10.1, -8.2, -6.1, -4.1, -2.1, 0.1, 2, 4.1, 6.2, 8.1, 10.2, 11.3, 12.1, 13.2, 14.2, 15.3, 16.3, 17.1, 18.1, 19.1, 20.1, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180] cl_extrap = [0.0000, 0.2299, 0.4597, 0.4907, 0.5053, 0.4805, 0.4102, 0.2985, 0.1565, 0.0000, -0.1565, -0.2985, -0.4102, -0.4805, -0.5053, -0.4907, -0.4637, -0.6300, -0.5600, -0.6400, -0.4200, -0.2100, 0.0500, 0.3000, 0.5400, 0.7900, 0.9000, 0.9300, 0.9200, 0.9500, 0.9900, 1.0100, 1.0200, 1.0000, 0.9400, 0.8500, 0.7000, 0.6600, 0.7010, 0.7219, 0.6864, 0.5860, 0.4264, 0.2235, 0.0000, -0.1565, -0.2985, -0.4102, -0.4805, -0.5053, -0.4907, -0.4597, -0.2299, 0.0000] cd_extrap = [0.1770, 0.2132, 0.3173, 0.4758, 0.6686, 0.8708, 1.0560, 1.1996, 1.2818, 1.2900, 1.2818, 1.1996, 1.0560, 0.8708, 0.6686, 0.4758, 0.3158, 0.0390, 0.0233, 0.0131, 0.0134, 0.0119, 0.0122, 0.0116, 0.0144, 0.0146, 0.0162, 0.0274, 0.0303, 0.0369, 0.0509, 0.0648, 0.0776, 0.0917, 0.0994, 0.2306, 0.3142, 0.3186, 0.4758, 0.6686, 0.8708, 1.0560, 1.1996, 1.2818, 1.2900, 1.2818, 1.1996, 1.0560, 0.8708, 0.6686, 0.4758, 0.3173, 0.2132, 0.1770] # re-interpolate b/c angles of attack are different cl = np.interp(alpha_extrap, newpolar.alpha, newpolar.cl) cd = np.interp(alpha_extrap, newpolar.alpha, newpolar.cd) # test equality np.testing.assert_allclose(cl, cl_extrap, atol=1.5e-4) np.testing.assert_allclose(cd, cd_extrap, atol=1.5e-4)
r_over_R, chord_over_r, tsr, alpha_max_corr=alpha_max_corr, alpha_linear_min=alpha_linear_min, alpha_linear_max=alpha_linear_max, ) # 4 --------- # 5 --------- cdmax = 1.3 # compute a 3D corrected and extended airfoil 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()
af3D_ex2 = af.correction3D(r_over_R, chord_over_r, tsr, alpha_max_corr=alpha_max_corr, alpha_linear_min=alpha_linear_min, alpha_linear_max=alpha_linear_max) # 4 --------- # 5 --------- cdmax = 1.3 # compute a 3D corrected and extended airfoil 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()