Skip to content

Add optional wake truncation feature#122

Merged
camUrban merged 4 commits intomainfrom
feature/wake_truncation
Mar 4, 2026
Merged

Add optional wake truncation feature#122
camUrban merged 4 commits intomainfrom
feature/wake_truncation

Conversation

@camUrban
Copy link
Owner

@camUrban camUrban commented Mar 4, 2026

Description

Add wake truncation support for the UVLM solver, allowing users to cap the maximum wake length and reduce memory usage and run time for long simulations.

Motivation

In the unsteady ring vortex lattice method, the wake grows by one chordwise row per time step, causing memory and computation costs to scale with the number of steps. For long simulations, the far-downstream wake has negligible influence on the bound circulation. Wake truncation discards the oldest wake rows beyond a user-specified limit, reducing memory usage and run times while preserving accuracy.

Relevant Issues

This new feature will be particularly useful in the development of coupled free flight simulations (Issue: #65, PR: #66)

Changes

  • Added three new optional parameters to Movement.__init__: max_wake_rows, max_wake_chords, and max_wake_cycles, with mutual exclusivity validation and appropriate static/non-static constraints.
  • Added conversion logic in Movement to translate max_wake_chords and max_wake_cycles to max_wake_rows using the same formulas as num_chords/num_cycles to num_steps.
  • Propagated max_wake_rows through UnsteadyProblem to the UnsteadyRingVortexLatticeMethodSolver.
  • Modified the solver to cap pre-allocated wake array sizes and truncate the oldest wake RingVortex rows and wake point grid rows during the simulation.
  • Added comprehensive unit tests for all three parameters, including validation, conversion, mutual exclusivity, and static/non-static constraints.
  • Added integration tests that run truncated vs. non-truncated simulations and verify that wake size is capped, loads remain within 10% of the non-truncated baseline, and pre-allocated arrays plateau correctly.
  • Updated CLASSES_AND_IMMUTABILITY.md to document the new attributes in Movement and UnsteadyProblem.
  • Added a docstring clarification in TYPE_HINT_AND_DOCSTRING_STYLE.md for simple getter properties.
  • Added # noinspection comments to suppress false IDE warnings.

New Dependencies

None.

Change Magnitude

Moderate: Medium-sized change that adds or modifies a feature without large-scale impact.


Checklist

  • I am familiar with the current contribution guidelines.
  • My branch is based on main and is up to date with the upstream main branch.
  • All calculations use S.I. units.
  • Code is formatted with black (line length = 88).
  • Code is well documented with block comments where appropriate.
  • Any external code, algorithms, or equations used have been cited in comments or docstrings.
  • All new modules, classes, functions, and methods have docstrings in reStructuredText format, and are formatted using docformatter (--in-place --black). See the style guide for type hints and docstrings for more details.
  • All new classes, functions, and methods in the pterasoftware package use type hints. See the style guide for type hints and docstrings for more details.
  • If any major functionality was added or significantly changed, I have added or updated tests in the tests package.
  • Code locally passes all tests in the tests package.
  • After pushing, PR passes all automated checks (codespell, black, mypy, and tests).
  • PR description links all relevant issues and follows this template.

camUrban added 3 commits March 4, 2026 15:28
Add max_wake_rows, max_wake_chords, and max_wake_cycles
parameters to Movement, with validation and conversion
logic mirroring num_steps/num_chords/num_cycles.
Propagate max_wake_rows through UnsteadyProblem to the
solver, which caps pre-allocated wake arrays and
truncates wake points and vortices each time step once
the threshold is reached.
@camUrban camUrban requested a review from Copilot March 4, 2026 22:54
@camUrban camUrban self-assigned this Mar 4, 2026
@camUrban camUrban added maintenance Improvements or additions to documentation, testing, or robustness feature New feature or request labels Mar 4, 2026
Copy link
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

Adds an optional “wake truncation” capability to the unsteady ring vortex lattice method (UVLM) workflow so long unsteady simulations can cap wake growth, reducing memory and runtime while keeping results reasonably close.

Changes:

  • Extends Movement with mutually-exclusive max_wake_rows / max_wake_chords / max_wake_cycles options (with validation + conversion to max_wake_rows).
  • Propagates max_wake_rows through UnsteadyProblem into UnsteadyRingVortexLatticeMethodSolver, which now caps wake preallocation and truncates wake point/vortex rows during shedding.
  • Adds unit + integration tests and updates developer documentation to reflect the new attributes and docstring guidance.

Reviewed changes

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

Show a summary per file
File Description
pterasoftware/movements/movement.py Adds wake truncation configuration/validation and conversion to an internal max_wake_rows.
pterasoftware/problems.py Propagates max_wake_rows from Movement to UnsteadyProblem.
pterasoftware/unsteady_ring_vortex_lattice_method.py Implements wake array preallocation capping and runtime truncation of wake points/vortices.
tests/unit/test_movement.py Adds unit tests for new Movement parameters (defaults, validation, conversion, constraints).
tests/integration/test_unsteady_ring_vortex_lattice_method_wake_truncation.py New integration test comparing truncated vs non-truncated runs and checking capped wake growth.
tests/integration/__init__.py Registers the new integration test module import.
tests/unit/test_wing_cross_section.py Adds IDE suppression comments in existing tests.
docs/CLASSES_AND_IMMUTABILITY.md Documents new immutable attributes for Movement / UnsteadyProblem.
docs/TYPE_HINT_AND_DOCSTRING_STYLE.md Clarifies docstring expectations for simple getter properties.
.idea/scopes/to_inspect.xml Updates IDE inspection scope exclusions.
Files not reviewed (1)
  • .idea/scopes/to_inspect.xml: Language not supported

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.39%. Comparing base (bad1d75) to head (1901941).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
+ Coverage   91.32%   91.39%   +0.06%     
==========================================
  Files          32       32              
  Lines        6111     6159      +48     
==========================================
+ Hits         5581     5629      +48     
  Misses        530      530              

☔ 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.

@camUrban camUrban merged commit 0346026 into main Mar 4, 2026
12 checks passed
@camUrban camUrban deleted the feature/wake_truncation branch March 4, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request maintenance Improvements or additions to documentation, testing, or robustness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants