Patm = 101325.#Pa
rho = 1.225#kg.m-3
c = numpy.sqrt(1.4*Patm/rho)
Mach = 0.17
airspeed = c*Mach

run_case(filename,
         wake_length=20.,
         alpha=[x[7]],
         beta=[0.],
         v=25.,
         rho=rho,
         P=Patm,
         Mach=Mach,
         origin=[0.,0.,0.],
         wingspan=2.*x[0],
         ref_chord=1.,
         Sref=10.,
         method=0,
         farfield_dist=50.,
         velorder=1)

fid = open('wing_polar.dat')
lines = fid.readlines()
fid.close()
[_,Cl,Cd] = [eval(word) for word in lines[0].split()]
    
print Cl,10000.*Cd

dakota_utils.write_outputs(sys.argv[2],[Cd,0.5-Cl],['Cd','Cl'])
Exemple #2
0
import sys
import numpy
import dakota_utils #--> le module a creer

def my_func(x):
    return x[0]**2+x[1]**2

def constraint(x):
	return x[0]-2.

x,varnames=dakota_utils.read_input(sys.argv[1])

fval = my_func(x)
cstr = constraint(x)

dakota_utils.write_outputs(sys.argv[2],[fval,cstr],['my_function','my_constraint'])