Skip to content

BUG: Fix incorrect Jacobian in only_radial_burn branch of SolidMotor.evaluate_geometry#944

Merged
MateusStano merged 3 commits intorel/v1.12.0from
copilot/sub-pr-935
Mar 20, 2026
Merged

BUG: Fix incorrect Jacobian in only_radial_burn branch of SolidMotor.evaluate_geometry#944
MateusStano merged 3 commits intorel/v1.12.0from
copilot/sub-pr-935

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

The geometry_jacobian function in SolidMotor.evaluate_geometry had copy-paste errors in the only_radial_burn branch — the formulas were carried over from the non-radial burn case without adjustment, producing a mathematically wrong Jacobian that can degrade or derail LSODA integration.

Pull request type

  • Code changes (bugfix, features)

Checklist

  • CHANGELOG.md has been updated (if relevant)

Current behavior

For only_radial_burn, burn_area = 2π·r·h, so ṙ = −vdiff / (2π·r·h).

The Jacobian was incorrectly computed as:

  • ∂ṙ/∂r = factor * (h − 2r) — copied from the non-radial case where d(burn_area)/dr = 2π(h−2r)
  • ∂ṙ/∂h = 0 — wrong; height appears in the denominator so it has a non-zero partial

New behavior

Correct partial derivatives for burn_area = 2π·r·h:

# ṙ = -vdiff / (2π·r·h), factor = vdiff / (2π·(r·h)²)
inner_radius_derivative_wrt_inner_radius = factor * grain_height   # ∂ṙ/∂r = vdiff/(2π·r²·h)
inner_radius_derivative_wrt_height       = factor * grain_inner_radius  # ∂ṙ/∂h = vdiff/(2π·r·h²)
# dh/dt = 0, so height Jacobian row remains zero
height_derivative_wrt_inner_radius = 0
height_derivative_wrt_height       = 0

Breaking change

  • No

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI mentioned this pull request Mar 20, 2026
…ometry

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Addressing feedback from PR #935 for release v1.12.0 BUG: Fix incorrect Jacobian in only_radial_burn branch of SolidMotor.evaluate_geometry Mar 20, 2026
Copilot AI requested a review from MateusStano March 20, 2026 01:13
# ∂ṙ/∂h = vdiff/(2π*r*h²) = factor * r
inner_radius_derivative_wrt_inner_radius = factor * grain_height
inner_radius_derivative_wrt_height = factor * grain_inner_radius
# dh/dt = 0, so all partial derivatives of height are zero
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# dh/dt = 0, so all partial derivatives of height are zero
# dh/dt = 0 (Height is a constant), so all partial derivatives of height are zero

@MateusStano MateusStano marked this pull request as ready for review March 20, 2026 01:55
@MateusStano MateusStano requested a review from a team as a code owner March 20, 2026 01:55
@MateusStano MateusStano merged commit d9c79ba into rel/v1.12.0 Mar 20, 2026
16 checks passed
@MateusStano MateusStano deleted the copilot/sub-pr-935 branch March 20, 2026 02:09
@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.09%. Comparing base (03f20c1) to head (4ad0554).
⚠️ Report is 5 commits behind head on rel/v1.12.0.

Files with missing lines Patch % Lines
rocketpy/motors/solid_motor.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           rel/v1.12.0     #944   +/-   ##
============================================
  Coverage        81.09%   81.09%           
============================================
  Files              107      107           
  Lines            13906    13906           
============================================
  Hits             11277    11277           
  Misses            2629     2629           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

MateusStano added a commit that referenced this pull request Mar 20, 2026
…or.evaluate_geometry` (#944)

* Initial plan

* BUG: Fix incorrect Jacobian in only_radial_burn branch of evaluate_geometry

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants