# noaa-gfdl/fms architecture

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

- Interactive diagram: https://gitdiagram.com/noaa-gfdl/fms
- Repository: https://github.com/noaa-gfdl/fms

## Overview

FMS is a climate-modeling framework and runtime library, not a single end-user application. Model developers use its common interfaces and infrastructure to construct and execute atmospheric, oceanic, and climate models; model output supports scientific interpretation. The README documents parallelization, I/O, grid exchange, time-step orchestration, diagnostics, and input preparation. The tree identifies corresponding subsystems, but most implementation excerpts were not provided, so internal links are limited to documented relationships and the sampled grid-intersection code.

Main entry points: [`fms/fms.F90`](https://github.com/noaa-gfdl/fms/blob/main/fms/fms.F90) (FMS runtime), [`horiz_interp/include/horiz_interp_conserve_xgrid.c`](https://github.com/noaa-gfdl/fms/blob/main/horiz_interp/include/horiz_interp_conserve_xgrid.c) (Exchange grids), [`coupler`](https://github.com/noaa-gfdl/fms/tree/main/coupler) (Model coupling), [`mpp/mpp.F90`](https://github.com/noaa-gfdl/fms/blob/main/mpp/mpp.F90) (MPP communication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Model runtime"]
  node_fms["FMS runtime<br/>[fms.F90]"]
  node_time["Time management"]
  node_coupler["Model coupling"]
end

subgraph group_parallel["Parallel computing"]
  node_mpp["MPP communication<br/>[mpp.F90]"]
  node_affinity["CPU affinity<br/>[affinity.c]"]
end

subgraph group_grids["Grids and exchange"]
  node_gridutils["Grid geometry<br/>[grid_utils.c]"]
  node_treenodes["Polygon utilities<br/>[tree_utils.c]"]
  node_gradient["Grid gradients<br/>[gradient_c2l.c]"]
  node_xgrid["Exchange grids"]
  node_hinterp["Horizontal interpolation<br/>[horiz_interp.F90]"]
end

subgraph group_data["Model data"]
  node_io["Model I/O<br/>[fms2_io.F90]"]
  node_fields["Field management<br/>[field_manager.F90]"]
  node_override["Input preparation<br/>[data_override.F90]"]
end

subgraph group_science["Scientific tools"]
  node_diagnostics["Diagnostics output<br/>[diag_manager.F90]"]
  node_drifters["Particle tracking<br/>[drifters.F90]"]
  node_parser["YAML parsing<br/>[yaml_parser.F90]"]
end

node_developer(("Model developer"))
node_model["Climate model"]
node_results["Model results"]
node_interpretation(("Scientific interpretation"))
node_netcdf["NetCDF libraries"]
node_mpi["MPI library"]

node_developer -->|"constructs"| node_model
node_model -->|"uses infrastructure"| node_fms
node_fms -->|"uses parallelization"| node_mpp
node_fms -->|"uses I/O"| node_io
node_fms -->|"orchestrates stepping"| node_time
node_model -->|"exchanges model data"| node_coupler
node_coupler -->|"uses grid exchange"| node_xgrid
node_xgrid -->|"calls geometry routines"| node_gridutils
node_xgrid -->|"uses polygon utilities"| node_treenodes
node_model -->|"uses interpolation"| node_hinterp
node_model -.->|"uses grid calculations"| node_gradient
node_model -->|"uses field interfaces"| node_fields
node_model -->|"uses prepared input"| node_override
node_model -->|"produces diagnostics"| node_diagnostics
node_model -.->|"tracks particles"| node_drifters
node_model -.->|"reads YAML configuration"| node_parser
node_io -->|"reads and writes"| node_netcdf
node_mpp -.->|"uses optionally"| node_mpi
node_model -->|"produces output"| node_results
node_results -->|"supports"| node_interpretation
node_model -.->|"may configure affinity"| node_affinity

click node_fms "https://github.com/noaa-gfdl/fms/blob/main/fms/fms.F90"
click node_time "https://github.com/noaa-gfdl/fms/tree/main/time_manager"
click node_coupler "https://github.com/noaa-gfdl/fms/tree/main/coupler"
click node_mpp "https://github.com/noaa-gfdl/fms/blob/main/mpp/mpp.F90"
click node_affinity "https://github.com/noaa-gfdl/fms/blob/main/affinity/affinity.c"
click node_gridutils "https://github.com/noaa-gfdl/fms/blob/main/grid_utils/grid_utils.c"
click node_treenodes "https://github.com/noaa-gfdl/fms/blob/main/grid_utils/tree_utils.c"
click node_gradient "https://github.com/noaa-gfdl/fms/blob/main/grid_utils/gradient_c2l.c"
click node_xgrid "https://github.com/noaa-gfdl/fms/blob/main/horiz_interp/include/horiz_interp_conserve_xgrid.c"
click node_hinterp "https://github.com/noaa-gfdl/fms/blob/main/horiz_interp/horiz_interp.F90"
click node_io "https://github.com/noaa-gfdl/fms/blob/main/fms2_io/fms2_io.F90"
click node_fields "https://github.com/noaa-gfdl/fms/blob/main/field_manager/field_manager.F90"
click node_override "https://github.com/noaa-gfdl/fms/blob/main/data_override/data_override.F90"
click node_diagnostics "https://github.com/noaa-gfdl/fms/blob/main/diag_manager/diag_manager.F90"
click node_drifters "https://github.com/noaa-gfdl/fms/blob/main/drifters/drifters.F90"
click node_parser "https://github.com/noaa-gfdl/fms/blob/main/parser/yaml_parser.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_fms,node_time,node_coupler toneBlue
class node_mpp,node_affinity toneAmber
class node_gridutils,node_treenodes,node_gradient,node_xgrid,node_hinterp toneMint
class node_io,node_fields,node_override toneRose
class node_diagnostics,node_drifters,node_parser,node_developer,node_model,node_results,node_interpretation,node_netcdf,node_mpi toneIndigo
```

## Components

### Model runtime

- [FMS runtime](https://github.com/noaa-gfdl/fms/blob/main/fms/fms.F90): `fms/fms.F90`
- [Time management](https://github.com/noaa-gfdl/fms/tree/main/time_manager): `time_manager`
- [Model coupling](https://github.com/noaa-gfdl/fms/tree/main/coupler): `coupler`

### Parallel computing

- [MPP communication](https://github.com/noaa-gfdl/fms/blob/main/mpp/mpp.F90): `mpp/mpp.F90`
- [CPU affinity](https://github.com/noaa-gfdl/fms/blob/main/affinity/affinity.c): `affinity/affinity.c`

### Grids and exchange

- [Grid geometry](https://github.com/noaa-gfdl/fms/blob/main/grid_utils/grid_utils.c): `grid_utils/grid_utils.c`
- [Polygon utilities](https://github.com/noaa-gfdl/fms/blob/main/grid_utils/tree_utils.c): `grid_utils/tree_utils.c`
- [Grid gradients](https://github.com/noaa-gfdl/fms/blob/main/grid_utils/gradient_c2l.c): `grid_utils/gradient_c2l.c`
- [Exchange grids](https://github.com/noaa-gfdl/fms/blob/main/horiz_interp/include/horiz_interp_conserve_xgrid.c): `horiz_interp/include/horiz_interp_conserve_xgrid.c`
- [Horizontal interpolation](https://github.com/noaa-gfdl/fms/blob/main/horiz_interp/horiz_interp.F90): `horiz_interp/horiz_interp.F90`

### Model data

- [Model I/O](https://github.com/noaa-gfdl/fms/blob/main/fms2_io/fms2_io.F90): `fms2_io/fms2_io.F90`
- [Field management](https://github.com/noaa-gfdl/fms/blob/main/field_manager/field_manager.F90): `field_manager/field_manager.F90`
- [Input preparation](https://github.com/noaa-gfdl/fms/blob/main/data_override/data_override.F90): `data_override/data_override.F90`

### Scientific tools

- [Diagnostics output](https://github.com/noaa-gfdl/fms/blob/main/diag_manager/diag_manager.F90): `diag_manager/diag_manager.F90`
- [Particle tracking](https://github.com/noaa-gfdl/fms/blob/main/drifters/drifters.F90): `drifters/drifters.F90`
- [YAML parsing](https://github.com/noaa-gfdl/fms/blob/main/parser/yaml_parser.F90): `parser/yaml_parser.F90`

### Other components

- **Model developer**
- **Climate model**
- **Model results**
- **Scientific interpretation**
- **NetCDF libraries**
- **MPI library**

## Connections

- Model developer → Climate model: constructs (evidence: `README.md`)
- Climate model → FMS runtime: uses infrastructure (evidence: `README.md`)
- FMS runtime → MPP communication: uses parallelization (evidence: `README.md`)
- FMS runtime → Model I/O: uses I/O (evidence: `README.md`)
- FMS runtime → Time management: orchestrates stepping (evidence: `README.md`)
- Climate model → Model coupling: exchanges model data (evidence: `README.md`)
- Model coupling → Exchange grids: uses grid exchange (evidence: `README.md`)
- Exchange grids → Grid geometry: calls geometry routines (evidence: `horiz_interp/include/horiz_interp_conserve_xgrid.c`)
- Exchange grids → Polygon utilities: uses polygon utilities (evidence: `horiz_interp/include/horiz_interp_conserve_xgrid.c`)
- Climate model → Horizontal interpolation: uses interpolation (evidence: `README.md`)
- Climate model → Grid gradients: uses grid calculations
- Climate model → Field management: uses field interfaces (evidence: `README.md`)
- Climate model → Input preparation: uses prepared input (evidence: `README.md`)
- Climate model → Diagnostics output: produces diagnostics (evidence: `README.md`)
- Climate model → Particle tracking: tracks particles
- Climate model → YAML parsing: reads YAML configuration
- Model I/O → NetCDF libraries: reads and writes (evidence: `README.md`)
- MPP communication → MPI library: uses optionally (evidence: `README.md`)
- Climate model → Model results: produces output (evidence: `README.md`)
- Model results → Scientific interpretation: supports (evidence: `README.md`)
- Climate model → CPU affinity: may configure affinity
