Beispiel #1
0
def create_wing(input_file,wing_name):
    # CREATION D'UNE AILE A PARTIR D'UN FICHIER CONTENANT LES DONNEES M,P,T,CHORD ET SPAN POUR LA SECTION ROOT ET LA SECTION TIP
    fichier=open(input_file,'r')
    lines=fichier.readlines()
    fichier.close()
    corde=[]
    m=[]
    y=[]
    p=[]
    t=[]
    wing=[] # wing will be a list of 2d wings
    n_sections=-1
    n_naca_points=-1
    lines.pop(0)
    for temp in lines:
        temp=temp.split()
        val=float(temp[1])
        temp=temp[0].split(".")
	temp=temp[1]
        if temp=='Y':
            y.append(val)
        elif temp=='M':
            m.append(val)    
        elif temp=='P':
            p.append(val)
        elif temp=='T':
            t.append(val)
        elif temp=='CORDE':
            corde.append(val)
        elif temp=='N_SECTIONS':
	    n_sections=int(val)
	elif temp=='N_NACA_PTS':
	    n_naca_points=int(val)
        else:
            raise TypeError("Erreur : caractere non reconnu",temp)
    if not(len(m)==len(p)==len(y)==len(t)==len(corde)):
        raise TypeError("Erreur : les listes ont une taille differente")
    if n_sections < 5:
	raise ValueError("Erreur : nombre de sections insuffisant")
    if n_naca_points < 10:
	raise ValueError("Erreur : nombre de points par profil insuffisant")
    fichier.close()
    root=[m[0],p[0],t[0],corde[0]]
    tip=[m[1],p[1],t[1],corde[1]]

    mesh_utils.create_mesh_linear_interp(wing_name,root,tip,2.*abs(y[1]),n_sections,n_naca_points)
	# list of alpha and beta to compute
	alpha_list = numpy.linspace(-10.,10.,21)
	beta_list = numpy.zeros(21)

	run_case('optimized_wing.vtp',
		 wake_length=10.,
		 alpha=alpha_list,
		 beta=beta_list,
		 v=airspeed,
		 rho=rho,
		 P=Patm,
		 Mach=0.,
		 origin=[0.,0.,0.],
		 wingspan=10.,
		 ref_chord=1.,
		 Sref=10.,
		 method=0,
		 farfield_dist=50.,
		 velorder=1)

file = open(sys.argv[1],'r')
tmp = file.readlines()
tmp = tmp[-1]
tmp = tmp.split()
root = [float(tmp[2]),float(tmp[4]),float(tmp[6]),1.]
tip = [float(tmp[3]),float(tmp[5]),float(tmp[7]),float(tmp[9])]
mesh_utils.create_mesh_linear_interp('optimized_wing',root,tip,float(tmp[8]),31,50)
run_apame()
file.close()