# nlrwindsystems/weis architecture

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

- Interactive diagram: https://gitdiagram.com/nlrwindsystems/weis
- Repository: https://github.com/nlrwindsystems/weis

## Overview

1. **What this repo is**
   WEIS is a Python-based co-design framework for wind turbines, especially floating offshore turbines. The core architecture is not a single application, but a set of coordinated subsystems that turn YAML-defined design/analysis inputs into simulations, load cases, optimizations, and visualizations.

2. **Primary boundary: orchestration vs. solvers**
   The main runtime boundary is between WEIS orchestration code and external solvers/tools. WEIS coordinates:
   - **OpenFAST** for aeroelastic time-domain simulation
   - **ROSCO** for control tuning and controller generation
   - **RAFT** for frequency-domain floating-system analysis
   - **WISDEM** for turbine design/cost-related models
   - **TurbSim / IEC wind models** for inflow and DLC wind generation
   - **pyOptSparse** and custom optimizers for design loops
   - **pCrunch**-style postprocessing for loads/output handling

3. **Input and schema layer**
   The `weis/inputs` package defines the input contract via YAML schemas and validation. These schemas describe:
   - geometry
   - modeling options
   - analysis options
   - OpenFAST-related inputs
   This layer is the main boundary for user configuration and is mirrored in the `docs/inputs` schema documentation and the many example YAML files.

4. **Workflow orchestration**
   The `weis/glue_code` package is the central integration layer. It parses input files, loads model options, coordinates tool setup, and dispatches work to the simulation and optimization subsystems. Files like `runWEIS.py`, `glue_code.py`, and the `gc_*` modules are the place where the end-to-end workflow is assembled.

5. **Aeroelastic simulation subsystem**
   The `weis/aeroelasticse` package wraps OpenFAST execution. It handles:
   - case generation
   - FAST input preparation
   - batch execution
   - linearization handling
   - OpenMDAO/OpenFAST integration
   - IEC/coherent gust helpers
   This subsystem is responsible for turning a turbine model plus load cases into simulation outputs and linearizations.

6. **Control subsystem**
   The `weis/control` package handles controller-related logic. It includes:
   - ROSCO tuning and controller input generation
   - linear model handling
   - multi-blade coordinate utilities
   - tuned mass damper support
   - distributed aerodynamic control tooling
   In the example models, this subsystem feeds controller files back into OpenFAST/ServoDyn inputs.

7. **Frequency-domain and hydrodynamic modeling**
   The `weis/frequency` and `weis/ss_fitting` packages support floating-system dynamics in the frequency domain. RAFT-based analysis provides efficient low-order response modeling, while state-space fitting tools convert hydrodynamic data into reduced models. This is a separate analysis path from time-domain OpenFAST, but it plugs into the same design workflow.

8. **Design load cases and wind field generation**
   The `weis/dlc_driver` package generates design load case runs and associated wind/turbulence inputs. It is the subsystem that expands a high-level analysis request into many simulation jobs, including IEC-style wind conditions and turbulence realizations. These generated jobs then flow into the OpenFAST execution layer.

9. **Optimization and multifidelity search**
   Optimization is split across two main areas:
   - `weis/multifidelity`: trust-region and multifidelity methods
   - `nsga2_weis`: a custom NSGA-II implementation integrated with optimization drivers
   This layer manages iterative design updates across aero, structural, control, and floating-system variables, using responses from simulation/frequency-domain tools as objective/constraint inputs.

10. **Postprocessing and visualization**
   The `weis/visualization` package and its Dash app server provide interactive inspection of inputs, geometry, optimization outputs, and OpenFAST/WISDEM results. Separate plotting utilities support offline result review. This is downstream-only: it consumes generated output files and does not participate in the core optimization loop.

11. **Examples as architecture documentation**
   The `examples` directory is effectively a map of supported workflows: setup of OpenFAST models, simulation of custom models, model generation for DLCs, controller design, RAFT-based design, parametric studies, preprocessing, and staged model-creation workflows. These examples show the intended data flow: YAML inputs → driver script → WEIS orchestration → external tools → results/postprocessing.

12. **Non-core but relevant infrastructure**
   CI and docs are well developed, but they support the architecture rather than define it. The presence of `.github/workflows`, `docs/`, and `environment.yml` indicates the repo is designed for reproducible scientific workflows, tested Python packaging, and documented input/output contracts. The `share/` and Kestrel-related scripts indicate HPC batch execution support as an operational boundary.

Main entry points: [`weis/glue_code/glue_code.py`](https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/glue_code.py) (Glue code), [`weis/glue_code/gc_RunTools.py`](https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/gc_RunTools.py) (Tool setup), [`weis/aeroelasticse`](https://github.com/nlrwindsystems/weis/tree/main/weis/aeroelasticse) (OpenFAST wrapper), [`weis/multifidelity`](https://github.com/nlrwindsystems/weis/tree/main/weis/multifidelity) (Trust region)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_core["Core workflow"]
  node_node_main["WEIS entry<br/>package entry<br/>[main.py]"]
  node_node_runweis["Run WEIS<br/>workflow driver<br/>[runWEIS.py]"]
  node_node_glue["Glue code<br/>integration layer<br/>[glue_code.py]"]
  node_node_inputs["Input schemas<br/>schema layer"]
  node_node_loadinputs["Load inputs<br/>input parsing<br/>[gc_LoadInputs.py]"]
  node_node_runtools["Tool setup<br/>tool dispatch<br/>[gc_RunTools.py]"]
end

subgraph group_group_analysis["Analysis engines"]
  node_node_rose["ROSCO inputs<br/>controller bridge<br/>[gc_ROSCOInputs.py]"]
  node_node_aero["OpenFAST wrapper<br/>time-domain simulation"]
  node_node_dlc["DLC driver<br/>load-case generator"]
  node_node_control["Control"]
  node_node_freq["Frequency analysis<br/>raft wrapper<br/>[raft_wrapper.py]"]
  node_node_ssfit["State-space fit<br/>hydro reduction"]
end

subgraph group_group_opt["Optimization"]
  node_node_mf["Trust region<br/>multifidelity optimization"]
  node_node_nsga["NSGA-II<br/>multiobjective optimizer"]
end

subgraph group_group_ui["Outputs"]
  node_node_viz["Visualization<br/>dash app"]
end

subgraph group_group_examples["Examples"]
  node_node_examples["Examples<br/>workflow gallery"]
  node_node_dlc_ex["DLC runs<br/>example workflow"]
  node_node_design_ex["Design loops<br/>example workflow"]
  node_node_freq_ex["RAFT design<br/>example workflow"]
  node_node_modelcreation_ex["Model stages<br/>example workflow"]
end

node_node_main -->|"starts"| node_node_runweis
node_node_runweis -->|"orchestrates"| node_node_glue
node_node_glue -->|"validates"| node_node_inputs
node_node_glue -->|"parses"| node_node_loadinputs
node_node_glue -->|"dispatches"| node_node_runtools
node_node_glue -->|"prepares"| node_node_rose
node_node_runtools -->|"runs"| node_node_aero
node_node_runtools -->|"expands"| node_node_dlc
node_node_runtools -->|"configures"| node_node_control
node_node_runtools -->|"analyzes"| node_node_freq
node_node_runtools -->|"reduces"| node_node_ssfit
node_node_control -->|"feeds"| node_node_aero
node_node_dlc -->|"generates cases"| node_node_aero
node_node_freq -.->|"supports"| node_node_mf
node_node_aero -->|"returns responses"| node_node_mf
node_node_aero -->|"returns responses"| node_node_nsga
node_node_mf -->|"iterates"| node_node_glue
node_node_nsga -->|"iterates"| node_node_glue
node_node_viz -->|"inspects"| node_node_aero
node_node_viz -->|"inspects"| node_node_mf
node_node_examples -->|"demonstrates"| node_node_glue
node_node_dlc_ex -->|"shows"| node_node_dlc
node_node_design_ex -->|"shows"| node_node_control
node_node_freq_ex -->|"shows"| node_node_freq
node_node_modelcreation_ex -->|"shows"| node_node_glue

click node_node_main "https://github.com/nlrwindsystems/weis/blob/main/weis/main.py"
click node_node_runweis "https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/runWEIS.py"
click node_node_glue "https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/glue_code.py"
click node_node_inputs "https://github.com/nlrwindsystems/weis/tree/main/weis/inputs"
click node_node_loadinputs "https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/gc_LoadInputs.py"
click node_node_runtools "https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/gc_RunTools.py"
click node_node_rose "https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/gc_ROSCOInputs.py"
click node_node_aero "https://github.com/nlrwindsystems/weis/tree/main/weis/aeroelasticse"
click node_node_dlc "https://github.com/nlrwindsystems/weis/tree/main/weis/dlc_driver"
click node_node_control "https://github.com/nlrwindsystems/weis/tree/main/weis/control"
click node_node_freq "https://github.com/nlrwindsystems/weis/blob/main/weis/frequency/raft_wrapper.py"
click node_node_ssfit "https://github.com/nlrwindsystems/weis/tree/main/weis/ss_fitting"
click node_node_mf "https://github.com/nlrwindsystems/weis/tree/main/weis/multifidelity"
click node_node_nsga "https://github.com/nlrwindsystems/weis/tree/main/nsga2_weis"
click node_node_viz "https://github.com/nlrwindsystems/weis/tree/main/weis/visualization"
click node_node_examples "https://github.com/nlrwindsystems/weis/tree/main/examples"
click node_node_dlc_ex "https://github.com/nlrwindsystems/weis/tree/main/examples/02_generate_openfast_model_for_dlcs"
click node_node_design_ex "https://github.com/nlrwindsystems/weis/tree/main/examples/03_design_with_openfast"
click node_node_freq_ex "https://github.com/nlrwindsystems/weis/tree/main/examples/04_frequency_domain_analysis_design"
click node_node_modelcreation_ex "https://github.com/nlrwindsystems/weis/tree/main/examples/11_model_creation_process"

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_node_main,node_node_runweis,node_node_glue,node_node_inputs,node_node_loadinputs,node_node_runtools toneBlue
class node_node_rose,node_node_aero,node_node_dlc,node_node_control,node_node_freq,node_node_ssfit toneAmber
class node_node_mf,node_node_nsga toneMint
class node_node_viz toneRose
class node_node_examples,node_node_dlc_ex,node_node_design_ex,node_node_freq_ex,node_node_modelcreation_ex toneIndigo
```

## Components

### Core workflow

Input parsing, orchestration, and end-to-end runtime coordination.

- [WEIS entry](https://github.com/nlrwindsystems/weis/blob/main/weis/main.py): package entry · Top-level command and package entry point for WEIS runs. · `weis/main.py`
- [Run WEIS](https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/runWEIS.py): workflow driver · Primary runner that assembles the full co-design workflow. · `weis/glue_code/runWEIS.py`
- [Glue code](https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/glue_code.py): integration layer · Central workflow assembly for loading inputs, wiring tools, and dispatching analyses. · `weis/glue_code/glue_code.py`
- [Input schemas](https://github.com/nlrwindsystems/weis/tree/main/weis/inputs): schema layer · YAML schema definitions and validation for geometry, modeling, analysis, and OpenFAST inputs. · `weis/inputs`
- [Load inputs](https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/gc_LoadInputs.py): input parsing · Helpers for reading and normalizing user configuration into runtime structures. · `weis/glue_code/gc_LoadInputs.py`
- [Tool setup](https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/gc_RunTools.py): tool dispatch · Coordinates setup and execution of external solvers and shared runtime utilities. · `weis/glue_code/gc_RunTools.py`

### Analysis engines

Time-domain, frequency-domain, wind/load-case, and control subsystems.

- [ROSCO inputs](https://github.com/nlrwindsystems/weis/blob/main/weis/glue_code/gc_ROSCOInputs.py): controller bridge · Builds controller-specific inputs and tuning data for turbine simulations. · `weis/glue_code/gc_ROSCOInputs.py`
- [OpenFAST wrapper](https://github.com/nlrwindsystems/weis/tree/main/weis/aeroelasticse): time-domain simulation · OpenFAST execution, case generation, linearization, and batch wrappers. · `weis/aeroelasticse`
- [DLC driver](https://github.com/nlrwindsystems/weis/tree/main/weis/dlc_driver): load-case generator · Expands analysis requests into design load case jobs and wind/turbulence inputs. · `weis/dlc_driver`
- [Control](https://github.com/nlrwindsystems/weis/tree/main/weis/control): controller design · ROSCO tuning, linear models, MBC utilities, distributed control, and TMD support. · `weis/control`
- [Frequency analysis](https://github.com/nlrwindsystems/weis/blob/main/weis/frequency/raft_wrapper.py): raft wrapper · Frequency-domain floating-system analysis path built around RAFT-style modeling. · `weis/frequency/raft_wrapper.py`
- [State-space fit](https://github.com/nlrwindsystems/weis/tree/main/weis/ss_fitting): hydro reduction · State-space fitting and inverse-frequency tools for reduced hydrodynamic models. · `weis/ss_fitting`

### Optimization

Search methods and specialized optimization drivers.

- [Trust region](https://github.com/nlrwindsystems/weis/tree/main/weis/multifidelity): multifidelity optimization · Trust-region and multifidelity search methods used in design loops. · `weis/multifidelity`
- [NSGA-II](https://github.com/nlrwindsystems/weis/tree/main/nsga2_weis): multiobjective optimizer · Custom NSGA-II algorithm and OpenMDAO-oriented driver integration. · `nsga2_weis`

### Outputs

Visualization and downstream inspection tools.

- [Visualization](https://github.com/nlrwindsystems/weis/tree/main/weis/visualization): dash app · Interactive Dash app and plotting utilities for inputs, geometry, optimization, and outputs. · `weis/visualization`

### Examples

Workflow examples and reference setups.

- [Examples](https://github.com/nlrwindsystems/weis/tree/main/examples): workflow gallery · Reference workflows showing supported input-to-result pipelines. · `examples`
- [DLC runs](https://github.com/nlrwindsystems/weis/tree/main/examples/02_generate_openfast_model_for_dlcs): example workflow · Example pipeline for generating and simulating design load cases. · `examples/02_generate_openfast_model_for_dlcs`
- [Design loops](https://github.com/nlrwindsystems/weis/tree/main/examples/03_design_with_openfast): example workflow · Examples for coupled design with OpenFAST, controller tuning, and floating-system design. · `examples/03_design_with_openfast`
- [RAFT design](https://github.com/nlrwindsystems/weis/tree/main/examples/04_frequency_domain_analysis_design): example workflow · Examples for frequency-domain floating-system analysis and optimization. · `examples/04_frequency_domain_analysis_design`
- [Model stages](https://github.com/nlrwindsystems/weis/tree/main/examples/11_model_creation_process): example workflow · Staged model-building workflow covering aero-structural, controller, floating, and DLC setup. · `examples/11_model_creation_process`

## Connections

- WEIS entry → Run WEIS: starts · CLI/package entry launches the main workflow runner.
- Run WEIS → Glue code: orchestrates · The runner delegates to the central glue layer.
- Glue code → Input schemas: validates · Workflow begins with schema-backed input loading and validation.
- Glue code → Load inputs: parses · Glue code reads and normalizes user configuration.
- Glue code → Tool setup: dispatches · Glue code hands execution to subsystem/tool setup.
- Glue code → ROSCO inputs: prepares · Controller-related inputs are derived during workflow assembly.
- Tool setup → OpenFAST wrapper: runs · Simulation jobs are executed through the OpenFAST wrapper layer.
- Tool setup → DLC driver: expands · Load-case generation is used to create simulation batches.
- Tool setup → Control: configures · Controller tuning and model utilities support the runtime setup.
- Tool setup → Frequency analysis: analyzes · Frequency-domain analysis is invoked as an alternate analysis path.
- Tool setup → State-space fit: reduces · Hydrodynamic data can be reduced to state-space representations.
- Control → OpenFAST wrapper: feeds · Controller outputs are consumed by OpenFAST/ServoDyn inputs.
- DLC driver → OpenFAST wrapper: generates cases · DLC jobs flow into OpenFAST execution.
- Frequency analysis → Trust region: supports · Frequency-domain responses can participate in design optimization.
- OpenFAST wrapper → Trust region: returns responses · Simulation outputs provide objective and constraint data.
- OpenFAST wrapper → NSGA-II: returns responses · Time-domain results can drive multiobjective search.
- Trust region → Glue code: iterates · Multifidelity search updates the coupled design workflow.
- NSGA-II → Glue code: iterates · NSGA-II-based optimization loops back through the orchestration layer.
- Visualization → OpenFAST wrapper: inspects · Visualization consumes OpenFAST outputs and derived results.
- Visualization → Trust region: inspects · Visualization also reviews optimization histories and outputs.
- Examples → Glue code: demonstrates · Examples show how drivers invoke the workflow layer.
- DLC runs → DLC driver: shows · DLC examples demonstrate load-case expansion and execution.
- Design loops → Control: shows · Design examples demonstrate control-aware co-design.
- RAFT design → Frequency analysis: shows · Frequency-domain examples demonstrate RAFT-based design.
- Model stages → Glue code: shows · Staged model creation examples demonstrate the orchestration boundary.
