Skip to content

Commit b73269c

Browse files
ndem0annaivagnes
andauthored
fix customprofile and add tutorial on it (#100)
* restyle profiles * fix profilebase for test_profilebase * add notebooks for tutorial 5 and 6 --------- Co-authored-by: Anna Ivagnes <s274001@studenti.polito.it>
1 parent 543621f commit b73269c

16 files changed

Lines changed: 2360 additions & 800 deletions

bladex/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
"""
22
BladeX init
33
"""
4-
__all__ = ['profilebase', 'nacaprofile', 'customprofile', 'reversepropeller', 'blade', 'shaft', 'propeller', 'deform', 'params', 'ndinterpolator']
4+
__all__ = ['ProfileInterface', 'NacaProfile', 'CustomProfile',
5+
'ReversePropeller', 'Blade', 'Shaft', 'Propeller', 'Deformation',
6+
'ParamFile', 'RBF', 'reconstruct_f', 'scipy_bspline']
57

68
from .meta import *
7-
from .profilebase import ProfileBase
8-
from .nacaprofile import NacaProfile
9-
from .customprofile import CustomProfile
9+
from .profile import ProfileInterface
10+
from .profile import NacaProfile
11+
from .profile import CustomProfile
1012
from .blade import Blade
1113
from .shaft import Shaft
1214
from .propeller import Propeller
1315
from .deform import Deformation
1416
from .params import ParamFile
15-
from .ndinterpolator import RBF, reconstruct_f, scipy_bspline
17+
from .ndinterpolator import RBF, reconstruct_f, scipy_bspline
1618
from .reversepropeller import ReversePropeller

bladex/blade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def plot(self, elev=None, azim=None, ax=None, outfile=None):
479479
>>> blade_2.rotate(rot_angle_deg=72)
480480
481481
>>> fig = plt.figure()
482-
>>> ax = fig.gca(projection=Axes3D.name)
482+
>>> ax = fig.add_subplot(projection='3d')
483483
>>> blade_1.plot(ax=ax)
484484
>>> blade_2.plot(ax=ax)
485485
@@ -504,7 +504,7 @@ def plot(self, elev=None, azim=None, ax=None, outfile=None):
504504
ax = ax
505505
else:
506506
fig = plt.figure()
507-
ax = fig.gca(projection=Axes3D.name)
507+
ax = fig.add_subplot(projection='3d')
508508
ax.set_aspect('auto')
509509

510510
for i in range(self.n_sections):

bladex/profile/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""
2+
Profile init
3+
"""
4+
__all__ = ['ProfileInterface', 'NacaProfile', 'CustomProfile']
5+
6+
from .profileinterface import ProfileInterface
7+
from .nacaprofile import NacaProfile
8+
from .customprofile import CustomProfile
Lines changed: 125 additions & 168 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""
2-
Derived module from profilebase.py to provide the airfoil coordinates for standard
3-
Naca profiles.
2+
Derived module from profilebase.py to provide the airfoil coordinates for
3+
standard Naca profiles.
44
"""
55
from scipy.interpolate import splev, splrep
66
import numpy as np
7-
from .profilebase import ProfileBase
7+
from .profileinterface import ProfileInterface
88

9-
class NacaProfile(ProfileBase):
9+
class NacaProfile(ProfileInterface):
1010
"""
1111
Generate 4- and 5-digit NACA profiles.
1212
@@ -24,29 +24,29 @@ class NacaProfile(ProfileBase):
2424
2525
- P/10: indicates the location of the maximum camber measured from the
2626
leading edge. The location is normalized by the chord length.
27-
27+
2828
- TT/100: the maximum thickness as fraction of the chord length.
2929
3030
The profile 00TT refers to a symmetrical NACA airfoil.
3131
3232
The NACA five-digit series describes more complex airfoil shapes.
3333
Its format is: LPSTT, where:
34-
34+
3535
- L: the theoretical optimum lift coefficient at ideal
3636
angle-of-attack = 0.15*L
37-
37+
3838
- P: the x-coordinate of the point of maximum camber
3939
(max camber at x = 0.05*P)
40-
40+
4141
- S: indicates whether the camber is simple (S=0) or reflex (S=1)
4242
TT/100: the maximum thickness in percent of chord, as in a four-digit
4343
NACA airfoil code
4444
4545
References:
46-
46+
4747
- Moran, Jack (2003). An introduction to theoretical and computational
4848
aerodynamics. Dover. p. 7. ISBN 0-486-42879-6.
49-
49+
5050
- Abbott, Ira (1959). Theory of Wing Sections: Including a Summary of
5151
Airfoil Data. New York: Dover Publications. p. 115. ISBN 978-0486605869.
5252
@@ -68,7 +68,8 @@ def __init__(self, digits, n_points=240, cosine_spacing=True):
6868
self.n_points = n_points
6969
self.cosine_spacing = cosine_spacing
7070
self._check_args()
71-
self._generate_coordinates()
71+
self.generate_coordinates()
72+
self.generate_parameters(convention='british')
7273

7374
def _check_args(self):
7475
"""
@@ -84,7 +85,10 @@ def _check_args(self):
8485
if self.n_points < 0:
8586
raise ValueError('n_points must be positive.')
8687

87-
def _generate_coordinates(self):
88+
def generate_parameters(self, convention='british'):
89+
return super().generate_parameters(convention)
90+
91+
def generate_coordinates(self):
8892
"""
8993
Private method that generates the coordinates of the NACA 4 or 5 digits
9094
airfoil profile. The method assumes a zero-thickness trailing edge, and
@@ -214,4 +218,5 @@ def _generate_coordinates(self):
214218
self.ydown_coordinates = yc - yt
215219

216220
else:
217-
raise Exception
221+
raise Exception
222+

0 commit comments

Comments
 (0)