BUG: correct the nozzle gyration tensor parallel axis term - #1188
BUG: correct the nozzle gyration tensor parallel axis term#1188thc1006 wants to merge 2 commits into
Conversation
The lateral components of the nozzle gyration tensor carried a quarter of the squared nozzle offset. The exit disk second moment per unit area gives the full square, and letting the exit radius go to zero has to leave diag(d^2, d^2, 0). Flight.u_dot already uses the full squared distance for the same quantity. The docstring said the tensor is in kg*m^2. Since T05 = mdot * S - I_dot has to be kg*m^2/s and mdot is kg/s, S is in m^2. Three recorded values in tests/unit/simulation/test_flight.py move past their tolerance and are updated. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
|
/cc @zuorenchen |
The nozzle gyration tensor correction moves the Defiance example's impact point about 17 m over a 1626 m range, which is outside the band the guard allows for y and inside it by 0.1 m for x. These two constants are recorded from the deterministic example rather than measured, so they track the model. The measured quantity in the same file is the apogee, and the correction moves the simulation closer to it: 0.709 percent error before, 0.693 percent after. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
|
CI caught something I missed locally. I ran Here is what this change does to that example:
The four
The other 17 acceptance tests pass untouched, including the measured-flight comparisons for Bella Lui, NDRT 2020 and Prometheus. I pushed 2953fd4 re-recording the two impact constants. Re-recording a guard someone else set is your call rather than mine, so if you would rather keep them pinned and take this a different way, say so and I will drop that commit. While I have the numbers: on this rocket the correction is worth about 17 m of impact point, not the sub-metre it is worth on |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1188 +/- ##
========================================
Coverage 89.96% 89.96%
========================================
Files 131 131
Lines 17527 17527
========================================
Hits 15769 15769
Misses 1758 1758 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Closing the one loose end from the description. I said |
This patch corrects the parallel axis term in
Rocket.evaluate_nozzle_gyration_tensor. It is currently a quarter of what the exit plane integral gives. The unit stated in the docstring is fixed too.Pull request type
Checklist
pytest tests -m slow --runslow) have passed locallySome notes so the boxes are not overstated.
The lint line still mentions
black, so to be precise about what I ran:ruff check .,ruff format --check .andpylint rocketpy/ tests/ docs/, matching the Linters workflow. The only docs change is prose inside an existing numpydoc docstring, with no directives or references, so I did not build the docs locally.I left the last box unticked rather than claim something I did not see finish. Of the 35 slow tests, 34 passed.
test_hrrr_atmospherefailed once on a forecast download and passes on re-run, on this branch and ondevelopalike; its own docstring notes that the HRRR latest model sometimes lacks 24 hours of forecast.test_monte_carlo_simulate[True], the parallel case, does not finish inside 40 minutes on this machine, so I cannot report it either way. The sequential case of the same test passed, and the two run the same simulations.Current behavior
evaluate_nozzle_gyration_tensorbuilds the tensor as:S_nozis the second moment of the nozzle exit plane per unit area, taken about the center of dry mass. For a uniform disk of radiusRcentred on the body axis at a distancedfrom that point:The axial component already matches. The two lateral ones should carry
d^2rather thand^2/4.The quickest way to see it is the point limit. Let
Rgo to zero and the exit plane collapses to a single mass flux location at distanced, soShas to tend todiag(d^2, d^2, 0). Today it returns a quarter of that, and nothing about that limit depends on the rest of the model.The older solid propulsion path already uses the full squared distance for the same quantity:
One smaller thing in the same function: the docstring says the tensor is in
kg*m². SinceT05 = mdot * S - I_dothas to be kg·m²/s andmdotis kg/s,Sis in m². I reworded that line and the tolerance comment in the existing test, which read1e-3 * 1e-2 * 1e-2 # Equivalent to 1g * 1cm^2.New behavior
The parallel axis term becomes
self.nozzle_to_cdm**2. On thecalistofixtureS_11goes from 0.3940207 to 1.5752660 m².S_nozreaches the trajectory only throughT05 @ winu_dot_generalized, so it is scaled by mass flow rate and body rate. How much of it shows up depends on the rocket. Onflight_calisto_custom_wind, a solid motor burning for 3.9 s, it is small. At apogee:On the Defiance example it is not small. That is a hybrid burning for 6.5 s, and the impact point moves from (1625.57, 81.79) to (1609.40, 87.03), roughly 17 m over a 1626 m range. That takes
test_defiance_rocket_matches_reference_flight_metricsout of its band, and I re-recorded the two impact constants. There is more on that in the comments, including the check against the measured apogee, which the change moves closer rather than further.Three recorded values in
tests/unit/simulation/test_flight.pymove past their 5e-3 tolerance and are updated. I re-recorded each tuple from the same run so it stays internally consistent, which is why the roll moment reads-1.005368e-18where it used to read-2.089120e-14. Both are numerical zero, and that component is unchanged in substance.test_accelerationsstays inside tolerance and is left alone. Everything else intests/unitandtests/integrationgives the same result it does ondevelop.Breaking change
No API change. Simulation results do shift slightly, as above.
Additional information
Two tests are added next to the existing one in
tests/unit/rocket/test_rocket.py:test_evaluate_nozzle_gyration_tensor_matches_the_exit_diskis parameterized overcalisto,calisto_liquid_moddedandcalisto_hybrid_modded, and checks all three diagonal entries againstR^2/4 + d^2andR^2/2built from each rocket's own geometry, plus the off-diagonal zeros. It does not restate the recorded number.test_evaluate_nozzle_gyration_tensor_parallel_axis_termsubtracts the disk contribution and checks what is left equalsnozzle_to_cdm**2, which is the coefficient this patch changes.I put the one line back to
0.25 * ...to check the tests really hold it. All five nozzle tests fail, including the parameterized ones on the liquid and hybrid motors, and the other 61 tests in that file still pass.While reading
u_dot_generalizedI ran into two other things that look independent of this change, so I filed them as #1185 and #1186 rather than fold them in here.