feat(mechanical): single canonical mechanical spin ODE + bearing friction#9
Merged
Merged
Conversation
…tion - Add dynbem_rs::mechanical (omega_derivative + step_omega) as the one canonical place the rigid-body rotor spin ODE is evaluated/stepped, with Coulomb bearing friction as a first-class parameter. - step_omega is semi-implicit in the aerodynamic torque term (freezes a local damping time constant tau = I*omega/Q_aero), so pure aero drag can never overshoot omega past zero; motor torque and friction are treated explicitly with a zero-crossing clamp so friction alone can't reverse rotation direction. - Fix a real bug: at omega ~= 0, step_omega previously dropped Q_aero entirely, so a windmill/driving torque on a stopped rotor would never spin it up. Both the omega~=0 branch and the invalid-tau fallback now share one full_explicit_step helper. - Add windmill-mode and realistic corner-case unit tests (spin-up from rest, autorotation-entry branch crossing, equilibrium under friction, no chattering near Q_aero sign flips, settle-and-stay-at-rest). - Consistency pass: replace every remaining hand-rolled/duplicate explicit-Euler omega step with the canonical integrator -- quasi_static_bem.rs test, vpm_viz/src/main.rs, envelope/point_mass.py (2 call sites), tests/test_oye.py -- and refresh stale doc comments in aero_io.rs pointing at the old ad hoc formula. - Bump dynbem to 0.7.0 (Cargo workspace + dynbem/pyproject.toml).
…le map - README.md / docs/API.md: replace old omega_derivative + plain-Euler examples (and stale "semi_implicit_step_omega" name) with the canonical step_omega(omega, spin_angle, ...) call. - dynbem_rs/README.md: add mechanical.rs to the module map, fix omega_rad_s / Q_spin field docs to point at crate::mechanical::step_omega instead of the old raw formula, bump the Cargo.toml usage snippet to dynbem_rs = "0.7".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consolidates the rotor's mechanical (rigid-body spin) ODE into one canonical implementation,
dynbem_rs::mechanical, exposed to Python asdynbem.mechanical.omega_derivative/dynbem.mechanical.step_omega, and audits the whole codebase for remaining hand-rolled duplicates.bearing_friction_Nm, default 0.0).step_omegais semi-implicit in the aerodynamic torque term: it freezes a local damping time constanttau = I*omega/Q_aeroover the step, so pure aero drag can never overshoot omega past zero. Motor torque and friction are treated explicitly with a zero-crossing clamp so friction alone can't reverse rotation direction.omega ~= 0,step_omegapreviously droppedQ_aeroentirely, so a windmill/driving torque acting on a stopped rotor would never spin it up. Both theomega~=0branch and the invalid-taufallback now share onefull_explicit_stephelper.Q_aerosign flips, settle-and-stay-at-rest.dynbem_rs/src/quasi_static_bem.rs(spindown time-integration test)vpm_viz/src/main.rs(standalone VPM visualization binary)envelope/point_mass.py(2 call sites)tests/test_oye.py(1 call site)dynbem_rs/src/aero_io.rsthat pointed at the old ad hoc formula.dynbemto0.7.0(Cargo workspaceversion.workspace,dynbem/pyproject.toml).Scope note
This branch was created directly off
origin/main(post-merge of #8) so it contains only the mechanical-ODE work above — no windmill/helicopter BEM branch changes are included since those are already merged.Testing
cargo fmtcargo test --release --workspace— 76 passed, 0 failedcargo check --workspace(post version bump) — clean,Cargo.lockunchanged