# kth-flowai/marl-drag-reduction-in-wall-bounded-flows architecture

> Architecture diagram of the GitHub repository kth-flowai/marl-drag-reduction-in-wall-bounded-flows, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows
- Repository: https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows

## Overview

This repository is a multi-agent reinforcement-learning benchmark for reducing drag in turbulent channel flow. Users configure and launch training or deterministic evaluation; the Python environment turns solver fields into agent observations and rewards, sends blowing/suction actions to the SIMSON solver, and training produces policies that evaluation can test. The README also documents configurable state/control setups and opposition control. Evaluation can use learned or scripted policies and record results. The graph follows the sampled CLI, runner, environment, and solver interactions; some evaluation and postprocessing details are documented or only partially sampled.

Main entry points: [`src/evaluate.py`](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/evaluate.py) (Evaluation runner), [`src/run.py`](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/run.py) (Training runner), [`src/simson_marl.py`](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/simson_marl.py) (Multi-agent environment), [`src/simson_MARL/__main__.py`](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/simson_MARL/__main__.py) (CLI dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command and configuration"]
  node_cli["CLI dispatcher<br/>[__main__.py]"]
  node_config["Run configuration<br/>[configuration.py]"]
end

subgraph group_learning["Learning and evaluation"]
  node_trainer["Training runner<br/>[run.py]"]
  node_evaluator["Evaluation runner<br/>[evaluate.py]"]
  node_model["RL model<br/>[run.py]"]
  node_wrappers["Vector wrappers<br/>[run.py]"]
end

subgraph group_environment["Environment and solver"]
  node_env["Multi-agent environment<br/>[simson_marl.py]"]
  node_inputwriter["Solver input writer<br/>[simsonutils3D.py]"]
  node_solver["SIMSON executable"]
  node_initial["Flow initial fields"]
end

subgraph group_results["Policies and results"]
  node_opposition["Opposition policy"]
  node_artifacts[("Saved models and runs")]
  node_postprocess["Statistics postprocessing"]
end

node_user(("Researcher"))
node_yaml["Experiment settings"]

node_user -->|"launches"| node_cli
node_yaml -->|"defines settings"| node_config
node_cli -->|"dispatches run"| node_trainer
node_cli -->|"dispatches evaluation"| node_evaluator
node_cli -->|"dispatches config"| node_config
node_trainer -->|"loads and overrides"| node_config
node_evaluator -->|"loads and overrides"| node_config
node_trainer -->|"writes solver input"| node_inputwriter
node_trainer -->|"creates environment"| node_env
node_trainer -->|"vectorizes environment"| node_wrappers
node_wrappers -->|"wraps environment"| node_env
node_trainer -->|"trains policy"| node_model
node_model -->|"saves checkpoints"| node_artifacts
node_evaluator -->|"writes solver input"| node_inputwriter
node_evaluator -->|"creates environment"| node_env
node_evaluator -->|"loads and evaluates"| node_model
node_evaluator -.->|"loads scripted policy"| node_opposition
node_evaluator -->|"records evaluation"| node_artifacts
node_env -->|"spawns and exchanges MPI data"| node_solver
node_env -->|"reads initial field"| node_initial
node_inputwriter -->|"reads plane settings"| node_yaml
node_artifacts -->|"provides run logs"| node_postprocess

click node_cli "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/simson_MARL/__main__.py"
click node_config "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/configuration.py"
click node_yaml "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/tree/master/conf"
click node_trainer "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/run.py"
click node_evaluator "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/evaluate.py"
click node_model "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/run.py"
click node_wrappers "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/run.py"
click node_env "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/simson_marl.py"
click node_inputwriter "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/simsonutils3D.py"
click node_solver "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/tree/master/bin"
click node_initial "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/tree/master/data/baseline"
click node_opposition "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/data/policy_opposition.py"
click node_artifacts "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/tree/master/runs"
click node_postprocess "https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/notebooks/postprocessingutils.py"

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_cli,node_config toneBlue
class node_trainer,node_evaluator,node_model,node_wrappers toneAmber
class node_env,node_inputwriter,node_solver,node_initial toneMint
class node_opposition,node_artifacts,node_postprocess toneRose
class node_user toneIndigo
class node_yaml toneTeal
```

## Components

### Command and configuration

- [CLI dispatcher](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/simson_MARL/__main__.py): `src/simson_MARL/__main__.py`
- [Run configuration](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/configuration.py): `src/configuration.py`

### Learning and evaluation

- [Training runner](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/run.py): `src/run.py`
- [Evaluation runner](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/evaluate.py): `src/evaluate.py`
- [RL model](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/run.py): `src/run.py`
- [Vector wrappers](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/run.py): `src/run.py`

### Environment and solver

- [Multi-agent environment](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/simson_marl.py): `src/simson_marl.py`
- [Solver input writer](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/src/simsonutils3D.py): `src/simsonutils3D.py`
- [SIMSON executable](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/tree/master/bin): `bin`
- [Flow initial fields](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/tree/master/data/baseline): `data/baseline`

### Policies and results

- [Opposition policy](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/data/policy_opposition.py): `data/policy_opposition.py`
- [Saved models and runs](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/tree/master/runs): `runs`
- [Statistics postprocessing](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/blob/master/notebooks/postprocessingutils.py): `notebooks/postprocessingutils.py`

### Other components

- **Researcher**
- [Experiment settings](https://github.com/kth-flowai/marl-drag-reduction-in-wall-bounded-flows/tree/master/conf): `conf`

## Connections

- Researcher → CLI dispatcher: launches
- Experiment settings → Run configuration: defines settings
- CLI dispatcher → Training runner: dispatches run
- CLI dispatcher → Evaluation runner: dispatches evaluation
- CLI dispatcher → Run configuration: dispatches config
- Training runner → Run configuration: loads and overrides
- Evaluation runner → Run configuration: loads and overrides
- Training runner → Solver input writer: writes solver input
- Training runner → Multi-agent environment: creates environment
- Training runner → Vector wrappers: vectorizes environment
- Vector wrappers → Multi-agent environment: wraps environment
- Training runner → RL model: trains policy
- RL model → Saved models and runs: saves checkpoints
- Evaluation runner → Solver input writer: writes solver input
- Evaluation runner → Multi-agent environment: creates environment
- Evaluation runner → RL model: loads and evaluates
- Evaluation runner → Opposition policy: loads scripted policy
- Evaluation runner → Saved models and runs: records evaluation
- Multi-agent environment → SIMSON executable: spawns and exchanges MPI data
- Multi-agent environment → Flow initial fields: reads initial field
- Solver input writer → Experiment settings: reads plane settings
- Saved models and runs → Statistics postprocessing: provides run logs
