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

BUG: Add reference area factor correction to aero surfaces (solves #557) #558

Merged
merged 10 commits into from
Feb 22, 2024
9 changes: 8 additions & 1 deletion rocketpy/prints/rocket_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ def rocket_aerodynamics_quantities(self):
print("\nAerodynamics Lift Coefficient Derivatives\n")
for surface, position in self.rocket.aerodynamic_surfaces:
name = surface.name
# ref_factor corrects lift for different reference areas
ref_factor = (surface.rocket_radius / self.rocket.radius) ** 2
Gui-FernandesBR marked this conversation as resolved.
Show resolved Hide resolved
print(
name
+ " Lift Coefficient Derivative: {:.3f}".format(surface.clalpha(0))
+ " Lift Coefficient Derivative: {:.3f}".format(
ref_factor * surface.clalpha(0)
)
+ "/rad"
)

Expand All @@ -135,6 +139,9 @@ def rocket_aerodynamics_quantities(self):
print(
f"Center of Mass position (time=0): {self.rocket.center_of_mass(0):.3f} m"
)
print(
f"Center of Pressure position (time=0): {self.rocket.cp_position(0):.3f} m"
)
print(
"Initial Static Margin (mach=0, time=0): "
+ "{:.3f}".format(self.rocket.static_margin(0))
Expand Down
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 @@
# 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

Check warning on line 354 in rocketpy/rocket/aero_surface.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/rocket/aero_surface.py#L354

Added line #L354 was not covered by tests
elif self.base_radius is not None and self.rocket_radius is None:
self.radius_ratio = 1
self.rocket_radius = self.base_radius

Check warning on line 357 in rocketpy/rocket/aero_surface.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/rocket/aero_surface.py#L356-L357

Added lines #L356 - L357 were not covered by tests
# 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:
giovaniceotto marked this conversation as resolved.
Show resolved Hide resolved
self.radius_ratio = self.base_radius / self.rocket_radius
else:
raise ValueError(

Check warning on line 363 in rocketpy/rocket/aero_surface.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/rocket/aero_surface.py#L363

Added line #L363 was not covered by tests
"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
30 changes: 20 additions & 10 deletions rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,13 @@ def evaluate_center_of_pressure(self):
# Calculate total lift coefficient derivative and center of pressure
if len(self.aerodynamic_surfaces) > 0:
for aero_surface, position in self.aerodynamic_surfaces:
self.total_lift_coeff_der += aero_surface.clalpha
self.cp_position += aero_surface.clalpha * (
position - self._csys * aero_surface.cpz
# ref_factor corrects lift for different reference areas
ref_factor = (aero_surface.rocket_radius / self.radius) ** 2
self.total_lift_coeff_der += ref_factor * aero_surface.clalpha
self.cp_position += (
ref_factor
* aero_surface.clalpha
* (position - self._csys * aero_surface.cpz)
Gui-FernandesBR marked this conversation as resolved.
Show resolved Hide resolved
)
self.cp_position /= self.total_lift_coeff_der

Expand Down Expand Up @@ -871,7 +875,9 @@ def add_tail(
self.add_surfaces(tail, position)
return tail

def add_nose(self, length, kind, position, bluffness=0, name="Nose Cone"):
def add_nose(
self, length, kind, position, bluffness=0, base_radius=None, name="Nose Cone"
):
giovaniceotto marked this conversation as resolved.
Show resolved Hide resolved
"""Creates a nose cone, storing its parameters as part of the
aerodynamic_surfaces list. Its parameters are the axial position
along the rocket and its derivative of the coefficient of lift
Expand All @@ -892,6 +898,8 @@ def add_nose(self, length, kind, position, bluffness=0, name="Nose Cone"):
bluffness : float, optional
Ratio between the radius of the circle on the tip of the ogive and
the radius of the base of the ogive.
base_radius : int, float, optional
Nose cone base radius in meters. If not given, use rocket radius.
Gui-FernandesBR marked this conversation as resolved.
Show resolved Hide resolved
name : string
Nose cone name. Default is "Nose Cone".

Expand All @@ -907,8 +915,8 @@ def add_nose(self, length, kind, position, bluffness=0, name="Nose Cone"):
nose = NoseCone(
length=length,
kind=kind,
base_radius=self.radius,
rocket_radius=self.radius,
base_radius=base_radius or self.radius,
rocket_radius=base_radius or self.radius,
bluffness=bluffness,
name=name,
)
Expand Down Expand Up @@ -983,8 +991,9 @@ def add_trapezoidal_fins(
with its base perpendicular to the rocket's axis. Cannot be used in
conjunction with sweep_length.
radius : int, float, optional
Reference radius to calculate lift coefficient. If None, which is
default, use rocket radius.
Reference fuselage radius where the fins are located. This is used
to calculate lift coefficient and to draw the rocket. If None,
which is default, use rocket radius.
airfoil : tuple, optional
Default is null, in which case fins will be treated as flat plates.
Otherwise, if tuple, fins will be considered as airfoils. The
Expand Down Expand Up @@ -1064,8 +1073,9 @@ def add_elliptical_fins(
Fins cant angle with respect to the rocket centerline. Must be given
in degrees.
radius : int, float, optional
Reference radius to calculate lift coefficient. If None, which
is default, use rocket radius.
Reference fuselage radius where the fins are located. This is used
to calculate lift coefficient and to draw the rocket. If None,
which is default, use rocket radius.
airfoil : tuple, optional
Default is null, in which case fins will be treated as flat plates.
Otherwise, if tuple, fins will be considered as airfoils. The
Expand Down
Loading