Skip to content

Commit

Permalink
ENH: add prandtl-glauert rule to nose cone and tail
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusStano committed May 23, 2024
1 parent e7b730a commit 7253f86
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions rocketpy/rocket/aero_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ def __init__(self, name):
self.name = name
return None

# Defines beta parameter
def _beta(_, mach):
"""Defines a parameter that is often used in aerodynamic
equations. It is commonly used in the Prandtl factor which
corrects subsonic force coefficients for compressible flow.
Parameters
----------
mach : int, float
Number of mach.
Returns
-------
beta : int, float
Value that characterizes flow speed based on the mach number.
"""

if mach < 0.8:
return np.sqrt(1 - mach**2)
elif mach < 1.1:
return np.sqrt(1 - 0.8**2)
else:
return np.sqrt(mach**2 - 1)

@abstractmethod
def evaluate_center_of_pressure(self):
"""Evaluates the center of pressure of the aerodynamic surface in local
Expand Down Expand Up @@ -465,7 +489,7 @@ def evaluate_lift_coefficient(self):
# It must be set as a Function because it will be called and treated
# as a function of mach in the simulation.
self.clalpha = Function(
lambda mach: 2 * self.radius_ratio**2,
lambda mach: 2 / self._beta(mach) * self.radius_ratio**2,
"Mach",
f"Lift coefficient derivative for {self.name}",
)
Expand Down Expand Up @@ -781,7 +805,7 @@ def evaluate_lift_coefficient(self):
clalpha2D_incompressible *= 180 / np.pi

# Correcting for compressible flow (apply Prandtl-Glauert correction)
clalpha2D = Function(lambda mach: clalpha2D_incompressible / self.__beta(mach))
clalpha2D = Function(lambda mach: clalpha2D_incompressible / self._beta(mach))

# Diederich's Planform Correlation Parameter
FD = 2 * np.pi * self.AR / (clalpha2D * np.cos(self.gamma_c))
Expand Down Expand Up @@ -857,30 +881,6 @@ def evaluate_roll_parameters(self):
self.roll_parameters = [clf_delta, cld_omega, self.cant_angle_rad]
return self.roll_parameters

# Defines beta parameter
def __beta(_, mach):
"""Defines a parameter that is often used in aerodynamic
equations. It is commonly used in the Prandtl factor which
corrects subsonic force coefficients for compressible flow.
Parameters
----------
mach : int, float
Number of mach.
Returns
-------
beta : int, float
Value that characterizes flow speed based on the mach number.
"""

if mach < 0.8:
return np.sqrt(1 - mach**2)
elif mach < 1.1:
return np.sqrt(1 - 0.8**2)
else:
return np.sqrt(mach**2 - 1)

# Defines number of fins factor
def __fin_num_correction(_, n):
"""Calculates a correction factor for the lift coefficient of multiple
Expand Down Expand Up @@ -1748,6 +1748,7 @@ def evaluate_lift_coefficient(self):
# as a function of mach in the simulation.
self.clalpha = Function(
lambda mach: 2
/ self._beta(mach)
* (
(self.bottom_radius / self.rocket_radius) ** 2
- (self.top_radius / self.rocket_radius) ** 2
Expand Down

0 comments on commit 7253f86

Please sign in to comment.