Skip to content

Commit

Permalink
fix customprofile and add tutorial on it (#100)
Browse files Browse the repository at this point in the history
* restyle profiles

* fix profilebase for test_profilebase

* add notebooks for tutorial 5 and 6

---------

Co-authored-by: Anna Ivagnes <s274001@studenti.polito.it>
  • Loading branch information
ndem0 and annaivagnes authored Sep 15, 2023
1 parent 543621f commit b73269c
Show file tree
Hide file tree
Showing 16 changed files with 2,360 additions and 800 deletions.
12 changes: 7 additions & 5 deletions bladex/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
"""
BladeX init
"""
__all__ = ['profilebase', 'nacaprofile', 'customprofile', 'reversepropeller', 'blade', 'shaft', 'propeller', 'deform', 'params', 'ndinterpolator']
__all__ = ['ProfileInterface', 'NacaProfile', 'CustomProfile',
'ReversePropeller', 'Blade', 'Shaft', 'Propeller', 'Deformation',
'ParamFile', 'RBF', 'reconstruct_f', 'scipy_bspline']

from .meta import *
from .profilebase import ProfileBase
from .nacaprofile import NacaProfile
from .customprofile import CustomProfile
from .profile import ProfileInterface
from .profile import NacaProfile
from .profile import CustomProfile
from .blade import Blade
from .shaft import Shaft
from .propeller import Propeller
from .deform import Deformation
from .params import ParamFile
from .ndinterpolator import RBF, reconstruct_f, scipy_bspline
from .ndinterpolator import RBF, reconstruct_f, scipy_bspline
from .reversepropeller import ReversePropeller
4 changes: 2 additions & 2 deletions bladex/blade.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def plot(self, elev=None, azim=None, ax=None, outfile=None):
>>> blade_2.rotate(rot_angle_deg=72)
>>> fig = plt.figure()
>>> ax = fig.gca(projection=Axes3D.name)
>>> ax = fig.add_subplot(projection='3d')
>>> blade_1.plot(ax=ax)
>>> blade_2.plot(ax=ax)
Expand All @@ -504,7 +504,7 @@ def plot(self, elev=None, azim=None, ax=None, outfile=None):
ax = ax
else:
fig = plt.figure()
ax = fig.gca(projection=Axes3D.name)
ax = fig.add_subplot(projection='3d')
ax.set_aspect('auto')

for i in range(self.n_sections):
Expand Down
8 changes: 8 additions & 0 deletions bladex/profile/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
Profile init
"""
__all__ = ['ProfileInterface', 'NacaProfile', 'CustomProfile']

from .profileinterface import ProfileInterface
from .nacaprofile import NacaProfile
from .customprofile import CustomProfile
293 changes: 125 additions & 168 deletions bladex/customprofile.py → bladex/profile/customprofile.py

Large diffs are not rendered by default.

31 changes: 18 additions & 13 deletions bladex/nacaprofile.py → bladex/profile/nacaprofile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
Derived module from profilebase.py to provide the airfoil coordinates for standard
Naca profiles.
Derived module from profilebase.py to provide the airfoil coordinates for
standard Naca profiles.
"""
from scipy.interpolate import splev, splrep
import numpy as np
from .profilebase import ProfileBase
from .profileinterface import ProfileInterface

class NacaProfile(ProfileBase):
class NacaProfile(ProfileInterface):
"""
Generate 4- and 5-digit NACA profiles.
Expand All @@ -24,29 +24,29 @@ class NacaProfile(ProfileBase):
- P/10: indicates the location of the maximum camber measured from the
leading edge. The location is normalized by the chord length.
- TT/100: the maximum thickness as fraction of the chord length.
The profile 00TT refers to a symmetrical NACA airfoil.
The NACA five-digit series describes more complex airfoil shapes.
Its format is: LPSTT, where:
- L: the theoretical optimum lift coefficient at ideal
angle-of-attack = 0.15*L
- P: the x-coordinate of the point of maximum camber
(max camber at x = 0.05*P)
- S: indicates whether the camber is simple (S=0) or reflex (S=1)
TT/100: the maximum thickness in percent of chord, as in a four-digit
NACA airfoil code
References:
- Moran, Jack (2003). An introduction to theoretical and computational
aerodynamics. Dover. p. 7. ISBN 0-486-42879-6.
- Abbott, Ira (1959). Theory of Wing Sections: Including a Summary of
Airfoil Data. New York: Dover Publications. p. 115. ISBN 978-0486605869.
Expand All @@ -68,7 +68,8 @@ def __init__(self, digits, n_points=240, cosine_spacing=True):
self.n_points = n_points
self.cosine_spacing = cosine_spacing
self._check_args()
self._generate_coordinates()
self.generate_coordinates()
self.generate_parameters(convention='british')

def _check_args(self):
"""
Expand All @@ -84,7 +85,10 @@ def _check_args(self):
if self.n_points < 0:
raise ValueError('n_points must be positive.')

def _generate_coordinates(self):
def generate_parameters(self, convention='british'):
return super().generate_parameters(convention)

def generate_coordinates(self):
"""
Private method that generates the coordinates of the NACA 4 or 5 digits
airfoil profile. The method assumes a zero-thickness trailing edge, and
Expand Down Expand Up @@ -214,4 +218,5 @@ def _generate_coordinates(self):
self.ydown_coordinates = yc - yt

else:
raise Exception
raise Exception

Loading

0 comments on commit b73269c

Please sign in to comment.