# openorion/turbodesigner architecture

> Architecture diagram of the GitHub repository openorion/turbodesigner, 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/openorion/turbodesigner
- Repository: https://github.com/openorion/turbodesigner

## Overview

##### Project Overview and Identification
- TurboDesigner is an open-source turbomachinery design tool focused on generating axial compressors (and eventually axial turbopumps). It uses input parameters (e.g., pressure ratio, mass flow rate) to perform mean-line design, blade flow analysis, and finally produces a CAD model exportable to STL/STEP.
- The project is modular, with distinct components for flow calculations, blade and airfoil design, CAD model generation, and visualization.

##### Key Components
a. Input/Configuration:
- Parameters/Ingestion: Input files (e.g., tests/designs/*.json) supply design parameters.
- Environment & Setup: Environment configurations such as .devcontainer, .github workflows, and configuration files ensure consistent builds and tests.
b. Core Calculation Modules:
- Turbomachinery Module: Located in turbodesigner/turbomachinery.py, + turbodesigner/flow_station.py, turbodesigner/stage.py, and related classes. This module handles overall compressor design and performance calculations.
- Blade Design Module: Under turbodesigner/blade, containing subdirectories for blade-specific computations (e.g., vortex methods in free_vortex.py and common aerodynamic calculations).
- Airfoil Module: Found in turbodesigner/airfoils, with implementations like DCA.py and common.py to define and manage blade airfoil geometries.
- Attachments Module: Located in turbodesigner/attachments for additional design features.
c. CAD and Export Logic:
- CAD Module: turbodesigner/cad contains blades, casing, and shaft generation. This module translates calculated parameters into CAD models.
- Exporter: turbodesigner/exporter.py converts internal design representations to exportable formats (STL/STEP).
d. Visualization:
- in turbodesigner/visualizer.py to render or visually inspect the design.
e. Testing and Examples:
- Tests directory: Validates each subcomponent (compressor stages, blade design, etc.).
- Examples directory: Includes Jupyter notebooks (e.g., airfoil.ipynb, cad.ipynb) which serve as practical usage cases and demonstration of the design workflow.

##### Relationships and Data/Control Flow
- From the Turbomachinery module split out:
- The “Flow Station” component (managing basic fluid dynamics and thermodynamics)
- The “Stage” and “Blade Design” submodules where the physics of blade formation and vortex methods (e.g., FreeVortex) are applied.
- Link the “Airfoil Module” into “Blade Design” for geometric observations.
- “Exporter” that receives data from the CAD module and then outputs files in STL/STEP formats.
- A pathway to “Visualization” that likely taps into both raw design data and CAD outputs.
- Optionally, represent testing and examples as side processes that verify or demonstrate the flow from parameter ingestion to exported CAD models.

##### Architectural Patterns & Design Principles
- A modular, layered architecture. Each module (turbomachinery, blade, CAD, visualization) maintains single responsibility, making testing and future enhancement easier.
- That the design supports extension (e.g., adding different methods for blade analysis or additional geometries).
- Separation between computation and presentation (visualization and CAD export are clearly distinct from the aerodynamic calculations).

##### Including Technologies and Frameworks
- External libraries: For instance, note that CadQuery is used for CAD operations (pip installs indicate its importance).
- Developer tooling such as Gitpod, VSCode, and GitHub Actions (from .github/workflows) should be noted in auxiliary areas to emphasize development environment support.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input & Configuration
    subgraph "Input & Configuration"
        direction TB
        inputFiles["Input Files"]
        envDevcontainer[".devcontainer"]
        envWorkflows[".github/workflows"]
        envGitpod[".gitpod.yml"]
        envPylint[".pylintrc"]
        envVSCode[".vscode"]
    end

    %% Core Calculation Modules
    subgraph "Core Calculation Modules"
        direction TB
        turbomachinery["Turbomachinery Module"]
        flowStation["Flow Station"]
        stage["Stage"]
        subgraph "Blade Design Module"
            direction TB
            bladeMain["Blade Design Base"]
            row["Row"]
            metalAngles["Metal Angles"]
            metalAngleMethod["Johnsen Bullock"]
            vortex["Free Vortex"]
            vortexCommon["Common Vortex"]
        end
        subgraph "Airfoil Module"
            direction TB
            airfoilMain["Airfoil Base"]
            dca["DCA"]
            airfoilCommon["Airfoil Common"]
        end
        attachments["Attachments Module"]
    end

    %% CAD & Export/Visualization
    subgraph "CAD & Export/Visualization"
        direction TB
        subgraph "CAD Module"
            direction TB
            cadMain["CAD Base"]
            bladeCAD["Blade CAD"]
            casingCAD["Casing CAD"]
            shaftCAD["Shaft CAD"]
            cadCommon["CAD Common"]
        end
        exporter["Exporter"]
        visualizer["Visualization"]
    end

    %% Testing & Examples
    subgraph "Testing & Examples"
        direction TB
        testsDir["Tests"]
        examplesDir["Examples Directory"]
        airfoilNB["Airfoil Notebook"]
        cadNB["CAD Notebook"]
    end

    %% Flow Connections
    inputFiles --> turbomachinery
    turbomachinery --> flowStation
    turbomachinery --> stage
    turbomachinery --> bladeMain
    bladeMain --> airfoilMain
    flowStation --> cadMain
    stage --> cadMain
    bladeMain --> cadMain
    attachments --> cadMain
    cadMain --> exporter
    cadMain --> visualizer
    visualizer -->|"feedback"| inputFiles
    testsDir --> turbomachinery
    airfoilNB --> airfoilMain
    cadNB --> cadMain

    %% Click Events for Input & Configuration
    click inputFiles "https://github.com/openorion/turbodesigner/tree/main/tests/designs"
    click envDevcontainer "https://github.com/openorion/turbodesigner/blob/main/.devcontainer"
    click envWorkflows "https://github.com/openorion/turbodesigner/tree/main/.github/workflows"
    click envGitpod "https://github.com/openorion/turbodesigner/blob/main/.gitpod.yml"
    click envPylint "https://github.com/openorion/turbodesigner/blob/main/.pylintrc"
    click envVSCode "https://github.com/openorion/turbodesigner/blob/main/.vscode"

    %% Click Events for Turbomachinery Module
    click turbomachinery "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/turbomachinery.py"
    click flowStation "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/flow_station.py"
    click stage "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/stage.py"

    %% Click Events for Blade Design Module
    click bladeMain "https://github.com/openorion/turbodesigner/tree/main/turbodesigner/blade"
    click row "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/blade/row.py"
    click metalAngles "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/blade/metal_angles.py"
    click metalAngleMethod "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/blade/metal_angle_methods/johnsen_bullock.py"
    click vortex "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/blade/vortex/free_vortex.py"
    click vortexCommon "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/blade/vortex/common.py"

    %% Click Events for Airfoil Module
    click airfoilMain "https://github.com/openorion/turbodesigner/tree/main/turbodesigner/airfoils"
    click dca "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/airfoils/DCA.py"
    click airfoilCommon "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/airfoils/common.py"

    %% Click Events for Attachments Module
    click attachments "https://github.com/openorion/turbodesigner/tree/main/turbodesigner/attachments"

    %% Click Events for CAD Module and Export/Visualization
    click cadMain "https://github.com/openorion/turbodesigner/tree/main/turbodesigner/cad"
    click bladeCAD "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/cad/blade.py"
    click casingCAD "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/cad/casing.py"
    click shaftCAD "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/cad/shaft.py"
    click cadCommon "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/cad/common.py"
    click exporter "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/exporter.py"
    click visualizer "https://github.com/openorion/turbodesigner/blob/main/turbodesigner/visualizer.py"

    %% Click Events for Testing & Examples
    click testsDir "https://github.com/openorion/turbodesigner/tree/main/tests"
    click examplesDir "https://github.com/openorion/turbodesigner/tree/main/examples"
    click airfoilNB "https://github.com/openorion/turbodesigner/blob/main/examples/airfoil.ipynb"
    click cadNB "https://github.com/openorion/turbodesigner/blob/main/examples/cad.ipynb"

    %% Class Definitions for Colors
    class inputFiles,envDevcontainer,envWorkflows,envGitpod,envPylint,envVSCode input
    class turbomachinery,flowStation,stage,bladeMain,row,metalAngles,metalAngleMethod,vortex,vortexCommon,airfoilMain,dca,airfoilCommon,attachments computation
    class cadMain,bladeCAD,casingCAD,shaftCAD,cadCommon,exporter cad
    class visualizer viz
    class testsDir,examplesDir,airfoilNB,cadNB test

    %% Style Classes
    classDef input fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef computation fill:#40E0D0,stroke:#333,stroke-width:2px;
    classDef cad fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef viz fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef test fill:#FFA07A,stroke:#333,stroke-width:2px;
```
