Skip to content

Merging feature/improved geometry definitions branch into main#44

Merged
camUrban merged 185 commits intomainfrom
feature/improved_geometry_definitions
Oct 29, 2025
Merged

Merging feature/improved geometry definitions branch into main#44
camUrban merged 185 commits intomainfrom
feature/improved_geometry_definitions

Conversation

@camUrban
Copy link
Owner

@camUrban camUrban commented Sep 24, 2025

Description

This PR represents a comprehensive refactoring that radically expands the types of geometry and motion Ptera Software can represent, while adopting a much more formal representation of axes, frames, and reference points. The changes enable more complex aircraft configurations and motion patterns through a complete architectural overhaul.

Motivation

Previously, Ptera Software modeled geometry using XFLR5-style definitions, which worked great for standard aircraft-like configurations. However, this approach was limiting in specifying wings with complex features like non-parallel cross sections and discontinuous symmetry. Since motion in Ptera Software is represented by a list of Airplane objects (each at a particular time step), these geometric limitations also constrained the types of motion Ptera Software was capable of modeling.

This refactor addresses these fundamental limitations by:

  • Implementing a formal coordinate system framework with explicit axes, reference points, and frames
  • Enabling representation of arbitrary aircraft geometries beyond standard XFLR5-style configurations
  • Supporting wings with non-parallel cross sections, discontinuous symmetry, and complex sectional relationships
  • Unlocking sophisticated time-dependent motions by using the new framework to define geometry
  • Establishing a robust foundation for future extensions

Relevant Issues

Closes #40

Changes

  • Implemented formal framework for representing vector-valued quantities

    • Established rigorous naming conventions and mathematical relationships between axes, reference points, and frames throughout the codebase
    • Added detailed documentation in docs/AXES_POINTS_AND_FRAMES.md
  • Implemented functions for transforming vectors-valued quantities with extremely detailed specifications about how to interpret and use them (active vs. passive transformations, intrinsic vs. extrinsic rotations, homogenous coordinates, etc.)

    • Added detailed documentation in docs/ANGLE_VECTORS_AND_TRANSFORMATIONS.md
    • Rigorously tested these transformation functions, and their documented interpretations, with unit tests in tests/unit/test_transformations.py
  • Reduced the number of public classes, functions, and methods.

  • Added parameter validation to all refactored, public classes, functions, and methods.

    • pterasoftware/parameter_validation.py
  • Radically expanded geometry capabilities beyond XFLR5-style limitations:

    • Refactored geometry.py into a package
      • pterasoftware/geometry/airplane.py
      • pterasoftware/geometry/wing.py
      • pterasoftware/geometry/wing_cross_section.py
      • pterasoftware/geometry/airfoil.py
      • pterasoftware/geometry/panel.py
    • Added significant unit testing for the classes in the geometry package
  • Using the new geometry definition framework, enhanced the movement system:

    • Refactored movement.py into a package
      • pterasoftware/movements/movement.py
      • pterasoftware/movements/operating_point_movement.py
      • pterasoftware/movements/airplane_movement.py
      • pterasoftware/movements/wing_movement.py
      • pterasoftware/movements/wing_cross_section_movement.py
      • pterasoftware/movements/airfoil_movement.py
      • pterasoftware/movements/panel_movement.py
    • Added significant unit testing for the classes in the movements package
  • Updated all solvers to work with the new geometry and motion definitions.

  • Updated all examples and benchmarks to use the new geometry and motion definitions.

  • Created CLAUDE.md with development guidelines for the expanded system

New Dependencies

None

Change Magnitude

Major: This is a fundamental architectural transformation that breaks backward compatibility while dramatically expanding Ptera Software's capabilities beyond XFLR5-style limitations. The changes affect the entire codebase and enables representation of aircraft configurations and motion patterns that were previously impossible to model.


Checklist

  • I have created or claimed an issue for this work as described in
    Contributing Code.
  • 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).
  • All new modules, classes, functions, and methods have docstrings in
    reStructuredText format.
  • Code is well documented with block comments where appropriate.
  • Code passes local automated checks (codespell, black, and tests).
  • If any major functionality was added or significantly changed, I have added or
    updated tests in the tests package.
  • Any external code, algorithms, or equations used have been cited in comments or
    docstrings.
  • PR description links all relevant issues and follows this template.

…hived old versions of some key modules with legacy_ prefixes, and began setting up the new WingCrossSection module.
Replaces legacy position and orientation parameters with local_position and local_rotations for both Wing and WingCrossSection. Adds support for arbitrary symmetry planes via symmetry_plane_normal and symmetry_plane_point, and introduces mirror_only flag. Updates docstrings and validation logic to clarify new transformation and symmetry handling. Temporarily disables panel meshing and related properties pending update to new coordinate system.
Added geometry_to_wing_axes_transformation_matrix property to compute the homogeneous transformation from geometry axes to wing axes, including translation, rotation, and optional reflection. Restored and updated properties for unit vectors, projected area, wetted area, span, standard mean chord, and mean aerodynamic chord to use the new transformation logic and provide correct geometric calculations for the Wing class.
Expanded CLAUDE.md with comprehensive conventions for naming and referencing axes, points, and frames in Ptera Software. The new appendix standardizes variable naming, text references, and context rules, improving clarity and consistency for multi-object simulations.
Added process_wing_symmetry and validate_first_airplane_constraints methods to the Airplane class. Updated documentation to clarify the role of Cgi_E_I and improved constructor parameters for clarity. Expanded class docstring to detail coordinate system conventions and responsibilities.
Updated Airplane and Wing classes to clarify parameter names and docstrings, improving consistency and readability. Added generate_rotation_matrix_from_a_to_b to functions.py for flexible rotation matrix generation. Moved transformation and angle vector documentation to dedicated files and updated references throughout the codebase.
Introduced functions to convert 3D vectors to homogeneous coordinates and generate rotational and translational transformation matrices in functions.py. Also renamed Wing property to clarify passive transformation matrix usage in geometry.py.
Introduced pterasoftware/parameter_validation.py for common parameter validation functions. Refactored Airplane and Wing classes to use these validation utilities, improved docstrings, and clarified symmetry processing logic. Updated mesh generation and reference dimension handling for robustness and maintainability.
Updated Airplane and Wing classes to use new symmetry parameter names and logic, improved symmetry plane coincidence checks, and centralized parameter validation in geometry.py. Added new validation functions to parameter_validation.py for 3D unit vectors and finite value checks, and refactored integer/float validation to ensure values are finite. Commented out unused Wing property methods pending further review.
Removed the requirement for custom spacing functions to have zero mean in movement modules and validation logic. Updated docstrings to clarify that non-zero mean is permitted and may be useful for asymmetric motion. Removed related test and fixture for zero mean validation.
Refactored convergence analysis functions in pterasoftware/convergence.py to improve parameter validation, documentation, and mesh generation logic. Removed unused and redundant methods from Panel class, replacing average span/chord and vector properties with a new aspect_ratio property. Added average_panel_aspect_ratio property to Wing class for mesh quality assessment. Updated benchmarks and experimental scripts to use new convergence API and mesh parameters. Minor docstring and formatting improvements throughout affected modules.
Introduces concurrency groups and cancel-in-progress for black, codespell, and tests workflows to prevent overlapping runs and improve CI efficiency.
Refactored unsteady benchmark scripts to use consistent naming (e.g., benchmark_airplane), added reflected wing handling, and updated docstrings to discourage committing changes. Improved logging in convergence.py for clarity and consistency, including more informative messages and capitalization. Enhanced the calculation of spanwise panels to consider only relevant time steps, and made minor bugfixes and docstring updates.
Formation flight simulations were incorrectly stacking all Airplanes on top of each other instead of positioning them according to their Cg_E_CgP1 parameters. Panel and vortex positions were stored in local geometry axes (G_Cg) but never transformed to common axes/ref points for multi-Airplane simulations.

Solved by implementing dual-frame coordinate storage where all solver computations use the first Airplane's geometry axes and CG (GP1_CgP1). Panels maintain both local (G_Cg) and formation (GP1_CgP1) coordinates, while vortices store only GP1_CgP1. Coordinate transformations occur once in Problem.__init__() via new Airplane.compute_T_pas_G_Cg_to_GP1_CgP1() method.
@camUrban camUrban requested a review from Copilot October 28, 2025 17:43
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@camUrban camUrban requested a review from Copilot October 29, 2025 00:11
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

Copilot reviewed 56 out of 1713 changed files in this pull request and generated 5 comments.

Files not reviewed (13)
  • .idea/PteraSoftware.iml: Language not supported
  • .idea/copilot.data.migration.agent.xml: Language not supported
  • .idea/copilot.data.migration.ask.xml: Language not supported
  • .idea/copilot.data.migration.ask2agent.xml: Language not supported
  • .idea/copilot.data.migration.edit.xml: Language not supported
  • .idea/dictionaries/project.xml: Language not supported
  • .idea/inspectionProfiles/Ptera_Software_Default.xml: Language not supported
  • .idea/inspectionProfiles/profiles_settings.xml: Language not supported
  • .idea/jsonCatalog.xml: Language not supported
  • .idea/misc.xml: Language not supported
  • .idea/scopes/to_inspect.xml: Language not supported
  • .idea/statistic.xml: Language not supported
  • .idea/vcs.xml: Language not supported

@camUrban camUrban marked this pull request as ready for review October 29, 2025 01:16
@camUrban camUrban requested a review from Copilot October 29, 2025 01:17
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

Copilot reviewed 50 out of 1714 changed files in this pull request and generated 2 comments.

Files not reviewed (13)
  • .idea/PteraSoftware.iml: Language not supported
  • .idea/copilot.data.migration.agent.xml: Language not supported
  • .idea/copilot.data.migration.ask.xml: Language not supported
  • .idea/copilot.data.migration.ask2agent.xml: Language not supported
  • .idea/copilot.data.migration.edit.xml: Language not supported
  • .idea/dictionaries/project.xml: Language not supported
  • .idea/inspectionProfiles/Ptera_Software_Default.xml: Language not supported
  • .idea/inspectionProfiles/profiles_settings.xml: Language not supported
  • .idea/jsonCatalog.xml: Language not supported
  • .idea/misc.xml: Language not supported
  • .idea/scopes/to_inspect.xml: Language not supported
  • .idea/statistic.xml: Language not supported
  • .idea/vcs.xml: Language not supported
Comments suppressed due to low confidence (3)

pterasoftware/geometry/init.py:1

  • The docstring lists a 'panel.py' module that doesn't exist in this package. The Panel class is now in pterasoftware._panel.py, not in the geometry package.
"""This package contains the geometry classes.

pterasoftware/_transformations.py:1

  • The code snippet in lines 287-288 appears to be incorrect - it references panel.moments_W_CgP1 which is unrelated to the transformation composition function. This should likely return the composed transformation matrix instead.
"""This module contains functions used for geometric transformations."""

pterasoftware/_parameter_validation.py:1

  • The parameter 'passive' is validated but then marked as unused with a noinspection comment. If the parameter is truly unused, consider removing it from the function signature rather than suppressing the warning.
"""This module contains common parameter validation functions."""

@camUrban camUrban merged commit 0ac21d3 into main Oct 29, 2025
3 checks passed
@camUrban camUrban deleted the feature/improved_geometry_definitions branch October 29, 2025 01:43
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.

[FEATURE] User-Definable Axes for Flapping Motions

1 participant