Skip to content

Commit

Permalink
Updated naming to use Airfoil2D and Airfoil3D
Browse files Browse the repository at this point in the history
Code should work better now
  • Loading branch information
pjuangph committed Sep 23, 2024
1 parent 27eb927 commit eae5cdc
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 38 deletions.
2 changes: 1 addition & 1 deletion 2D_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import numpy as np
from pyturbo.aero import *
from pyturbo.helper import *
stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58) # This creates the camberline
stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58) # This creates the camberline
stator_hub.le_thickness_add(0.04)
ps_height = [0.0500,0.0200,-0.0100]
ps_height_loc = exp_ratio(1.2,len(ps_height)+2,0.95)
Expand Down
4 changes: 2 additions & 2 deletions 3D_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The code below shows an example of how to build a 3D Blade from 2D designs locat

```
# Hub Geometry
stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
stator_hub.le_thickness_add(0.04)
ps_height = [0.0500,0.0200,-0.0100]
ps_height = [0.0500,0.0200,-0.0100]
Expand All @@ -29,7 +29,7 @@ stator_hub.le_thickness_match()
stator_hub.flow_guidance2(10)
# Tip Geometry
stator_tip = airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
stator_tip = Airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
stator_tip.le_thickness_add(0.04)
ps_height = [0.0500,0.0200,-0.0100]
ps_height_loc = exp_ratio(1.2,len(ps_height)+2,0.95)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyturbo-aero"
version = "1.0.14"
version = "1.0.16"
description = "PyTurbo_Aero is a Turbomachinery blade design library that lets you create a full 3D blades and passages."
authors = ["Paht Juangphanich <[email protected]>"]
packages = [
Expand Down
10 changes: 5 additions & 5 deletions pyturbo/aero/airfoil3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class stack_type(enum.Enum):
"""class defining the type of stacking for airfoil2D profiles
"""class defining the type of stacking for Airfoil2D profiles
Args:
enum (enum.Emum): inherits enum
Expand All @@ -33,7 +33,7 @@ class Airfoil3D():
'''
Properties
'''
profileArray: List[airfoil2D]
profileArray: List[Airfoil2D]
profileSpan: List[float]
span:float
IsSplineFitted: bool
Expand Down Expand Up @@ -121,12 +121,12 @@ class Airfoil3D():

"""Defines a 3D Airfoil to be used in a channel
"""
def __init__(self, profileArray: List[airfoil2D], profile_loc: List[float], height: float):
def __init__(self, profileArray: List[Airfoil2D], profile_loc: List[float], height: float):
"""Constructs a 3D Airfoil
Args:
profileArray (List[airfoil2D]): array of airfoil2D profiles
profile_loc (List[float]): location of the airfoil2D profiles
profileArray (List[Airfoil2D]): array of Airfoil2D profiles
profile_loc (List[float]): location of the Airfoil2D profiles
height (float): height of the 3D blade
"""
self.profileArray = profileArray
Expand Down
6 changes: 3 additions & 3 deletions pyturbo/aero/airfoil_wavy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
from ..helper import derivative_1, bezier,cosd,sind
import math

class airfoil_wavy(airfoil3D):
class airfoil_wavy(Airfoil3D):
"""Makes the surface of the airfoil: LE, TE, SS, PS wavy
"""
def __init__(self,profileArray,profile_loc,height):
"""Initializes a wavy airfoil from an array of profiles, location and height, same as airfoil3D
"""Initializes a wavy airfoil from an array of profiles, location and height, same as Airfoil3D
Args:
profileArray ([airfoil2D]): Array of 2D airfoil profiles
profileArray ([Airfoil2D]): Array of 2D airfoil profiles
profile_loc ([List[float]]): Locations in terms of percent span where these 2D airfoils are located
height ([float]): height of the airfoil
"""
Expand Down
49 changes: 25 additions & 24 deletions tests/aero_design_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
import sys, copy
sys.path.insert(0, "../../")
import numpy as np
from pyturbo.aero import airfoil2D,airfoil3D,airfoil_wavy,stack_type, passage2D
from pyturbo.aero import Airfoil2D,Airfoil3D,airfoil_wavy,stack_type, passage2D
from pyturbo.helper import *
import matplotlib.pyplot as plt
from math import pi
import math

class TestDesign(unittest.TestCase):
def test_2D_stator(self):
# stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)

# stator_hub.le_thickness_add(0.08)
# ps_height = [0.0500,0.0200,-0.0100]
Expand All @@ -32,7 +33,7 @@ def test_2D_stator(self):
pass

def test_2D_rotor(self):
# rotor_hub = airfoil2D(alpha1=40,alpha2=60,axial_chord=5.119,stagger=20)
# rotor_hub = Airfoil2D(alpha1=40,alpha2=60,axial_chord=5.119,stagger=20)

# rotor_hub.le_thickness_add(0.08)
# ps_height = [-0.0500,-0.0200,-0.0100]
Expand All @@ -50,7 +51,7 @@ def test_2D_rotor(self):

def test_3D_Stator(self):
# Hub Geometry
# stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub.le_thickness_add(0.04)
# ps_height = [0.0500,0.0200,-0.0100]
# ps_height = [0.0500,0.0200,-0.0100]
Expand All @@ -64,7 +65,7 @@ def test_3D_Stator(self):
# stator_hub.flow_guidance2(10)

# # Tip Geometry
# stator_tip = airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
# stator_tip = Airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
# stator_tip.le_thickness_add(0.04)
# ps_height = [0.0500,0.0200,-0.0100]
# ps_height_loc = exp_ratio(1.2,len(ps_height)+2,0.95)
Expand All @@ -80,7 +81,7 @@ def test_3D_Stator(self):
# plt.clf()
# plt.close('all')
# # Begin 3D design
# stator3D = airfoil3D([stator_hub,stator_tip],[0,1],0.05)
# stator3D = Airfoil3D([stator_hub,stator_tip],[0,1],0.05)
# stator3D.stack(stack_type.centroid)
# # stator3D.lean_add([0, 0.05, 1], [0,0.5,1])
# stator3D.create_blade(100,80,20)
Expand All @@ -93,7 +94,7 @@ def test_stator3D_wavy_const_te(self):
Wavy with constant trailing edge
'''
# # Hub Geometry
# stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub.le_thickness_add(0.04)
# ps_height = [0.0500,0.0200,-0.0100]
# stator_hub.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -107,7 +108,7 @@ def test_stator3D_wavy_const_te(self):
# # stator_hub.plot2D()

# # Tip Geometry
# stator_tip = airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
# stator_tip = Airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
# stator_tip.le_thickness_add(0.04)
# ps_height = [0.0500,0.0200,-0.0100]
# stator_tip.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -121,7 +122,7 @@ def test_stator3D_wavy_const_te(self):

# # Begin 3D design
# span = 0.05
# stator3D = airfoil3D([stator_hub,stator_tip],[0,1],0.05)
# stator3D = Airfoil3D([stator_hub,stator_tip],[0,1],0.05)
# stator3D.stack(stack_type.trailing_edge)
# stator3D.lean_add([0, 0.05, 0], [0,0.5,1])
# stator3D.create_blade(100,100,20)
Expand Down Expand Up @@ -155,7 +156,7 @@ def test_wavy(self):
Wavy without constant trailing edge
'''
# # Hub Geometry
# stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub.le_thickness_add(0.04)
# ps_height = [0.0500,0.0200,-0.0100]
# stator_hub.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -169,7 +170,7 @@ def test_wavy(self):
# # stator_hub.plot2D()

# # Tip Geometry
# stator_tip = airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
# stator_tip = Airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
# stator_tip.le_thickness_add(0.04)
# ps_height = [0.0500,0.0200,-0.0100]
# stator_tip.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -183,7 +184,7 @@ def test_wavy(self):

# # Begin 3D design
# span = 0.05
# stator3D = airfoil3D([stator_hub,stator_tip],[0,1],0.05)
# stator3D = Airfoil3D([stator_hub,stator_tip],[0,1],0.05)
# stator3D.stack(stack_type.trailing_edge)
# stator3D.lean_add([0, 0.05, 0], [0,0.5,1])
# stator3D.create_blade(100,100,20)
Expand Down Expand Up @@ -216,7 +217,7 @@ def test_wavy_whisker(self):
Wavy blade that maintains cross sectional area
'''
# Hub Geometry
stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
stator_hub.le_thickness_add(0.04)
ps_height = [0.0500,0.0200,-0.0100]
stator_hub.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -230,7 +231,7 @@ def test_wavy_whisker(self):
# stator_hub.plot2D()

# Tip Geometry
stator_tip = airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
stator_tip = Airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
stator_tip.le_thickness_add(0.04)
ps_height = [0.0500,0.0200,-0.0100]
stator_tip.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand Down Expand Up @@ -270,12 +271,12 @@ def test_wavy_whisker(self):
pass

def test_import_geometry(self):
# rotor = airfoil3D.import_geometry(folder='import_7%',axial_chord=124) # Set axial chord to 124 mm
# rotor = Airfoil3D.import_geometry(folder='import_7%',axial_chord=124) # Set axial chord to 124 mm
# rotor.plot3D_ly()
pass

def test_imported_blade_shell(self):
# rotor = airfoil3D.import_geometry(folder='import_7%',axial_chord=124,span=114,ss_ps_split=105)
# rotor = Airfoil3D.import_geometry(folder='import_7%',axial_chord=124,span=114,ss_ps_split=105)
# rotor.rotate(90)
# # [ss_x_new,ss_y_new,ss_z,ps_x_new,ps_y_new,ps_z] = rotor.get_shell_2D(percent_span=0.5,shell_thickness=-4)
# rotor.plot_shell_2D(percent_span=0.0,shell_thickness=-3)
Expand All @@ -286,7 +287,7 @@ def test_blade_shell(self):
You can create 2D shell from a 3D Design
'''
# # Hub Geometry
# stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58)
# stator_hub.le_thickness_add(0.04)
# ps_height = [0.0500,0.0200,-0.0100]
# stator_hub.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -300,7 +301,7 @@ def test_blade_shell(self):
# # stator_hub.plot2D()

# # Tip Geometry
# stator_tip = airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
# stator_tip = Airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
# stator_tip.le_thickness_add(0.04)
# ps_height = [0.0500,0.0200,-0.0100]
# stator_tip.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -314,7 +315,7 @@ def test_blade_shell(self):

# # Begin 3D design
# span = 0.05
# stator3D = airfoil3D([stator_hub,stator_tip],[0,1],0.05)
# stator3D = Airfoil3D([stator_hub,stator_tip],[0,1],0.05)
# stator3D.stack(stack_type.trailing_edge)
# stator3D.lean_add([0, 0.05, 0], [0,0.5,1])
# stator3D.create_blade(100,100,20)
Expand All @@ -329,7 +330,7 @@ def test_channel_2D(self):
'''
# Stator Hub Geometry
cax_stator = 0.038
stator_hub = airfoil2D(alpha1=0,alpha2=72,axial_chord=cax_stator,stagger=58)
stator_hub = Airfoil2D(alpha1=0,alpha2=72,axial_chord=cax_stator,stagger=58)
stator_hub.le_thickness_add(0.04)
ps_height = [0.0500,0.0200,-0.0100]
stator_hub.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -343,7 +344,7 @@ def test_channel_2D(self):
# stator_hub.plot2D()

# Stator Tip Geometry
stator_tip = airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
stator_tip = Airfoil2D(alpha1=5,alpha2=72,axial_chord=0.036,stagger=56)
stator_tip.le_thickness_add(0.04)
ps_height = [0.0500,0.0200,-0.0100]
stator_tip.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -357,15 +358,15 @@ def test_channel_2D(self):

# Begin Stator 3D design
stator_span = cax_stator
stator3D = airfoil3D([stator_hub,stator_tip],[0,1],stator_span)
stator3D = Airfoil3D([stator_hub,stator_tip],[0,1],stator_span)
stator3D.stack(stack_type.trailing_edge)
stator3D.lean_add([0, 0.05, 0], [0,0.5,1])
stator3D.create_blade(100,100,20)
# stator3D.plot3D()

# Rotor Hub Geometry
cax_rotor_hub = stator_span
rotor_hub = airfoil2D(alpha1=30,alpha2=72,axial_chord=cax_rotor_hub,stagger=40)
rotor_hub = Airfoil2D(alpha1=30,alpha2=72,axial_chord=cax_rotor_hub,stagger=40)
rotor_hub.le_thickness_add(0.04)
ps_height = [0.0500,0.01,0.05]
rotor_hub.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand All @@ -379,7 +380,7 @@ def test_channel_2D(self):
#rotor_hub.plot2D()

# Rotor Tip Geometry
rotor_tip = airfoil2D(alpha1=30,alpha2=72,axial_chord=0.036,stagger=45)
rotor_tip = Airfoil2D(alpha1=30,alpha2=72,axial_chord=0.036,stagger=45)
rotor_tip.le_thickness_add(0.04)
ps_height = [0.0500,0.01,0.05]
rotor_tip.ps_thickness_add(thicknessArray=ps_height,expansion_ratio=1.2)
Expand Down
4 changes: 2 additions & 2 deletions tutorials/stl_tutorial/stl_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import sys
sys.path.insert(0,'../../')
import numpy as np
from pyturbo.aero import airfoil2D
from pyturbo.aero import Airfoil2D
from pyturbo.helper import exp_ratio
from pyturbo.aero import airfoil3D, stack_type
import matplotlib.pyplot as plt

stator2D = airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58) # This creates the camberline
stator2D = Airfoil2D(alpha1=0,alpha2=72,axial_chord=0.038,stagger=58) # This creates the camberline

# Building Leading Edge
stator2D.le_thickness_add(0.04)
Expand Down

0 comments on commit eae5cdc

Please sign in to comment.