# gotm-model/code architecture

> Architecture diagram of the GitHub repository gotm-model/code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gotm-model/code
- Repository: https://github.com/gotm-model/code

## Overview

##### Main Components

a. Core Simulation Components:
- Mean Flow Module (/src/meanflow)
- Turbulence Module (/src/turbulence)
- Air-Sea Interface (/src/airsea)
- Observations Module (/src/observations)

b. Supporting Components:
- Input/Output System (/src/input)
- Utilities (/src/util)
- Configuration System (/src/config)
- External Dependencies (extern/)
- CVMix
- FABM (Framework for Aquatic Biogeochemical Models)
- GSW (Gibbs SeaWater)
- Flexout

**┌─────────────────────────────────────────────┐**
- Input Layer                 │
- (NetCDF, Configuration, Observations)    │
- ┤
- Core GOTM Engine              │
- ┬───────────────┬────────────┤
- Mean Flow    │  Turbulence   │  Air-Sea   │
- Processing   │  Modeling     │  Interface │
- ┴───────────────┴────────────┘

**┌─────────────────────────────────────────────┐**
- External Libraries               │
- (CVMix, FABM, GSW, Flexout)            │
- ┘

##### Specific Implementation Details

a. Physics Modules:
- Temperature equations
- Salinity calculations
- Pressure computations
- Coriolis effects
- Stokes drift

b. Turbulence Models:
- Various equation solvers (k-ε, k-ω, etc.)
- Algebraic length scales
- Dissipation equations

c. Integration Points:
- How external libraries integrate
- Data flow between components
- Configuration management

##### Implementation Notes

- Maintain consistent styling
- Clear labels
- Brief descriptions for each major component
- Both compile-time and runtime dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        Config["Configuration System"]:::config
        InputSys["Input/Output System"]:::io
        ObsMod["Observations Module"]:::obs
    end

    subgraph Core["Core GOTM Engine"]
        MeanFlow["Mean Flow Module"]:::core
        Turb["Turbulence Module"]:::core
        AirSea["Air-Sea Interface"]:::core
        Stokes["Stokes Drift"]:::core
    end

    subgraph Integration["Integration Layer"]
        FABM_Int["FABM Integration"]:::int
        CVMix_Int["CVMix Integration"]:::int
    end

    subgraph External["External Libraries"]
        CVMix["CVMix"]:::ext
        FABM["FABM"]:::ext
        GSW["GSW"]:::ext
        Flexout["Flexout"]:::ext
    end

    subgraph Utils["Utility Layer"]
        Utilities["Utilities"]:::util
    end

    %% Connections
    Config --> MeanFlow
    Config --> Turb
    Config --> AirSea
    InputSys --> MeanFlow
    InputSys --> Turb
    ObsMod --> MeanFlow
    
    MeanFlow --> Turb
    MeanFlow --> AirSea
    Turb --> AirSea
    Stokes --> MeanFlow
    
    MeanFlow --> FABM_Int
    Turb --> CVMix_Int
    
    FABM_Int --> FABM
    CVMix_Int --> CVMix
    
    MeanFlow --> GSW
    MeanFlow --> Flexout
    Turb --> Flexout
    
    Utilities --> MeanFlow
    Utilities --> Turb
    Utilities --> AirSea

    %% Click Events
    click MeanFlow "https://github.com/gotm-model/code/tree/master/src/meanflow/"
    click Turb "https://github.com/gotm-model/code/tree/master/src/turbulence/"
    click AirSea "https://github.com/gotm-model/code/tree/master/src/airsea/"
    click ObsMod "https://github.com/gotm-model/code/tree/master/src/observations/"
    click InputSys "https://github.com/gotm-model/code/tree/master/src/input/"
    click Config "https://github.com/gotm-model/code/tree/master/src/config/"
    click Utilities "https://github.com/gotm-model/code/tree/master/src/util/"
    click CVMix "https://github.com/gotm-model/code/tree/master/extern/CVMix-src/"
    click FABM "https://github.com/gotm-model/code/tree/master/extern/fabm/"
    click GSW "https://github.com/gotm-model/code/tree/master/extern/gsw/"
    click Flexout "https://github.com/gotm-model/code/tree/master/extern/flexout/"
    click Stokes "https://github.com/gotm-model/code/tree/master/src/stokes_drift/"
    click FABM_Int "https://github.com/gotm-model/code/tree/master/src/fabm/"
    click CVMix_Int "https://github.com/gotm-model/code/tree/master/src/cvmix/"

    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef config fill:#4CAF50,stroke:#2E7D32,color:white
    classDef io fill:#4CAF50,stroke:#2E7D32,color:white
    classDef obs fill:#4CAF50,stroke:#2E7D32,color:white
    classDef ext fill:#FF9800,stroke:#F57C00,color:white
    classDef int fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef util fill:#9C27B0,stroke:#7B1FA2,color:white

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Input Components"]:::io
        L3["External Libraries"]:::ext
        L4["Integration/Utility"]:::int
    end
```
