# peterdsharpe/aerosandbox architecture

> Architecture diagram of the GitHub repository peterdsharpe/aerosandbox, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/peterdsharpe/aerosandbox
- Repository: https://github.com/peterdsharpe/aerosandbox

## Overview

#### Purpose and Entry Points
AeroSandbox is a Python library for differentiable engineering and aircraft-design optimization. Users import the package through `aerosandbox/__init__.py`, then compose geometry, operating conditions, physics models, and optimization variables in Python. The principal optimization API is `aerosandbox/optimization/opti.py`; NumPy-like, differentiation-aware operations are exposed by `aerosandbox/numpy/__init__.py`.

#### Optimization and Differentiable Numerics
The core control flow is: define design variables/parameters → evaluate vectorized numerical and physics expressions → add objectives and constraints → solve → use optimized values and sensitivities. `aerosandbox/optimization/opti.py` owns problem construction and solution behavior, while `aerosandbox/numpy/` supplies overloaded array, calculus, interpolation, integration, linear-algebra, and conditional operations that preserve compatibility with optimization expressions. This is the primary boundary between user-authored models and the underlying nonlinear/automatic-differentiation solver runtime.
Paths: `aerosandbox/optimization/opti.py`, `aerosandbox/numpy/array.py`, `aerosandbox/numpy/calculus.py`.

#### Geometry and Mass Data Model
Aircraft definitions are object models rather than files or services: airplanes aggregate wings, fuselages, propulsors, airfoils, and mass properties. These geometry objects are shared inputs to aerodynamic solvers, exports, visualization, and design optimization. Airfoil geometry can be loaded from the bundled coordinate database or parameterized using Kulfan representations.
Paths: `aerosandbox/geometry/airplane.py`, `aerosandbox/geometry/wing.py`, `aerosandbox/geometry/airfoil/airfoil.py`.

#### Aerodynamics Stack
Two-dimensional analysis provides airfoil inviscid/viscous/polar workflows and optimizer-facing airfoil calculations. Three-dimensional analysis operates on aircraft geometry plus an operating point, offering VLM, lifting-line, potential-flow, and the higher-level AeroBuildup model. Outputs are aerodynamic forces, moments, coefficients, and distributions that can feed directly into objectives, structural calculations, or flight dynamics.
Paths: `aerosandbox/aerodynamics/aero_2D/airfoil_inviscid.py`, `aerosandbox/aerodynamics/aero_3D/aero_buildup.py`, `aerosandbox/aerodynamics/aero_3D/vortex_lattice_method.py`.

#### Conditions, Dynamics, and Coupled Design Disciplines
`OperatingPoint` and atmosphere models provide flight-state and thermodynamic context for aerodynamic and propulsion calculations. The dynamics hierarchy represents point-mass and rigid-body states and exposes derivative constraints, enabling direct transcription-style trajectory and optimal-control problems. Supporting analytical libraries cover propulsion, weights, structures, regulations, winds, and performance calculations, allowing a single optimization graph to couple aircraft sizing and missions.
Paths: `aerosandbox/performance/operating_point.py`, `aerosandbox/atmosphere/atmosphere.py`, `aerosandbox/dynamics/point_mass/common_point_mass.py`.

#### Modeling, Surrogates, and External Boundaries
Surrogate/fitting/interpolation modules support differentiable replacement or approximation of data and black-box models. External-tool adapters form explicit boundaries for AVL, XFoil, MSES, and OpenVSP/CAD-oriented workflows; these may involve local executables or generated exchange scripts rather than a network service. Optional visualization and geometry-export capabilities integrate with Python ecosystem packages for 3D plotting, meshes, and CAD; the lightweight install excludes those optional dependencies.
Paths: `aerosandbox/modeling/surrogate_model.py`, `aerosandbox/aerodynamics/aero_3D/avl.py`, `aerosandbox/geometry/openvsp_io/asb_to_openvsp/airplane_vspscript_generator.py`.

#### Runtime, Assets, and Delivery
The runtime is Python, distributed as a PyPI package with dependency definitions in `pyproject.toml` and lock state in `uv.lock`. Bundled engineering data includes airfoil coordinates, ISA tables, and wind/engine datasets, keeping common analyses local and reproducible. GitHub Actions runs pytest, publishes package releases from master pushes, and deploys documentation; Read the Docs configuration is present for hosted docs.
Paths: `pyproject.toml`, `aerosandbox/geometry/airfoil/airfoil_database/`, `.github/workflows/publish-on-master-push.yml`.

Main entry points: [`aerosandbox/optimization/opti.py`](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/optimization/opti.py) (Opti), [`aerosandbox/geometry/airplane.py`](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/airplane.py) (Aircraft geometry), [`aerosandbox/aerodynamics/aero_3D/aero_buildup.py`](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_3D/aero_buildup.py) (AeroBuildup), [`aerosandbox/performance/operating_point.py`](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/performance/operating_point.py) (Operating point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Differentiable Core"]
  node_package["AeroSandbox API<br/>Python package<br/>[__init__.py]"]
  node_opti["Opti<br/>[opti.py]"]
  node_numpy_array["Differentiable arrays<br/>numerics layer<br/>[array.py]"]
  node_numpy_calculus["Calculus operations<br/>numerics layer<br/>[calculus.py]"]
end

subgraph group_models["Engineering Models"]
  node_airplane["Aircraft geometry<br/>object model<br/>[airplane.py]"]
  node_wing["Wing geometry<br/>geometry model<br/>[wing.py]"]
  node_airfoil["Airfoil geometry<br/>geometry model<br/>[airfoil.py]"]
  node_airfoil_data[("Airfoil database<br/>bundled data")]
  node_operating_point["Operating point<br/>flight-state model<br/>[operating_point.py]"]
  node_atmosphere["Atmosphere<br/>thermodynamic model<br/>[atmosphere.py]"]
end

subgraph group_analysis["Analysis &amp; Coupling"]
  node_airfoil_2d["2D airfoil analysis<br/>aerodynamics solver"]
  node_aero_buildup["AeroBuildup<br/>3D aerodynamics solver<br/>[aero_buildup.py]"]
  node_vlm["Vortex lattice method<br/>3D aerodynamics solver"]
  node_dynamics["Point-mass dynamics<br/>dynamics model"]
  node_coupled_disciplines["Sizing disciplines<br/>engineering libraries"]
  node_surrogates["Surrogates &amp; fitting<br/>modeling layer<br/>[surrogate_model.py]"]
end

subgraph group_external["External Boundaries"]
  node_avl{{"AVL adapter<br/>external-tool adapter<br/>[avl.py]"}}
  node_openvsp{{"OpenVSP export<br/>CAD adapter"}}
end

subgraph group_delivery["Packaging &amp; Delivery"]
  node_package_config["Package definition<br/>Python packaging<br/>[pyproject.toml]"]
  node_publish_ci["Release workflow<br/>GitHub Actions"]
end

node_package -->|"optimization API"| node_opti
node_package -->|"numerical API"| node_numpy_array
node_numpy_calculus -->|"array expressions"| node_numpy_array
node_opti -->|"symbolic expressions"| node_numpy_array
node_opti -->|"differentiable calculus"| node_numpy_calculus
node_airplane -->|"aggregates"| node_wing
node_wing -->|"uses sections"| node_airfoil
node_airfoil -->|"loads coordinates"| node_airfoil_data
node_operating_point -->|"atmospheric context"| node_atmosphere
node_airfoil -->|"analysis input"| node_airfoil_2d
node_airplane -->|"geometry input"| node_aero_buildup
node_operating_point -->|"flight condition"| node_aero_buildup
node_airplane -->|"geometry input"| node_vlm
node_operating_point -->|"flight condition"| node_vlm
node_aero_buildup -->|"aerodynamic loads"| node_coupled_disciplines
node_coupled_disciplines -->|"mission forces"| node_dynamics
node_aero_buildup -->|"objectives and constraints"| node_opti
node_vlm -->|"loads and coefficients"| node_opti
node_dynamics -->|"derivative constraints"| node_opti
node_surrogates -->|"differentiable models"| node_opti
node_airplane -.->|"external analysis input"| node_avl
node_airplane -.->|"CAD export"| node_openvsp
node_package_config -->|"builds distribution"| node_package
node_publish_ci -->|"publishes"| node_package_config

click node_package "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/__init__.py"
click node_opti "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/optimization/opti.py"
click node_numpy_array "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/numpy/array.py"
click node_numpy_calculus "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/numpy/calculus.py"
click node_airplane "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/airplane.py"
click node_wing "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/wing.py"
click node_airfoil "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/airfoil/airfoil.py"
click node_airfoil_data "https://github.com/peterdsharpe/aerosandbox/tree/master/aerosandbox/geometry/airfoil/airfoil_database"
click node_operating_point "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/performance/operating_point.py"
click node_atmosphere "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/atmosphere/atmosphere.py"
click node_airfoil_2d "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_2D/airfoil_inviscid.py"
click node_aero_buildup "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_3D/aero_buildup.py"
click node_vlm "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_3D/vortex_lattice_method.py"
click node_dynamics "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/dynamics/point_mass/common_point_mass.py"
click node_surrogates "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/modeling/surrogate_model.py"
click node_avl "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_3D/avl.py"
click node_openvsp "https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/openvsp_io/asb_to_openvsp/airplane_vspscript_generator.py"
click node_package_config "https://github.com/peterdsharpe/aerosandbox/blob/master/pyproject.toml"
click node_publish_ci "https://github.com/peterdsharpe/aerosandbox/blob/master/.github/workflows/publish-on-master-push.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_package,node_opti,node_numpy_array,node_numpy_calculus toneBlue
class node_airplane,node_wing,node_airfoil,node_airfoil_data,node_operating_point,node_atmosphere toneAmber
class node_airfoil_2d,node_aero_buildup,node_vlm,node_dynamics,node_coupled_disciplines,node_surrogates toneMint
class node_avl,node_openvsp toneRose
class node_package_config,node_publish_ci toneIndigo
```

## Components

### Differentiable Core

- [AeroSandbox API](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/__init__.py): Python package · User import and composition entry point. · `aerosandbox/__init__.py`
- [Opti](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/optimization/opti.py): optimization API · Builds problems, constraints, objectives, solutions, and sensitivities. · `aerosandbox/optimization/opti.py`
- [Differentiable arrays](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/numpy/array.py): numerics layer · Overloaded vectorized array operations preserve optimization expressions. · `aerosandbox/numpy/array.py`
- [Calculus operations](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/numpy/calculus.py): numerics layer · `aerosandbox/numpy/calculus.py`

### Engineering Models

- [Aircraft geometry](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/airplane.py): object model · Aggregates wings, fuselages, propulsors, airfoils, and mass properties. · `aerosandbox/geometry/airplane.py`
- [Wing geometry](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/wing.py): geometry model · `aerosandbox/geometry/wing.py`
- [Airfoil geometry](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/airfoil/airfoil.py): geometry model · Supports coordinate-backed and Kulfan-parameterized airfoils. · `aerosandbox/geometry/airfoil/airfoil.py`
- [Airfoil database](https://github.com/peterdsharpe/aerosandbox/tree/master/aerosandbox/geometry/airfoil/airfoil_database): bundled data · Local coordinate data for airfoil definitions. · `aerosandbox/geometry/airfoil/airfoil_database`
- [Operating point](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/performance/operating_point.py): flight-state model · Provides aerodynamic and propulsion flight conditions. · `aerosandbox/performance/operating_point.py`
- [Atmosphere](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/atmosphere/atmosphere.py): thermodynamic model · `aerosandbox/atmosphere/atmosphere.py`

### Analysis & Coupling

- [2D airfoil analysis](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_2D/airfoil_inviscid.py): aerodynamics solver · Provides inviscid, viscous, polar, and optimizer-facing airfoil calculations. · `aerosandbox/aerodynamics/aero_2D/airfoil_inviscid.py`
- [AeroBuildup](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_3D/aero_buildup.py): 3D aerodynamics solver · High-level aircraft aerodynamic forces, moments, and coefficients. · `aerosandbox/aerodynamics/aero_3D/aero_buildup.py`
- [Vortex lattice method](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_3D/vortex_lattice_method.py): 3D aerodynamics solver · Produces aircraft aerodynamic loads and distributions. · `aerosandbox/aerodynamics/aero_3D/vortex_lattice_method.py`
- [Point-mass dynamics](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/dynamics/point_mass/common_point_mass.py): dynamics model · Exposes state derivatives and trajectory constraints. · `aerosandbox/dynamics/point_mass/common_point_mass.py`
- **Sizing disciplines**: engineering libraries · Propulsion, weights, structures, regulations, winds, and performance calculations.
- [Surrogates & fitting](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/modeling/surrogate_model.py): modeling layer · Differentiable approximations for data and black-box models. · `aerosandbox/modeling/surrogate_model.py`

### External Boundaries

- [AVL adapter](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/aerodynamics/aero_3D/avl.py): external-tool adapter · Generates exchange inputs for local AVL analysis. · `aerosandbox/aerodynamics/aero_3D/avl.py`
- [OpenVSP export](https://github.com/peterdsharpe/aerosandbox/blob/master/aerosandbox/geometry/openvsp_io/asb_to_openvsp/airplane_vspscript_generator.py): CAD adapter · Generates OpenVSP aircraft scripts. · `aerosandbox/geometry/openvsp_io/asb_to_openvsp/airplane_vspscript_generator.py`

### Packaging & Delivery

- [Package definition](https://github.com/peterdsharpe/aerosandbox/blob/master/pyproject.toml): Python packaging · Defines PyPI distribution dependencies and optional installs. · `pyproject.toml`
- [Release workflow](https://github.com/peterdsharpe/aerosandbox/blob/master/.github/workflows/publish-on-master-push.yml): GitHub Actions · Publishes package releases from master pushes. · `.github/workflows/publish-on-master-push.yml`

## Connections

- AeroSandbox API → Opti: optimization API
- AeroSandbox API → Differentiable arrays: numerical API
- Calculus operations → Differentiable arrays: array expressions
- Opti → Differentiable arrays: symbolic expressions
- Opti → Calculus operations: differentiable calculus
- Aircraft geometry → Wing geometry: aggregates
- Wing geometry → Airfoil geometry: uses sections
- Airfoil geometry → Airfoil database: loads coordinates
- Operating point → Atmosphere: atmospheric context
- Airfoil geometry → 2D airfoil analysis: analysis input
- Aircraft geometry → AeroBuildup: geometry input
- Operating point → AeroBuildup: flight condition
- Aircraft geometry → Vortex lattice method: geometry input
- Operating point → Vortex lattice method: flight condition
- AeroBuildup → Sizing disciplines: aerodynamic loads
- Sizing disciplines → Point-mass dynamics: mission forces
- AeroBuildup → Opti: objectives and constraints
- Vortex lattice method → Opti: loads and coefficients
- Point-mass dynamics → Opti: derivative constraints
- Surrogates & fitting → Opti: differentiable models
- Aircraft geometry → AVL adapter: external analysis input
- Aircraft geometry → OpenVSP export: CAD export
- Package definition → AeroSandbox API: builds distribution
- Release workflow → Package definition: publishes
