示例#1
0
class CrossSectionStructureVT(VariableTree):
    """
    Container for a cross-sectional definition of the
    internal structure of a blade.
    """
    s = Float()
    regions = List(desc='List of names of regions in the cross section')
    webs = List(desc='List of names of regions in the cross section')
    materials = Dict(desc='Dictionary of MaterialProps vartrees')
    airfoil = VarTree(AirfoilShape(), desc='Cross sectional shape')
    DPs = List(desc='Region division points (nregion + 1)')

    def add_region(self, name):

        self.add(name, VarTree(Region()))
        self.regions.append(name)
        return getattr(self, name)

    def add_web(self, name):

        self.add(name, VarTree(Region()))
        self.webs.append(name)
        return getattr(self, name)

    def add_material(self, name, material):

        if name in self.materials.keys():
            return
        else:
            self.materials[name] = material

        return self.materials[name]
    def test_airfoilshape(self):

        af = AirfoilShape(afs[0])
        aff = af.redistribute(20, even=True)

        self.assertEqual(
            np.testing.assert_array_almost_equal(
                af.LE, np.array([-1.76645007e-05,
                                 -2.90461132e-04]), decimal=6), None)
        self.assertAlmostEqual(af.sLE, 0.49898457668804924, places=6)
        self.assertEqual(
            np.testing.assert_array_almost_equal(aff.points,
                                                 aff_data,
                                                 decimal=6), None)
示例#3
0
def redistribute_airfoil_example():

    af = AirfoilShape(np.loadtxt('data/ffaw3301.dat'))

    print 'number of points, ni: ', af.ni
    print 'Airfoil leading edge (x, y): ', af.LE
    print 'Airfoil leading edge curve fraction (s): ', af.sLE

    plt.figure()
    plt.plot(af.points[:, 0], af.points[:, 1], '-x', label='original')

    # redistribute 200 points along the surface
    # and let the LE cell size be determined based on curvature
    aff = af.redistribute(200, dLE=True)

    plt.plot(aff.points[:, 0], aff.points[:, 1], '-<', label='redistributed')

    plt.plot(aff.LE[0], aff.LE[1], 'o', label='LE')

    plt.legend(loc='best')
    plt.axis('equal')
    plt.show()