Skip to content

Commit

Permalink
ENH: add option to enter sweep angle in Rocket.addTrapezoidalFins
Browse files Browse the repository at this point in the history
  • Loading branch information
giovaniceotto committed Oct 12, 2022
1 parent 89c36c0 commit 909b38e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion rocketpy/Rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ def addTrapezoidalFins(
distanceToCM,
cantAngle=0,
sweepLength=None,
sweepAngle=None,
radius=None,
airfoil=None,
):
Expand Down Expand Up @@ -514,6 +515,13 @@ def addTrapezoidalFins(
parallel to the rocket centerline. If not given, the sweep length is
assumed to be equal the root chord minus the tip chord, in which case the
fin is a right trapezoid with its base perpendicular to the rocket's axis.
Cannot be used in conjunction with sweepAngle.
sweepAngle : int, float, optional
Fins sweep angle with respect to the rocket centerline. Must
be given in degrees. If not given, the sweep angle is automatically
calculated, in which case the fin is assumed to be a right trapezoid with
its base perpendicular to the rocket's axis.
Cannot be used in conjunction with sweepLength.
radius : int, float, optional
Reference radius to calculate lift coefficient. If None, which
is default, use rocket radius. Otherwise, enter the radius
Expand Down Expand Up @@ -545,11 +553,21 @@ def addTrapezoidalFins(
"""
# Retrieves and convert basic geometrical parameters
Cr, Ct = rootChord, tipChord
sweepLength = Cr - Ct if sweepLength is None else sweepLength
s = span
radius = self.radius if radius is None else radius
cantAngleRad = np.radians(cantAngle)

# Check if sweep angle or sweep length is given
if sweepLength is not None and sweepAngle is not None:
raise ValueError("Cannot use sweepLength and sweepAngle together")
elif sweepAngle is not None:
sweepLength = np.tan(sweepAngle * np.pi / 180) * span
elif sweepLength is None:
sweepLength = Cr - Ct
else:
# Sweep length is given
pass

# Compute auxiliary geometrical parameters
d = 2 * radius
Aref = np.pi * radius**2
Expand Down

0 comments on commit 909b38e

Please sign in to comment.