# rocketpy-team/rocketpy architecture

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

- Interactive diagram: https://gitdiagram.com/rocketpy-team/rocketpy
- Repository: https://github.com/rocketpy-team/rocketpy

## Overview

#### Purpose and Entry Points
RocketPy is a Python library for high-power rocket trajectory analysis: primarily nonlinear 6-DOF flight simulation with variable mass, aerodynamics, weather, recovery, controls, and uncertainty analysis. The public API is exposed from `rocketpy/__init__.py`; users typically construct `Environment`, a motor, `Rocket`, then `Flight`. Interactive entry points are notebooks such as `docs/notebooks/getting_started.ipynb` and scenario examples under `docs/examples/`.

#### Core Simulation Pipeline
`Flight` is the central orchestration and results object. It consumes a fully assembled rocket plus environment and launch-rail/heading parameters, integrates the trajectory, models flight phases including descent, and retains computed states for reporting/export.
- `rocketpy/simulation/flight.py`
- `rocketpy/simulation/flight_data_exporter.py`
- `rocketpy/simulation/flight_comparator.py`

The principal boundary is object configuration versus numerical execution: `Environment`, motor, rocket geometry/recovery, sensors, and controllers are composed before `Flight` runs.

#### Environment and Atmospheric Data
`Environment` owns launch location, date, elevation/topography, gravity, and atmospheric state such as wind and pressure profiles. It supports standard/custom atmosphere and retrieved forecast, reanalysis, sounding, and ensemble data; fetcher/mapping code isolates external weather providers from simulation consumers.
- `rocketpy/environment/environment.py`
- `rocketpy/environment/fetchers.py`
- `rocketpy/environment/weather_model_mapping.py`

Packaged NetCDF weather/topography files provide reproducible local datasets, e.g. `data/weather/EuroC_pressure_levels_reanalysis_2001-2021.nc` and `data/sites/switzerland/NASADEM_NC_n46e008.nc`.

#### Propulsion and Mass Evolution
The motor hierarchy turns thrust inputs and propellant/tank definitions into time-varying thrust, mass, center of mass, and inertia used by `Rocket` and `Flight`. It supports solid, hybrid, liquid, generic, point-mass, and clustered motors; liquid/hybrid paths compose fluids, tanks, and tank geometry.
- `rocketpy/motors/motor.py`
- `rocketpy/motors/solid_motor.py`
- `rocketpy/motors/liquid_motor.py`

Inputs cross a file-format boundary through ENG/RSE/CSV thrust and flow data, with representative assets in `data/motors/cesaroni/Cesaroni_M1670.eng` and `data/motors/liquid_motor_example/`.

#### Vehicle, Aerodynamics, Recovery, and Control
`Rocket` aggregates dry-body properties, attached motor(s), drag models, rail hardware, and aerodynamic surfaces. Surface subclasses encapsulate geometry/aerodynamic contributions; parachutes define deployment trigger, lag, noise, and descent drag. Controllers allow custom continuous or discrete actuation, including air brakes.
- `rocketpy/rocket/rocket.py`
- `rocketpy/rocket/aero_surface/air_brakes.py`
- `rocketpy/rocket/parachute.py`
- `rocketpy/control/controller.py`

This is the main assembly boundary: component APIs produce a vehicle model consumed by the flight solver rather than directly solving trajectories.

#### Numerical and Sensor Foundations
Reusable `Function`/interpolation machinery represents thrust curves, atmospheric profiles, drag tables, and derived time histories. Vector/matrix operations support the 6-DOF dynamics. Simulated accelerometer, gyroscope, barometer, and GNSS models can feed recovery/control logic with noise and seeding behavior.
- `rocketpy/mathutils/function.py`
- `rocketpy/mathutils/vector_matrix.py`
- `rocketpy/sensors/sensor.py`

#### Dispersion, Sensitivity, and Outputs
Stochastic wrappers parameterize uncertain environment, motor, rocket, aerodynamic, parachute, and flight inputs. `MonteCarlo` repeatedly instantiates/runs these models for dispersion; sensitivity analysis evaluates output dependence. Results are exposed through plotting/printing facades and may be exported/imported as flight data or KML.
- `rocketpy/simulation/monte_carlo.py`
- `rocketpy/stochastic/stochastic_flight.py`
- `rocketpy/sensitivity/sensitivity_model.py`
- `rocketpy/plots/flight_plots.py`

#### Runtime and Delivery
The material runtime is Python, distributed as the `rocketpy` package through PyPI and Conda. Documentation is Sphinx/Read the Docs-oriented (`docs/conf.py`), with Jupyter and MATLAB integration artifacts. Docker supports reproducible development/runtime environments.
- `pyproject.toml`
- `docker/Dockerfile`
- `.github/workflows/publish-to-pypi.yml`

Main entry points: [`rocketpy/simulation/flight.py`](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/simulation/flight.py) (Flight), [`rocketpy/rocket/rocket.py`](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/rocket/rocket.py) (Rocket), [`rocketpy/environment/environment.py`](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/environment/environment.py) (Environment), [`rocketpy/motors/motor.py`](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/motors/motor.py) (Motor hierarchy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_assembly["Model Assembly"]
  node_environment["Environment<br/>[environment.py]"]
  node_weather_providers["Weather providers<br/>data adapter<br/>[fetchers.py]"]
  node_weather_mapping["Weather mapping<br/>provider mapping"]
  node_weather_data[("Packaged weather data<br/>NetCDF dataset")]
  node_motor["Motor hierarchy<br/>propulsion model<br/>[motor.py]"]
  node_liquid_motor["Liquid motor<br/>propulsion specialization<br/>[liquid_motor.py]"]
  node_thrust_data["Thrust &amp; flow inputs<br/>motor data<br/>[Cesaroni_M1670.eng]"]
  node_rocket["Rocket<br/>vehicle model<br/>[rocket.py]"]
  node_air_brakes["Air brakes<br/>aero surface<br/>[air_brakes.py]"]
  node_parachute["Parachute<br/>recovery model<br/>[parachute.py]"]
  node_controller["Controllers<br/>control model<br/>[controller.py]"]
end

subgraph group_simulation["Simulation &amp; Analysis"]
  node_flight["Flight<br/>6-DOF solver<br/>[flight.py]"]
  node_flight_export["Flight data export<br/>results exporter"]
  node_monte_carlo["Monte Carlo<br/>dispersion runner<br/>[monte_carlo.py]"]
  node_stochastic_flight["Stochastic flight<br/>uncertainty model"]
  node_sensitivity["Sensitivity analysis<br/>output analysis"]
  node_flight_plots["Flight plots<br/>results view<br/>[flight_plots.py]"]
end

subgraph group_foundations["Shared Foundations"]
  node_function["Function &amp; interpolation<br/>numerical primitive<br/>[function.py]"]
  node_sensors["Simulated sensors<br/>sensor models<br/>[sensor.py]"]
end

subgraph group_delivery["Delivery"]
  node_package["Python package<br/>distribution<br/>[pyproject.toml]"]
  node_pypi_publish["PyPI publishing<br/>CI workflow"]
end

node_api["Public API<br/>package facade<br/>[__init__.py]"]

node_api -->|"exposes"| node_environment
node_api -->|"exposes"| node_motor
node_api -->|"exposes"| node_rocket
node_api -->|"exposes"| node_flight
node_weather_providers -->|"uses"| node_weather_mapping
node_weather_mapping -->|"normalizes for"| node_environment
node_weather_data -->|"profiles for"| node_environment
node_thrust_data -->|"defines"| node_motor
node_liquid_motor -->|"specializes"| node_motor
node_motor -->|"attached to"| node_rocket
node_air_brakes -->|"aerodynamic component"| node_rocket
node_parachute -->|"recovery component"| node_rocket
node_controller -->|"actuates"| node_rocket
node_function -->|"profiles"| node_environment
node_function -->|"curves"| node_motor
node_function -->|"drag tables"| node_rocket
node_environment -->|"conditions"| node_flight
node_rocket -->|"vehicle model"| node_flight
node_sensors -.->|"measurements for"| node_controller
node_flight -->|"exports results"| node_flight_export
node_flight -->|"visualizes"| node_flight_plots
node_stochastic_flight -->|"parameterizes"| node_monte_carlo
node_monte_carlo -.->|"repeats"| node_flight
node_flight -->|"outputs analyzed"| node_sensitivity
node_package -->|"published by"| node_pypi_publish

click node_api "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/__init__.py"
click node_environment "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/environment/environment.py"
click node_weather_providers "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/environment/fetchers.py"
click node_weather_mapping "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/environment/weather_model_mapping.py"
click node_weather_data "https://github.com/rocketpy-team/rocketpy/blob/master/data/weather/EuroC_pressure_levels_reanalysis_2001-2021.nc"
click node_motor "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/motors/motor.py"
click node_liquid_motor "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/motors/liquid_motor.py"
click node_thrust_data "https://github.com/rocketpy-team/rocketpy/blob/master/data/motors/cesaroni/Cesaroni_M1670.eng"
click node_rocket "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/rocket/rocket.py"
click node_air_brakes "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/rocket/aero_surface/air_brakes.py"
click node_parachute "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/rocket/parachute.py"
click node_controller "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/control/controller.py"
click node_flight "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/simulation/flight.py"
click node_flight_export "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/simulation/flight_data_exporter.py"
click node_monte_carlo "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/simulation/monte_carlo.py"
click node_stochastic_flight "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/stochastic/stochastic_flight.py"
click node_sensitivity "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/sensitivity/sensitivity_model.py"
click node_flight_plots "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/plots/flight_plots.py"
click node_function "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/mathutils/function.py"
click node_sensors "https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/sensors/sensor.py"
click node_package "https://github.com/rocketpy-team/rocketpy/blob/master/pyproject.toml"
click node_pypi_publish "https://github.com/rocketpy-team/rocketpy/blob/master/.github/workflows/publish-to-pypi.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_environment,node_weather_providers,node_weather_mapping,node_weather_data,node_motor,node_liquid_motor,node_thrust_data,node_rocket,node_air_brakes,node_parachute,node_controller toneBlue
class node_flight,node_flight_export,node_monte_carlo,node_stochastic_flight,node_sensitivity,node_flight_plots toneAmber
class node_function,node_sensors toneMint
class node_package,node_pypi_publish toneRose
class node_api toneNeutral
```

## Components

### Model Assembly

Configured inputs assembled before numerical execution.

- [Environment](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/environment/environment.py): environment model · Launch conditions and atmospheric state. · `rocketpy/environment/environment.py`
- [Weather providers](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/environment/fetchers.py): data adapter · Maps external weather sources into environment profiles. · `rocketpy/environment/fetchers.py`
- [Weather mapping](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/environment/weather_model_mapping.py): provider mapping · `rocketpy/environment/weather_model_mapping.py`
- [Packaged weather data](https://github.com/rocketpy-team/rocketpy/blob/master/data/weather/EuroC_pressure_levels_reanalysis_2001-2021.nc): NetCDF dataset · Reproducible weather and topography inputs. · `data/weather/EuroC_pressure_levels_reanalysis_2001-2021.nc`
- [Motor hierarchy](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/motors/motor.py): propulsion model · Produces time-varying thrust, mass, center of mass, and inertia. · `rocketpy/motors/motor.py`
- [Liquid motor](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/motors/liquid_motor.py): propulsion specialization · Composes fluids, tanks, and tank geometry. · `rocketpy/motors/liquid_motor.py`
- [Thrust & flow inputs](https://github.com/rocketpy-team/rocketpy/blob/master/data/motors/cesaroni/Cesaroni_M1670.eng): motor data · ENG, RSE, CSV, and flow definitions. · `data/motors/cesaroni/Cesaroni_M1670.eng`
- [Rocket](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/rocket/rocket.py): vehicle model · Aggregates body, motors, aerodynamics, rail hardware, and recovery. · `rocketpy/rocket/rocket.py`
- [Air brakes](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/rocket/aero_surface/air_brakes.py): aero surface · `rocketpy/rocket/aero_surface/air_brakes.py`
- [Parachute](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/rocket/parachute.py): recovery model · Models deployment trigger, lag, noise, and descent drag. · `rocketpy/rocket/parachute.py`
- [Controllers](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/control/controller.py): control model · Continuous or discrete actuator logic. · `rocketpy/control/controller.py`

### Simulation & Analysis

Flight execution and post-flight studies.

- [Flight](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/simulation/flight.py): 6-DOF solver · Integrates flight phases and retains trajectory results. · `rocketpy/simulation/flight.py`
- [Flight data export](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/simulation/flight_data_exporter.py): results exporter · `rocketpy/simulation/flight_data_exporter.py`
- [Monte Carlo](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/simulation/monte_carlo.py): dispersion runner · Repeatedly instantiates and runs uncertain models. · `rocketpy/simulation/monte_carlo.py`
- [Stochastic flight](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/stochastic/stochastic_flight.py): uncertainty model · Parameterizes uncertain flight inputs. · `rocketpy/stochastic/stochastic_flight.py`
- [Sensitivity analysis](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/sensitivity/sensitivity_model.py): output analysis · `rocketpy/sensitivity/sensitivity_model.py`
- [Flight plots](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/plots/flight_plots.py): results view · `rocketpy/plots/flight_plots.py`

### Shared Foundations

- [Function & interpolation](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/mathutils/function.py): numerical primitive · Represents profiles, tables, curves, and derived histories. · `rocketpy/mathutils/function.py`
- [Simulated sensors](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/sensors/sensor.py): sensor models · Noisy accelerometer, gyroscope, barometer, and GNSS models. · `rocketpy/sensors/sensor.py`

### Delivery

- [Python package](https://github.com/rocketpy-team/rocketpy/blob/master/pyproject.toml): distribution · Published through PyPI and Conda. · `pyproject.toml`
- [PyPI publishing](https://github.com/rocketpy-team/rocketpy/blob/master/.github/workflows/publish-to-pypi.yml): CI workflow · `.github/workflows/publish-to-pypi.yml`

### Other components

- [Public API](https://github.com/rocketpy-team/rocketpy/blob/master/rocketpy/__init__.py): package facade · `rocketpy/__init__.py`

## Connections

- Public API → Environment: exposes
- Public API → Motor hierarchy: exposes
- Public API → Rocket: exposes
- Public API → Flight: exposes
- Weather providers → Weather mapping: uses
- Weather mapping → Environment: normalizes for
- Packaged weather data → Environment: profiles for
- Thrust & flow inputs → Motor hierarchy: defines
- Liquid motor → Motor hierarchy: specializes
- Motor hierarchy → Rocket: attached to
- Air brakes → Rocket: aerodynamic component
- Parachute → Rocket: recovery component
- Controllers → Rocket: actuates
- Function & interpolation → Environment: profiles
- Function & interpolation → Motor hierarchy: curves
- Function & interpolation → Rocket: drag tables
- Environment → Flight: conditions
- Rocket → Flight: vehicle model
- Simulated sensors → Controllers: measurements for
- Flight → Flight data export: exports results
- Flight → Flight plots: visualizes
- Stochastic flight → Monte Carlo: parameterizes
- Monte Carlo → Flight: repeats
- Flight → Sensitivity analysis: outputs analyzed
- Python package → PyPI publishing: published by
