# immm-sfa/wm architecture

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

- Interactive diagram: https://gitdiagram.com/immm-sfa/wm
- Repository: https://github.com/immm-sfa/wm

## Overview

WM is a spatially distributed water-management model coupled to MOSART river routing. Its documented workflow represents withdrawals and reservoir operations, calibrates reservoir releases from long-term inflow, demand, and goals, then adjusts releases for annual variability and daily constraints. The README establishes these capabilities and the WM–MOSART coupling, but no source excerpts were provided; internal call relationships and the role of the listed input data therefore cannot be verified.

Main entry points: [`MOSART_WM2013/MOSART_subw_WRM.F90`](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90) (Reservoir operations), [`MOSART_WM2013/WRM_start_op_year.F90`](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/WRM_start_op_year.F90) (Annual release updates), [`MOSART_WM2013/MOSART_physics_mod.F90`](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_physics_mod.F90) (MOSART routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_management["Water management"]
  node_withdrawals["Water withdrawals"]
  node_reservoirs["Reservoir operations"]
  node_release_calibration["Release calibration"]
  node_annual_updates["Annual release updates"]
  node_daily_constraints["Daily constraints"]
end

subgraph group_routing["River routing"]
  node_mosart_routing["MOSART routing"]
end

subgraph group_support["Model support"]
  node_water_types["Water model types"]
end

node_reservoirs -->|"calibrates releases"| node_release_calibration
node_reservoirs -->|"updates annually"| node_annual_updates
node_reservoirs -->|"applies constraints"| node_daily_constraints
node_reservoirs -->|"couples with routing"| node_mosart_routing

click node_withdrawals "https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90"
click node_reservoirs "https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90"
click node_release_calibration "https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90"
click node_annual_updates "https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/WRM_start_op_year.F90"
click node_daily_constraints "https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90"
click node_mosart_routing "https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_physics_mod.F90"
click node_water_types "https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_type_mod.F90"

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_withdrawals,node_reservoirs,node_release_calibration,node_annual_updates,node_daily_constraints toneBlue
class node_mosart_routing toneAmber
class node_water_types toneMint
```

## Components

### Water management

- [Water withdrawals](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90): `MOSART_WM2013/MOSART_subw_WRM.F90`
- [Reservoir operations](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90): `MOSART_WM2013/MOSART_subw_WRM.F90`
- [Release calibration](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90): `MOSART_WM2013/MOSART_subw_WRM.F90`
- [Annual release updates](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/WRM_start_op_year.F90): `MOSART_WM2013/WRM_start_op_year.F90`
- [Daily constraints](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_subw_WRM.F90): `MOSART_WM2013/MOSART_subw_WRM.F90`

### River routing

- [MOSART routing](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_physics_mod.F90): `MOSART_WM2013/MOSART_physics_mod.F90`

### Model support

- [Water model types](https://github.com/immm-sfa/wm/blob/master/MOSART_WM2013/MOSART_type_mod.F90): `MOSART_WM2013/MOSART_type_mod.F90`

## Connections

- Reservoir operations → Release calibration: calibrates releases (evidence: `README.md`)
- Reservoir operations → Annual release updates: updates annually (evidence: `README.md`)
- Reservoir operations → Daily constraints: applies constraints (evidence: `README.md`)
- Reservoir operations → MOSART routing: couples with routing (evidence: `README.md`)
