CliMA/SurfaceFluxes.jl

GPU-capable surface fluxes between atmosphere, ocean, and land via Monin-Obukhov Similarity Theory

21

stars

352

commits

Julia

primary language

Sep 1, 2026

updated

clima.github.io/SurfaceFluxes.jl/stable/
atmosphere
automatic-differentiation
boundary-layer
climate-modeling
gpu
julia
monin-obukhov
ocean
surface-fluxes
turbulence

README

SurfaceFluxes.jl Logo

SurfaceFluxes.jl

A package for computing surface fluxes between the atmosphere, ocean, and land using Monin-Obukhov Similarity Theory (MOST).

SurfaceFluxes.jl provides robust, efficient methods for calculating turbulent surface fluxes of momentum, heat, and moisture. It supports GPU broadcasting, automatic differentiation, and multiple universal function parameterizations (Businger, Gryanik, Grachev), making it ideal for high-performance climate modeling.

Documentationstable dev
Versionversion
Licenselicense
Testsgha ci buildkite
Code Coveragecodecov
DownloadsDownloads

Features

  • Monin-Obukhov Similarity Theory: Robust iterative solver for stability-dependent surface fluxes
  • Universal Function Parameterizations: Businger et al. (1971), Gryanik et al. (2020), and Grachev et al. (2007) formulations
  • GPU Support: Full GPU acceleration with CUDA.jl and other GPU array types
  • Land and Ocean Parameterizations: Support for parameterizations for land and ocean surfaces, including roughness lengths that depend on wind speed (ocean) and vegetation characteristics (land)
  • Dynamic Skin States: Supports dynamic calculations of skin temperatures and humidities via user-supplied functions
  • Finite-Difference and Finite-Volume Schemes: Supports both finite-difference (point-wise) and finite-volume (layer-averaged) formulations following Nishizawa & Kitamura (2018)
  • AD Compatible: Works with automatic differentiation frameworks for integration into differentiable models

Quick Example

using SurfaceFluxes
import SurfaceFluxes.Parameters as SFP
import SurfaceFluxes.UniversalFunctions as UF
import ClimaParams

# Create parameters
FT = Float64
param_set = SFP.SurfaceFluxesParameters(FT, UF.BusingerParams)

# Compute surface fluxes
result = surface_fluxes(
    param_set,
    T_int,           # Interior temperature [K]
    q_tot,           # Interior total specific humidity [kg/kg]
    q_liq,           # Interior liquid specific humidity [kg/kg]
    q_ice,           # Interior ice specific humidity [kg/kg]
    ρ_int,           # Interior density [kg/m³]
    T_sfc,           # Surface temperature [K]
    q_sfc,           # Surface specific humidity [kg/kg]
    Φ_sfc,           # Surface geopotential [m²/s²]
    Δz,              # Height above surface [m]
    d,               # Displacement height [m]
    u_int,           # Interior wind (u, v) [m/s]
    u_sfc,           # Surface wind (u, v) [m/s]
)

# Access results
result.shf      # Sensible heat flux [W/m²]
result.lhf      # Latent heat flux [W/m²]
result.evaporation  # Evaporation rate [kg/(m²·s)]
result.ustar    # Friction velocity [m/s]
result.ρτxz     # Momentum flux, x-component [N/m²]
result.ρτyz     # Momentum flux, y-component [N/m²]
result.Cd       # Drag coefficient [-]
result.g_h      # Heat conductance Ch * U_eff [m/s]
result.T_sfc    # Surface temperature [K] (final)
result.q_vap_sfc # Surface vapor specific humidity [kg/kg] (final)
result.L_MO     # Monin-Obukhov length [m]
result.converged # Solver convergence status

Documentation

The full documentation, including the mathematical formulation of MOST, the universal function parameterizations, and the API reference, is available at the stable docs.

Contributing

Contributors should follow the shared CliMA engineering standards in docs/dev-guides/, which cover architecture, performance, code quality, documentation, and workflows. These are vendored from CliMA/DeveloperGuides and synced automatically each month. The repo's AGENTS.md is a starting point for AI agents with repo-specific guidance.

Contributors

bors[bot]

79 commits

akshaysridhar

68 commits

szy21

34 commits

CliMA/SurfaceFluxes.jl

GPU-capable surface fluxes between atmosphere, ocean, and land via Monin-Obukhov Similarity Theory

21

stars

352

commits

Julia

primary language

Sep 1, 2026

updated

clima.github.io/SurfaceFluxes.jl/stable/
atmosphere
automatic-differentiation
boundary-layer
climate-modeling
gpu
julia
monin-obukhov
ocean
surface-fluxes
turbulence

README

SurfaceFluxes.jl Logo

SurfaceFluxes.jl

A package for computing surface fluxes between the atmosphere, ocean, and land using Monin-Obukhov Similarity Theory (MOST).

SurfaceFluxes.jl provides robust, efficient methods for calculating turbulent surface fluxes of momentum, heat, and moisture. It supports GPU broadcasting, automatic differentiation, and multiple universal function parameterizations (Businger, Gryanik, Grachev), making it ideal for high-performance climate modeling.

Documentationstable dev
Versionversion
Licenselicense
Testsgha ci buildkite
Code Coveragecodecov
DownloadsDownloads

Features

  • Monin-Obukhov Similarity Theory: Robust iterative solver for stability-dependent surface fluxes
  • Universal Function Parameterizations: Businger et al. (1971), Gryanik et al. (2020), and Grachev et al. (2007) formulations
  • GPU Support: Full GPU acceleration with CUDA.jl and other GPU array types
  • Land and Ocean Parameterizations: Support for parameterizations for land and ocean surfaces, including roughness lengths that depend on wind speed (ocean) and vegetation characteristics (land)
  • Dynamic Skin States: Supports dynamic calculations of skin temperatures and humidities via user-supplied functions
  • Finite-Difference and Finite-Volume Schemes: Supports both finite-difference (point-wise) and finite-volume (layer-averaged) formulations following Nishizawa & Kitamura (2018)
  • AD Compatible: Works with automatic differentiation frameworks for integration into differentiable models

Quick Example

using SurfaceFluxes
import SurfaceFluxes.Parameters as SFP
import SurfaceFluxes.UniversalFunctions as UF
import ClimaParams

# Create parameters
FT = Float64
param_set = SFP.SurfaceFluxesParameters(FT, UF.BusingerParams)

# Compute surface fluxes
result = surface_fluxes(
    param_set,
    T_int,           # Interior temperature [K]
    q_tot,           # Interior total specific humidity [kg/kg]
    q_liq,           # Interior liquid specific humidity [kg/kg]
    q_ice,           # Interior ice specific humidity [kg/kg]
    ρ_int,           # Interior density [kg/m³]
    T_sfc,           # Surface temperature [K]
    q_sfc,           # Surface specific humidity [kg/kg]
    Φ_sfc,           # Surface geopotential [m²/s²]
    Δz,              # Height above surface [m]
    d,               # Displacement height [m]
    u_int,           # Interior wind (u, v) [m/s]
    u_sfc,           # Surface wind (u, v) [m/s]
)

# Access results
result.shf      # Sensible heat flux [W/m²]
result.lhf      # Latent heat flux [W/m²]
result.evaporation  # Evaporation rate [kg/(m²·s)]
result.ustar    # Friction velocity [m/s]
result.ρτxz     # Momentum flux, x-component [N/m²]
result.ρτyz     # Momentum flux, y-component [N/m²]
result.Cd       # Drag coefficient [-]
result.g_h      # Heat conductance Ch * U_eff [m/s]
result.T_sfc    # Surface temperature [K] (final)
result.q_vap_sfc # Surface vapor specific humidity [kg/kg] (final)
result.L_MO     # Monin-Obukhov length [m]
result.converged # Solver convergence status

Documentation

The full documentation, including the mathematical formulation of MOST, the universal function parameterizations, and the API reference, is available at the stable docs.

Contributing

Contributors should follow the shared CliMA engineering standards in docs/dev-guides/, which cover architecture, performance, code quality, documentation, and workflows. These are vendored from CliMA/DeveloperGuides and synced automatically each month. The repo's AGENTS.md is a starting point for AI agents with repo-specific guidance.

Contributors

bors[bot]

79 commits

akshaysridhar

68 commits

szy21

34 commits

Languages

Julia

100.0%