コード例 #1
0
    def test_blend1_w_airfoil(self):

        af1 = Airfoil([self.polar1])
        af2 = Airfoil([self.polar2])
        af3 = af1.blend(af2, 0.5)
        polar3 = af3.polars[0]  # kind of bad practice for me to be accessing this

        alpha_blend = [-3.04, -2.03, -1.01, 0.01, 1.03, 2.05, 3.07, 4.09,
                       5.11, 6.13, 7.14, 8.16, 9.17, 10.18, 11.18, 12.19,
                       13.18, 14.18, 15.18, 16.17, 17.14, 18.06, 19.06, 20.07,
                       25]
        cl_blend = [-0.078, 0.048, 0.158, 0.265, 0.372, 0.479, 0.589, 0.695,
                    0.801, 0.894, 0.971, 1.041, 1.101, 1.159, 1.162, 1.205,
                    1.252, 1.225, 1.181, 1.109, 1.045, 0.992, 0.875, 0.877,
                    1.200]
        cd_blend = [0.0134, 0.0117, 0.0125, 0.0147, 0.0150, 0.0154, 0.0162,
                    0.0172, 0.0178, 0.0190, 0.0210, 0.0237, 0.0273, 0.0373,
                    0.0598, 0.0497, 0.0490, 0.0737, 0.0822, 0.1131, 0.1620,
                    0.3101, 0.3101, 0.3101, 0.4000]
        cm_blend = [-0.00405, -0.00475, -0.00165, -0.0099, -0.0249, -0.0314,
                    -0.03755, -0.043, -0.0481, -0.04555, -0.03625, -0.0301,
                    -0.02825, -0.0303, -0.03415, -0.0362, -0.0378, -0.03955,
                    -0.06905, -0.11125, -0.11985, -0.11115,-0.10245, -0.09375,
                    -0.072]

        # re-interpolate b/c angles of attack are different
        cl3 = np.interp(alpha_blend, polar3.alpha, polar3.cl)
        cd3 = np.interp(alpha_blend, polar3.alpha, polar3.cd)
        cm3 = np.interp(alpha_blend, polar3.alpha, polar3.cm)

        # should be within 1e-3
        np.testing.assert_allclose(cl3, cl_blend, atol=1e-3)
        np.testing.assert_allclose(cd3, cd_blend, atol=1e-3)
        np.testing.assert_allclose(cm3, cm_blend, atol=1e-3)
コード例 #2
0
    def test_stall1_w_airfoil(self):
        R = 2.4
        r = 0.25 * R
        chord = 0.18
        Omega = 200 * pi / 30
        Uinf = 10.0
        tsr = Omega * R / Uinf

        af = Airfoil([self.polar])
        newaf = af.correction3D(r / R,
                                chord / r,
                                tsr,
                                alpha_max_corr=30,
                                alpha_linear_min=-4,
                                alpha_linear_max=4)
        _, _, cl_grid, cd_grid, cm_grid = newaf.createDataGrid()

        newpolar = newaf.polars[0]

        cl_3d = [
            -0.8466, -0.7523, -0.6420, -0.5342, -0.4302, -0.3284, -0.2276,
            -0.1303, -0.0404, 0.0618, 0.2191, 0.3321, 0.4336, 0.5501, 0.6755,
            0.7363, 0.8101, 0.8973, 0.9810, 1.0640, 1.1450, 1.2098, 1.2682,
            1.3281, 1.3731, 1.3088, 1.3159, 1.3534, 1.4010, 1.4515, 1.9140,
            1.8857, 1.6451
        ]
        cd_3d = [
            0.0399, 0.0334, 0.0316, 0.0293, 0.0269, 0.0254, 0.0246, 0.0246,
            0.0246, 0.0252, 0.0249, 0.0200, 0.0167, 0.0157, 0.0174, 0.0183,
            0.0212, 0.0255, 0.0303, 0.0367, 0.0465, 0.0615, 0.0800, 0.1047,
            0.1301, 0.1695, 0.2047, 0.2384, 0.2728, 0.3081, 0.8097, 1.2625,
            1.6280
        ]
        cm_test = [[-0.0037], [-0.0044], [-0.0051], [0.0018], [-0.0216],
                   [-0.0282], [-0.0346], [-0.0405], [-0.0455], [-0.0507],
                   [-0.0404], [-0.0321], [-0.0281], [-0.0284], [-0.0322],
                   [-0.0361], [-0.0363], [-0.0393], [-0.0398], [-0.0983],
                   [-0.1242], [-0.1155], [-0.1068], [-0.0981], [-0.0894],
                   [-0.0807], [-0.072], [-0.0633], [-0.054], [-0.045],
                   [-0.036], [-0.22], [-0.13]]

        # test equality
        np.testing.assert_allclose(newpolar.cl, cl_3d, atol=1e-3)
        np.testing.assert_allclose(newpolar.cd, cd_3d, atol=1e-3)
        np.testing.assert_allclose(cm_grid, cm_test, atol=1e-3)
コード例 #3
0
    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)
コード例 #4
0
ファイル: example.py プロジェクト: ptrbortolotti/WEIS
# TODO : the input files for this shouldn't be duplicated.
# Figure out how best to have them accessible here AND for test_ccblade

# Imports and loading an airfoil
import os
import numpy as np
from wisdem.airfoilprep import Polar, Airfoil

airfoil = Airfoil.initFromAerodynFile("../_airfoil_files/DU21_A17.dat")
# ------

# first polar
Re = 7e6
alpha = [
    -14.50,
    -12.01,
    -11.00,
    -9.98,
    -8.12,
    -7.62,
    -7.11,
    -6.60,
    -6.50,
    -6.00,
    -5.50,
    -5.00,
    -4.50,
    -4.00,
    -3.50,
    -3.00,
    -2.50,