我使用Barba集团的AeroPython codes
#import libraries and modules needed
import os
import numpy
from scipy import integrate, linalg
from matplotlib import pyplot
# load geometry from data file
naca_filepath = os.path.join('resources', 'naca0012.dat')
with open(naca_filepath, 'r') as infile:
x, y = numpy.loadtxt(infile, dtype=float, unpack=True)
# plot geometry
width = 10
pyplot.figure(figsize=(width, width))
pyplot.grid()
pyplot.xlabel('x', fontsize=16)
pyplot.ylabel('y', fontsize=16)
pyplot.plot(x, y, color='k', linestyle='-', linewidth=2)
pyplot.axis('scaled', adjustable='box')
pyplot.xlim(-0.1, 1.1)
pyplot.ylim(-0.1, 0.1);
并从翼型.comnaca0012 data file使用(将名称“n0012.dat”更改为“naca0012.dat”,并删除文件中的标题,因为程序不使用数据文件中的字符串)
在本课中,请看下面的图
但我用的是代码图这包括了球场线
有什么不对劲,那是什么
翼型数据库的链接包含Lednicer格式的NACA0012坐标,而AeroPython课程中的代码是为Selig格式的翼型编写的。 (该Notebook使用源面板法计算翼型周围的流动。)
Selig的格式从机翼的后缘开始,经过上表面,然后经过下表面,回到后缘
Lednicer格式列出上表面上的点(从前缘到后缘),然后列出下表面上的点(从前缘到后缘)
您可以按如下方式加载Selig格式(跳过标题“NACA 0012翼型”,在
numpy.loadtxt
中使用skiprows=1
):此处NACA0012翼型包含
131
点,您将看到后缘具有有限厚度:如果对Lednicer格式(标题为
skiprows=2
)执行相同操作,则将加载132
点(前缘点重复),上表面上的点将翻转(从前缘到后缘)。 (这就是为什么你在中间用^ {CD6>}来观察这条线,这条线将后缘从上表面连接到下表面的前缘。)按照Selig的格式重新定向点的一种方法是跳过上表面上的前缘(即跳过复制点)并翻转上表面上的点。 以下是一个可能的解决方案:
最终将得到
131
点,方向与Selig的格式相同最后,我们还可以检查坐标是否与
numpy.allclose
相同:相关问题 更多 >
编程相关推荐