Skip to content
Snippets Groups Projects
Commit a3d8e760 authored by Malte Nyhuis's avatar Malte Nyhuis
Browse files

initial tests for airfoil generators

parent 06d38b1b
No related branches found
No related tags found
No related merge requests found
...@@ -111,7 +111,7 @@ def pcoef( ...@@ -111,7 +111,7 @@ def pcoef(
return coef return coef
def parsec_airfoil_gen(pparray,halfsinespacing, resolution): def parsec_airfoil_gen(pparray,halfsinespacing=True, resolution=2000):
# TE & LE of airfoil (normalized, chord = 1) # TE & LE of airfoil (normalized, chord = 1)
xle = 0.0 xle = 0.0
...@@ -219,3 +219,4 @@ def demo(): ...@@ -219,3 +219,4 @@ def demo():
X,Y = profile_points[::,0],profile_points[::,1] X,Y = profile_points[::,0],profile_points[::,1]
d.plot(X, Y) d.plot(X, Y)
d.show() d.show()
...@@ -2,6 +2,7 @@ import numpy as np ...@@ -2,6 +2,7 @@ import numpy as np
import pyvista as pv import pyvista as pv
def test_calcConcaveHull(): def test_calcConcaveHull():
""" """
in these simple geometries, each point must be found by calcConcaveHull in these simple geometries, each point must be found by calcConcaveHull
...@@ -36,3 +37,34 @@ def test_calcConcaveHull(): ...@@ -36,3 +37,34 @@ def test_calcConcaveHull():
assert len(xs) == len(xs_raw) assert len(xs) == len(xs_raw)
assert any([yi in ys_raw for yi in ys]) assert any([yi in ys_raw for yi in ys])
def test_parsec():
from ntrfc.database.parsec_airfoil_creator import parsec_airfoil_gen
R_LE = 0.01
x_PRE = 0.450
y_PRE = -0.006
d2y_dx2_PRE = -0.4
th_PRE = 0.05
x_SUC = 0.450
y_SUC = 0.055
d2y_dx2_SUC = -0.350
th_SUC = -6
pparray = [R_LE,x_PRE,y_PRE,d2y_dx2_PRE,th_PRE,x_SUC,y_SUC,d2y_dx2_SUC,th_SUC]
profile_points = parsec_airfoil_gen(pparray)
X,Y = profile_points[::,0],profile_points[::,1]
def test_naca():
def rand_naca_code():
digits = np.random.choice([4,5])
if digits ==4:
d1,d2,d3,d4 = np.random.randint(0,6),np.random.randint(0,8),np.random.randint(0,6),np.random.randint(0,9)
digitstring = str(d1)+str(d2)+str(d3)+str(d4)
if digits ==5:
d1,d2,d3,d4,d5 = np.random.randint(0,5),np.random.randint(0,5),np.random.randint(0,6),np.random.randint(0,9),np.random.randint(0,9)
digitstring = str(d1)+str(d2)+str(d3)+str(d4)+str(d5)
return digitstring
profNaca = [rand_naca_code() for i in range(6)]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment