API

RRTMGP has an API for creating various types of solvers, and accessing data passed to it.

Radiation modes

RRTMGP.AbstractRRTMGPMethodType
AbstractRRTMGPMethod

An abstract type used for different radiation methods.

These subtypes are helpful for configuring lookup tables, and pre-configuring caches for different radiation modes.

source
RRTMGP.AllSkyRadiationType
AllSkyRadiation

The all-sky radiation mode, given:

  • aerosol_radiation bool indicating to turn on aerosol radiation
  • reset_rng_seed Reset the RNG seed before calling RRTMGP to a known value (the timestep number). When modeling cloud optics, RRTMGP uses a random number generator. Resetting the seed every time RRTMGP is called to a deterministic value ensures that the simulation is fully reproducible and can be restarted in a reproducible way. Disable this option when running production runs.
source
RRTMGP.AllSkyRadiationWithClearSkyDiagnosticsType
AllSkyRadiationWithClearSkyDiagnostics

The all-sky radiation mode (with diagnostics), given:

  • aerosol_radiation bool indicating to turn on aerosol radiation
  • reset_rng_seed Reset the RNG seed before calling RRTMGP to a known value (the timestep number). When modeling cloud optics, RRTMGP uses a random number generator. Resetting the seed every time RRTMGP is called to a deterministic value ensures that the simulation is fully reproducible and can be restarted in a reproducible way. Disable this option when running production runs.
source
RRTMGP.ClearSkyRadiationType
ClearSkyRadiation

The clear-sky radiation mode, given:

  • aerosol_radiation bool indicating to turn on aerosol radiation
source

Grid parameters

RRTMGP.RRTMGPGridParamsType
RRTMGPGridParams(
    FT;
    context::ClimaComms.AbstractCommsContext,
    nlay::Int,
    ncol::Int
)

A struct containing grid parameters.

  • context the ClimaComms context
  • nlay::Int the number of layers
  • ncol::Int the number of columns
  • isothermal_boundary_layer::Bool a boolean indicating if the isothermal boundary layer should be included in the grid, or not.
source

RRTMGPSolver

RRTMGP.RRTMGPSolverType
RRTMGPSolver

A RRTMGP model that contains all RRTMGP structs, and provides getter methods to retrieve data.

source

RRTMGPData

RRTMGP.RRTMGPDataType
RRTMGPData{O, A, T, N} <: AbstractArray{T, N}

A wrapper around a multidimensional array for storing radiation-related data, with a parameterized index ordering type O.

Fields

  • array::A: The underlying array storage.

Example

RRTMGPData{NCOrder}(rand(2,2))
source
RRTMGP.NVCDataFunction
NVCData(gp::RRTMGPGridParams, ::Type{T}; N, nlay)
NVCData(gp::RRTMGPGridParams; N, nlay)

Construct a RRTMGPData object with index order (N, vertical level, column).

source
RRTMGP.VCDataFunction
VCData(gp::RRTMGPGridParams, ::Type{T}; nlay)
VCData(gp::RRTMGPGridParams; nlay)
VCData(fn, gp::RRTMGPGridParams; nlay)

Construct a RRTMGPData object with index order (vertical level, column).

source
RRTMGP.NCDataFunction
NCData(gp::RRTMGPGridParams, ::Type{T}; N)
NCData(gp::RRTMGPGridParams; N)

Construct a RRTMGPData object with index order (N, column).

source
RRTMGP.NDataFunction
NData(gp::RRTMGPGridParams, ::Type{T}; N)
NData(gp::RRTMGPGridParams; N)

Construct a RRTMGPData object with index order (N).

source
RRTMGP.set_domain!Function
set_domain!(data::RRTMGPData, value, gp::RRTMGPGridParams)

Sets data in the domain to value (excludes extra layer).

source
RRTMGP.set_cols!Function
set_cols!(data, value::Union{Number, AbstractArray})

Sets the columns in data to values in value, based on the index order.

source
RRTMGP.domain_viewFunction
domain_view(gp::RRTMGPGridParams, data::RRTMGPData{NVCOrder})

Return a view into the domain portion of the data, (excludes the isothermal boundary layer if it exists)

source

Lookup tables

RRTMGP.lookup_tablesFunction
lookup_tables(::AbstractRRTMGPMethod, device, FloatType)

Return a NamedTuple, containing

  • RRTMGP lookup tables (varies by radiation mode)
  • nbnd_lw
  • nbnd_sw
  • ngas_lw (absent for GrayRadiation)
  • ngas_sw (absent for GrayRadiation)

This is an extension that requires NCDatasets be loaded prior to using RRTMGP.

TODO:

  • We should add type annotations for the data read from NC files as this will improve inference and the return type of lookup_tables.
source

Volume Mixing Ratio

RRTMGP.Vmrs.VolumeMixingRatioGlobalMeanFunction
VolumeMixingRatioGlobalMean

Returns the VmrGM struct given:

  • grid_params::RRTMGPGridParams grid parameters
  • vmr_h2o volume mixing ratio of h2o
  • vmr_h2o volume mixing ratio of o3
  • vmr_h2o volume mixing ratio of ?
source

Computing fluxes

Aerosol properties

RRTMGP.aero_radiusFunction
aero_radius(s::RRTMGPSolver, name::String)

Returns the aerosol radius for the given aerosol name.

Available names are: ["dust4", "sea_salt5", "dust1", "sulfate", "organic_carbon", "dust5", "sea_salt3", "sea_salt1", "organic_carbon_rh", "dust2", "sea_salt2", "sea_salt4", "dust3", "black_carbon_rh", "black_carbon"]

source
RRTMGP.aero_column_mass_densityFunction
aero_column_mass_density(s::RRTMGPSolver, name::String)

Returns the column aerosol mass density (volume mixing ratio) for the given aerosol name.

Available names are: ["dust4", "sea_salt5", "dust1", "sulfate", "organic_carbon", "dust5", "sea_salt3", "sea_salt1", "organic_carbon_rh", "dust2", "sea_salt2", "sea_salt4", "dust3", "black_carbon_rh", "black_carbon"]

source

Volume mixing ratios

RRTMGP.volume_mixing_ratioFunction
volume_mixing_ratio(s::RRTMGPSolver, name::String)

Returns the volume moxing ratio for the given name.

Available names are: ["h2o", "cfc11", "h2o_self", "co2", "cfc12", "hfc134a", "cfc22", "ch4", "hfc23", "ccl4", "hfc143a", "co", "no2", "n2", "o2", "o3", "h2o_frgn", "hfc32", "n2o", "cf4", "hfc125"]

source

Helpers

RRTMGP.gas_names_swFunction
gas_names_sw()

Return a vector containing the gas names in the shortwave lookup tables.

This should be the same list of gases returned from the following code, and is tested in lookup_tables

function gas_names_sw_from_artifacts()
   artifact(t, b, n) =
       NC.Dataset(RRTMGP.ArtifactPaths.get_lookup_filename(t, b)) do ds
           getproperty(RRTMGP.LookUpTables, n)(ds, Float64, Array)
       end
   _, idx_gases_sw = artifact(:gas, :sw, :LookUpSW)
   return keys(idx_gases_sw)
end
source

Internals

RRTMGP.AbstractIndexOrderType
AbstractIndexOrder

An abstract type representing index orderings for multidimensional arrays used in radiation data layouts.

source
RRTMGP.VCOrderType
VCOrder <: AbstractIndexOrder

Index order with dimensions (vertical level, column).

source
RRTMGP.NVCOrderType
NVCOrder <: AbstractIndexOrder

Index order with dimensions (N, vertical level, column).

source