RFM Numerical Optimisations

13MAY24

Introduction

The following assumes that the Fortran compiler options have already been set to produce 'fast' code, eg removing array bound checks, enabling any compiler-specific optimisations.

The RFM decomposes any problem into a calculation of monochromatic absorption spectra for a number of single-absorber, homogeneous paths. The computation time therefore scales approximately as the time required for a single spectral calculation multiplied by the number of paths. That is:

(geometric component) × (spectral component) × (No. absorbing species)

Geometric Component

The principal calculation unit is a 'path', defined as the segment of a ray path within an atmospheric profile layer for a single gas. For example, if an atmosphere is defined at 0, 10, 20 .... 60 km, and a single limb-viewing spectrum from tangent height 35 km is required, there will be 3 paths (for each absorbing species) corresponding to the altitudes 35–40, 40–50 and 50–60 km.

For zenith-viewing from the surface (ZEN flag) there will be 6 paths (0–10, 10–20, ... 50–60 km)

Adding horizontal structure with limb-viewing (GRA Flag) will double the number of paths since the upward and downward parts of the ray path are no longer identical.

If a Field-of-View convolution (FOV Flag) is required the number of paths is again increased by a factor corresponding to the number of tangent rays required to specify the FOV.

The following options, starting with the simplest, are suggested to reduce the number of paths:

*ATM Section
The number of paths is also determined by the height (or pressure range) and resolution of the atmospheric profile, i.e. the altitude (or pressure) grid specified in the first file named in the *ATM section of the Driver Table.
It is generally adequate to set an upper limit of 120 km for the earth's atmosphere (unless performing specialist high-altitude calculations) and to increase the profile spacing in the upper levels.
Rather than reformat the standard atmosphere files, the suggested method is to prepare a single height (or pressure) profile in the .atm file format which contains the required subset of profile levels and insert this as the first file in the *ATM section.
Something similar to the US Std Atmosphere levels (hgt_std.atm) is adequate for limb-viewing but even this is probably too fine (particularly in the upper altitudes) for nadir-viewing.
The LAY and/or BFX Flags can be used for a quick check whether the layering makes a significant change to the calculated spectra.

*TAN Section
Compute as many tangent heights as possible at the same time. This is because many path sections in the upper atmosphere have similar Curtis-Godson p,T values so the absorption coefficients only need to be calculated for one path segment and will be automatically scaled by the absorber amount for similar segments (the CLC Flag switches off this scaling).
For plane-parallel atmospheres (NAD or ZEN flags) this makes no difference as the RFM already uses the fact that all slant paths have mathematically identical CG parameters.

.fov File (limb-viewing)
The field-of-view (FOV) representation critically affects the number of calculated paths. For single tangent heights, the number of paths will be proportional to the number of points required to specify the FOV. For multiple, regularly-spaced tangent heights, efficiency can be gained by using a FOV tabulation on the same spacing as the tangent heights which allows individual tangent paths to be reused and adding the FVZ Flag. For example, the MIPAS trapezium-shape response (0,1,1,1,0) at relative altitude coordinates (-2,-1.4,0,+1.4,+2) can be replaced by an 'equivalent' shape (0,y,1,y,0) where y=0.2798 for (-3,-1.5,0,+1.5,+3), or y=0.2302 for (-2,-1,0,+1,+2). For the 1.5km FOV spacing, a series of n limb views at 3 km increments will require 2n+3 tangent paths instead of 5n.

Spectral Component

The spectral calculation for an individual molecule can be performed in a number of ways (see
RFM spectral calculations) but generally the time-consuming part will be the line-by-line calculations which use the HITRAN line parameters. This will vary according to molecule simply due to the number of lines which have to be considered within the required spectral range but, for each molecule, the number of calculations required will be the same for each path.

Speed improvements can be made by reducing the number of spectral points at which calculations are made, reducing the number of lines considered, using simplified lineshapes, or replacing the line-by-line calculation with look-up tables.

REJ Flag
Sets lower limits on the path-adjusted strength of lines which are included in the spectral calculation. Different criteria will be appropriate for different spectral regions and tangent heights so it is advisable to compare results with and without this option for specific cases.

SHP Flag
By default the RFM uses the Voigt lineshape throughout (=convolution of Lorentz and Doppler lineshapes). However if it is known that either Doppler or Lorentz are appropriate, the calculation is quicker if these lineshapes are used explicitly. (Warning: although the Lorentz line shape may describe the lineshape at low tangent altitudes it is often necessary to allow for the Doppler 'core' of lines when performing calculations using the limb-viewing geometry)

FIN Flag
If an ILS convolution is required (set by the ILS or AVG Flags) the default is to perform the calculation at 2000 pts/cm-1 (i.e. 0.0005 cm-1 grid) which is adequate to resolve Doppler lines at high altitudes (required for limb-viewing calculations) in the mid-infrared (~10µm), but for nadir-viewing calculations 1000 pts/cm-1 is usually adequate. Specifying a coarser resolution will speed up the calculation.

GRD Flag
The user can supply irregular grids (.grd files) to specify the spectral points at which the lineshapes, absorption coefficients, radiative transfer etc are calculated instead of using every point on the regular fine grid. The path radiances, absorptions and transmissions are then interpolated to the regular grid before output (also prior to any ILS convolution). Alternatively, the GRD flag can be used in conjunction with .tab files to calculate radiances only at the grid points contained in the files.

LUT Flag
The user can supply Look-Up Tables (see See RFM LUTs) to supply pretabulated absorption coefficients for specific absorbers and spectral ranges, instead of using a line-by-line calculation.

Absorbing Species

*GAS Section
The number of paths is proportional to the number of molecules specified in the driver table, although it is usually the cost of calculating the spectral component of 'line' molecules (*HIT section) rather than the number of molecules which is the main influence.

Beware of including molecules with overall weak absorption but a large number of lines (eg COF2 and COCl2 in HITRAN2016). You can use the WID flag to see how many lines each molecule contributes.

Molecules represented by HITRAN cross-section data (*XSC), collision-induced absorption (*CIA) or by RFM Look-Up Tables (*LUT) generally impact the memory usage rather than computation time.