# doi-usgs/coawst architecture

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

- Interactive diagram: https://gitdiagram.com/doi-usgs/coawst
- Repository: https://github.com/doi-usgs/coawst

## Overview

COAWST is a coupled coastal modeling system built around ROMS, with atmospheric and wave-model components and supporting preprocessing tools. The principal workflow is to configure a simulation, initialize its component models, exchange fields through a coupling layer, and compute coupled ocean–atmosphere–wave behavior. ROMS also contains nonlinear, tangent-linear, adjoint, and representer model stages. The README documents the component set and selected coupling capabilities; sampled source confirms parts of the ROMS and coupling implementation, but not the full runtime wiring, so uncertain links are omitted or dashed.

Main entry points: [`Master/cmeps_roms.h`](https://github.com/doi-usgs/coawst/blob/main/Master/cmeps_roms.h) (CMEPS ROMS cap), [`WPS`](https://github.com/doi-usgs/coawst/tree/main/WPS) (WPS preprocessing), [`ROMS/Nonlinear/step2d_LF_AM3.h`](https://github.com/doi-usgs/coawst/blob/main/ROMS/Nonlinear/step2d_LF_AM3.h) (Nonlinear dynamics), [`ROMS/Include/cppdefs.h`](https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/cppdefs.h) (ROMS configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Configuration and preprocessing"]
  node_wps["WPS preprocessing"]
end

subgraph group_coupling["Coupling and drivers"]
  node_coawst_coupler["CMEPS ROMS cap<br/>[cmeps_roms.h]"]
  node_wrf["WRF atmosphere"]
end

subgraph group_roms["ROMS ocean model"]
  node_roms_config["ROMS configuration<br/>[cppdefs.h]"]
  node_roms_globals["Grid and shared state<br/>[globaldefs.h]"]
  node_roms_bounds["Tile bounds<br/>[set_bounds.h]"]
  node_roms_tile["Tile execution<br/>[tile.h]"]
  node_roms_nonlinear["Nonlinear dynamics<br/>[step2d_LF_AM3.h]"]
  node_roms_tangent["Tangent model<br/>[tl_step2d_LF_AM3.h]"]
  node_roms_adjoint["Adjoint model<br/>[ad_uv3dmix4_geo.h]"]
  node_roms_representer["Representer model<br/>[rp_step2d_LF_AM3.h]"]
  node_roms_functionals["Analytic inputs"]
end

subgraph group_waves["Wave models"]
  node_swan["SWAN waves"]
  node_ww3["WW3 waves"]
  node_inwave["InWave<br/>[inwave.h]"]
end

node_user(("Model user"))
node_simulation(("Coupled simulation"))

node_user -.->|"prepares inputs"| node_wps
node_wps -.->|"supplies fields"| node_coawst_coupler
node_user -.->|"configures run"| node_coawst_coupler
node_coawst_coupler -.->|"couples ROMS"| node_roms_nonlinear
node_coawst_coupler -.->|"couples atmosphere"| node_wrf
node_coawst_coupler -.->|"couples waves"| node_swan
node_coawst_coupler -.->|"couples waves"| node_ww3
node_coawst_coupler -.->|"couples waves"| node_inwave
node_roms_config -->|"selects options"| node_roms_globals
node_roms_nonlinear -.->|"computes dynamics"| node_simulation
node_roms_tangent -.->|"computes sensitivities"| node_simulation
node_roms_adjoint -.->|"computes adjoints"| node_simulation
node_roms_representer -.->|"computes representer"| node_simulation
node_coawst_coupler -.->|"coordinates run"| node_simulation

click node_wps "https://github.com/doi-usgs/coawst/tree/main/WPS"
click node_roms_config "https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/cppdefs.h"
click node_roms_globals "https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/globaldefs.h"
click node_roms_bounds "https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/set_bounds.h"
click node_roms_tile "https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/tile.h"
click node_roms_nonlinear "https://github.com/doi-usgs/coawst/blob/main/ROMS/Nonlinear/step2d_LF_AM3.h"
click node_roms_tangent "https://github.com/doi-usgs/coawst/blob/main/ROMS/Tangent/tl_step2d_LF_AM3.h"
click node_roms_adjoint "https://github.com/doi-usgs/coawst/blob/main/ROMS/Adjoint/ad_uv3dmix4_geo.h"
click node_roms_representer "https://github.com/doi-usgs/coawst/blob/main/ROMS/Representer/rp_step2d_LF_AM3.h"
click node_roms_functionals "https://github.com/doi-usgs/coawst/tree/main/ROMS/Functionals"
click node_coawst_coupler "https://github.com/doi-usgs/coawst/blob/main/Master/cmeps_roms.h"
click node_wrf "https://github.com/doi-usgs/coawst/tree/main/WRF"
click node_swan "https://github.com/doi-usgs/coawst/tree/main/SWAN/src"
click node_ww3 "https://github.com/doi-usgs/coawst/tree/main/WW3/model/src"
click node_inwave "https://github.com/doi-usgs/coawst/blob/main/InWave/Include/inwave.h"

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_wps,node_user toneBlue
class node_coawst_coupler,node_wrf toneAmber
class node_roms_config,node_roms_globals,node_roms_bounds,node_roms_tile,node_roms_nonlinear,node_roms_tangent,node_roms_adjoint,node_roms_representer,node_roms_functionals toneMint
class node_swan,node_ww3,node_inwave toneRose
class node_simulation toneIndigo
```

## Components

### Configuration and preprocessing

- [WPS preprocessing](https://github.com/doi-usgs/coawst/tree/main/WPS): `WPS`

### Coupling and drivers

- [CMEPS ROMS cap](https://github.com/doi-usgs/coawst/blob/main/Master/cmeps_roms.h): `Master/cmeps_roms.h`
- [WRF atmosphere](https://github.com/doi-usgs/coawst/tree/main/WRF): `WRF`

### ROMS ocean model

- [ROMS configuration](https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/cppdefs.h): `ROMS/Include/cppdefs.h`
- [Grid and shared state](https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/globaldefs.h): `ROMS/Include/globaldefs.h`
- [Tile bounds](https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/set_bounds.h): `ROMS/Include/set_bounds.h`
- [Tile execution](https://github.com/doi-usgs/coawst/blob/main/ROMS/Include/tile.h): `ROMS/Include/tile.h`
- [Nonlinear dynamics](https://github.com/doi-usgs/coawst/blob/main/ROMS/Nonlinear/step2d_LF_AM3.h): `ROMS/Nonlinear/step2d_LF_AM3.h`
- [Tangent model](https://github.com/doi-usgs/coawst/blob/main/ROMS/Tangent/tl_step2d_LF_AM3.h): `ROMS/Tangent/tl_step2d_LF_AM3.h`
- [Adjoint model](https://github.com/doi-usgs/coawst/blob/main/ROMS/Adjoint/ad_uv3dmix4_geo.h): `ROMS/Adjoint/ad_uv3dmix4_geo.h`
- [Representer model](https://github.com/doi-usgs/coawst/blob/main/ROMS/Representer/rp_step2d_LF_AM3.h): `ROMS/Representer/rp_step2d_LF_AM3.h`
- [Analytic inputs](https://github.com/doi-usgs/coawst/tree/main/ROMS/Functionals): `ROMS/Functionals`

### Wave models

- [SWAN waves](https://github.com/doi-usgs/coawst/tree/main/SWAN/src): `SWAN/src`
- [WW3 waves](https://github.com/doi-usgs/coawst/tree/main/WW3/model/src): `WW3/model/src`
- [InWave](https://github.com/doi-usgs/coawst/blob/main/InWave/Include/inwave.h): `InWave/Include/inwave.h`

### Other components

- **Model user**
- **Coupled simulation**

## Connections

- Model user → WPS preprocessing: prepares inputs
- WPS preprocessing → CMEPS ROMS cap: supplies fields
- Model user → CMEPS ROMS cap: configures run
- CMEPS ROMS cap → Nonlinear dynamics: couples ROMS
- CMEPS ROMS cap → WRF atmosphere: couples atmosphere
- CMEPS ROMS cap → SWAN waves: couples waves
- CMEPS ROMS cap → WW3 waves: couples waves
- CMEPS ROMS cap → InWave: couples waves
- ROMS configuration → Grid and shared state: selects options (evidence: `ROMS/Include/cppdefs.h`)
- Nonlinear dynamics → Coupled simulation: computes dynamics
- Tangent model → Coupled simulation: computes sensitivities
- Adjoint model → Coupled simulation: computes adjoints
- Representer model → Coupled simulation: computes representer
- CMEPS ROMS cap → Coupled simulation: coordinates run
