Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f048c56
Functions associated to the regression updated #801
caioessouza Apr 24, 2025
4f32f88
super() corrected and dict functions updated #801
caioessouza Apr 30, 2025
550e149
Last update #801
caioessouza May 3, 2025
7a4267a
Update CHANGELOG.md
caioessouza May 9, 2025
95970b9
Merge branch 'develop' into enh/enable-only-radial-burning
MateusStano May 16, 2025
3287138
Only radial burning enabled on hybrid class #801
caioessouza May 20, 2025
02de507
Merge branch 'enh/enable-only-radial-burning' of https://github.com/c…
caioessouza May 20, 2025
d97ba24
only_radial_burn on hybrid corrected
caioessouza May 30, 2025
0cb0eb5
Tests created
caioessouza Aug 13, 2025
8de2ab4
Corrections made based in the review
caioessouza Aug 14, 2025
e681877
Merge branch 'develop' into enh/enable-only-radial-burning
caioessouza Aug 14, 2025
4e4df54
Tests approved
caioessouza Oct 2, 2025
c941070
Merge branch 'enh/enable-only-radial-burning' of https://github.com/c…
caioessouza Oct 2, 2025
2b3a15c
Merge branch 'develop' into enh/enable-only-radial-burning
caioessouza Oct 2, 2025
79e2a1c
Unit tests
caioessouza Oct 2, 2025
3ecf1d7
Merge branch 'enh/enable-only-radial-burning' of https://github.com/c…
caioessouza Oct 2, 2025
65dfa23
Merge branch 'develop' into enh/enable-only-radial-burning
caioessouza Oct 2, 2025
79c066c
Integration mock_show correction
caioessouza Oct 2, 2025
32f7711
Merge branch 'enh/enable-only-radial-burning' of https://github.com/c…
caioessouza Oct 2, 2025
f92cb64
mock_show returned to unit tests
caioessouza Oct 2, 2025
d9d99dd
Integration problem solved
caioessouza Oct 2, 2025
cb3c3a2
Ruff run again
caioessouza Oct 3, 2025
8ebbc90
Sugestions Update
caioessouza Oct 3, 2025
292ab84
Ruff format run
caioessouza Oct 3, 2025
b99afb1
Removed @property
caioessouza Oct 3, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Attention: The newest changes should be on top -->

### Added

- ENH: Enable only radial burning [#815](https://github.com/RocketPy-Team/RocketPy/pull/815)
- ENH: Parallel mode for monte-carlo simulations 2 [#768](https://github.com/RocketPy-Team/RocketPy/pull/768)
- DOC: ASTRA Flight Example [#770](https://github.com/RocketPy-Team/RocketPy/pull/770)
- ENH: Add Eccentricity to Stochastic Simulations [#792](https://github.com/RocketPy-Team/RocketPy/pull/792)
Expand Down
135 changes: 92 additions & 43 deletions rocketpy/motors/solid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
interpolation_method="linear",
coordinate_system_orientation="nozzle_to_combustion_chamber",
reference_pressure=None,
only_radial_burn=False,
):
"""Initialize Motor class, process thrust curve and geometrical
parameters and store results.
Expand Down Expand Up @@ -314,6 +315,11 @@
"nozzle_to_combustion_chamber".
reference_pressure : int, float, optional
Atmospheric pressure in Pa at which the thrust data was recorded.
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 Down Expand Up @@ -353,6 +359,9 @@
)
self.grain_initial_mass = self.grain_density * self.grain_initial_volume

# Burn surface definition
self.only_radial_burn = only_radial_burn

self.evaluate_geometry()

# Initialize plots and prints object
Expand Down Expand Up @@ -500,17 +509,25 @@

# Compute state vector derivative
grain_inner_radius, grain_height = y
burn_area = (
2
* np.pi
* (
grain_outer_radius**2
- grain_inner_radius**2
+ grain_inner_radius * grain_height
if self.only_radial_burn:
burn_area = 2 * np.pi * (grain_inner_radius * grain_height)

Check warning on line 513 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L513

Added line #L513 was not covered by tests

grain_inner_radius_derivative = -volume_diff / burn_area
grain_height_derivative = 0

Check warning on line 516 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L515-L516

Added lines #L515 - L516 were not covered by tests

else:
burn_area = (
2
* np.pi
* (
grain_outer_radius**2
- grain_inner_radius**2
+ grain_inner_radius * grain_height
)
)
)
grain_inner_radius_derivative = -volume_diff / burn_area
grain_height_derivative = -2 * grain_inner_radius_derivative

grain_inner_radius_derivative = -volume_diff / burn_area
grain_height_derivative = -2 * grain_inner_radius_derivative

return [grain_inner_radius_derivative, grain_height_derivative]

Expand All @@ -521,32 +538,54 @@

# Compute jacobian
grain_inner_radius, grain_height = y
factor = volume_diff / (
2
* np.pi
* (
grain_outer_radius**2
- grain_inner_radius**2
+ grain_inner_radius * grain_height
if self.only_radial_burn:
factor = volume_diff / (

Check warning on line 542 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L541-L542

Added lines #L541 - L542 were not covered by tests
2 * np.pi * (grain_inner_radius * grain_height) ** 2
)
** 2
)
inner_radius_derivative_wrt_inner_radius = factor * (
grain_height - 2 * grain_inner_radius
)
inner_radius_derivative_wrt_height = factor * grain_inner_radius
height_derivative_wrt_inner_radius = (
-2 * inner_radius_derivative_wrt_inner_radius
)
height_derivative_wrt_height = -2 * inner_radius_derivative_wrt_height

return [
[
inner_radius_derivative_wrt_inner_radius,
inner_radius_derivative_wrt_height,
],
[height_derivative_wrt_inner_radius, height_derivative_wrt_height],
]
inner_radius_derivative_wrt_inner_radius = factor * (

Check warning on line 546 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L546

Added line #L546 was not covered by tests
grain_height - 2 * grain_inner_radius
)
inner_radius_derivative_wrt_height = 0
height_derivative_wrt_inner_radius = 0
height_derivative_wrt_height = 0

Check warning on line 551 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L549-L551

Added lines #L549 - L551 were not covered by tests

return [

Check warning on line 553 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L553

Added line #L553 was not covered by tests
[
inner_radius_derivative_wrt_inner_radius,
inner_radius_derivative_wrt_height,
],
[height_derivative_wrt_inner_radius, height_derivative_wrt_height],
]

else:
factor = volume_diff / (

Check warning on line 562 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L562

Added line #L562 was not covered by tests
2
* np.pi
* (
grain_outer_radius**2
- grain_inner_radius**2
+ grain_inner_radius * grain_height
)
** 2
)

inner_radius_derivative_wrt_inner_radius = factor * (

Check warning on line 573 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L573

Added line #L573 was not covered by tests
grain_height - 2 * grain_inner_radius
)
inner_radius_derivative_wrt_height = factor * grain_inner_radius
height_derivative_wrt_inner_radius = (

Check warning on line 577 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L576-L577

Added lines #L576 - L577 were not covered by tests
-2 * inner_radius_derivative_wrt_inner_radius
)
height_derivative_wrt_height = -2 * inner_radius_derivative_wrt_height

Check warning on line 580 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L580

Added line #L580 was not covered by tests

return [

Check warning on line 582 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L582

Added line #L582 was not covered by tests
[
inner_radius_derivative_wrt_inner_radius,
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]
Expand Down Expand Up @@ -597,16 +636,24 @@
burn_area : Function
Function representing the burn area progression with the time.
"""
burn_area = (
2
* np.pi
* (
self.grain_outer_radius**2
- self.grain_inner_radius**2
+ self.grain_inner_radius * self.grain_height
if self.only_radial_burn:
burn_area = (

Check warning on line 640 in rocketpy/motors/solid_motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/solid_motor.py#L640

Added line #L640 was not covered by tests
2
* np.pi
* (self.grain_inner_radius * self.grain_height)
* self.grain_number
)
else:
burn_area = (
2
* np.pi
* (
self.grain_outer_radius**2
- self.grain_inner_radius**2
+ self.grain_inner_radius * self.grain_height
)
* self.grain_number
)
* self.grain_number
)
return burn_area

@funcify_method("Time (s)", "burn rate (m/s)")
Expand Down Expand Up @@ -778,6 +825,7 @@
"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 @@ -822,4 +870,5 @@
interpolation_method=data["interpolate"],
coordinate_system_orientation=data["coordinate_system_orientation"],
reference_pressure=data.get("reference_pressure"),
only_radial_burn=data.get("only_radial_burn", False),
)