Skip to content

Commit

Permalink
Revise license, much documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertPincus committed Feb 19, 2025
1 parent 0c51fa2 commit ff5598e
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 93 deletions.
4 changes: 3 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
BSD 3-Clause License

Copyright (c) 2015-2018, Atmospheric and Environmental Research and Regents of the University of Colorado.
Copyright (c) 2015-2025, Atmospheric and Environmental Research,
Regents of the University of Colorado,
Trustees of Columbia University in the City of New York.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion doc/ford_site/rrtmgp-kernels.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ github: https://github.com/earth-system-radiation/
license: by
title: RRTMGP kernels
src_dir: ../../rrtmgp-kernels
exclude_dir: ../../rrtmgp-kernels/accel
exclude_dir: ../../rrtmgp-kernels/accel ../../rrtmgp-kernels/api
output_dir: ../../public/reference/rrtmgp-kernels
---

Expand Down
2 changes: 1 addition & 1 deletion doc/ford_site/rte-kernels.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ github: https://github.com/earth-system-radiation/
license: by
title: RTE kernels
src_dir: ../../rte-kernels
exclude_dir: ../../rte-kernels/accel
exclude_dir: ../../rte-kernels/accel ../../rte-kernels/api
output_dir: ../../public/reference/rte-kernels
---

Expand Down
12 changes: 7 additions & 5 deletions doc/jekyll_site/explanations/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
layout: page
title: Explanations
title: RTE+RRTMGP - Explanations
---

# Explanations will live here
# RTE and RRTMGP

### Spectral discretization
RTE+RRTMGP is a set of codes for computing radiative fluxes in planetary atmospheres. These pages provide a orientation to the code's architcture.

The spectral properties of the atmosphere and the source functions depend on electromagnetic wavelength (or frequency or wavenumber). RTE treats this spectral dependence by dividing the spectrum into one or more _bands_, each of which represents a continuous set of wavelengths/frequencies. Bands may be further sub-divided into _g-points_ (the language is borrowed from _k_-distributions). Each _g_-point is treated as a independent psudo-monchromatic calculation but there is no inherent mapping between _g_-points and wavelengths; the sum over _g_-points is the band-average value.
RTE [computes](/explanations/rte-solvers.html) radiative [_fluxes_](/explanations/rte-fluxes.html) given values of optical properties, source functions, and boundary conditions.

The bands defined by RRTMGP cover the full spectrum of radiation emitted by the Sun and Earth: these are _broadband_ calculations. In RRTMGP the bands are continuous so that the ending wavelength of one band is the starting wavelength of the next.
RRTMGP computes the optical properties and source functions of the gaseous atmosphere given the distribution of temperature, pressure, and gas concentrations within the atmosphere.

Each of the italicized phrases above corresponds to a class in the Fortran 2003 interface which bundles some combination of code and data.
22 changes: 22 additions & 0 deletions doc/jekyll_site/explanations/rte-fluxes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
layout: page
title: RTE - fluxes
---

RTE solves the radiative transfer equation for each spectral point independently but this detailed information typically isn't useful. Class `ty_fluxes` in module `[mo_fluxes](https://earth-system-radiation.github.io/rte-rrtmgp/reference/rte-fortran-interface/module/mo_fluxes.html)` in the RTE library provides a way to reduce the highly-detailed information based on precisely what the user needs. Class `ty_fluxes_broadband` provides an example implementation that reports broadband flux i.e. the sum over all spectral points at all levels.

# Fluxes interface

`[ty_fluxes](https://earth-system-radiation.github.io/rte-rrtmgp/reference/rte-fortran-interface/type/ty_fluxes.html)` is an abstract class that defines [two interfaces](/reference/rte-fortran-interface/type/ty_fluxes.html) defining type-bound functions. Function `reduce` is called within the RTE solvers. The input arguments include the spectrally-resolved fluxes up and down (and, optically, the direct-beam flux) and the spectral discretization. Logical function `are_desired` is called by RTE to check if the results of a calculation will be used.

Class `ty_fluxes` is abstract; it defines only the interfaces to these routines. Implementation is deferred to user classes that extend this class.

# Broadband fluxes

Class `[ty_fluxes_broadband](https://earth-system-radiation.github.io/rte-rrtmgp/reference/rte-fortran-interface/type/ty_fluxes_broadband.html)` in the same [module](/reference/rte-fortran-interface/module/mo_fluxes.html) provides an example of how to extend `ty_fluxes`. This class reports broadband values i.e. the sum over every element in the spectral dimensions. The class contains [four data fields](/reference/rte-fortran-interface/type/ty_fluxes_broadband.html). Before calling one of the RTE solvers with this class as output, users either allocate one or more of these output fields or point to an existing array. The fields must have the same number of columns and layers as the problem being solved. In class `ty_fluxes_broadband` logical function \`are_desired()\`\` returns true if one or more of the data fields points to storage and false otherwise.

# Other extensions

Class `ty_fluxes_byband` in subdirectory `extensions/` provides another example that makes use of the spectral discretization information.

It's useful to extend the class when particular subsets of fluxes, such as photosynthetically-active radiation at the surface, are required.
16 changes: 16 additions & 0 deletions doc/jekyll_site/explanations/rte-optical-props.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
layout: page
title: RTE - optical properties
---

# Optical properties and spectral discretization

The spectral properties of the atmosphere and the source functions depend on electromagnetic wavelength (or frequency or wavenumber). RTE treats this spectral dependence by dividing the spectrum into one or more _bands_, each of which represents a continuous set of wavelengths/frequencies/wavenumbers. Bands may be further sub-divided into _g-points_ (the language is borrowed from _k_-distributions). Each _g_-point is treated as a independent psudo-monchromatic calculation but there is no inherent mapping between _g_-points and wavelengths; the sum over _g_-points is the band-average value.

Bands are defined by their bounds, expressed as wavenumbers in cm$^{-1}$, and by their staring and ending (integer) g-points. A spectral discretization defined only on bands is represented with one _g_-point per band. A set of monochromatic caclulations may be represented by additionally setting the upper and lower wavenumbers for each band to the same value.

Class `ty_optical_props` implements a range of [procedures](/reference/optical-props-overview.html) for representing and manipulating the spectral discretization. These capabilities are inherited by classes that represent arrays of optical properties (i.e. optical depth) or sources of radiation and by those used to compute optical properties from a physical description of the atmosphere.

# RRTMGP's spectral discretization

The bands defined by RRTMGP cover the full spectrum of radiation emitted by the Sun and Earth: these are _broadband_ calculations. In RRTMGP the bands are continuous so that the ending wavelength of one band is the starting wavelength of the next.
10 changes: 10 additions & 0 deletions doc/jekyll_site/explanations/rte-solvers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
layout: page
title: RTE - solvers
---

The `[rte_lw()](/reference/rte-fortran-interface/proc/rte_lw.html)` and `[rte_sw()](/reference/rte-fortran-interface/proc/rte_sw.html)` routines in the RTE library compute radiative transfer on a user-specified problem. Both routines allow for an upper boundary condition for spectrally-resolved diffuse radiation. `rte_sw()` is overloaded to allow users to specify either a single value of `mu0` per column or a value at each layer of each column.

If optical properties are specified as variables of type ty_optical_props_1scl (meaning extinction optical depth alone) in the longwave, radiative transfer is computed accounting for only emission and absorption. If optical properties are specified as variables of type `ty_optical_props_2str` (optical depth, single-scattering albedo, and asymmetry parameter) the rescaling and refinement method of [Tang et al. 2018](https://doi.org/10.1175/JAS-D-18-0014.1) is used by default; two-stream and adding methods maybe be chosen by setting optional argument `use_2stream` to `.TRUE.`

The sensitivity of broadband flux (W/m$^2$-K) to changes in surface temperature is available in optional output argument `flux_up_Jac` . Jacobians are not available if `use_2stream` is \`\`.TRUE.\`
74 changes: 6 additions & 68 deletions doc/jekyll_site/how-tos/build-and-test.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: page
title: How to build and run tests
title: Building and testing using examples
---

How to build the libraries, tests, and examples, run the tests, and verify the results

## In a nutshell
# In a nutshell

RTE+RRTMGP uses `CMake`. To generate a configuration using the `ninja` build system:
`cmake -S . -B build -G "Ninja" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_TESTING=ON`
Expand All @@ -18,78 +18,16 @@ To run the examples and tests and check the results:

Evaluating the results of the tests requires `Python` and the packages described in `environment*.yml`.

## Building and testing using (Gnu) autotools
See also possible values of [compiler flags](/reference/compiler-flags.html).

# Building and testing using (Gnu) autotools

Sergey Kosukhin and his colleagues at the Max Planck Institute for Meteorology
maintain the `autoconf` branch which adds Gnu `autotools` building to `main` branch.

## Supplying data
# Supplying data

Data files needed for RRTMGP are available via a [data repository](https://github.com/earth-system-radiation/rrtmgp-data) or
as a [Zenodo archive](https://doi.org/10.5281/zenodo.7988260).

`ctest` fetches a specific version of this data for running the tests and examples.

## Example compiler flags

In these examples `FC` is the Fortran compilers using flags `FCFLAGS`

### Gnu Fortran

(see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/continuous-integration.yml))
`FC`: `gfortran-12` or `gfortran-13` or `gfortran-14`

#### Debugging flags

`FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -finit-real=nan"`

#### Even stricter debugging flags

`FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fbacktrace -finit-real=nan -pedantic -g -Wall"`

### Intel Fortran Classic

(see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: ifort`

#### Debugging flags

`FCFLAGS: "-m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08"`

#### Optimization flags:

`FCFLAGS:"-m64 -O3 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132"`

### Intel Fortran

(LLVM, see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: ifx`

#### Debugging flags

`FCFLAGS: "-debug -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08"`

#### Using OpenMP GPU offload

See [this open issue](https://github.com/earth-system-radiation/rte-rrtmgp/issues/194)

### NVFortran

(see also the see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: nvfortran`

#### Debugging flags

`FCFLAGS: "-g -Minfo -Mbounds -Mchkptr -Mstandard -Kieee -Mchkstk -Mallocatable=03 -Mpreprocess"`

#### Optimization flags:

`FCFLAGS: "-O3 -fast -Minfo -Mallocatable=03 -Mpreprocess"`

### HPE CCE for GPU using OpenMP-acc: crayftn -- requires at least CCE 14.0.0

`FC: crayftn`

#### Debugging flags (these appear to be insufficient during the link stage)

`FCFLAGS: "-hnoacc -homp -O0"`
18 changes: 8 additions & 10 deletions doc/jekyll_site/index.markdown
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: home
title: RTE+RRTMGP documentation
---

This is the documentation for RTE+RRTMGP, a set of codes for computing radiative
fluxes in planetary atmospheres. RTE+RRTMGP is described in a
[paper](https://doi.org/10.1029/2019MS001621) in
[Journal of Advances in Modeling Earth Systems](http://james.agu.org).
The code itself can be sited as
fluxes in planetary atmospheres. The initial release of RTE+RRTMGP is described in a
[paper](https://doi.org/10.1029/2019MS001621).
The code itself can be cited as
doi:[10.5281/zenodo.3403172](https://doi.org/10.5281/zenodo.3403172) or via the
DOI attached to each release.

Expand All @@ -23,17 +21,17 @@ present-day, pre-industrial, and 4xCO2 conditions.
RTE computes fluxes given spectrally-resolved optical descriptions and source
functions. The fluxes are normally summarized or reduced via a user extensible class.

# Work in progress
RTE+RRTMGP is a collaboration between Columbia University and Atmospheric and Environmental Research, Inc. with support from a growing community including the German Climate Computing Center, Nvidia, and the Swiss Supercomputing Center. Please open an [issue](https://github.com/earth-system-radiation/rte-rrtmgp/issues) with questions.

Comprehensive documentation for RTE and RRTMGP is very much under development.
# Documentation is always a work in progress

We are planning to follow the [Diataxis](https://diataxis.fr/) framework
We follow the [Diataxis](https://diataxis.fr/) framework
and produce [tutorials](./tutorials/index.html), [how-to guides](./how-tos/index.html),
[explanations](./explanations/index.html), and [reference](./reference/index.html).

We are starting with the [reference documentation](./reference/index.html),
Much of the [reference documentation](./reference/index.html) is
auto-generated from the code itself. This is provided separately for
RTE and RRTMGP and for the user-facing classes and underlying computational kernels.

We welcome contributions to the documentation via pull requests to the `documentation` branch
We welcome contributions to the documentation via pull requests against the `main` branch
of the Github repository.
68 changes: 68 additions & 0 deletions doc/jekyll_site/reference/compiler-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
layout: page
title: Example compiler flags
---

Here are sets of compiler flags used to compile and test the code over time. They are provided as a starting point - other configurations may work as well or better.

In these examples `FC` is the Fortran compilers using flags `FCFLAGS`

# Gnu Fortran

(see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/continuous-integration.yml))
`FC`: `gfortran-12` or `gfortran-13` or `gfortran-14`

## Debugging flags

`FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -finit-real=nan"`

## Even stricter debugging flags

`FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fbacktrace -finit-real=nan -pedantic -g -Wall"`

# Intel Fortran Classic

(see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: ifort`

## Debugging flags

`FCFLAGS: "-m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08"`

## Optimization flags:

`FCFLAGS:"-m64 -O3 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132"`

# Intel Fortran

(LLVM, see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: ifx`

## Debugging flags

`FCFLAGS: "-debug -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08"`

## Using OpenMP GPU offload

See [this open issue](https://github.com/earth-system-radiation/rte-rrtmgp/issues/194)

# NVFortran

(see also the see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: nvfortran`

## Debugging flags

`FCFLAGS: "-g -Minfo -Mbounds -Mchkptr -Mstandard -Kieee -Mchkstk -Mallocatable=03 -Mpreprocess"`

## Optimization flags:

`FCFLAGS: "-O3 -fast -Minfo -Mallocatable=03 -Mpreprocess"`

# HPE CCE for GPU using OpenMP-acc: crayftn -- requires at least CCE 14.0.0

`FC: crayftn`

## Debugging flags (these appear to be insufficient during the link stage)

`FCFLAGS: "-hnoacc -homp -O0"`
6 changes: 3 additions & 3 deletions doc/jekyll_site/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layout: page
title: Reference (technical documentation)
---

# Reference/Technical documentation
# Reading the code

RTE and RRTMGP aspire to follow a set of coding conventions:

Expand All @@ -17,13 +17,13 @@ RTE and RRTMGP aspire to follow a set of coding conventions:
- Units are MKS
- Procedures (with the exception of testing code) do not perform I/O

## Fortran user-facing class interfaces
# Fortran user-facing class interfaces

[RTE Fortran interface](./rte-fortran-interface/index.html)

[RRTMGP Fortran interface](./rrtmgp-fortran-interface/index.html)

## Kernel interfaces
# Kernel interfaces

[RTE kernels: Fortran interface](./rte-kernels/index.html)

Expand Down
20 changes: 20 additions & 0 deletions doc/jekyll_site/reference/optical-props-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
layout: page
title: Working with optical properties and spectral discretizations
---

This page provides an overview of methods available for working with spectral discretizations as used by the optical properties class and its descendents. Further details are available in the [auto-generated documentation](/reference/rte-fortran-interface/type/ty_optical_props.html).

Optical properties are defined by their spectral dependence which is described during [initialization](/reference/rte-fortran-interface/type/ty_optical_props.html).

The spectral dependence can be described via arrays: array `band_lims_wvn` with extents (2, number-of-bands) describes the number of bands beginning and ending wavenumber of each band (in MKS units i.e. inverse meters). Optional argument `band_lims_gpt` describes the beginning and ending g-point of each band; if this array isn't provided it's assumed values are available by band. An optional `name` may be useful in debugging.

Alternatively variables of type `ty_optical_props` can copy the spectral discretization from a previously-initialized variable e.g. `err_msg = op2%init(op1)`.

Real-valued functions ``` op%get_band_lims_wavenumber()`` and ```op%get_band_lims_wavelength()\` return arrays of extent (2, number-of-bands) containing the spectral limits of each band expressed in wavelength or wavenumber = 1/wavelength (again in MKS units).

Procedure `op%is_initialized()` returns a logical value indicating if the spectral discretization has been provided. `op%get_nband()` and `op%get_ngpt()` return the (integer) number of band and g-points; if these numbers are the same the optical properties are defined by band.

Integer functions `op%convert_band2gpt()` and `op%convert_gpt2band()` provide a map between individual bands and g-points. Function `op%get_gpoint_bands()` returns an integer of length op%get_ngpt() with the band number to which each g-point belongs (i.e. it's the vector version of `op%convert_gpt2band()`).

Comparison functions `op1%bands_are_equal(op2)` and `op1%gpoints_are_equal(op2)` return logical values indicating whether the tw sets of optical properties share the same band or g-point discretization.
6 changes: 2 additions & 4 deletions doc/jekyll_site/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ layout: page
title: Tutorials
---

# Tutorials will live here

### Clear-sky calculation
# Clear-sky calculation

A typical workflow for a clear-sky calculation is to

Expand All @@ -16,7 +14,7 @@ A typical workflow for a clear-sky calculation is to

This repository contains all the pieces needed to perform a clear-sky calculation. An [example](https://github.com/RobertPincus/rte-rrtmgp/tree/master/examples/rfmip-clear-sky) is provided.

### All-sky calculation
# All-sky calculation

An all-sky calculation is a small variant

Expand Down

0 comments on commit ff5598e

Please sign in to comment.