API
RRTMGP has an API for creating various types of solvers, and accessing data passed to it.
Radiation modes
RRTMGP.AbstractRRTMGPMethod — TypeAbstractRRTMGPMethodAn abstract type used for different radiation methods.
These subtypes are helpful for configuring lookup tables, and pre-configuring caches for different radiation modes.
RRTMGP.AllSkyRadiation — TypeAllSkyRadiationThe all-sky radiation mode, given:
aerosol_radiationbool indicating to turn on aerosol radiationreset_rng_seedReset 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.
RRTMGP.AllSkyRadiationWithClearSkyDiagnostics — TypeAllSkyRadiationWithClearSkyDiagnosticsThe all-sky radiation mode (with diagnostics), given:
aerosol_radiationbool indicating to turn on aerosol radiationreset_rng_seedReset 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.
RRTMGP.GrayRadiation — TypeGrayRadiationThe gray radiation mode, given:
RRTMGP.ClearSkyRadiation — TypeClearSkyRadiationThe clear-sky radiation mode, given:
aerosol_radiationbool indicating to turn on aerosol radiation
Grid parameters
RRTMGP.RRTMGPGridParams — TypeRRTMGPGridParams(
FT;
context::ClimaComms.AbstractCommsContext,
nlay::Int,
ncol::Int
)A struct containing grid parameters.
contexttheClimaCommscontextnlay::Intthe number of layersncol::Intthe number of columnsisothermal_boundary_layer::Boola boolean indicating if the isothermal boundary layer should be included in the grid, or not.
RRTMGPSolver
RRTMGP.RRTMGPSolver — TypeRRTMGPSolverA RRTMGP model that contains all RRTMGP structs, and provides getter methods to retrieve data.
RRTMGPData
RRTMGP.RRTMGPData — TypeRRTMGPData{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))RRTMGP.NVCData — FunctionNVCData(gp::RRTMGPGridParams, ::Type{T}; N, nlay)
NVCData(gp::RRTMGPGridParams; N, nlay)Construct a RRTMGPData object with index order (N, vertical level, column).
RRTMGP.VCData — FunctionVCData(gp::RRTMGPGridParams, ::Type{T}; nlay)
VCData(gp::RRTMGPGridParams; nlay)
VCData(fn, gp::RRTMGPGridParams; nlay)Construct a RRTMGPData object with index order (vertical level, column).
RRTMGP.NCData — FunctionNCData(gp::RRTMGPGridParams, ::Type{T}; N)
NCData(gp::RRTMGPGridParams; N)Construct a RRTMGPData object with index order (N, column).
RRTMGP.NData — FunctionNData(gp::RRTMGPGridParams, ::Type{T}; N)
NData(gp::RRTMGPGridParams; N)Construct a RRTMGPData object with index order (N).
RRTMGP.set_domain! — Functionset_domain!(data::RRTMGPData, value, gp::RRTMGPGridParams)Sets data in the domain to value (excludes extra layer).
RRTMGP.set_cols! — Functionset_cols!(data, value::Union{Number, AbstractArray})Sets the columns in data to values in value, based on the index order.
RRTMGP.domain_view — Functiondomain_view(gp::RRTMGPGridParams, data::RRTMGPData{NVCOrder})Return a view into the domain portion of the data, (excludes the isothermal boundary layer if it exists)
Lookup tables
RRTMGP.lookup_tables — Functionlookup_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.
Volume Mixing Ratio
RRTMGP.Vmrs.VolumeMixingRatioGlobalMean — FunctionVolumeMixingRatioGlobalMeanReturns the VmrGM struct given:
grid_params::RRTMGPGridParamsgrid parametersvmr_h2ovolume mixing ratio of h2ovmr_h2ovolume mixing ratio of o3vmr_h2ovolume mixing ratio of ?
Computing fluxes
RRTMGP.update_sw_fluxes! — Functionupdate_sw_fluxes!(s::RRTMGPSolver)Updates the shortwave fluxes.
RRTMGP.update_lw_fluxes! — Functionupdate_lw_fluxes!(s::RRTMGPSolver)Updates the longwave fluxes.
Aerosol properties
RRTMGP.aero_radius — Functionaero_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"]
RRTMGP.aero_column_mass_density — Functionaero_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"]
Volume mixing ratios
RRTMGP.volume_mixing_ratio — Functionvolume_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"]
Helpers
RRTMGP.gas_names_sw — Functiongas_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)
endRRTMGP.aerosol_names — Functionaerosol_names()Return a vector containing aerosol names used in the AerosolState.
Internals
RRTMGP.AbstractIndexOrder — TypeAbstractIndexOrderAn abstract type representing index orderings for multidimensional arrays used in radiation data layouts.
RRTMGP.VCOrder — TypeVCOrder <: AbstractIndexOrderIndex order with dimensions (vertical level, column).
RRTMGP.NOrder — TypeNOrder <: AbstractIndexOrderIndex order with a single N dimension.
RRTMGP.NCOrder — TypeNCOrder <: AbstractIndexOrderIndex order with dimensions (N, column).
RRTMGP.NVCOrder — TypeNVCOrder <: AbstractIndexOrderIndex order with dimensions (N, vertical level, column).