Skip to content

Commit 711b9b3

Browse files
ENH: implement some more evaluate_shape() methods
1 parent a66cd06 commit 711b9b3

1 file changed

Lines changed: 45 additions & 1 deletion

File tree

rocketpy/rocket/aero_surface.py

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from abc import ABC, abstractmethod
22
import warnings
33

4-
import matplotlib.pyplot as plt
54
import numpy as np
65
from scipy.optimize import fsolve
76

@@ -20,6 +19,7 @@
2019
_TrapezoidalFinsPrints,
2120
)
2221

22+
# TODO: all the evaluate_shape() methods need tests and documentation
2323

2424
class AeroSurface(ABC):
2525
"""Abstract class used to define aerodynamic surfaces."""
@@ -1215,6 +1215,30 @@ def evaluate_geometrical_parameters(self):
12151215
self.roll_damping_interference_factor = roll_damping_interference_factor
12161216
self.roll_forcing_interference_factor = roll_forcing_interference_factor
12171217

1218+
self.evaluate_shape()
1219+
return None
1220+
1221+
def evaluate_shape(self):
1222+
if self.sweep_length:
1223+
points = [
1224+
(0, 0),
1225+
(self.sweep_length, self.span),
1226+
(self.sweep_length + self.tip_chord, self.span),
1227+
(self.root_chord, 0),
1228+
]
1229+
else:
1230+
points = [
1231+
(0, 0),
1232+
(self.root_chord - self.tip_chord, self.span),
1233+
(self.root_chord, self.span),
1234+
(self.root_chord, 0),
1235+
]
1236+
1237+
x_array, y_array = zip(*points)
1238+
self.shape_vec = [np.array(x_array), np.array(y_array)]
1239+
1240+
return None
1241+
12181242
def info(self):
12191243
self.prints.geometry()
12201244
self.prints.lift()
@@ -1521,6 +1545,16 @@ def evaluate_geometrical_parameters(self):
15211545
self.roll_damping_interference_factor = roll_damping_interference_factor
15221546
self.roll_forcing_interference_factor = roll_forcing_interference_factor
15231547

1548+
self.evaluate_shape()
1549+
return None
1550+
1551+
def evaluate_shape(self):
1552+
angles = np.arange(0, 360, 5)
1553+
x_array = self.root_chord / 2 + self.root_chord / 2 * np.cos(np.radians(angles))
1554+
y_array = self.span * np.sin(np.radians(angles))
1555+
self.shape_vec = [x_array, y_array]
1556+
return None
1557+
15241558
def info(self):
15251559
self.prints.geometry()
15261560
self.prints.lift()
@@ -1675,6 +1709,16 @@ def evaluate_geometrical_parameters(self):
16751709
self.surface_area = (
16761710
np.pi * self.slant_length * (self.top_radius + self.bottom_radius)
16771711
)
1712+
self.evaluate_shape()
1713+
return None
1714+
1715+
def evaluate_shape(self):
1716+
# Assuming the tail is a cone, calculate the shape vector
1717+
self.shape_vec = [
1718+
np.array([0, self.length]),
1719+
np.array([self.top_radius, self.bottom_radius]),
1720+
]
1721+
return None
16781722

16791723
def evaluate_lift_coefficient(self):
16801724
"""Calculates and returns tail's lift coefficient.

0 commit comments

Comments
 (0)