# lon-fee/aviary architecture

> Architecture diagram of the GitHub repository lon-fee/aviary, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lon-fee/aviary
- Repository: https://github.com/lon-fee/aviary

## Overview

##### Project’s Major Domains and Layers
- Core Engine: At the heart is the aviary package. The core modules (found under aviary/core, aviary/api.py, and aviary/mission) perform the main modeling, mission-analysis (with separate FLOPS-based and GASP-based options), and solution of aircraft performance equations.
- Subsystems: A huge part of the project is divided into functional “subsystems” (e.g., aerodynamics, energy, geometry, mass, propulsion) located under aviary/subsystems. Each subsystem is further split into versions (flops_based and gasp_based) and encapsulates domain-specific calculations.
- Models and External Data: The aviary/models directory holds various aircraft model definitions and engine decks. This also includes definitions for external subsystems and decks used during simulations.
- Interface and Visualization: The aviary/interface module provides user interaction points (CLI entry points, graphical input, report generation), while aviary/visualization handles aircraft 3D models and dashboards.
- Testing, Validation, and Documentation: There are extensive tests (under aviary/interface/test, aviary/utils/test, aviary/mission/test, and aviary/validation_cases). Documentation and developer guides in aviary/docs further describe the workflows and design rationale.

##### How Components Interact
- Data Flow:
– Inputs (user provided CSV decks, configuration files, engine/aero decks) get processed by the respective subsystem builders.
– The mission module collects these outputs and passes them through either the 2DOF or energy-height mission analysis pipelines.
– Results are combined with weight and sizing computations from the core modules.
– The interface layer then provides report generation and visualizations.

##### Architectural Patterns
- Separation of Concerns: The project is compartmentalized into clearly defined modules (e.g., mission, subsystems, interface, visualization) – each being responsible for distinct aspects of the simulation.
- Layered Architecture: Separate data input (models, decks), computation (subsystems, core mission solvers), and output (reports, visualization) layers. Indicate where OpenMDAO’s capabilities streamline optimization and performance calculations.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Input
    subgraph "User Input"
        UI["User/Configuration"]:::data
    end

    %% Models & External Data
    subgraph "Models & External Data"
        M_External["Models & Engine Decks"]:::data
    end

    %% Subsystems
    subgraph "Subsystems"
        S_AeroF["Aerodynamics - FLOPS"]:::subsystem
        S_AeroG["Aerodynamics - GASP"]:::subsystem
        S_Energy["Energy"]:::subsystem
        S_Geom["Geometry"]:::subsystem
        S_Mass["Mass"]:::subsystem
        S_Prop["Propulsion"]:::subsystem
    end

    %% Core Engine
    subgraph "Core Engine"
        A_API["Core API"]:::core
        A_Core["Core Modules"]:::core
        A_Mission["Mission Analysis"]:::core
    end

    %% Interface & Visualization
    subgraph "Interface & Visualization"
        I_Interface["Interface/CLI"]:::interface
        V_Visualization["Visualization Dashboard"]:::interface
    end

    %% Testing & Validation
    subgraph "Testing & Validation"
        T_Interface["Interface Tests"]:::testing
        T_Utils["Utils Tests"]:::testing
        T_Mission["Mission Tests"]:::testing
        T_Validation["Validation Cases"]:::testing
        T_Docs["Documentation Tests"]:::testing
    end

    %% CI/CD & OpenMDAO Integration
    subgraph "CI/CD & OpenMDAO Integration"
        I_Env["Environment Config"]:::integration
        I_PyProject["PyProject Config"]:::integration
        I_Docker["Dockerfile"]:::integration
        I_GitHub["GitHub Workflows"]:::integration
        I_OpenMDAO["OpenMDAO Integration"]:::integration
    end

    %% Data Flow Connections
    UI -->|"provides_data"| M_External

    M_External -->|"builds"| S_AeroF
    M_External -->|"builds"| S_AeroG
    M_External -->|"builds"| S_Energy
    M_External -->|"builds"| S_Geom
    M_External -->|"builds"| S_Mass
    M_External -->|"builds"| S_Prop

    S_AeroF -->|"outputs"| A_Mission
    S_AeroG -->|"outputs"| A_Mission
    S_Energy -->|"outputs"| A_Mission
    S_Geom -->|"outputs"| A_Mission
    S_Mass -->|"outputs"| A_Mission
    S_Prop -->|"outputs"| A_Mission

    A_Mission -->|"calculates"| A_Core
    A_Core -->|"supports"| A_API

    I_Interface -->|"triggers"| A_API
    A_API -->|"sends_results"| V_Visualization

    UI -.->|"configures"| I_Interface

    %% Integration Connections
    I_Env --> A_Core
    I_PyProject --> A_Core
    I_Docker --> A_API
    I_GitHub --> A_API
    I_OpenMDAO --> A_Mission

    %% Testing Connections (dashed indicates feedback/validation)
    T_Interface -.-> I_Interface
    T_Utils -.-> A_Core
    T_Mission -.-> A_Mission
    T_Validation -.-> A_Mission
    T_Docs -.-> A_API

    %% Click Events for Core Engine
    click A_API "https://github.com/lon-fee/aviary/blob/main/aviary/api.py"
    click A_Core "https://github.com/lon-fee/aviary/tree/main/aviary/core"
    click A_Mission "https://github.com/lon-fee/aviary/tree/main/aviary/mission"

    %% Click Events for Subsystems (all map to aviary/subsystems)
    click S_AeroF "https://github.com/lon-fee/aviary/tree/main/aviary/subsystems"
    click S_AeroG "https://github.com/lon-fee/aviary/tree/main/aviary/subsystems"
    click S_Energy "https://github.com/lon-fee/aviary/tree/main/aviary/subsystems"
    click S_Geom "https://github.com/lon-fee/aviary/tree/main/aviary/subsystems"
    click S_Mass "https://github.com/lon-fee/aviary/tree/main/aviary/subsystems"
    click S_Prop "https://github.com/lon-fee/aviary/tree/main/aviary/subsystems"

    %% Click Events for Models & External Data
    click M_External "https://github.com/lon-fee/aviary/tree/main/aviary/models"

    %% Click Events for Interface & Visualization
    click I_Interface "https://github.com/lon-fee/aviary/tree/main/aviary/interface"
    click V_Visualization "https://github.com/lon-fee/aviary/tree/main/aviary/visualization"

    %% Click Events for Testing & Validation
    click T_Interface "https://github.com/lon-fee/aviary/tree/main/aviary/interface/test"
    click T_Utils "https://github.com/lon-fee/aviary/tree/main/aviary/utils/test"
    click T_Mission "https://github.com/lon-fee/aviary/tree/main/aviary/mission/test"
    click T_Validation "https://github.com/lon-fee/aviary/tree/main/aviary/validation_cases"
    click T_Docs "https://github.com/lon-fee/aviary/tree/main/aviary/docs/tests"

    %% Click Events for CI/CD & OpenMDAO Integration
    click I_Env "https://github.com/lon-fee/aviary/blob/main/environment.yml"
    click I_PyProject "https://github.com/lon-fee/aviary/blob/main/pyproject.toml"
    click I_Docker "https://github.com/lon-fee/aviary/tree/main/Dockerfile"
    click I_GitHub "https://github.com/lon-fee/aviary/tree/main/.github/workflows"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef subsystem fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef data fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef interface fill:#D8BFD8,stroke:#000,stroke-width:2px;
    classDef testing fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef integration fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
