Ejemplo n.º 1
0
def my_func(X):
	M=X[0:5]
	P=X[5:10]
	T=X[10:15]
	build_mesh.create_mesh(M,P,T)
	run_apame()
	fid = open('output_polar.dat','r')
	nb_lines=0
	while fid.readline():
		nb_lines+=1
	if nb_lines==0:
		raise TypeError("Empty file")
	fid.close()
	fid = open('output_polar.dat','r')
	# revenir au debut
	alpha=numpy.zeros(nb_lines)
	cx=numpy.zeros(nb_lines)
	cz=numpy.zeros(nb_lines)
	for i in xrange(nb_lines):
		tmp=fid.readline()
		tmp=tmp.split()
		alpha[i]=float(tmp[0])
		cx[i]=float(tmp[2])
		cz[i]=float(tmp[1])
	fid.close()
	print(min(cx))
	return min(cx)
Ejemplo n.º 2
0
def my_func(M,P,T):
	build_mesh.create_mesh(M,P,T)
	run_apame()
	fid = open('output_polar.dat','r')
	nb_lines=0
	while fid.readline():
		nb_lines+=1
	if nb_lines==0:
		raise TypeError("Empty file")
	fid.close()
	fid = open('output_polar.dat','r')
	# revenir au debut
	alpha=numpy.zeros(nb_lines)
	cx=numpy.zeros(nb_lines)
	cz=numpy.zeros(nb_lines)
	for i in xrange(nb_lines):
		tmp=fid.readline()
		tmp=tmp.split()
		alpha[i]=float(tmp[0])
		cx[i]=float(tmp[2])
		cz[i]=float(tmp[1])
	fid.close()
	f = interpolate.interp1d(numpy.array(cz), numpy.array(cx), kind=‘cubic’)
	return min(f(0.5))
Ejemplo n.º 3
0
import vtk
import dakota_utils
import matplotlib.pyplot as plt
from build_mesh import create_mesh
from run_apame import run

N_sections=numpy.linspace(5,101,49)
Cx=numpy.zeros(49)
Cz=numpy.zeros(49)
it=0
for i in N_sections:
	print('Test de convergence - section numero {}'.format(int(i)))
	M=0.08*numpy.ones(2)
	P=0.4*numpy.ones(2)
	T=0.15*numpy.ones(2)
	create_mesh(M,P,T,int(i))
	run()
	fid = open('output_polar.dat','r')
	tmp=fid.readline()
	tmp=tmp.split()
	Cx[it]=float(tmp[2])
	Cz[it]=float(tmp[1])
	it+=1
	fid.close()

plt.figure()
plt.plot(N_sections,Cx)
plt.title('Cx')
plt.figure()
plt.plot(N_sections,Cz)
plt.title('Cz')