Skip to content

Fix bug in untested linearize branch#227

Merged
1-Bart-1 merged 2 commits intomainfrom
fix-linearize
Apr 23, 2026
Merged

Fix bug in untested linearize branch#227
1-Bart-1 merged 2 commits intomainfrom
fix-linearize

Conversation

@1-Bart-1
Copy link
Copy Markdown
Member

No description provided.

@1-Bart-1 1-Bart-1 changed the title Use nonzero y vel Fix bug in untested linearize branch Apr 23, 2026
@1-Bart-1 1-Bart-1 requested a review from ufechner7 April 23, 2026 11:03
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ufechner7
Copy link
Copy Markdown
Member

ufechner7 commented Apr 23, 2026

Perhaps wait for the comments from Copilot and add a description.

@1-Bart-1 1-Bart-1 merged commit ad26d24 into main Apr 23, 2026
11 checks passed
@1-Bart-1 1-Bart-1 deleted the fix-linearize branch April 23, 2026 11:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes incorrect handling of omega / va defaults in the linearize workflow (previously resetting omega to zero in some index configurations) and updates related set_va! semantics and tests to cover non-zero operating points.

Changes:

  • Update linearize to preserve the initial omega (and use _va) when corresponding index sets are nothing.
  • Adjust set_va!(body_aero, va, omega) to always keep body_aero.va defined by setting has_distributed_va=false.
  • Update/expand tests to use non-zero baseline (va, theta, delta, omega) and tweak combined-input linearization tolerances.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/solver.jl Fixes linearize input application so omitted omega_idxs doesn’t implicitly zero out rotation, and avoids body_aero.va access when it may be undefined.
src/body_aerodynamics.jl Changes set_va!(va, omega) to treat rotation-induced panel variation as non-“distributed inflow” for purposes of .va access.
test/body_aerodynamics/test_results.jl Strengthens coverage with non-zero operating point inputs and updates combined-perturbation acceptance thresholds.
test/body_aerodynamics/test_body_aerodynamics.jl Updates expectations around has_distributed_va / body_aero.va behavior when omega is non-zero.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/solver.jl
Comment on lines +1089 to +1090
va = isnothing(va_idxs) ? init_va : y[va_idxs]
om = isnothing(omega_idxs) ? init_omega :
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

In calc_results!, y[va_idxs] / y[omega_idxs] create new arrays each call. Since linearize evaluates this many times during finite-difference Jacobian computation, this can add significant allocation overhead. Consider using @views for these slices (and/or view(y, va_idxs) / view(y, omega_idxs)) so set_va! receives a view instead of an allocated copy.

Suggested change
va = isnothing(va_idxs) ? init_va : y[va_idxs]
om = isnothing(omega_idxs) ? init_omega :
@views va = isnothing(va_idxs) ? init_va : y[va_idxs]
@views om = isnothing(omega_idxs) ? init_omega :

Copilot uses AI. Check for mistakes.
Comment thread src/body_aerodynamics.jl
Comment on lines +1081 to +1082
body_aero._va .= va
body_aero.has_distributed_va = false
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

has_distributed_va is now always set to false in the (va, omega) overload, even when omega induces per-panel velocity variation. Since getproperty(::BodyAerodynamics, :va) uses this flag to decide whether .va is well-defined, it would help to clarify (in the set_va! docstring and/or the :va error message) that has_distributed_va only refers to externally supplied per-panel inflow (matrix input), not rotation-induced variation.

Copilot uses AI. Check for mistakes.
Comment on lines +305 to +306
@test lin_prediction ≈ nonlin_res rtol=0.05 atol=1e-3
@test error_ratio < 0.05
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The combined-input linearization assertions were loosened substantially (rtol 0.01→0.05 and error_ratio 0.005→0.05). This reduces the test’s ability to catch regressions in linearize. If the failures were due to leaving the linear regime, consider keeping a tighter tolerance by reducing combo_scale / perturbation magnitudes, or assert primarily on error_ratio with a smaller bound for at least one representative combined case.

Copilot uses AI. Check for mistakes.
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