Closed
Description
Describe the bug
When setting up a rocket with multiple fuselage sections with different diameters, RocketPy may calculate the wrong value of center of pressure position.
To Reproduce
Here is an example:
from rocketpy import Rocket, NoseCone, Tail, TrapezoidalFins
radius_1 = 0.1
radius_2 = 0.15
multiple_diameter_rocket = Rocket(
radius=radius_2,
mass=1,
inertia=(1, 1, 1),
power_off_drag=1,
power_on_drag=1,
center_of_mass_without_motor=1,
coordinate_system_orientation="nose_to_tail",
)
nose = NoseCone(
length=0.5,
kind="vonKarman",
base_radius=radius_1,
rocket_radius=radius_1,
bluffness=None,
name="Nose Cone",
)
transition = Tail(
length=0.1,
top_radius=radius_1,
bottom_radius=radius_2,
rocket_radius=radius_2,
name="Transition",
)
fins = TrapezoidalFins(
n=4,
span=0.2,
root_chord=0.3,
tip_chord=0.2,
name="Fins",
rocket_radius=radius_2,
)
boat_tail = Tail(
length=0.1,
top_radius=radius_2,
bottom_radius=radius_2/2,
rocket_radius=radius_2,
name="Tail",
)
multiple_diameter_rocket.add_surfaces([nose, transition, fins, boat_tail], [0, 1.5, 2.5, 3])
print(multiple_diameter_rocket.static_margin(0))
Expected behavior
The expected static margin for the example above is: 2.71
The returned value is: 1.75
Screenshots
Current result:
Additional context
This bug was caught by Faraday Rocketry UPV when attempting to simulate a two-stage rocket.
Workaround
The current workaround is to use all rocket_radius
values as the largest rocket radius. This causes the following side-effects:
Rocket.draw
will return a drawing where the fuselage does not meet the nose cone or transitions appropriately.- Lift coefficient interference factors between fins and the fuselage will be badly estimated. This, however, should result in negligible differences in the overall lift coefficient and center of pressure position, for most cases.
Here is an example code:
from rocketpy import Rocket, NoseCone, Tail, TrapezoidalFins
radius_1 = 0.1
radius_2 = 0.15
multiple_diameter_rocket = Rocket(
radius=radius_2,
mass=1,
inertia=(1, 1, 1),
power_off_drag=1,
power_on_drag=1,
center_of_mass_without_motor=1,
coordinate_system_orientation="nose_to_tail",
)
nose = NoseCone(
length=0.5,
kind="vonKarman",
base_radius=radius_1,
rocket_radius=radius_1,
bluffness=None,
name="Nose Cone",
)
transition = Tail(
length=0.1,
top_radius=radius_1,
bottom_radius=radius_2,
rocket_radius=radius_2,
name="Transition",
)
fins = TrapezoidalFins(
n=4,
span=0.2,
root_chord=0.3,
tip_chord=0.2,
name="Fins",
rocket_radius=radius_2,
)
boat_tail = Tail(
length=0.1,
top_radius=radius_2,
bottom_radius=radius_2/2,
rocket_radius=radius_2,
name="Tail",
)
multiple_diameter_rocket.add_surfaces([nose, transition, fins, boat_tail], [0, 1.5, 2.5, 3])
print(multiple_diameter_rocket.static_margin(0))
Results in a static margin of: 2.71.
The rocket drawing ends up like this:
Metadata
Metadata
Assignees
Type
Projects
Status
Closed