コード例 #1
0
def cfd_table():
    af = MyTools.airfoil.airfoil.Airfoil()
    af.read_txt('Clark-Y.txt')
    af.display()
    
    #Mach = np.arange(0.2, 0.9, 0.05)
    Mach = np.array([0.90])
    aseq = np.arange(-20., 21., 2.0)
    pth = 'ClarkY-C81.txt'
    fc = FlightConditions(0.2,0.0)
    scale = 1.0
    yplus = 1.0
    
#    fid = open(pth,'wt')
#    fid.write('Mach\talpha\tCL\tCD\tCM\n')
#    fid.close()
#    
    idx = 14
    for M in Mach:
        fc.set_speed(M)
        idx += 1
        for a in aseq:
            fid = open(pth,'at')
            cl,cd,cm,gs = cfd.run_analysis(af,fc,a,yplus,scale, idx)
            fid.write('%.4f\t%.4f\t%.8f\t%.8f\t%.8f\n'%(M,a,cl,cd,cm))
    fid.close()
コード例 #2
0
class CFDrun:
    def __init__(self, af,path=None):
        self.fc = FlightConditions(0.2, 0.0)
        self.scale = 1.0
        self.af = af
        self.yplus = 1.0
        self.xl = np.array([0.2, -20.0]) #Mach, alpha
        self.xu = np.array([0.8, 20.0])
        self.norm = mt.Normalization(self.xl, self.xu,-1.0,1.0)
        self.idx = 0
        if path==None:
            self.path = 'ClarkY-hifiCFD.txt'
        else:
            self.path = path
        fid = open(self.path,'wt')
        fid.write('Mach\talpha\tcl\tcd\tcm\n')
        fid.close()
    
    def __call__(self,x):
        self.idx += 1
        x = self.norm.denormalize(x)
        Mach = x[0]
        alpha = x[1]
        self.fc.set_speed(Mach)
        cl,cd,cm,gs = cfd.run_analysis(self.af,self.fc,alpha,self.yplus,self.scale, self.idx)
        self.save(Mach,alpha,cl,cd,cm)
        return cl, cd, cm
    
    def save(self,M,a,cl,cd,cm):
        fid = open(self.path,'at')
        fid.write('%.8f\t%.8f\t%.8f\t%.8f\t%.8f\n'%(M,a,cl,cd,cm))
        fid.close()
コード例 #3
0
def main():
    af = MyTools.airfoil.airfoil.Airfoil()
    af.create_naca4()
    
    Mach = np.arange(0.2, 0.9, 0.1)
    aseq = [-20, 20, 4.0]
    fc = FlightConditions(0.2,0.0)
    
    fid = open('aero_data_jfoil.txt','wt')
    
    for M in Mach:
        fc.set_speed(M)
        pol = af.get_jfoil_polar(M,fc.Re,aseq)
        for a,cl,cd,cm in zip(pol.alpha, pol.cl, pol.cd, pol.cm):
            fid.write('%.2f\t%.2f\t%.6f\t%.6f\t%.6f\n'%(M,a,cl,cd,cm))
    fid.close()