8000 ENH: Enable only radial burning by caioessouza · Pull Request #815 · RocketPy-Team/RocketPy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Enable only radial burning #815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
super() corrected and dict functions updated #801
The new parameter of the SolidMotor class was removed from super, since it's not on the Motor class. The dict functions were updated to take this new parameter into acount. Also the comments about the SolidMotor class parameters were updated.

Still need to do some tests running the code to be sure everything is ok, then I can open the PR.
  • Loading branch information
caioessouza committed Apr 30, 2025
commit 4f32f88d2f5c747b0b85097a95e400903b7662c5
33 changes: 11 additions & 22 deletions rocketpy/motors/solid_motor.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is important to add at least an integration test to this new implementation.

Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ class Function. Thrust units are Newtons.
positions specified. Options are "nozzle_to_combustion_chamber" and
"combustion_chamber_to_nozzle". Default is
"nozzle_to_combustion_chamber".
only_radial_burn : boolean, optional
If True, inhibits the grain from burning axially, only computing
radial burn. Otherwise, if False, allows the grain to also burn
axially. May be useful for axially inhibited grains or hybrid motors.
Default is False.

Returns
-------
Expand All @@ -316,7 +321,6 @@ class Function. Thrust units are Newtons.
reshape_thrust_curve=reshape_thrust_curve,
interpolation_method=interpolation_method,
coordinate_system_orientation=coordinate_system_orientation,
only_radial_burn = only_radial_burn,
)
# Nozzle parameters
self.throat_radius = throat_radius
Expand Down Expand Up @@ -484,13 +488,7 @@ def geometry_dot(t, y):
# Compute state vector derivative
grain_inner_radius, grain_height = y
if self.only_radial_burn:
burn_area = (
2
* np.pi
* (
grain_inner_radius * grain_height
)
)
burn_area = 2 * np.pi * (grain_inner_radius * grain_height)
else:
burn_area = (
2
Expand All @@ -516,12 +514,7 @@ def geometry_jacobian(t, y):
grain_inner_radius, grain_height = y
if self.only_radial_burn:
factor = volume_diff / (
2
* np.pi
* (
grain_inner_radius * grain_height
)
** 2
2 * np.pi * (grain_inner_radius * grain_height) ** 2
)

inner_radius_derivative_wrt_inner_radius = factor * (
Expand All @@ -537,8 +530,6 @@ def geometry_jacobian(t, y):
inner_radius_derivative_wrt_height,
],
[height_derivative_wrt_inner_radius, height_derivative_wrt_height],


]

else:
Expand Down Expand Up @@ -568,10 +559,8 @@ def geometry_jacobian(t, y):
inner_radius_derivative_wrt_height,
],
[height_derivative_wrt_inner_radius, height_derivative_wrt_height],


]

def terminate_burn(t, y): # pylint: disable=unused-argument
end_function = (self.grain_outer_radius - y[0]) * y[1]
return end_function
Expand Down Expand Up @@ -625,9 +614,7 @@ def burn_area(self):
burn_area = (
2
* np.pi
* (
self.grain_inner_radius * self.grain_height
)
* (self.grain_inner_radius * self.grain_height)
* self.grain_number
)
else:
Expand Down Expand Up @@ -812,6 +799,7 @@ def to_dict(self, include_outputs=False):
"grain_initial_height": self.grain_initial_height,
"grain_separation": self.grain_separation,
"grains_center_of_mass_position": self.grains_center_of_mass_position,
"only_radial_burn": self.only_radial_burn,
}
)

Expand Down Expand Up @@ -855,4 +843,5 @@ def from_dict(cls, data):
throat_radius=data["throat_radius"],
interpolation_method=data["interpolate"],
coordinate_system_orientation=data["coordinate_system_orientation"],
only_radial_burn=data.get("only_radial_burn", False),
)
0