Skip to content

CliMA/RRTMGP.jl

Repository files navigation

RRTMGP.jl Logo

RRTMGP.jl

The RRTMGP.jl package is a Julia implementation of the radiative transfer solver RTE (Radiative Transfer for Energetics) and the RRTMGP (RRTM for General circulation model applications—Parallel) correlated-k gas optics (Pincus et al., 2019), based on the reference Fortran implementation rte-rrtmgp. It computes longwave and shortwave radiative fluxes and heating rates for clear, cloudy, and aerosol-laden atmospheres, and is the radiation scheme of the CliMA Earth System Model.

Documentation stable dev
Version version
License license
Tests gha ci buildkite
Code Coverage codecov
Downloads Downloads

Quick Start

Installation

using Pkg
Pkg.add("RRTMGP")

Basic Usage

The standalone front door provides a quick start. A gray (single-band) atmosphere uses analytic formulas:

using RRTMGP

out = RRTMGP.solve_gray(Float64; nlay = 60, ncol = 1)
out.net          # net flux at each level [W/m²]
out.heating_rate # radiative heating rate at each layer [K/s]

For the full correlated-k gas optics, build an idealized clear-sky profile and solve it (the lookup tables are downloaded automatically; loading NCDatasets activates them):

using RRTMGP, NCDatasets

profile = RRTMGP.standard_atmosphere(Float64; kind = :tropical)
out = RRTMGP.solve(profile)
out.lw_up[end, 1]   # outgoing longwave radiation at the top of the atmosphere [W/m²]
out.heating_rate    # radiative heating rate at each layer [K/s]

Host-Model Usage

Climate models construct an RRTMGPSolver once, write their state through the getter contract, and call update_fluxes!(solver) every radiation step:

solver = RRTMGP.RRTMGPSolver(grid_params, method, params, bcs_lw, bcs_sw, as)
RRTMGP.update_fluxes!(solver)          # allocation-free, in place
F = RRTMGP.net_flux(solver)            # (nlev, ncol) view into solver memory

Key Features

  • Full RRTMGP gas optics: longwave and shortwave correlated-k lookup tables, clouds (with McICA sampling of partial cloudiness), and MERRA aerosols, validated against the Fortran rte-rrtmgp reference fluxes.
  • Gray radiation: analytic single-band optics for idealized-climate and teaching use.
  • Two-stream and no-scattering solvers for both bands, with optional per-band (spectrally resolved) flux output.
  • CPU and GPU: the same code runs single-threaded, multi-threaded, and on CUDA GPUs via ClimaComms.
  • Zero-allocation driver: update_fluxes! is allocation-free and type-stable (asserted in CI with @allocated and JET), allowing it to run fast within a climate simulation.
  • Dual precision: Float32 and Float64 throughout, with high accuracy (~ 1e-3 W/m²) at Float32 and an accuracy-ratchet test pinning the Float32Float64 flux differences.

Design

RRTMGP.jl is organized in three layers:

  1. Functional core: solve_lw! / solve_sw! kernels acting on explicit state (AtmosphericState, optics, sources, boundary conditions, flux workspaces). See the Functional core page.
  2. Solver aggregate: RRTMGPSolver bundles the configuration, state, and workspaces; hosts exchange data through documented getters and drive it with update_fluxes!.
  3. Standalone front door: solve_gray(FT), standard_atmosphere(FT), and solve(profile) for classroom use, single-column experiments, and quick starts.

Readers coming from the Fortran implementation can use the Fortran and paper concordance to map names between the two code bases and the underlying papers.

Documentation

Integration with Climate Models

RRTMGP.jl provides radiative fluxes and heating rates for the CliMA ecosystem, including:

Getting Help

For questions, check the documentation or open an issue on GitHub.

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. The repo's AGENTS.md is a starting point for AI agents with repo-specific guidance.

Acknowledgments

  • Robert Pincus for his invaluable help.
  • Robert Pincus, Eli Mlawer, and Jennifer Delamere, the developers of RTE+RRTMGP and its reference Fortran implementation, on which this code is based.

About

Fast, GPU-ready atmospheric radiative transfer in Julia: the RTE solver with RRTMGP correlated-k gas optics.

Topics

Resources

License

Apache-2.0, BSD-3-Clause licenses found

Licenses found

Apache-2.0
LICENSE
BSD-3-Clause
LICENSE_original

Stars

64 stars

Watchers

4 watching

Forks

Packages

 
 
 

Contributors

Languages