Skip to content

Commit

Permalink
FIX: make sure NoseCone.rocket_radius is always defined
Browse files Browse the repository at this point in the history
  • Loading branch information
giovaniceotto committed Feb 14, 2024
1 parent 700c165 commit 09fa805
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rocketpy/rocket/aero_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,20 @@ def evaluate_geometrical_parameters(self):
# If base radius is not given, the ratio between base radius and
# rocket radius is assumed as 1, meaning that the nose cone has the
# same radius as the rocket
if self.base_radius is None or self.rocket_radius is None:
if self.base_radius is None and self.rocket_radius is not None:
self.radius_ratio = 1
self.base_radius = self.rocket_radius
elif self.base_radius is not None and self.rocket_radius is None:
self.radius_ratio = 1
self.rocket_radius = self.base_radius
# If base radius is given, the ratio between base radius and rocket
# radius is calculated
else:
elif self.base_radius is not None or self.rocket_radius is not None:
self.radius_ratio = self.base_radius / self.rocket_radius
else:
raise ValueError(
"Either base radius or rocket radius must be given to calculate the nose cone radius ratio."
)

self.fineness_ratio = self.length / (2 * self.base_radius)
return None
Expand Down

0 comments on commit 09fa805

Please sign in to comment.