# ncar/wrf_hydro_nwm_public architecture

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

- Interactive diagram: https://gitdiagram.com/ncar/wrf_hydro_nwm_public
- Repository: https://github.com/ncar/wrf_hydro_nwm_public

## Overview

##### Main Components Identification
The system should be divided into these major components:

a. Land Surface Models
- Noah Land Surface Model
- NoahMP Land Surface Model
- Each with their own physics, I/O, and utility components

b. Routing System
- Overland routing
- Subsurface routing
- Channel routing
- Reservoir routing

c. Coupling Interfaces
- WRF coupling
- CLM coupling
- NUOPC coupling
- LIS coupling

d. Core Infrastructure
- MPP (Massively Parallel Processing) layer
- I/O system
- Data structures
- Orchestrator layer

**[Land Surface Models] ←→ [Orchestrator Layer] ←→ [Routing System]**
- ↑                        ↑                      ↑

- ↓                        ↓                      ↓
- [Physics Engine]        [Data Structures]     [Routing Modules]

- ↓                        ↓                      ↓
**[External Coupling] ←→ [MPP Layer/I/O System] ←→ [Output Processing]**

##### Key Details

a. Land Surface Models:
- Noah and NoahMP as parallel options
- Physics modules and forcing data inputs

b. Routing Components:
- Different routing types (overland, subsurface, channel)
- Reservoir management system
- Nudging capabilities

c. Infrastructure:
- Demonstrate parallel processing capabilities
- I/O system interaction with NetCDF
- Configuration management

##### External Interfaces
- Coupling points with external models (WRF, CLM, etc.)
- Data exchange formats
- Initialization points

##### Data Flow
- Input data paths
- Output generation routes
- Feedback loops

##### Notes
- Version information
- Performance-critical paths
- Optional components
- Configuration dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph LSM["Land Surface Models"]
        Noah["Noah LSM"]:::lsm
        NoahMP["NoahMP LSM"]:::lsm
        PhysicsEngine["Physics Engine"]:::physics
    end

    subgraph Core["Core Infrastructure"]
        Orchestrator["Orchestrator Layer"]:::infra
        MPP["MPP Layer"]:::infra
        IO["I/O System"]:::infra
        DataStruct["Data Structures"]:::infra
    end

    subgraph Routing["Routing System"]
        OverlandRoute["Overland Routing"]:::routing
        SubsurfaceRoute["Subsurface Routing"]:::routing
        ChannelRoute["Channel Routing"]:::routing
        ReservoirRoute["Reservoir Routing"]:::routing
    end

    subgraph Coupling["Coupling Interfaces"]
        WRF["WRF Coupling"]:::coupling
        CLM["CLM Coupling"]:::coupling
        NUOPC["NUOPC Coupling"]:::coupling
        LIS["LIS Coupling"]:::coupling
    end

    MainDriver["Main Driver"]:::driver

    %% Connections
    Noah --> PhysicsEngine
    NoahMP --> PhysicsEngine
    PhysicsEngine --> Orchestrator
    
    Orchestrator --> MPP
    Orchestrator --> IO
    Orchestrator --> DataStruct
    
    MPP --> MainDriver
    IO --> MainDriver
    DataStruct --> MainDriver
    
    MainDriver --> OverlandRoute
    MainDriver --> SubsurfaceRoute
    MainDriver --> ChannelRoute
    MainDriver --> ReservoirRoute
    
    Orchestrator -.-> WRF
    Orchestrator -.-> CLM
    Orchestrator -.-> NUOPC
    Orchestrator -.-> LIS

    %% Styles
    classDef lsm fill:#3498db
    classDef physics fill:#2ecc71
    classDef infra fill:#95a5a6
    classDef routing fill:#e74c3c
    classDef coupling fill:#f1c40f
    classDef driver fill:#9b59b6

    %% Click Events
    click Noah "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/Land_models/Noah/"
    click NoahMP "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/Land_models/NoahMP/"
    click OverlandRoute "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/Routing/Overland/"
    click SubsurfaceRoute "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/Routing/Subsurface/"
    click ReservoirRoute "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/Routing/Reservoirs/"
    click ChannelRoute "https://github.com/NCAR/wrf_hydro_nwm_public/blob/main/src/Routing/module_channel_routing.F90"
    click WRF "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/CPL/WRF_cpl/"
    click CLM "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/CPL/CLM_cpl/"
    click NUOPC "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/CPL/NUOPC_cpl/"
    click LIS "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/CPL/LIS_cpl/"
    click MPP "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/MPP/"
    click IO "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/IO/"
    click DataStruct "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/Data_Rec/"
    click Orchestrator "https://github.com/NCAR/wrf_hydro_nwm_public/tree/main/src/OrchestratorLayer/"
    click MainDriver "https://github.com/NCAR/wrf_hydro_nwm_public/blob/main/src/HYDRO_drv/module_HYDRO_drv.F90"
```
