Skip to content

Commit 8c0fb8a

Browse files
ENH: adding final plots do AeroSurfaces
1 parent 01819ac commit 8c0fb8a

File tree

1 file changed

+126
-8
lines changed

1 file changed

+126
-8
lines changed

rocketpy/AeroSurfaces.py

Lines changed: 126 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class NoseCone:
4242
attack and the Mach number. It must take as input the angle of attack in
4343
radians and the Mach number. It should return the lift coefficient.
4444
NoseCone.clalpha : float
45-
Lift coefficient derivative. Has units of 1/rad.
45+
Lift coefficient slope. Has units of 1/rad.
4646
"""
4747

4848
def __init__(self, length, kind, distanceToCM, name="Nose Cone"):
@@ -98,6 +98,61 @@ def __init__(self, length, kind, distanceToCM, name="Nose Cone"):
9898

9999
return None
100100

101+
def geometricInfo(self):
102+
"""Prints out all the geometric information of the nose cone.
103+
104+
Parameters
105+
----------
106+
None
107+
108+
Returns
109+
-------
110+
None
111+
"""
112+
print("Nose Cone Geometric Information of Nose: {}".format(self.name))
113+
print("-------------------------------")
114+
print("Length: ", self.length)
115+
print("Kind: ", self.kind)
116+
print(f"Distance to rocket's dry CM: {self.distanceToCM:.3f} m")
117+
118+
return None
119+
120+
def aerodynamicInfo(self):
121+
"""Prints out all the aerodynamic information of the nose cone.
122+
123+
Parameters
124+
----------
125+
None
126+
127+
Returns
128+
-------
129+
None
130+
"""
131+
print("Nose Cone Aerodynamic Information of Nose: {}".format(self.name))
132+
print("-------------------------------")
133+
print("Center of Pressure position: ", self.cp, "m")
134+
print("Lift Coefficient Slope: ", self.clalpha)
135+
print("Lift Coefficient as a function of Alpha and Mach:")
136+
self.cl()
137+
138+
return None
139+
140+
def allInfo(self):
141+
"""Prints out all the geometric and aerodynamic information of the nose cone.
142+
143+
Parameters
144+
----------
145+
None
146+
147+
Returns
148+
-------
149+
None
150+
"""
151+
self.geometricInfo()
152+
self.aerodynamicInfo()
153+
154+
return None
155+
101156

102157
class Fins:
103158
"""Super class that holds common methods for the fin classes.
@@ -363,7 +418,7 @@ def geometricalInfo(self):
363418
------
364419
None
365420
"""
366-
print("\n\n Geometrical Parameters\n")
421+
print("\n Geometrical Parameters\n")
367422
if isinstance(self, TrapezoidalFins):
368423
print("Fin Type: Trapezoidal")
369424
print("Tip Chord: {:.3f} m".format(self.tipChord))
@@ -373,7 +428,7 @@ def geometricalInfo(self):
373428
print("Root Chord: {:.3f} m".format(self.rootChord))
374429
print("Span: {:.3f} m".format(self.span))
375430
print("Cant Angle: {:.3f} °".format(self.cantAngle))
376-
print("Fin Area: {:.3f} m".format(self.Af))
431+
print("Longitudinal Section Area: {:.3f} m".format(self.Af))
377432
print("Aspect Ratio: {:.3f} m".format(self.AR))
378433
print("Gamma_c: {:.3f} m".format(self.gamma_c))
379434
print("Mean Aerodynamic Chord: {:.3f} m".format(self.Yma))
@@ -397,15 +452,23 @@ def liftInfo(self):
397452
------
398453
None
399454
"""
400-
print("\n\nLift Information\n")
455+
print("\nLift Information")
456+
print("----------------")
401457
print("Lift Interference Factor: {:.3f} m".format(self.liftInterferenceFactor))
402458
print(
403459
"Center of Pressure position: ({:.3f},{:.3f},{:.3f}) (x, y, z)".format(
404460
self.cpx, self.cpy, self.cpz
405461
)
406462
)
463+
print(
464+
"Lift Coefficient derivative as a Function of Alpha and Mach for Single Fin"
465+
)
407466
self.clalphaSingleFin()
467+
print(
468+
"Lift Coefficient derivative as a Function of Alpha and Mach for the Fin Set"
469+
)
408470
self.clalphaMultipleFins()
471+
print("Lift Coefficient as a Function of Alpha and Mach for the Fin Set")
409472
self.cl()
410473

411474
return None
@@ -422,9 +485,13 @@ def rollInfo(self):
422485
------
423486
None
424487
"""
425-
print("\n\nRoll Information\n")
426-
print("Cant Angle: {:.3f} °".format(self.cantAngle))
427-
print("Cant Angle Radians: {:.3f} rad".format(self.cantAngleRad))
488+
print("\nRoll Information")
489+
print("----------------")
490+
print(
491+
"Cant Angle: {:.3f} ° or {:.3f} rad".format(
492+
self.cantAngle, self.cantAngleRad
493+
)
494+
)
428495
print(
429496
"Roll Damping Interference Factor: {:.3f} rad".format(
430497
self.rollDampingInterferenceFactor
@@ -453,7 +520,7 @@ def allInfo(self):
453520
None
454521
"""
455522

456-
print("Fin information\n\n")
523+
print("Fin set information\n\n")
457524

458525
print("Basic Information\n")
459526

@@ -1218,6 +1285,15 @@ def __init__(
12181285
# Retrieve reference radius
12191286
rref = self.radius
12201287

1288+
# Calculate tail slant length
1289+
self.slantLength = np.sqrt(
1290+
(self.length) ** 2 + (self.topRadius - self.bottomRadius) ** 2
1291+
)
1292+
# Calculate the surface area of the tail
1293+
self.surfaceArea = (
1294+
np.pi * self.slantLength * (self.topRadius + self.bottomRadius)
1295+
)
1296+
12211297
# Calculate cp position relative to center of dry mass
12221298
if distanceToCM < 0:
12231299
cpz = distanceToCM - (length / 3) * (1 + (1 - r) / (1 - r**2))
@@ -1241,3 +1317,45 @@ def __init__(
12411317
self.clalpha = clalpha
12421318

12431319
return None
1320+
1321+
def geometricInfo(self):
1322+
"""Prints out all the geometric information of the tail.
1323+
1324+
Returns
1325+
-------
1326+
None
1327+
"""
1328+
1329+
print(f"\nTail name: {self.name}")
1330+
print(f"Tail Top Radius: {self.topRadius:.3f} m")
1331+
print(f"Tail Bottom Radius: {self.bottomRadius:.3f} m")
1332+
print(f"Tail Length: {self.length:.3f} m")
1333+
print(f"Tail Distance to Center of Dry Mass: {self.distanceToCM:.3f} m")
1334+
print(f"Rocket body radius at tail position: {2*self.radius:.3f} m")
1335+
print(f"Tail Slant Length: {self.slantLength:.3f} m")
1336+
print(f"Tail Surface Area: {self.surfaceArea:.6f} m^2")
1337+
1338+
return None
1339+
1340+
def aerodynamicInfo(self):
1341+
1342+
print(f"\nTail name: {self.name}")
1343+
print(f"Tail Center of Pressure: {self.cp}")
1344+
# print(f"Tail Lift Coefficient: {self.cl}")
1345+
print(f"Tail Lift Coefficient Slope: {self.clalpha}")
1346+
print("Tail Lift Coefficient as a function of Alpha and Mach:")
1347+
self.cl()
1348+
1349+
return None
1350+
1351+
def allInfo(self):
1352+
"""Prints all the information about the tail object.
1353+
1354+
Returns
1355+
-------
1356+
None
1357+
"""
1358+
self.geometricInfo()
1359+
self.aerodynamicInfo()
1360+
1361+
return None

0 commit comments

Comments
 (0)