RTE Solver
RRTMGP.Fluxes.apply_metric_scaling! — Function
apply_metric_scaling!(flux::Union{FluxLW, FluxSW}, metric_scaling)Apply the metric scaling factor to radiative fluxes (longwave or shortwave; for a FluxSW the direct beam flux_dn_dir is scaled too). This accounts for geometric expansion of grid columns with increasing altitude when deep-atmosphere metric terms are used. Requires flux_up, flux_dn and flux_net to be available in flux. The metric scaling factor is an optional argument that has a value nothing when shallow atmosphere approximations are used (in which case this function returns nothing).
RRTMGP.RTESolver.solve_lw! — Function
solve_lw!((; context, flux, src, bcs, op, angle_disc)::NoScatLWRTE, as::GrayAtmosphericState, metric_scaling::M = nothing)Non-scattering RTE solver for the longwave problem, using gray optics. The optional metric_scaling argument scales the fluxes to account for column expansion in deep-atmosphere configurations.
solve_lw!((; context, flux, src, bcs, op)::TwoStreamLWRTE, as::GrayAtmosphericState, metric_scaling::M = nothing)Two Stream RTE solver for the longwave problem, using gray optics. The optional metric_scaling argument scales the fluxes to account for column expansion in deep-atmosphere configurations.
solve_lw!(
(; context, fluxb, flux, src, bcs, op, angle_disc)::NoScatLWRTE,
as::AtmosphericState,
lookup_lw::LookUpLW,
lookup_lw_cld::Union{LookUpCld, Nothing},
lookup_lw_aero::Union{LookUpAerosolMerra, Nothing},
metric_scaling = nothing
)Non-scattering RTE solver for the longwave problem, using RRTMGP optics. The optional metric_scaling argument scales the fluxes to account for column expansion in deep-atmosphere configurations.
solve_lw!(
(; context, fluxb, flux, band_flux, src, bcs, op)::TwoStreamLWRTE,
as::AtmosphericState,
lookup_lw::LookUpLW,
lookup_lw_cld::Union{LookUpCld, Nothing},
lookup_lw_aero::Union{LookUpAerosolMerra, Nothing},
metric_scaling = nothing
)Two Stream RTE solver for the longwave problem, using RRTMGP optics. The optional metric_scaling argument scales the fluxes to account for column expansion in deep-atmosphere configurations.
RRTMGP.RTESolver.solve_sw! — Function
solve_sw!((; context, flux, bcs, op)::NoScatSWRTE, as::GrayAtmosphericState, metric_scaling = nothing)Non-scattering RTE solver for the shortwave problem, using gray optics. The optional metric_scaling argument scales the fluxes to account for column expansion in deep-atmosphere configurations.
solve_sw!((; context, flux, src, bcs, op)::TwoStreamSWRTE, as::GrayAtmosphericState, metric_scaling = nothing)Two Stream RTE solver for the shortwave problem, using gray optics. The optional metric_scaling argument scales the fluxes to account for column expansion in deep-atmosphere configurations.
solve_sw!(
(; context, fluxb, flux, bcs, op)::NoScatSWRTE,
as::AtmosphericState,
lookup_sw::LookUpSW,
metric_scaling = nothing,
)Non-scattering RTE solver for the shortwave problem, using RRTMGP optics. The optional metric_scaling argument scales the fluxes to account for column expansion in deep-atmosphere configurations.
solve_sw!(
(; context, fluxb, flux, band_flux, src, bcs, op)::TwoStreamSWRTE,
as::AtmosphericState,
lookup_sw::LookUpSW,
lookup_sw_cld::Union{LookUpCld, Nothing},
lookup_sw_aero::Union{LookUpAerosolMerra, Nothing},
metric_scaling = nothing
)Two Stream RTE solver for the shortwave problem, using RRTMGP optics. The optional metric_scaling argument scales the fluxes to account for column expansion in deep-atmosphere configurations.
RRTMGP.RTESolver.solve_lw_both_skies! — Function
solve_lw_both_skies!(lw, flux_lw_clear, as, lookup_lw, lookup_lw_cld, lookup_lw_aero, metric_scaling)Solve the longwave problem for both skies in one pass over the g-points, accumulating the clear sky into flux_lw_clear and the all-sky into the solver's own flux.
The clear-sky result is bit-for-bit what a solve_lw! with no cloud lookup produces. For a given key the all-sky result uses the same cloud mask as two separate solves would, and agrees with them to the roundoff of reusing the already-swept gas and aerosol optics rather than recomputing them. Both paths apply the increments in the order gas, aerosol, cloud: combining optical properties normalizes with max(eps(FT), ...) and so is not associative, which is why compute_optical_props! had to adopt this order instead of the fused path adopting its gas, cloud, aerosol one – applying the aerosol increment after the cloud one would mean recomputing it, which is the saving this exists for.
solve_lw_both_skies!(solver, flux_lw_clear, as, lookup_lw, lookup_lw_cld, lookup_lw_aero, metric_scaling = nothing)
solve_sw_both_skies!(solver, flux_sw_clear, as, lookup_sw, lookup_sw_cld, lookup_sw_aero, metric_scaling = nothing)Fill the clear-sky and all-sky fluxes for one band, leaving the all-sky result in the solver's own flux and the clear-sky result in flux_*_clear.
A solver that can share the gas and aerosol optics between the two skies specializes these and computes the shared part once; TwoStreamLWRTE and TwoStreamSWRTE do. This fallback is for the others, and runs two independent solves – exactly what the caller used to do inline.
Reachability differs between the bands, which is worth knowing before trusting test coverage here. NoScatLWRTE is a supported spectral longwave solver, so the longwave fallback is live and the suite exercises it. Spectral shortwave requires scattering – OneScalar shortwave optics are rejected for anything but GrayRadiation – so TwoStreamSWRTE is currently the only shortwave solver that can reach update_sw_fluxes!, and the shortwave fallback is unreachable. It is kept for symmetry, and so that update_sw_fluxes! stays correct rather than merely lucky if another shortwave solver is added.
RRTMGP.RTESolver.solve_sw_both_skies! — Function
solve_sw_both_skies!(sw, flux_sw_clear, as, lookup_sw, lookup_sw_cld, lookup_sw_aero, metric_scaling)Solve the shortwave problem for both skies in one pass over the g-points. See solve_lw_both_skies!.
RRTMGP.RTESolver.lw_2stream_coeffs — Function
lw_2stream_coeffs(τ::FT, ssa::FT, g::FT, lev_src_bot::FT, lev_src_top::FT) where {FT}Combine RRTMGP-specific sources at levels and compute the layer reflectance, transmittance, and total source function at levels, using the linear-in-tau approximation.
RRTMGP.RTESolver.lw_noscat_source_up — Function
lw_noscat_source_up(lev_source_inc::FT, lay_source::FT, τ_loc::FT, trans::FT, τ_thresh) where {FT}Compute LW source function for upward emission at levels using linear-in-tau assumption See Clough et al., 1992, doi: 10.1029/92JD01419, Eq 13
RRTMGP.RTESolver.lw_noscat_source_dn — Function
lw_noscat_source_dn(lev_source_dec::FT, lay_source::FT, τ_loc::FT, trans::FT, τ_thresh) where {FT}Compute LW source function for downward emission at levels using linear-in-tau assumption See Clough et al., 1992, doi: 10.1029/92JD01419, Eq 13
RRTMGP.RTESolver.rte_lw_noscat_one_angle! — Function
rte_lw_noscat_one_angle!(
src_lw::SourceLWNoScat,
bcs_lw::LwBCs,
op::OneScalar,
Ds::FT,
w_μ::FT,
gcol::Int,
flux::FluxLW,
igpt::Int,
ibnd::Int,
nlay::Int,
nlev::Int,
) where {FT}Transport for no-scattering longwave problem.
RRTMGP.RTESolver.rte_lw_2stream! — Function
rte_lw_2stream!(
op::TwoStream,
flux::FluxLW,
src_lw::SL,
bcs_lw::BCL,
gcol::Int,
igpt::Int,
ibnd::Int,
nlev::Int,
ncol::Int,
) where {SL, BCL}Two stream solver for the longwave problem.
Transport of diffuse radiation through a vertically layered atmosphere, for the longwave problem. Equations are after Shonk and Hogan 2008, doi:10.1175/2007JCLI1940.1 (SH08)
RRTMGP.RTESolver.sw_2stream_coeffs — Function
sw_2stream_coeffs(τ::FT, ssa::FT, g::FT, μ₀::FT) where {FT}Compute cell properties (transmittance and reflectance) for direct and diffuse radiation Two-stream solutions to direct and diffuse reflectance and transmittance for a layer with optical depth tau, single scattering albedo w0, and asymmetry parameter g.
Equations are developed in Meador and Weaver, 1980, doi:10.1175/1520-0469(1980)037<0630:TSATRT>2.0.CO;2
RRTMGP.RTESolver.rte_sw_noscat! — Function
rte_sw_noscat!(
flux::FluxSW,
op::OneScalar,
bcs_sw::SwBCs,
igpt::Int,
n_gpt::Int,
solar_frac::AbstractFloat,
gcol,
nlev,
)No-scattering solver for the shortwave problem. (Extinction-only i.e., solar direct beam)
RRTMGP.RTESolver.rte_sw_2stream! — Function
rte_sw_2stream!(
(; τ, ssa, g)::TwoStream,
(; albedo, src)::SourceSW2Str,
bcs_sw::SwBCs,
(; flux_up, flux_dn, flux_dn_dir)::FluxSW,
solar_frac::FT,
igpt::Int,
n_gpt::Int,
ibnd::Int,
nlev::Int,
gcol::Int,
) where {FT}Two stream solver for the shortwave problem.
Transport of diffuse radiation through a vertically layered atmosphere. Equations are after Shonk and Hogan 2008, doi:10.1175/2007JCLI1940.1 (SH08)