Optics

RRTMGP.Optics.OneScalarType
OneScalar{D, V} <: AbstractOpticalProps

Single scalar approximation for optical depth, used in calculations accounting for extinction and emission.

Fields

  • layerdata: Storage for optical thickness.
  • τ: View into optical depth.
source
RRTMGP.Optics.TwoStreamType
TwoStream{D, V} <: AbstractOpticalProps

Two stream approximation for optical properties, used in calculations accounting for extinction and emission.

Fields

  • layerdata: Storage for optical depth, single scattering albedo and asymmetry parameter.
  • τ: View into optical depth (ncol, nlay).
  • ssa: View into single scattering albedo (ncol, nlay).
  • g: View into asymmetry parameter (ncol, nlay).
source
RRTMGP.Optics.compute_col_gas!Function
compute_col_gas!(
    device,
    p_lev,
    col_dry,
    param_set,
    vmr_h2o,
    lat,
    max_threads = Int(256),
)

Compute the column amounts of dry or moist air.

source
RRTMGP.Optics.compute_relative_humidity!Function
compute_relative_humidity!(
    device::ClimaComms.AbstractCPUDevice,
    rh::AbstractArray{FT, 2},
    p_lay::AbstractArray{FT, 2},
    t_lay::AbstractArray{FT, 2},
    param_set::RP.ARP,
    vmr_h2o::Union{AbstractArray{FT, 2}, Nothing} = nothing,
) where {FT}

Compute the relative humidity.

source
RRTMGP.Optics.compute_optical_props!Function
compute_optical_props!(
    op::AbstractOpticalProps,
    as::AtmosphericState{FT},
    state_cache::Union{TransposedStateCache, Nothing},
    sf::AbstractSourceLW{FT},
    gcol::Int,
    igpt::Int,
    lkp::LookUpLW{FT},
    lkp_cld::Union{LookUpCld,Nothing} = nothing,
    lkp_aero::Union{LookUpAerosolMerra, Nothing} = nothing,
) where {FT<:AbstractFloat}

Compute optical properties for the longwave problem. The layer data and level temperatures are read through state_cache (column-first copies for coalesced GPU access) when one is provided, and from as directly otherwise.

source
compute_optical_props!(
    op::AbstractOpticalProps,
    as::AtmosphericState,
    state_cache::Union{TransposedStateCache, Nothing},
    gcol::Int,
    igpt::Int,
    lkp::LookUpSW,
    lkp_cld::Union{LookUpCld, Nothing} = nothing,
    lkp_aero::Union{LookUpAerosolMerra, Nothing} = nothing,
)

Compute optical properties for the shortwave problem. The layer data are read through state_cache (column-first copies for coalesced GPU access) when one is provided, and from as directly otherwise.

source
compute_optical_props!(
    op::AbstractOpticalProps,
    as::GrayAtmosphericState,
    sf::AbstractSourceLW,
    gcol::Int,
)

Compute optical properties for the longwave gray radiation problem.

source
compute_optical_props!(
    op::AbstractOpticalProps,
    as::GrayAtmosphericState,
    gcol::Int,
)

Compute optical properties for the shortwave gray radiation problem.

source
RRTMGP.Optics.compute_relative_humidity_kernel!Function

computerelativehumiditykernel!( rh::AbstractArray{FT, 2}, play::AbstractArray{FT, 2}, tlay::AbstractArray{FT, 2}, vmrh2o::AbstractArray{FT, 2}, mwd::FT, tref::FT, qlay_min::FT, glay::Int, gcol::Int, ) where {FT}

Compute the relative humidity.

source
RRTMGP.Optics.compute_gas_opticsFunction
compute_gas_optics(
    lkp::Union{LookUpLW, LookUpSW},
    vmr,
    col_dry,
    igpt,
    ibnd,
    p_lay,
    t_lay,
    glay, gcol,
)

Compute optical thickness, single scattering albedo, and asymmetry parameter.

source
RRTMGP.Optics.compute_τ_minorFunction
compute_τ_minor(
    lkp_minor::LookUpMinor,
    vmr,
    vmr_h2o::FT,
    col_dry,
    p_lay::FT,
    t_lay::FT,
    jtemp::Int,
    ftemp::FT,
    jη1::Int,
    jη2::Int,
    fη1::FT,
    fη2::FT,
    igpt,
    ibnd,
    glay,
    gcol,
) where {FT<:AbstractFloat}

Compute optical thickness contributions from minor gases.

source
RRTMGP.Optics.compute_τ_rayleighFunction
compute_τ_rayleigh(
    rayleigh_coeff::AbstractArray{FT, 2},
    col_dry::FT,
    vmr_h2o::FT,
    jtemp::Int,
    ftemp::FT,
    jη1::Int,
    jη2::Int,
    fη1::FT,
    fη2::FT,
    igpt::Int,
) where {FT<:AbstractFloat}

Compute Rayleigh scattering optical depths for shortwave problem

source
RRTMGP.Optics.build_cloud_mask!Function
build_cloud_mask!(cld_mask, cld_frac, ::MaxRandomOverlap)

Build a McICA-sampled cloud mask from cloud fraction data for maximum-random overlap

Reference: https://github.com/AER-RC/RRTMG_SW/

Determinism: the mask is drawn with Random.rand() within the per-column g-point loop, i.e. from the RNG of whichever task runs that iteration. On a single CPU thread every draw comes from the one RNG that Random.seed! reseeds, so a fixed seed makes the sampling reproducible. Under multithreading each worker task uses its own independent task-local RNG (seeded from the parent at spawn, not by Random.seed!), and on the GPU the device RNG is keyed by a per-launch seed the host Random.seed! does not control (at least on CUDA 6.x); combined with a work assignment that is not fixed across runs or thread counts, the per-column McICA sample is then not guaranteed reproducible. Broadband fluxes are statistically unbiased regardless; bit-reproducible per-column sampling would require column-indexed seeding, deliberately not done here to keep the kernel allocation-free.

source
RRTMGP.Optics.add_cloud_optics_2stream!Function
add_cloud_optics_2stream!(
    τ,
    ssa,
    g,
    cld_mask,
    cld_r_eff_liq,
    cld_r_eff_ice,
    cld_path_liq,
    cld_path_ice,
    ice_rgh,
    lkp_cld,
    ibnd;
    delta_scaling = false,
)

Compute the TwoStream cloud optics properties and add them to the TwoStream gas optics properties.

source
RRTMGP.Optics.compute_lookup_cld_liq_propsFunction
compute_lookup_cld_liq_props(
    nsize_liq,
    radliq_lwr,
    radliq_upr,
    extliq,
    ssaliq,
    asyliq,
    re_liq,
    cld_path_liq,
)

Compute the TwoStream cloud liquid properties using the LookUpTable method.

source
RRTMGP.Optics.compute_lookup_cld_ice_propsFunction
compute_lookup_cld_ice_props(
    nsize_ice,
    radice_lwr,
    radice_upr,
    extice,
    ssaice,
    asyice,
    re_ice,
    cld_path_ice,
)

Compute the TwoStream cloud ice properties using the LookUpTable method.

source
RRTMGP.Optics.add_aerosol_optics_1scalar!Function
add_aerosol_optics_1scalar!(
    τ,
    aod_ext,
    aod_sca,
    aero_mask,
    aero_size,
    aero_mass,
    rel_hum,
    lkp_aero,
    ibnd,
    iband_550nm
)

Compute the OneScalar aerosol optics properties and add them to the existing OneScalar optics properties.

source
RRTMGP.Optics.add_aerosol_optics_2stream!Function
add_aerosol_optics_2stream!(
    τ,
    ssa,
    g,
    aod_ext,
    aod_sca,
    aero_mask,
    aero_size,
    aero_mass,
    rel_hum,
    lkp_aero,
    ibnd,
    iband_550nm;
    delta_scaling = false,
)

Compute the TwoStream aerosol optics properties and add them to the existing TwoStream optics properties:

  • aod_ext total aerosol optical depth
  • aod_sca scattering component of aerosol optical depth
source
RRTMGP.Optics.compute_lookup_aerosolFunction
compute_lookup_aerosol(lkp_aero, ibnd::Int, aero_mass, aero_size, rh::FT, glay) where {FT}

Compute cumulative aerosol optical properties for various aerosol particles given the aerosol lookup table (lkp_aero), band number (ibnd), aerosol mass (aeromass), aerosol size (aerosize), and relative humidity (rh).

source
RRTMGP.Optics.compute_lookup_dust_propsFunction
compute_lookup_dust_props(lkp_aero, ibnd, aeromass::FT, aerosize::FT) where {FT}

Compute aerosol optical properties for dust particles given the aerosol lookup table (lkp_aero), band number (ibnd), aerosol mass (aeromass) and aerosol size (aerosize).

source
RRTMGP.Optics.compute_lookup_sea_salt_propsFunction
compute_lookup_sea_salt_props(lkp_aero, ibnd, aeromass::FT, aerosize::FT, rh::FT) where {FT}

Compute aerosol optical properties for sea salt particles given the aerosol lookup table (lkp_aero), band number (ibnd), aerosol mass (aeromass), aerosol size (aerosize), and relative humidity (rh).

source
RRTMGP.Optics.compute_lookup_sulfate_propsFunction
compute_lookup_sulfate_props(lkp_aero, ibnd, aeromass::FT, rh::FT) where {FT}

Compute aerosol optical properties for sulfate particles given the aerosol lookup table (lkp_aero), band number (ibnd), aerosol mass (aeromass), and relative humidity (rh).

source
RRTMGP.Optics.compute_lookup_black_carbon_propsFunction
compute_lookup_black_carbon_props(lkp_aero, ibnd, aeromass::FT) where {FT}

Compute aerosol optical properties for hydrophobic black carbon particles given the aerosol lookup table (lkp_aero), band number (ibnd), and aerosol mass (aeromass).

source
compute_lookup_black_carbon_props(lkp_aero, ibnd, aeromass::FT, rh::FT) where {FT}

Compute aerosol optical properties for hydrophilic black carbon particles given the aerosol lookup table (lkp_aero), band number (ibnd), aerosol mass (aeromass), and relative humidity (rh).

source
RRTMGP.Optics.compute_lookup_organic_carbon_propsFunction
compute_lookup_organic_carbon_props(lkp_aero, ibnd, aeromass)

Compute aerosol optical properties for hydrophobic organic carbon particles given the aerosol lookup table (lkp_aero), band number (ibnd), and aerosol mass (aeromass).

source
compute_lookup_organic_carbon_props(lkp_aero, ibnd, aeromass::FT, rh::FT) where {FT}

Compute aerosol optical properties for hydrophilic organic carbon particles given the aerosol lookup table (lkp_aero), band number (ibnd), aerosol mass (aeromass), and relative humidity (rh).

source
RRTMGP.Optics.compute_gray_optical_thickness_lwFunction
compute_gray_optical_thickness_lw(
    params::GrayOpticalThicknessSchneider2004{FT},
    p0,
    Δp,
    p,
    lat,
) where {FT<:AbstractFloat}

Calculate the optical thickness from pressure and lapse rate for a gray atmosphere.

See Schneider 2004, J. Atmos. Sci. (2004) 61 (12): 1317–1340. DOI: https://doi.org/10.1175/1520-0469(2004)061<1317:TTATTS>2.0.CO;2

source
compute_gray_optical_thickness_lw(
    params::GrayOpticalThicknessOGorman2008{FT},
    p0,
    Δp,
    p,
    lat,
) where {FT}

Calculate the optical thickness from pressure and lapse rate for a gray atmosphere.

See Frierson, Held & Zurita-Gotor (2006), J. Atmos. Sci. 63, 2548-2566 (DOI: https://doi.org/10.1175/JAS3753.1) and O'Gorman & Schneider (2008), J. Climate 21, 3815-3832 (DOI: https://doi.org/10.1175/2007JCLI2065.1).

source
RRTMGP.Optics.compute_gray_optical_thickness_swFunction
compute_gray_optical_thickness_sw(
    params::GrayOpticalThicknessOGorman2008{FT},
    p0,
    Δp,
    p,
    rest...,
) where {FT}

Calculate the optical thickness from pressure for a gray atmosphere.

See O'Gorman 2008, Journal of Climate Vol 21, Page(s): 3815–3832. DOI: https://doi.org/10.1175/2007JCLI2065.1

source
RRTMGP.Optics.interp2dFunction
interp2d(
    fη1::FT,
    fη2::FT,
    ftemp::FT,
    coeff::FTA2D,
    jη1::Int,
    jη2::Int,
    jtemp::Int,
) where {FT,FTA2D}

Perform 2D linear interpolation.

fminor[1, 1] = (FT(1) - fη1) * (1-ftemp)

fminor[2, 1] = fη1 * (1-ftemp)

fminor[1, 2] = (FT(1) - fη2) * ftemp

fminor[2, 2] = fη2 * ftemp

source
RRTMGP.Optics.interp3dFunction
interp3d(
    jη1::Int,
    jη2::Int,
    fη1::FT,
    fη2::FT,
    jtemp::Int,
    ftemp::FT,
    jpresst::Int,
    fpress::FT,
    coeff::FTA3D,
    s1::FT = FT(1),
    s2::FT = FT(1),
) where {FT<:AbstractFloat,FTA3D<:AbstractArray{FT,3}}

Perform 3D linear interpolation.

fmajor[1, 1, itemp] = (FT(1) - fpress) * fminor[1, itemp]

fmajor[2, 1, itemp] = (FT(1) - fpress) * fminor[2, itemp]

fmajor[1, 2, itemp] = fpress * fminor[1, itemp]

fmajor[2, 2, itemp] = fpress * fminor[2, itemp]

where,

fminor[1, itemp=1] = (FT(1) - fη1) * (1-ftemp)

fminor[2, itemp=1] = fη1 * (1-ftemp)

fminor[1, itemp=2] = (FT(1) - fη2) * ftemp

fminor[2, itemp=2] = fη2 * ftemp

source
RRTMGP.Optics.increment_2streamFunction
increment_2stream(τ1::FT, ssa1::FT, g1::FT, τ2::FT, ssa2::FT, g2::FT) where {FT}

Increment TwoStream optical properties τ1, ssa1 and g1 with τ2, ssa2 and g2. Here τ is the optical thickness, ssa is the single-scattering albedo, and g is the asymmetry parameter.

source
RRTMGP.Optics.loc_lowerFunction
loc_lower(xi, Δx, n, x)

Return the location of the left (lower) point of the interval in which xi is located in vector x, assuming uniform Δx.

source
function loc_lower(xi, x)

Return the location of the left (lower) point of the interval in which xi is located in vector x.

source
RRTMGP.Optics.interp1d_loc_factorFunction
function interp1d_loc_factor(xi::FT, x::AbstractArray{FT, 1}) where {FT <: AbstractFloat}

Compute the weights for linear interpolation. This works with non-uniformly spaced x.

source