Exemple #1
0
    def calibrate(self,
                  obj,
                  airfoil: Airfoil,
                  calibrate_x: bool = False,
                  calibrate_y: bool = True,
                  calibrate_w: bool = False):
        """
        calibrates the splines to match the airfoil as good as possible (lstsq)
        """
        mapping, lower_bounds_upper_spline, upper_bounds_upper_spline = self._get_bounds_and_mapping(
            calibrate_x, calibrate_y, calibrate_w, upper=True)
        mapping, lower_bounds_lower_spline, upper_bounds_lower_spline = self._get_bounds_and_mapping(
            calibrate_x, calibrate_y, calibrate_w, upper=False)
        bounds_upper_spline = (lower_bounds_upper_spline,
                               upper_bounds_upper_spline)
        bounds_lower_spline = (lower_bounds_lower_spline,
                               upper_bounds_lower_spline)

        upper_array = obj.Proxy.get_upper_array(obj)
        lower_array = obj.Proxy.get_lower_array(obj)
        new_upper_mat = self._calibrate_one_side(
            upper_array, mapping, bounds_upper_spline,
            airfoil.get_upper_data()[::-1])
        new_lower_mat = self._calibrate_one_side(lower_array, mapping,
                                                 bounds_lower_spline,
                                                 airfoil.get_lower_data())
        obj.upper_array = new_upper_mat.tolist()
        obj.lower_array = new_lower_mat.tolist()
Exemple #2
0
def flap_objective(x):
    af = Airfoil()
    af.read_txt('GA37A315mod_reworked.txt')
    flapRatio = 0.3 
#    lipLen    = 0.13 #0.1 - 0.27 
#    leRad     = 0.15 #0.05 - 0.25
#    gap       = 0.02 #0.005;0.02
#    overlap   = -0.02 #-0.02 0.02
    defl      = 35
#    vratio1   = 0.73 #0.5 0.95
#    vratio2   = 1.3 #1.05 1.5
#    vratio3   = 0.55 #0.2 0.9
    lipLen = x[0]
    leRad = x[1]
    gap = x[2]
    overlap = x[3]
    vratio1 = x[4]
    vratio2 = x[5]
    vratio3 = x[6]
    try:
        Flap  = flap_geometry(af,flapRatio,lipLen, leRad, gap, overlap, defl,vratio1,vratio2,vratio3)
        polar = calc_Jpolar(0.06,3e6,Flap)
        clmax = ny.max(polar.cl)
        #print clmax
        return -clmax,[],[]
    except:
        return 100,[],[]
Exemple #3
0
    def __init__(self, OC, AoA0=0., Sref=1., Lref=1., rel_thick=0.0, sweep=0.0, pcop=0.25, Ka=0.95, grad_active=True):
        '''
        Constructor for airfoils
        @param AoA0:angle of attack of null lift
        @param Cd0 : drag
        @param Cm0 : pitch moment
        @param relative_thickness : relative thickness for addition of a correction of ClAlpha
        @param Sref : reference surface
        @param Lref : reference length
        '''
        if rel_thick<0. or rel_thick>0.30:
            raise Exception, "Relative thickness must be >0. and <0.30"
        
        Airfoil.__init__(self, OC, Lref=Lref, Sref=Sref, grad_active=grad_active)
        
        self.__AoA0_deg  = None
        self.__AoA0      = None
        self.set_AoA0(AoA0)
        
        self.__Ka        = None
        self.set_Ka(Ka)

        self.__rel_thick      = None
        self.__rel_thick_grad = None
        self.set_rel_thick(rel_thick)
        
        self.__sweep          = None
        self.__sweep_grad     = None
        self.set_sweep(sweep)
        
        self.pcop        = pcop
Exemple #4
0
    def __init__(self, database=None, relative_thickness=0.15, interpolator='2DSpline',Sref=1., Lref=1.):
        '''
        Constructor for a polar of a simple airfoil.
        @param Sref : reference surface
        @param Lref : reference length        
        @param database : the dataBase in which the discrete values are stored, or None
        '''
        Airfoil.__init__(self,Sref,Lref,relative_thickness)
        
#         self.__database=database
#         self.__fd_database=Database()
        
        if interpolator == '2DSpline':
                print "building new spline 2D Interpolator"
                x,y=self.__database.get_all_in_outs(self.DATABASE_ABSCISSA_TAG,self.DATABASE_AERO_COEFS_TAG)
                y=array(y).T
                x=array(x)
                scale=array([1.,1.])
                self.__cl_interpolator=Spline2D_interpolator(array(x),array(y[0,:]),scale)
                self.__cd_interpolator=Spline2D_interpolator(array(x),array(y[1,:]),scale)
                self.__cm_interpolator=Spline2D_interpolator(array(x),array(y[2,:]),scale)
                print "Done."
        else:
            self.__cl_interpolator=aero_coefs_interpolator[0]
            self.__cd_interpolator=aero_coefs_interpolator[1]
            self.__cm_interpolator=aero_coefs_interpolator[2]
Exemple #5
0
    def __init__(self, OC, surrogate_model, relative_thickness=.12, camber=0., Sref=1., Lref=1., sweep=0., surrogate_fcs=None):

        Airfoil.__init__(self, OC, Sref, Lref, relative_thickness, sweep, camber)
        if not surrogate_fcs:
            self.__coefs = SurrogateCoefs(surrogate_model)
        else:
            self.__coefs = surrogate_fcs
        self.__surrogate_model = surrogate_model
    def __init__(self, controls=None, proxy=None, 
                 pos = Vector3(0,0,0), 
                 attitude = Quaternion(0.5, -0.5, 0.5, 0.5), 
                 velocity = Vector3(0,0,0), 
                 thrust = 0, ident=None):
	global cterrain
	Airfoil.__init__(self, pos, attitude, velocity, thrust, cterrain)
	ControlledSer.__init__(self, MyAirfoil.TYP, ident, proxy)
	self.setControls(controls)
Exemple #7
0
    def __init__(self):
        super().__init__()
        self.af_left = Airfoil()
        self.af_right = Airfoil()
        self.it_point_list_right = []
        self.it_point_list_left = []

        self.af_left.data_changed.connect(self.connect_airfoils)
        self.af_right.data_changed.connect(self.connect_airfoils)
Exemple #8
0
 def __init__(self,
              controls=None,
              proxy=None,
              pos=Vector3(0, 0, 0),
              attitude=Quaternion(0.5, -0.5, 0.5, 0.5),
              velocity=Vector3(0, 0, 0),
              thrust=0,
              ident=None):
     global cterrain
     Airfoil.__init__(self, pos, attitude, velocity, thrust, cterrain)
     ControlledSer.__init__(self, MyAirfoil.TYP, ident, proxy)
     self.setControls(controls)
Exemple #9
0
    def __init__(self,
                 OC,
                 surrogate_model,
                 relative_thickness=.12,
                 camber=0.,
                 Sref=1.,
                 Lref=1.,
                 sweep=0.,
                 surrogate_fcs=None):

        Airfoil.__init__(self, OC, Sref, Lref, relative_thickness, sweep,
                         camber)
        if not surrogate_fcs:
            self.__coefs = SurrogateCoefs(surrogate_model)
        else:
            self.__coefs = surrogate_fcs
        self.__surrogate_model = surrogate_model
 def __init__(self, OC, AoA0=0., Cm0=0.0, Sref=1., Lref=1., rel_thick=0.0, sweep=0.0, Ka=0.95):
     '''
     Constructor for airfoils
     @param AoA0:angle of attack of null lift
     @param Cd0 : drag
     @param Cm0 : pitch moment
     @param relative_thickness : relative thickness for addition of a correction of ClAlpha
     @param Sref : reference surface
     @param Lref : reference length
     '''
     if rel_thick<0. or rel_thick>0.25:
         raise Exception, "Relative thickness must be >0. and <0.25"
     
     Airfoil.__init__(self,OC, Sref,Lref,rel_thick,sweep)
     self.__AoA0 = AoA0*np.pi/180.
     self.__Cm0  = Cm0
     self.__Ka   = Ka
Exemple #11
0
 def __init__(self, OC, Sref=1., Lref=1., y_pos=None, grad_active=False):
     '''
     Constructor for airfoils
     @param y_pos : span-wise position for interpolation
     @param Sref  : reference surface
     @param Lref  : reference length
     '''
     
     Airfoil.__init__(self, OC, Lref=Lref, Sref=Sref, grad_active=grad_active)
     
     self.y_pos = y_pos
     
     self.__y_def_list    = None
     self.__file_def_list = None
     self.__interp_list   = None
     
     self.__index_p       = None
     self.__index_m       = None
     self.__fact_p        = None
     self.__fact_m        = None
Exemple #12
0
def plot_results():
#    xBest =[0.18978,0.24883,0.00824,0.02996,0.50002,1.37683,0.20097]
    #xBest =[0.18913399,0.13287908,0.00548619,0.02999233,0.50557791,1.49805884,0.20113115]
    xBest=[0.19417077,0.24936138,0.01010853,0.0299996,0.50077753,1.39159708,0.2021984]
    af = Airfoil()
    af.read_txt('GA37A315mod_reworked.txt')
    FlapOpt = flap_geometry(af, 0.3, xBest[0], xBest[1],xBest[2],xBest[3],35,xBest[4],xBest[5],xBest[6])
    mainSec, flap, flap0 = FlapOpt
    flap1 = Curves.rotate2D(flap,[0.785,-0.135],-35)
    mainSec, flap, flap0 = FlapOpt
   # write_txt(FlapOpt,'KLA100flap_20121213.txt')
    plt.figure(1)
    plt.hold(True)
    plt.plot(mainSec[:,0],mainSec[:,1])
    plt.plot(flap[:,0],flap[:,1])
    plt.plot(flap0[:,0],flap0[:,1])
    #plt.axis([0,1.1,-.5,.5])
    plt.axis('equal')
    plt.grid(True)
    plt.show()
Exemple #13
0
def generator():
    """
    generates airofil data for defined set of airfoils
    consider paths
    
    """
    for name in ['mh114', 'mh115', 'mh117']:
        airfoil = Airfoil(
            'XFOIL',
            r'E:/propeller/mh_airofils/{}/{}xfoil.txt'.format(name, name))
        generate(airfoil,
                 r'E:\propeller\qprop\airfoildata\{}.txt'.format(name))
Exemple #14
0
def test_func():
    af = Airfoil()
    af.read_txt('GA37A315mod_reworked.dat')
    print af.up, af.coord
    flapRatio = 0.3 
    lipLen    = 0.1643088
    leRad     = 0.14054948
    gap       = 0.0157
    overlap   = -0.02
    defl      = 35
    vratio1   = 0.77033947
    vratio2   = 1.39164569
    vratio3   = 0.55
    Flap = flap_geometry(af, 0.3, lipLen, leRad,gap,overlap,35,vratio1,vratio2,vratio3)
    mainSec, flap = Flap
    polar = calc_Jpolar(0.06,3e6,Flap)
    
    plt.figure(1)
    plt.hold(True)
    plt.plot(mainSec[:,0],mainSec[:,1])
    plt.plot(flap[:,0],flap[:,1])
    plt.axis([0,1.1,-.5,.5])
    plt.grid(True)
    plt.show()
Exemple #15
0
 def get_airfoil(self, obj):
     return Airfoil.compute_vandevooren(obj.tau, obj.epsilon,
                                        obj.numpoints * 2 + 1)
Exemple #16
0
class ConnectedAirfoilsModel(QtCore.QObject):
    data_changed = QtCore.pyqtSignal()

    def __init__(self):
        super().__init__()
        self.af_left = Airfoil()
        self.af_right = Airfoil()
        self.it_point_list_right = []
        self.it_point_list_left = []

        self.af_left.data_changed.connect(self.connect_airfoils)
        self.af_right.data_changed.connect(self.connect_airfoils)

    def connect_airfoils(self):
        if (self.af_left.loaded and self.af_right.loaded):
            degrees = list(
                set(self.af_left.get_degree_list() +
                    self.af_right.get_degree_list()))
            degrees.sort()

            self.it_point_list_right = self.af_right.get_interpolated_point_list(
                degrees)
            self.it_point_list_left = self.af_left.get_interpolated_point_list(
                degrees)

            self.data_changed.emit()

    def generate_gcode(self, feedrate):
        gcode = list()
        if (self.af_left.loaded and self.af_right.loaded):
            # turn on the spindle (hotwire) at the given temp
            gcode.append("M3 S" + str(control_widget.temp_spbox.value()) +
                         "\n")
            gcode.append("M7\n")
            gcode.append("F%.2f\n" % feedrate)

            # example coordinate for cutting block to size:
            # (x, y) -> x = x and u, y = y and z
            if (control_widget.cutBlockToSizeCheckbox.isChecked()):
                # (0, 0)
                gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" % (0, 0, 0, 0))

                # (0, block height)
                gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" %
                             (0, control_widget.block_height_spbox.value(), 0,
                              control_widget.block_height_spbox.value()))

                # (block length, block height)
                gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" %
                             (control_widget.block_length_spbox.value(),
                              control_widget.block_height_spbox.value(),
                              control_widget.block_length_spbox.value(),
                              control_widget.block_height_spbox.value()))

                # (block length, 0)
                gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" %
                             (control_widget.block_length_spbox.value(), 0,
                              control_widget.block_length_spbox.value(), 0))

                # (block length, block height)
                gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" %
                             (control_widget.block_length_spbox.value(),
                              control_widget.block_height_spbox.value(),
                              control_widget.block_length_spbox.value(),
                              control_widget.block_height_spbox.value()))

                # (0, block height)
                gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" %
                             (0, control_widget.block_height_spbox.value(), 0,
                              control_widget.block_height_spbox.value()))

                # (0, 0)
                gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" % (0, 0, 0, 0))

            # Cut the wing profiles
            gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" %
                         (self.af_right.start[0], self.af_right.start[1],
                          self.af_left.start[0], self.af_left.start[1]))

            for i in range(len(self.it_point_list_right[0])):
                gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" %
                             (self.it_point_list_right[0][i],
                              self.it_point_list_right[1][i],
                              self.it_point_list_left[0][i],
                              self.it_point_list_left[1][i]))

            gcode.append("G01 X%.3f Y%.3f U%.3f Z%.3f\n" %
                         (self.af_right.end[0], self.af_right.end[1],
                          self.af_left.end[0], self.af_left.end[1]))

        return gcode
Exemple #17
0
    def foilProps(self):
        # -------------------------------------------------------------------------------
        # section to define airfoils and local properties
        # -------------------------------------------------------------------------------
        def foilname(t):
            """ return airfoil name for given thickness, in % chord """
            #            thicknesses = np.array([9.8, 11, 13, 14.7, 16.2])
            #            names = ['mh117','mh115', 'mh114','mh113','mh112' ]

            thicknesses = np.array([.05])
            names = ['mh117']
            return 'mh117'

            a = np.insert(thicknesses, 0, 0)
            thresholds = thicknesses - 0.5 * (thicknesses - a[:-1])
            for i in range(len(thresholds) - 1):
                if t < thresholds[i + 1] and t > thresholds[i]:
                    return names[i]
            return names[i + 1]

        self.airfoils = []
        self.airfoilsdata = []  # use this to load preevaluated airofil data
        # list of airfoil objects for each radial postion

        for i in range(self.N_stations):
            #            print(foilname(self.t[i] / self.chord[i]*100))
            self.airfoils.append(
                Airfoil('XFOIL',
                        r'E:/propeller/mh_airofils/{}/{}xfoil.txt'.format(
                            foilname(self.ts[i] * 100),
                            foilname(self.ts[i] * 100)),
                        origin=0))

        for name in ['mh112', 'mh113', 'mh114', 'mh115', 'mh117']:
            self.airfoilsdata.append(
                np.loadtxt(
                    r'E:\propeller\qprop\airfoildata\{}.txt'.format(name)))

        def returnX(name):
            i = 0
            for nm in ['mh112', 'mh113', 'mh114', 'mh115', 'mh117']:
                if nm == name:
                    return self.airfoilsdata[i]
                i += 1

        # arrays of airofil properties
        self.Cl0 = np.zeros(self.N_stations)
        self.Cla = np.zeros(self.N_stations)
        self.Cd0 = np.zeros(self.N_stations)
        self.ClCd0 = np.zeros(self.N_stations)
        self.Cd2u = np.zeros(self.N_stations)
        self.Cd2l = np.zeros(self.N_stations)

        self.m = self.rs * 2 * self.rpm * np.pi / 60. / 340.
        self.re = self.m * 340 * self.chords / 1.42e-5

        print('\nr [m]\tchord\tfoil\tmach\tRe')
        for i in range(self.N_stations):
            print('{:.2f}\t{:.2f}\t{}\t{:.2f}\t{:.1f}'.format(
                self.rs[i], self.chords[i], foilname(self.ts[i] * 100),
                self.m[i], self.re[i]))

        for i in range(self.N_stations):
            # first option when dont have airfoil data
            # second uses preevaluated airofil polar data

            #            self.Cl0[i], self.Cla[i], self.Cd0[i], self.ClCd0[i], self.Cd2u[i], self.Cd2l[i] = self.airfoils[i].qpropData(self.m[i], self.re[i])
            self.Cl0[i], self.Cla[i], self.Cd0[i], self.ClCd0[i], self.Cd2u[
                i], self.Cd2l[i] = readQPolar(
                    self.re[i],
                    X=returnX(foilname(self.ts[i] / self.chords[i] * 100)))

        self.Clmin = np.ones(self.N_stations) * .2
        self.Clmax = np.ones(self.N_stations) * 1
        self.Reref = self.chords * self.rs
Exemple #18
0
import numpy as np
import matplotlib.pyplot as plt

wind_speed = knots(10)
blade_speed = rpm(140)

ax = plt.subplot(1, 1, 1)
ax.set_xlabel('Wind Speed (knots)')
ax.set_ylabel('Blade Speed (rpm)')

import time
start_time = time.time()
i = 0

path = glob(r'C:\Users\mlip814\airfoil_data\airfoil_data\*')[56]
airfoil = Airfoil.from_folder(path, 100000, 9)

for n in (2, 3, 6, 12):
    blade = Blade(airfoil, n)
    torque = resistance(blade_speed) / n  # (per blade)
    blade.design(knots(10), torque, rpm(140))

    wind_speeds = np.linspace(8, 12, 20)
    results = [
        blade.solve(knots(wind_speed), system) for wind_speed in wind_speeds
    ]
    blade_speeds = [rads(result[0]) for result in results]

    ax.plot(wind_speeds, blade_speeds, label=str(n))

ax.legend()
 def genAirfoil(self, t=0):
     """ generate airfoil"""
     return Airfoil('XFOIL', self.xfoil, t=t)
Exemple #20
0
 def get_airfoil(self, obj, numpoints=50, curvature_factor=0.5):
     coordinates = self.discretize(obj, numpoints, curvature_factor)
     return Airfoil(coordinates)
Exemple #21
0
 def get_airfoil(self, obj):
     if hasattr(self, "_airfoil") and self._airfoil:
         return self._airfoil
     else:
         self._airfoil = Airfoil.import_from_dat(obj.filename)
         return self._airfoil
Exemple #22
0
def testFcn():
    path = paths.CFD_paths('GA_opt')
    cruise = Flight_conditions(1500, 48.92)
    af = Airfoil()
    af.CST_airfoil(ny.array([0.178551,0.273254,0.268906,0.226346]),ny.array([-0.178551,-0.101338,-0.255260,-0.043527]))
    af.write_airfoil_txt('optAirfoil.dat')
    af.create_af_CAT(save = path.file_igs)
    Airfoil_mesh(path,cruise)
    Airfoil_mesh.yplus_wall = 1.0
    fluent = Solver(path,cruise)
    fluent.turb_model = 'ke-realizable'
    for alpha in range(10, 21, 2):
        fluent.run_fluent(alpha)
    af.polar.Re = cruise.Re
    af.polar.M = cruise.Mach
    af.polar.alpha = fluent.alpha
    af.polar.CL = fluent.cl
    af.polar.CD = fluent.cd
    af.polar.CM = fluent.cm
    #af.calc_Jpolar(0.1463,2999951,ny.array([-2,20,2.]))
    af.write_polar_txt(r'D:\3. Projects\afOpt\experimental data\GAopt.pol')

#def batch_calculation():
    designs = open(r'D:\3. Projects\afOpt\results\CFD_20120719\Designs.txt','rt')
    Au = ny.zeros([4,1])
    Al = ny.zeros([4,1])
    lines = designs.readlines()
    designs.close()
    landing = Flight_conditions(0, 32.5)
    path = paths.CFD_paths()
    results = r'D:\3. Projects\afOpt\results\CFD_20120719'
    for N,line in enumerate(lines):
        path.set_name(('DoE_%d'%N))
        segLine = line.split()
        Au[0] = float(segLine[0])
        Au[1] = float(segLine[1])
        Au[2] = float(segLine[2])
        Au[3] = float(segLine[3])
        Al[0] = -float(segLine[0])
        Al[1] = float(segLine[4])
        Al[2] = float(segLine[5])
        Al[3] = float(segLine[6])

        af = Airfoil()
        af.name = ('DoE %d'%N)
        af.CST_airfoil(Au,Al)
        af.create_af_CAT(save = path.file_igs)
        Airfoil_mesh(path,landing)
        Airfoil_mesh.yplus_wall = 1.0
        fluent = Solver(path,landing)
        fluent.turb_model = 'ke-realizable'
        alphaSeq = ny.array([10, 12, 14, 16, 18, 20])
        for alpha in alphaSeq:
            fluent.run_fluent(alpha)
        af.polar.Re = landing.Re
        af.polar.M = landing.Mach
        af.polar.alpha = fluent.alpha
        af.polar.cl = fluent.cl
        af.polar.cd = fluent.cd
        af.polar.cm = fluent.cm
        af.write_airfoil_txt(('%s\\airfoil_%d_coord.dat'%(results,N)))
        af.write_polar_txt(('%s\\airfoil_%d.pol'%(results,N)))
Exemple #23
0
from airfoil import Airfoil

if __name__ == "__main__":
    af = Airfoil()
    af.angle = 30
    af.angle = 30
    af.nodes =200
    af.refinement = 3
    af.samples = 10
    af.viscosity = 0.0001
    af.speed = 10.0
    af.time = 1

    af.execute()
Exemple #24
0
 def get_airfoil(self, obj):
     return Airfoil.compute_joukowsky(obj.real_part + 1j * obj.imag_part,
                                      obj.numpoints * 2 + 1)
def create_propeller(x,afOld):
    diameter = 1.75
    hubDiameter = 0.3
    hubX = hubDiameter / diameter
    baseAfPath = 'clark-Y.txt'

    chordX = array([hubX,0.35,0.5,0.75,0.95])
    pitchX = array([hubX,0.35,0.5,0.75,0.95])
    thickX = array([hubX,0.35,0.5,0.75,0.95])
    xnew = linspace(hubX,0.95,10)
    betaSet = pitchX[3]
    n1,n2,n3 = len(chordX), len(pitchX), len(thickX)
    chordY = x[0:n1]
    pitchY = x[n1:n1+n2]
    thickY = x[n1+n2:]

    method = 'spline'
    chord = _interpolate(chordX,chordY,xnew,method)
    pitch = _interpolate(pitchX,pitchY,xnew,method)
    thick = _interpolate(thickX,thickY,xnew,method)
    
    prop = propeller()
    if afOld==None:
        af = list()
        for tc in thick:
            afnew = Airfoil()
            afnew.read_txt(baseAfPath)
            afnew.analyze_geometry()
            afnew.scale_thickness(tc,False)
            afnew.build_aero_table(alphaSeq=[-40.0,40.0,1.0])
            af.append(afnew)
        prop.airfoil = af
    else:
        prop.airfoil = afOld

    prop.name = 'MDO_project'
    prop.diameter = diameter
    prop.hubDiameter = hubDiameter
    prop.chord = chord
    prop.beta = pitch
    prop.x = xnew
    prop.r = xnew*diameter/2.0
    prop.radius = diameter/2.0
    prop.numBlades = 3.0
    prop.thickness = thick
    prop.numStations = len(xnew)
    prop.analyze_geometry()
    prop.set_beta(betaSet)
    
#    if show:
#        fig = plt.figure(1)
#        ax1 = fig.add_subplot(311)
#        ax1.grid(True)
#        ax1.hold(True)
#        ax1.plot(xnew,chord)
#        ax2 = fig.add_subplot(312)
#        ax2.grid(True)
#        ax2.plot(xnew,pitch)
#        ax3 = fig.add_subplot(313)
#        ax3.grid(True)
#        ax3.plot(xnew,thick)
#        plt.show()
    return prop
Exemple #26
0
 def get_airfoil(self, obj):
     return Airfoil.compute_trefftz_kutta(
         obj.real_part + 1j * obj.imag_part, obj.tau, obj.numpoints * 2 + 1)
Exemple #27
0
 def get_airfoil(self, obj):
     return Airfoil.compute_naca(obj.naca_digits, obj.numpoints)
Exemple #28
0
 def _hitGround(self):
     Airfoil._hitGround(self)
     if self._velocity:
         self.__play_tire = True
         self.markChanged(full_ser=True)
Exemple #29
0
    def _hitGround(self):
	    Airfoil._hitGround(self)
	    if self._velocity:
		    self.__play_tire=True
		    self.markChanged(full_ser=True)
Exemple #30
0
def flap_geometry2(x=None,args=1):
    
    if x==None:
        x = ny.array([0.15, 0.3, 0.05, 0.5, 0.1, 0.5, 0.02, 0.02])
    
    flapRatio = 0.7
    defl = 35.0
    airfoil = Airfoil()
    airfoil.read_txt('aiaa_cfd_final_optimum.txt')
    offset = 0.005 # main section flap offset
    lipTe  = 0.0033 # trailing edge thickness
    rTe    = 0.01 # trailing edge radius

    exitLipLen   = x[0]
    leRadPos     = x[1]
    entryLipLen  = x[2]
    v1           = x[3]
    v2           = x[4]
    v3           = x[5]
    gap          = x[6]
    overlap      = x[7]
    
    upNode = ny.zeros([4,2])
    loNode = ny.zeros([4,2])

    upCurve = Curves.xyCurve(airfoil.upPts)
    loCurve = Curves.xyCurve(airfoil.loPts)

    thickness = upCurve(flapRatio)-loCurve(flapRatio) #local thickness
    leRad = v2 * thickness # V2 length
    leRadPos = leRadPos * thickness + loCurve(flapRatio)

    upNode[0,0] = flapRatio + exitLipLen
    upNode[0,1] = upCurve(upNode[0,0])
    
    tan0 = upCurve.tan(upNode[0,0])
    upNode[1,0] = upNode[0,0] - exitLipLen*v1
    upNode[1,1] = -(upNode[0,0]-upNode[1,0])*tan0 + upNode[0,1]
    
    loNode[0,0] = flapRatio + entryLipLen
    loNode[0,1] = loCurve(loNode[0,0])
    
    tan1 = loCurve.tan(loNode[0,0])
    loNode[1,0] = loNode[0,0] - entryLipLen*v3
    loNode[1,1] = loNode[0,1] - (loNode[0,0]-loNode[1,0])*tan1
    
    upNode[2,0] = flapRatio
    loNode[2,0] = flapRatio
    upNode[3,0] = flapRatio
    loNode[3,0] = flapRatio
    
    upNode[3,1] = leRadPos
    loNode[3,1] = leRadPos
    upNode[2,1] = upNode[3,1] + leRad
    loNode[2,1] = loNode[3,1] - leRad
    
    curve3 = Curves.BezierCurve(upNode,10)
    curve4 = Curves.BezierCurve(loNode,10)
    curve4e = ny.flipud(curve4)
    curve4e[:,2] = curve4[:,2]
    curve4e = curve4e[1:]
    curve4e[:,2] = curve4e[:,2]+1.0
    curve11 = ny.vstack([curve3,curve4e])
    
    curve11offset = Curves.xytCurveOffset(curve11,-offset)
    curve6 = Curves.xyCurveSplit(upCurve.pts,upNode[0,0])
    curve7 = Curves.xyCurveSplit(loCurve.pts,0,loNode[0,0])
    curve8 = Curves.xyCurveSplit(loCurve.pts,loNode[0,0])
    
    curve9, curve10 = Curves.trimTe(airfoil.upPts,curve11offset,lipTe)
    curve7, curve10 = Curves.splitCurveSimple(curve7,curve10,[0,0])

    curve12, circle1, curve13 = Curves.roundCorner(curve7,curve10,rTe)
    
    mainSec = ny.vstack([ny.flipud(curve9),curve12,circle1,ny.flipud(curve13[:,0:2])])
    flapSec1 = ny.vstack([ny.flipud(curve6)[:-1,:],curve11[:-1,0:2],curve8])
    #flapSec0 = flapSec1

    flapSec1 = Curves.rotate2D(flapSec1,[0.7,-.1],defl)
    flapAdd = Curves.rotate2D(curve11,[0.7,-.1],defl)
    
    refPt = mainSec[-1]
    moveX1 = ny.min(flapSec1[:,0]) - refPt[0] + overlap
    flapSec1[:,0] = flapSec1[:,0] - moveX1
    flapAdd[:,0]  = flapAdd[:,0]  - moveX1
    #gap
    dy = Curves.adjustGap(flapAdd,refPt,gap)
    flapSec1[:,1] = flapSec1[:,1] + dy

    return mainSec, flapSec1
Exemple #31
0
 def genAirfoil(self, t=0):
     return Airfoil('XY', x=self.x, y=self.y, t=t)