Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Free-Form Fins #694

Merged
merged 22 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rocketpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
Components,
EllipticalFins,
Fins,
FreeFormFins,
GenericSurface,
LinearGenericSurface,
NoseCone,
Expand Down
67 changes: 67 additions & 0 deletions rocketpy/plots/aero_surface_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,73 @@ def draw(self):
plt.show()


class _FreeFormFinsPlots(_FinsPlots):
"""Class that contains all free form fin plots."""

# pylint: disable=too-many-statements
def draw(self):
"""Draw the fin shape along with some important information, including
the center line, the quarter line and the center of pressure position.
Returns
-------
None
"""
Comment on lines +387 to +394
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The draw method is not closing the fin draw when the last point is different than the initial point, as shown in the figure below

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are we going to close it? linearly? we should provide an example (in a future PR maybe) showing case when the fin is set at a non-planar surface. for example when the fins are placed on the tail/transition

Copy link
Contributor

@Lucas-Prates Lucas-Prates Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I assumed that the Fin is defined by a closed polygon. Indeed, the documentation states that "the last point should be the first one." So, if the user forgot to make sure the last point is the first one, we either should raise an error or just close it ourselves.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model assumes that it is closed linearly. I will add the last line in the plot as well

# Color cycle [#348ABD, #A60628, #7A68A6, #467821, #D55E00, #CC79A7,
# #56B4E9, #009E73, #F0E442, #0072B2]

# Center of pressure
cp_point = [self.aero_surface.cpz, self.aero_surface.Yma]

# Mean Aerodynamic Chord
yma_line = plt.Line2D(
(
self.aero_surface.mac_lead,
self.aero_surface.mac_lead + self.aero_surface.mac_length,
),
(self.aero_surface.Yma, self.aero_surface.Yma),
color="#467821",
linestyle="--",
label="Mean Aerodynamic Chord",
)

# Plotting
fig = plt.figure(figsize=(7, 4))
with plt.style.context("bmh"):
ax = fig.add_subplot(111)

# Fin
ax.scatter(
self.aero_surface.shape_vec[0],
self.aero_surface.shape_vec[1],
color="#A60628",
)
ax.plot(
self.aero_surface.shape_vec[0],
self.aero_surface.shape_vec[1],
color="#A60628",
)
# line from the last point to the first point
ax.plot(
[self.aero_surface.shape_vec[0][-1], self.aero_surface.shape_vec[0][0]],
[self.aero_surface.shape_vec[1][-1], self.aero_surface.shape_vec[1][0]],
color="#A60628",
)

ax.add_line(yma_line)
ax.scatter(*cp_point, label="Center of Pressure", color="red", s=100, zorder=10)
ax.scatter(*cp_point, facecolors="none", edgecolors="red", s=500, zorder=10)

# Plot settings
ax.set_xlabel("Root chord (m)")
ax.set_ylabel("Span (m)")
ax.set_title("Free Form Fin Cross Section")
ax.legend(bbox_to_anchor=(1.05, 1.0), loc="upper left")

plt.tight_layout()
plt.show()


class _TailPlots(_AeroSurfacePlots):
"""Class that contains all tail plots."""

Expand Down
4 changes: 4 additions & 0 deletions rocketpy/prints/aero_surface_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ class _EllipticalFinsPrints(_FinsPrints):
"""Class that contains all elliptical fins prints."""


class _FreeFormFinsPrints(_FinsPrints):
"""Class that contains all free form fins prints."""


class _TailPrints(_AeroSurfacePrints):
"""Class that contains all tail prints."""

Expand Down
1 change: 1 addition & 0 deletions rocketpy/rocket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
AirBrakes,
EllipticalFins,
Fins,
FreeFormFins,
GenericSurface,
LinearGenericSurface,
NoseCone,
Expand Down
7 changes: 6 additions & 1 deletion rocketpy/rocket/aero_surface/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from rocketpy.rocket.aero_surface.aero_surface import AeroSurface
from rocketpy.rocket.aero_surface.air_brakes import AirBrakes
from rocketpy.rocket.aero_surface.fins import EllipticalFins, Fins, TrapezoidalFins
from rocketpy.rocket.aero_surface.fins import (
EllipticalFins,
Fins,
FreeFormFins,
TrapezoidalFins,
)
from rocketpy.rocket.aero_surface.generic_surface import GenericSurface
from rocketpy.rocket.aero_surface.linear_generic_surface import LinearGenericSurface
from rocketpy.rocket.aero_surface.nose_cone import NoseCone
Expand Down
1 change: 1 addition & 0 deletions rocketpy/rocket/aero_surface/fins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from rocketpy.rocket.aero_surface.fins.elliptical_fins import EllipticalFins
from rocketpy.rocket.aero_surface.fins.fins import Fins
from rocketpy.rocket.aero_surface.fins.free_form_fins import FreeFormFins
from rocketpy.rocket.aero_surface.fins.trapezoidal_fins import TrapezoidalFins
Loading
Loading