-
Notifications
You must be signed in to change notification settings - Fork 69
RRTMGP: gas optics
Class ty_gas_optics
in module mo_gas_optics
in the RRTMGP library computes the
optical properties and
source functions of the gaseous atmosphere given the distribution of temperature, pressure, and
gas concentrations within the atmosphere.
Class ty_gas_optics
extends class ty_optical_props
from module mo_optical_properties
and so inherits methods for describing the spectral discretization including the number of bands and g-points. The class is abstract, meaning that variables can not be directly defined as being of type(ty_gas_optics)
. The abstract class provides an interface.
There are two variants of the ty_gas_optics
class: one for problems for which the source of radiation are internal to the planetary atmosphere ("longwave" or "terrestrial" problems) and one for which radiation comes from a star ("shortwave" or "solar" problems), each with a corresponding interface for computing gas optical properties. For computing the quantities for longwave/internal-source problems the interface is
function gas_optics(play, plev, tlay, tsfc, gas_desc, &
optical_props, sources, &
col_dry, tlev) result(error_msg)
real(wp), dimension(:,:), intent(in ) :: play, & ! layer pressures [Pa, mb]; (ncol,nlay)
plev, & ! level pressures [Pa, mb]; (ncol,nlay+1)
tlay ! layer temperatures [K]; (ncol,nlay)
real(wp), dimension(:), intent(in ) :: tsfc ! surface skin temperatures [K]; (ncol)
type(ty_gas_concs), intent(in ) :: gas_desc ! Gas volume mixing ratios
! output
class(ty_optical_props_arry), &
intent(inout) :: optical_props ! Optical properties
class(ty_source_func_lw ), &
intent(inout) :: sources ! Planck sources
character(len=128) :: error_msg
! Optional inputs
real(wp), dimension(:,:), intent(in ), &
optional, target :: col_dry, & ! Column dry amount; dim(ncol,nlay)
tlev ! level temperatures [K]l (ncol,nlay+1)
The interface for shortwave/stellar-source problems is
function gas_optics(play, plev, tlay, gas_desc, & ! mandatory inputs
optical_props, toa_src, & ! mandatory outputs
col_dry) result(error_msg) ! optional input
real(wp), dimension(:,:), intent(in ) :: play, & ! layer pressures [Pa, mb]; (ncol,nlay)
plev, & ! level pressures [Pa, mb]; (ncol,nlay+1)
tlay ! layer temperatures [K]; (ncol,nlay)
type(ty_gas_concs), intent(in ) :: gas_desc ! Gas volume mixing ratios
! output
class(ty_optical_props_arry), &
intent(inout) :: optical_props
real(wp), dimension(:,:), intent( out) :: toa_src ! Incoming solar irradiance(ncol,ngpt)
character(len=128) :: error_msg
! Optional inputs
real(wp), dimension(:,:), intent(in ), &
optional, target :: col_dry ! Column dry amount; dim(ncol,nlay)
Both routines are called as err_msg = go%gas_optics(...)
Gas optics are defined over a range of temperatures and pressures, the limits of which can be determined via calls to real-valued functions go%get_press_min()
, go%get_press_max()
, go%get_temp_min()
, and go%get_temp_max()
. Users should expect that providing values outside this range will cause the calculation to fail with an error message.
The examples below assume a declaration like type(ty_gas_optics) :: go
.
Class ty_gas_optics_rrtmgp
extends class ty_gas_optics
to provide the RRTMGP implementation of gas optics.
Variables of class ty_gas_optics_rrtmgp
require a set of lookup tables in order to compute optical properties from atmospheric state and composition. These data are provided in netCDF files in the rrtmgp/data/
directory. The fields in the netCDF file must be passed to the load()
functions, invoked as err_msg = go%load(...)
, before the gas optics class can be used.
The longwave/shortwave variant is set depending on what data are provided to load()
. Logical functions go%source_is_external()
and go%source_is_internal()
can be used to determine the variant.
RRTMGP does not read the netCDF files directly (we expect the code to be used in many environment with specific requirements) but a straightforward implementation is available in examples/rfmip-clear-sky/mo_load_coefficients.F90
.
Longwave flux can be estimated from intensity calculations made at one or more angles; using more than one angle increases accuracy at the expense of more computation. RRTMGP gas optics can provide an empirical estimate, based on the atmospheric opacity, of the single spectrally-dependent angle at which to make such calculations to minimize error. For example:
real(wp), dimension(ncol, ngpt) :: lw_Ds
! Compute the optical properties of the clear atmosphere in atmos
call stop_on_err(k_dist%gas_optics(..., atmos)
! Compute the spectrally dependent optimal angle
call stop_on_err(k_dist%compute_optimal_angles(atmos, lw_Ds))
! Use the optimal angle in flux calculations
call stop_on_err(rte_lw(atmos, ..., lw_Ds=lw_Ds))
The solar source function provided by the solar variant of ty_gas_optics_rrtmgp
can be modified via calls. The total solar irradiance can be set directly with a call to err_msg = go%set_tsi(tsi)
. Alternatively any or all of parameters of the NRLSSI2 model of solar variability (total solar irradiance, Bremen facular index, and sunspot index) can be provided via err_msg = go%set_solar_variability(mg_index, sb_index, tsi)
. Values persist until they are explicitly reset. Directory extensions/solar_variability/
contains code and data for determining these indices as a function of position in an average solar cycle.