Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions rocketpy/rocket/aero_surface/nose_cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def kind(self, value):
self.y_nosecone = Function(lambda x: x * self.base_radius / self.length)

case "lvhaack":
self.k = 0.563
self.k = 7 / 16

def theta_lvhaack(x):
return np.arccos(1 - 2 * max(min(x / self.length, 1), 0))
Expand Down Expand Up @@ -293,7 +293,7 @@ def theta_vonkarman(x):
)
)
case "parabolic":
self.k = 0.5
self.k = 7 / 15
self.y_nosecone = Function(
lambda x: (
self.base_radius
Expand Down
33 changes: 33 additions & 0 deletions tests/unit/rocket/aero_surface/test_aero_surfaces.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from unittest.mock import patch

import numpy as np
import pytest
from scipy.integrate import quad

from rocketpy import NoseCone

Expand All @@ -10,6 +12,37 @@
NOSECONE_KIND = "powerseries"


@pytest.mark.parametrize(
"kind, power",
[
("conical", None),
("ogive", None),
("elliptical", None),
("vonkarman", None),
("lvhaack", None),
("parabolic", None),
("powerseries", 0.5),
],
)
def test_nose_cone_center_of_pressure_matches_shape(kind, power):
"""Checks the center of pressure against the volume of the nose cone shape.
From slender body theory, it's at L - V / A from the tip, where L is the
length, V is the volume and A is the base area.
"""
length, base_radius = 0.5, 0.06
nose_cone = NoseCone(
length=length,
base_radius=base_radius,
rocket_radius=base_radius,
kind=kind,
power=power,
)
volume, _ = quad(lambda x: np.pi * nose_cone.y_nosecone(x) ** 2, 0, length)
base_area = np.pi * base_radius**2

assert nose_cone.cpz == pytest.approx(length - volume / base_area, rel=1e-6)


@pytest.mark.parametrize(
"power, bluffness",
[
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/rocket/test_rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ def test_static_margin_internal_use_does_not_warn(calisto_motorless):

@pytest.mark.parametrize(
"k, type_",
([2 / 3, "conical"], [0.46469957130675876, "ogive"], [0.563, "lvhaack"]),
(
[2 / 3, "conical"],
[0.46469957130675876, "ogive"],
[7 / 16, "lvhaack"],
[7 / 15, "parabolic"],
),
)
def test_add_nose_assert_cp_cm_plus_nose(k, type_, calisto, dimensionless_calisto, m):
calisto.add_nose(length=0.55829, kind=type_, position=1.160)
Expand Down