-
Notifications
You must be signed in to change notification settings - Fork 7
ClearskyFluxExample
Prev: Building and testing the latest Socrates code
The executable used to calculate radiative fluxes or radiances from netCDF input is called ''l_run_cdf''. This may be run directly from the command line and will then prompt for the required input options. Alternatively, a wrapper script called ''Cl_run_cdf'' can be used which allows a more concise way of supplying input options. Here we will use the script ''Cl_run_cdf'' to run through the simplest options to solve for radiative fluxes in a clear-sky atmosphere.
The full set of input options for Cl_run_cdf are documented in the man page:
man Cl_run_cdf
To run the code, profiles of atmospheric data are required along with a spectral file containing details of the absorbers present in a number of spectral bands. Output profiles of fluxes or radiances are calculated for the thermal (long wave) or solar (short wave) regions.
We will make use of one of the example cases to illustrate the input profiles required for various options: examples/netcdf/CIRC_case6/. As indicated in the README file in the directory, this is a case study from a recent intercomparison. Let's first make a new directory to work in and copy across just the relevant profiles as we need them:
mkdir example1
cd example1
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.t* .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.surflw case6.surf
ls
These four files give us the most basic input required to run the code to calculate thermal radiative fluxes. Each file contains a single atmospheric variable given by the file suffix:
- .tstar: provides the surface temperature (the corresponding surface pressure defined in the file is not used by the code).
- .surf: provides the surface albedo (1 - surface emissivity) when calculating two-stream fluxes. This file allows the flexibility to provide weights for a full bidirectional reflectance distribution function (BRDF) when used for calculating radiances (see section 6.1.3 of the user guide). When calculating fluxes the first ''basis'' dimension provides the diffuse albedo and the second ''basis'' dimension the direct albedo (not used for LW calculations). An optional ''bands'' dimension allows albedos to be specified for each band in the spectral file.
- .t and .tl: provide the temperature structure of the atmosphere. The atmosphere is divided into a number of homogeneous layers specified by .t (equivalent to theta levels in the UM) numbered downwards from 1 to N, these are bounded by levels specified by .tl (UM rho levels) numbered downwards from 0 to N.
You can use your favourite netCDF utilities to view these but a couple of simple scripts are available in the package:
cdfdump case6.tstar
cdfdump case6.surf
ncplot case6.t
ncplot case6.tl
We can now calculate the thermal fluxes using these input profiles, essentially just calculating the thermal emission from the surface with no absorption in the atmosphere:
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_lw_ga7 -R 1 9 -I -t 12 -v 13 -C 5
This should have produced four output files giving the total fluxes and heating rates:
- .dflx: (diffuse) downwards flux on levels in Wm-2 (i.e. the levels specified in the .tl file)
- .uflx: upwards flux on levels
- .nflx: net downwards flux on levels (essentially dflx - uflx)
- .hrts: heating rates for the layers (as specified in the .t file) in K/day
For this simple situation the upward flux is constant as determined by the surface emission, downward flux is zero, and the atmospheric heating rates are zero (although with some insignificant numerical noise).
Now let's unpick the options given to the code:
- -B case6: the base name for the input filenames.
- -s sp_lw_ga7: the spectral file. This is the standard 9-band LW configuration used with the Met Office Global Atmosphere 7 (GA7) model.
- -R 1 9: the range of bands to solve for.
- -I: solve for thermal emission from the atmosphere and surface
- -t 12: the two-stream approximation to use. 12 is the recommended approximation for the LW as used within the Met Office. (Practical improved flux method with diffusivity factor = 1.66.)
- -v 13: the solver used for the two-stream calculations. 13 is recommended for clear-sky, 16 is recommended for cloudy-sky, 17 is recommended for cloud with separate stratiform and convective regions.
- -C 5: the cloud scheme to use. 5 is clear-sky.
Options -t and -v can be omitted in the latest version of the script and will be set automatically to the defaults.
Before we continue, we can move the output files to a new basename so that they don't prevent further output being written (the program will not overwrite files that are already present):
fmove case6 case6_lw
ls
A couple more input files are required for the most basic SW calculation:
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.stoa .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.szen .
These provide the solar irradiance (in Wm-2) at the top of the atmosphere, and the solar zenith angle in degrees from the zenith.
The solar fluxes can then be calculated as follows:
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_sw_ga7 -R 1 6 -S -C 5
fmove case6 case6_sw
Notice the range of bands is now 1 to 6 as the standard SW spectral file for GA7 has 6 bands. The option -S now specifies we are solving for an external solar source. We have left out the options -t and -v which will be set to their default values for a SW clear-sky calculation (-t 16 -v 13).
The SW calculation should have produced 6 output files:
- .sflx: direct (unscattered) downwards flux on levels in Wm-2
- .dflx: diffuse (scattered) downwards flux on levels
- .vflx: total (direct + diffuse) downwards flux on levels
- .uflx: upwards flux on levels (there is no direct upwards flux as all flux reflected from the surface is diffuse)
- .nflx: net downwards flux on levels (essentially vflx - uflx)
- .hrts: heating rates for the layers in K/day
For this simple situation where there is no absorption or scattering the direct flux remains constant as it passes down through the atmosphere, the upwards flux is zero because our albedo has been set to 0.0 and the resulting heating rates are zero.
On top of this basic setup we can now switch on and off various options to study the effects of different absorption and scattering processes:
Simply add the option -r to include Rayleigh scattering:
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_sw_ga7 -R 1 6 -S -r -C 5
fmove case6 case6_sw_rayleigh
This option makes use of the Rayleigh scattering coefficients given in the spectral file for each wavelength band. For the GA7 files these are provided in the SW file for Rayleigh scattering due to air molecules (there are no coefficients specified in the LW where Rayleigh scattering is neglected). Rayleigh scattering is purely conservative here with no absorption, and the same amount of scattering in the forwards and backwards directions. This means the net flux (ncplot case6_sw_rayleigh.nflx) remains constant: the direct flux (ncplot case6_sw_rayleigh.sflx) is reduced as it is scattered into diffuse downwards (ncplot case6_sw_rayleigh.dflx) and upwards flux (ncplot case6_sw_rayleigh.uflx). The heating rates are effectively zero but contain some insignificant numerical noise.
The -g option should be added to include gaseous absorption. This is parametrised through the correlated-''k'' method with gas absorption coefficients (k-terms) given in the spectral file. The gases included in the files we are currently using are listed at the top of the SW and LW files respectively:
head -20 $RAD_DATA/spectra/ga7/sp_sw_ga7
head -20 $RAD_DATA/spectra/ga7/sp_lw_ga7
Input profiles of gas mass mixing ratios (MMR) can be provided for each of the gases listed using the chemical symbol as the file suffix (except we use q for water vapour, see appendix A.1 of the user guide for the full list of gases and suffixes). Here MMR refers to the mass of the gas divided by the total mass of the mixture including the gas. If no input file is present for a given gas its mixing ratio is set to zero.
Copy across the MMR files from the CIRC case 6 example:
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.q .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.co2 .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.o3 .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.n2o .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.ch4 .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.o2 .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.cfc11 .
cp $RAD_DIR/examples/netcdf/CIRC_case6/case6.cfc12 .
We can include gas absorption for a single gas by using the option -g 1 followed by the unique identifier for the gas we want (this is the second number in the spectral file list, i.e. ozone = 3, cfc12=15 etc.). So, to include ozone absorption only for the LW and SW calculations:
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_lw_ga7 -R 1 9 -I -g 1 3 -C 5
fmove case6 case6_lw_ozone
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_sw_ga7 -R 1 6 -S -g 1 3 -C 5
fmove case6 case6_sw_ozone
Then compare the ozone profile and the resulting SW and LW heating rates:
ncplot case6.o3 &
ncplot case6_lw_ozone.hrts &
ncplot case6_sw_ozone.hrts &
To include more than one gas we need to choose a method for how the k-terms of the individual gases should be combined. Due to the fact that absorption features are generally sharp functions of wavelength and the lines for different gases are uncorrelated, the most accurate method of combining the k-terms is to treat the total absorption as a random combination of the individual gas k-terms. To use this "random overlap" method we use the option -g 2. This method is too slow for use within a General Circulation Model so we instead use the method of "equivalent extinction" -g 4. This uses a full treatment of the major gas in each band and approximates the minor gas absorption with a single absorption coefficient at each level calculated as the best fit values for the given atmospheric profile. These two methods can be compared for the treatment of all the gases in our current example:
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_lw_ga7 -R 1 9 -I -g 2 -C 5
fmove case6 case6_lw_krand
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_lw_ga7 -R 1 9 -I -g 4 -C 5
fmove case6 case6_lw_keqv
ncplot case6_lw_krand.hrts &
ncplot case6_lw_keqv.hrts &
You can see the equivalent extinction method does a pretty good job.
If you only want to include a subset of gases then only supply the files for those gases with the given base filename.
The -c option should be added to include continuum absorption. This will include band averaged absorption for the continuum types present in the spectral file (generally only water vapour). The GA7 spectral files only contain coefficients for the self-broadened water vapour continuum. This absorption depends on the density of H2O pairs which is calculated for each level in the radiative transfer code. The foreign-broadened water vapour continuum is directly included with the water vapour k-terms as it depends on pressure in a similar way to the H2O absorption lines.
To include the (self-broadened) water vapour continuum (requires a .q input file):
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_lw_ga7 -R 1 9 -I -c -C 5
fmove case6 case6_lw_cont
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7/sp_sw_ga7 -R 1 6 -S -c -C 5
fmove case6 case6_sw_cont
All the flags discussed here (-r -g -c) can be combined for a complete treatment of clear-sky absorption and scattering.
The -ch option can be added to output fluxes and heating rates in more than one spectral channel. Each channel can contain any number of the bands used in the calculation set through the use of a channel map. If the l_run_cdl or l_run_cdf fortran routines are run directly the channel map may be entered in detail. When the scripts (Cl_run_cdl/f) are used the -ch option will accept a number of channels that divides exactly into the range of bands.
The GA7 spectral files we have been using are optimised for accurate but fast calculation of broadband fluxes and are poorly resolved in wavelength (9 bands in the LW, 6 in the SW). There are more highly resolved spectral files available that contain equivalent optical properties. These can be run to output and plot spectral fluxes and heating rates:
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7_ref/sp_lw_300_jm2 -R 1 300 -ch 300 -I -g 4 -c -C 5
fmove case6 case6_lw300_all
ncplot case6_lw300_all.uflx &
Cl_run_cdf -B case6 -s $RAD_DATA/spectra/ga7_ref/sp_sw_260_jm2 -R 1 260 -ch 260 -S -r -g 4 -c -C 5
fmove case6 case6_sw260_all
ncplot case6_sw260_all.vflx &
These plots display the spectral effect of the combined gas absorption and Rayleigh scattering. By altering the flags described above the effect of individual gases etc. on the top-of-atmosphere and surface spectra can be studied.