Skip to content

Commit 06332e9

Browse files
Merge pull request #325 from RocketPy-Team/maint/move-flutter-analysis
MAINT: move flutter analysis into utilities submodule
2 parents f36f866 + 185daf5 commit 06332e9

File tree

4 files changed

+303
-194
lines changed

4 files changed

+303
-194
lines changed

rocketpy/Flight.py

Lines changed: 0 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -511,16 +511,6 @@ class Flight:
511511
Defined as the minimum angle between the attitude vector and
512512
the freestream velocity vector. Can be called or accessed as
513513
array.
514-
515-
Fin Flutter Analysis:
516-
Flight.flutterMachNumber: Function
517-
The freestream velocity at which begins flutter phenomenon in
518-
rocket's fins. It's expressed as a function of the air pressure
519-
experienced for the rocket. Can be called or accessed as array.
520-
Flight.difference: Function
521-
Difference between flutterMachNumber and machNumber, as a function of time.
522-
Flight.safetyFactor: Function
523-
Ratio between the flutterMachNumber and machNumber, as a function of time.
524514
"""
525515

526516
def __init__(
@@ -1069,9 +1059,6 @@ def __init_post_process_variables(self):
10691059
"""Initialize post-process variables."""
10701060
# Initialize all variables calculated after initialization.
10711061
# Important to do so that MATLAB® can access them
1072-
self.flutterMachNumber = Function(0)
1073-
self.difference = Function(0)
1074-
self.safetyFactor = Function(0)
10751062
self._drift = Function(0)
10761063
self._bearing = Function(0)
10771064
self._latitude = Function(0)
@@ -2681,160 +2668,6 @@ def calculateStallWindVelocity(self, stallAngle):
26812668

26822669
return None
26832670

2684-
def calculateFinFlutterAnalysis(self, finThickness, shearModulus):
2685-
"""Calculate, create and plot the Fin Flutter velocity, based on the
2686-
pressure profile provided by Atmospheric model selected. It considers the
2687-
Flutter Boundary Equation that is based on a calculation published in
2688-
NACA Technical Paper 4197.
2689-
Be careful, these results are only estimates of a real problem and may
2690-
not be useful for fins made from non-isotropic materials. These results
2691-
should not be used as a way to fully prove the safety of any rocket's fins.
2692-
IMPORTANT: This function works if only a single set of fins is added.
2693-
2694-
Parameters
2695-
----------
2696-
finThickness : float
2697-
The fin thickness, in meters
2698-
shearModulus : float
2699-
Shear Modulus of fins' material, must be given in Pascal
2700-
2701-
Return
2702-
------
2703-
None
2704-
"""
2705-
2706-
s = (self.rocket.tipChord + self.rocket.rootChord) * self.rocket.span / 2
2707-
ar = self.rocket.span * self.rocket.span / s
2708-
la = self.rocket.tipChord / self.rocket.rootChord
2709-
2710-
# Calculate the Fin Flutter Mach Number
2711-
self.flutterMachNumber = (
2712-
(shearModulus * 2 * (ar + 2) * (finThickness / self.rocket.rootChord) ** 3)
2713-
/ (1.337 * (ar**3) * (la + 1) * self.pressure)
2714-
) ** 0.5
2715-
2716-
# Calculate difference between Fin Flutter Mach Number and the Rocket Speed
2717-
self.difference = self.flutterMachNumber - self.MachNumber
2718-
2719-
# Calculate a safety factor for flutter
2720-
self.safetyFactor = self.flutterMachNumber / self.MachNumber
2721-
2722-
# Calculate the minimum Fin Flutter Mach Number and Velocity
2723-
# Calculate the time and height of minimum Fin Flutter Mach Number
2724-
minflutterMachNumberTimeIndex = np.argmin(self.flutterMachNumber[:, 1])
2725-
minflutterMachNumber = self.flutterMachNumber[minflutterMachNumberTimeIndex, 1]
2726-
minMFTime = self.flutterMachNumber[minflutterMachNumberTimeIndex, 0]
2727-
minMFHeight = self.z(minMFTime) - self.env.elevation
2728-
minMFVelocity = minflutterMachNumber * self.env.speedOfSound(minMFHeight)
2729-
2730-
# Calculate minimum difference between Fin Flutter Mach Number and the Rocket Speed
2731-
# Calculate the time and height of the difference ...
2732-
minDifferenceTimeIndex = np.argmin(self.difference[:, 1])
2733-
minDif = self.difference[minDifferenceTimeIndex, 1]
2734-
minDifTime = self.difference[minDifferenceTimeIndex, 0]
2735-
minDifHeight = self.z(minDifTime) - self.env.elevation
2736-
minDifVelocity = minDif * self.env.speedOfSound(minDifHeight)
2737-
2738-
# Calculate the minimum Fin Flutter Safety factor
2739-
# Calculate the time and height of minimum Fin Flutter Safety factor
2740-
minSFTimeIndex = np.argmin(self.safetyFactor[:, 1])
2741-
minSF = self.safetyFactor[minSFTimeIndex, 1]
2742-
minSFTime = self.safetyFactor[minSFTimeIndex, 0]
2743-
minSFHeight = self.z(minSFTime) - self.env.elevation
2744-
2745-
# Print fin's geometric parameters
2746-
print("Fin's geometric parameters")
2747-
print("Surface area (S): {:.4f} m2".format(s))
2748-
print("Aspect ratio (AR): {:.3f}".format(ar))
2749-
print("TipChord/RootChord = \u03BB = {:.3f}".format(la))
2750-
print("Fin Thickness: {:.5f} m".format(finThickness))
2751-
2752-
# Print fin's material properties
2753-
print("\n\nFin's material properties")
2754-
print("Shear Modulus (G): {:.3e} Pa".format(shearModulus))
2755-
2756-
# Print a summary of the Fin Flutter Analysis
2757-
print("\n\nFin Flutter Analysis")
2758-
print(
2759-
"Minimum Fin Flutter Velocity: {:.3f} m/s at {:.2f} s".format(
2760-
minMFVelocity, minMFTime
2761-
)
2762-
)
2763-
print("Minimum Fin Flutter Mach Number: {:.3f} ".format(minflutterMachNumber))
2764-
# print(
2765-
# "Altitude of minimum Fin Flutter Velocity: {:.3f} m (AGL)".format(
2766-
# minMFHeight
2767-
# )
2768-
# )
2769-
print(
2770-
"Minimum of (Fin Flutter Mach Number - Rocket Speed): {:.3f} m/s at {:.2f} s".format(
2771-
minDifVelocity, minDifTime
2772-
)
2773-
)
2774-
print(
2775-
"Minimum of (Fin Flutter Mach Number - Rocket Speed): {:.3f} Mach at {:.2f} s".format(
2776-
minDif, minDifTime
2777-
)
2778-
)
2779-
# print(
2780-
# "Altitude of minimum (Fin Flutter Mach Number - Rocket Speed): {:.3f} m (AGL)".format(
2781-
# minDifHeight
2782-
# )
2783-
# )
2784-
print(
2785-
"Minimum Fin Flutter Safety Factor: {:.3f} at {:.2f} s".format(
2786-
minSF, minSFTime
2787-
)
2788-
)
2789-
print(
2790-
"Altitude of minimum Fin Flutter Safety Factor: {:.3f} m (AGL)\n\n".format(
2791-
minSFHeight
2792-
)
2793-
)
2794-
2795-
# Create plots
2796-
fig12 = plt.figure(figsize=(6, 9))
2797-
ax1 = plt.subplot(311)
2798-
ax1.plot()
2799-
ax1.plot(
2800-
self.flutterMachNumber[:, 0],
2801-
self.flutterMachNumber[:, 1],
2802-
label="Fin flutter Mach Number",
2803-
)
2804-
ax1.plot(
2805-
self.MachNumber[:, 0],
2806-
self.MachNumber[:, 1],
2807-
label="Rocket Freestream Speed",
2808-
)
2809-
ax1.set_xlim(0, self.apogeeTime if self.apogeeTime != 0.0 else self.tFinal)
2810-
ax1.set_title("Fin Flutter Mach Number x Time(s)")
2811-
ax1.set_xlabel("Time (s)")
2812-
ax1.set_ylabel("Mach")
2813-
ax1.legend()
2814-
ax1.grid(True)
2815-
2816-
ax2 = plt.subplot(312)
2817-
ax2.plot(self.difference[:, 0], self.difference[:, 1])
2818-
ax2.set_xlim(0, self.apogeeTime if self.apogeeTime != 0.0 else self.tFinal)
2819-
ax2.set_title("Mach flutter - Freestream velocity")
2820-
ax2.set_xlabel("Time (s)")
2821-
ax2.set_ylabel("Mach")
2822-
ax2.grid()
2823-
2824-
ax3 = plt.subplot(313)
2825-
ax3.plot(self.safetyFactor[:, 0], self.safetyFactor[:, 1])
2826-
ax3.set_xlim(self.outOfRailTime, self.apogeeTime)
2827-
ax3.set_ylim(0, 6)
2828-
ax3.set_title("Fin Flutter Safety Factor")
2829-
ax3.set_xlabel("Time (s)")
2830-
ax3.set_ylabel("Safety Factor")
2831-
ax3.grid()
2832-
2833-
plt.subplots_adjust(hspace=0.5)
2834-
plt.show()
2835-
2836-
return None
2837-
28382671
def exportPressures(self, fileName, timeStep):
28392672
"""Exports the pressure experienced by the rocket during the flight to
28402673
an external file, the '.csv' format is recommended, as the columns will

0 commit comments

Comments
 (0)