-
Notifications
You must be signed in to change notification settings - Fork 68
RTE: fluxes
RTE solves the radiative transfer equation for each spectral point independently but this detailed information isn't useful. Class ty_fluxes
in module mo_fluxes
in the RTE library encapsulates the output from the RTE solvers and provides a way to reduce the highly-detailed information based on precisely what the user needs. Class ty_fluxes_broadband
provides an example implementation that reports broadband flux i.e. the sum over all spectral points at all levels.
ty_fluxes
is an abstract class that defines two interfaces.
function reduce(gpt_flux_up, gpt_flux_dn, spectral_disc, top_at_1, gpt_flux_dn_dir) result(error_msg)
real(kind=wp), dimension(:,:,:), intent(in ) :: gpt_flux_up ! Fluxes by gpoint [W/m2](ncol, nlay+1, ngpt)
real(kind=wp), dimension(:,:,:), intent(in ) :: gpt_flux_dn ! Fluxes by gpoint [W/m2](ncol, nlay+1, ngpt)
class(ty_optical_props), intent(in ) :: spectral_disc !< derived type with spectral information
logical, intent(in ) :: top_at_1
real(kind=wp), dimension(:,:,:), optional, &
intent(in ) :: gpt_flux_dn_dir! Direct flux down
character(len=128) :: error_msg
end function reduce_abstract
is called within the RTE solvers. The input arguments are the spectrally-resolved fluxes up and down (and, optically, the direct-beam flux), the spectral discretization, and a flag indicating whether the top of the atmosphere is at index 1 or nlay in the vertical dimension.
Logical function fluxes%are_desired()
is called by RTE to check if the results of a calculation will be used.
Note that class ty_fluxes
defines only the interfaces to these routines. Implementation is deferred to user classes that extend this class.
Class ty_fluxes_broadband
in the same module provides an example of how to extend ty_fluxes
. This class reports broadband values i.e. the sum over every element in the spectral dimensions. The class contains four data fields
real(wp), dimension(:,:), pointer :: flux_up => NULL(), flux_dn => NULL()
real(wp), dimension(:,:), pointer :: flux_net => NULL() ! Net (down - up)
real(wp), dimension(:,:), pointer :: flux_dn_dir => NULL() ! Direct flux down
Before calling one of the RTE solvers with this class as output, users either allocate one or more of these output fields or point to an existing array. The fields must have the same number of columns and layers as the problem being solved.
In class ty_fluxes_broadband
logical function are_desired()
returns true if one or more of the data fields points to storage and false otherwise.
When routine reduce
is called from the RTE solver the implementation sums over all elements of the input arrays for which output storage is available. Net broadband flux is computed from the difference of spectrally-resolved values if broadband values of flux_up
and flux_dn
are not available.
Class ty_fluxes_byband
in subdirectory extensions
provides another example that makes use of the spectral discretization information.
It would be especially useful to extend the class when particular subsets of fluxes, such as photosynthetically-active radiation at the surface, are required.