Skip to content

Commit af2de0c

Browse files
committed
TST: implement tests related to trapezoidal fin sweep
1 parent 909b38e commit af2de0c

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

tests/test_rocket.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,70 @@ def test_add_tail_assert_cp_cm_plus_tail(rocket, dimensionless_rocket, m):
340340
)
341341

342342

343+
@pytest.mark.parametrize(
344+
"sweep_angle, expected_fin_cpz, expected_clalpha, expected_cpz_cm",
345+
[(39.8, 2.51, 3.16, 1.65), (-10, 2.47, 3.21, 1.63), (29.1, 2.50, 3.28, 1.66)],
346+
)
347+
def test_add_trapezoidal_fins_sweep_angle(
348+
rocket, sweep_angle, expected_fin_cpz, expected_clalpha, expected_cpz_cm
349+
):
350+
# Reference values from OpenRocket
351+
Nose = rocket.addNose(length=0.55829, kind="vonKarman", distanceToCM=0.71971)
352+
353+
FinSet = rocket.addTrapezoidalFins(
354+
n=3,
355+
span=0.090,
356+
rootChord=0.100,
357+
tipChord=0.050,
358+
sweepAngle=sweep_angle,
359+
distanceToCM=-1.182,
360+
)
361+
362+
# Check center of pressure
363+
translate = 0.55829 + 0.71971
364+
cpz = FinSet["cp"][2]
365+
assert translate - cpz == pytest.approx(expected_fin_cpz, 0.01)
366+
367+
# Check lift coefficient derivative
368+
cl_alpha = FinSet["cl"](1, 0.0)
369+
assert cl_alpha == pytest.approx(expected_clalpha, 0.01)
370+
371+
# Check rocket's center of pressure (just double checking)
372+
assert translate - rocket.cpPosition == pytest.approx(expected_cpz_cm, 0.01)
373+
374+
375+
@pytest.mark.parametrize(
376+
"sweep_length, expected_fin_cpz, expected_clalpha, expected_cpz_cm",
377+
[(0.075, 2.51, 3.16, 1.65), (-0.0159, 2.47, 3.21, 1.63), (0.05, 2.50, 3.28, 1.66)],
378+
)
379+
def test_add_trapezoidal_fins_sweep_length(
380+
rocket, sweep_length, expected_fin_cpz, expected_clalpha, expected_cpz_cm
381+
):
382+
# Reference values from OpenRocket
383+
Nose = rocket.addNose(length=0.55829, kind="vonKarman", distanceToCM=0.71971)
384+
385+
FinSet = rocket.addTrapezoidalFins(
386+
n=3,
387+
span=0.090,
388+
rootChord=0.100,
389+
tipChord=0.050,
390+
sweepLength=sweep_length,
391+
distanceToCM=-1.182,
392+
)
393+
394+
# Check center of pressure
395+
translate = 0.55829 + 0.71971
396+
cpz = FinSet["cp"][2]
397+
assert translate - cpz == pytest.approx(expected_fin_cpz, 0.01)
398+
399+
# Check lift coefficient derivative
400+
cl_alpha = FinSet["cl"](1, 0.0)
401+
assert cl_alpha == pytest.approx(expected_clalpha, 0.01)
402+
403+
# Check rocket's center of pressure (just double checking)
404+
assert translate - rocket.cpPosition == pytest.approx(expected_cpz_cm, 0.01)
405+
406+
343407
def test_add_fins_assert_cp_cm_plus_fins(rocket, dimensionless_rocket, m):
344408
rocket.addTrapezoidalFins(
345409
4,

0 commit comments

Comments
 (0)