Example #1
0
# -*- coding: utf-8 -*-
"""
Created on Wed Dec  9 17:30:38 2015

@author: winstroth
"""

import airfoiltools as aft
import matplotlib.pyplot as plt
import numpy as np
from scipy import interpolate

# Load airfoil from iges file
iges_file = '../airfoils/NACA643618.igs'
tck_org = aft.load_airfoil_iges(iges_file)

# Point coordinates from org spline
u = np.linspace(0.0, 1.0, 10000)

airfoil_org = interpolate.splev(u, tck_org, der=0)
curvature_org = aft.curvature_iges(tck_org)

# New spline
tck_new, u_new = interpolate.splprep(airfoil_org, k=5, s=0.000000000001)
airfoil_new = interpolate.splev(u, tck_new, der=0)
curvature_new = aft.curvature_iges(tck_new)

plt.figure('Curvature')
plt.plot(curvature_new, label='curvature new')
plt.plot(curvature_org, '-r', label='curvature old')
import numpy as np
from scipy import interpolate
import os
import airfoiltools as aft
import pickle


inp_fname_igs = "r8400.igs"

inp_dir = "/mnt/hgfs/GAeroFerRo/Referenzblatt_3d/E-44_V2/2D_Profile"
out_dir_norm_bspline = "/mnt/hgfs/GAeroFerRo/Referenzblatt_3d/" "3D-Referenzblatt/E-44_V2/2D_Profile/bspline_norm"
out_dir_norm_pointwise = "/mnt/hgfs/GAeroFerRo/Referenzblatt_3d/" "3D-Referenzblatt/E-44_V2/2D_Profile/pointwise_norm"

# Load airfoil from iges file
iges_file = os.path.join(inp_dir, inp_fname_igs)
tck = aft.load_airfoil_iges(iges_file)

tck_norm, dist_le_te, rot_deg = aft.norm_bspline_airfoil(tck)
print("chord length: {}".format(dist_le_te))
print("twist: {}".format(-rot_deg))

tck_norm_smooth = aft.smooth_bspline(tck_norm, num_points=1000, s=0.00000005, k=5)


tck_norm_mod = aft.correct_te(tck_norm_smooth, k=5)
num_points, points = aft.bspline_to_points(tck_norm_mod, min_step=5e-4, max_step=0.01)
print("num of points: {}".format(num_points))

# Get name of input file
fname, _ = os.path.splitext(inp_fname_igs)