source: trunk/LMDZ.GENERIC/DOC/kspectrum.tex @ 3087

Last change on this file since 3087 was 987, checked in by jleconte, 11 years ago

11/06/2013 == JL+EM

  • User manual (+ sources) added in DOC.
File size: 5.8 KB
Line 
1\chapter{Changing the radiative transfer properties}
2
3\label{sc:kspectrum}
4
5One of the key advantages of the LMD generic model is the ability
6to work with arbitrary gas and aerosol mixtures in the radiative transfer.
7In this chapter we describe how to produce new correlated-k absorption coefficients
8and implement them in the GCM.
9
10\section{Producing the high-resolution data}
11We use the open-source software {\tt kspectrum} to produce line-by-line (LBL) absorption coefficients. {\tt Kspectrum}
12is freely available online at
13
14\begin{verbatim}
15http://code.google.com/p/kspectrum/
16\end{verbatim}
17
18See its user manual for general information on installation and basic usage.
19
20To produce LBL data on a grid of pressure and temperature suitable for the GCM, the program \verb+make_composition.F90+ is used (available in the {\tt utilities} folder of the main GCM directory). This may be compiled with the script {\tt compile} in the same folder. Once this has been done, the two scripts \verb+prekspectrum+ and \verb+postkspectrum+ are used to feed {\tt kspectrum} the correct inputs and convert the LBL data to correlated-k coefficients afterward. These scripts require three environment variables to be defined: {\tt DWORK\_DIR}, {\tt KSPEC\_DIR} and {\tt BANDS\_DIR}.
21
22In the following example, we create a database with a mixed CO$_2$ / H$_2$O atmosphere where CO$_2$ is the dominant gas. First, the three environment variables are set as
23
24\begin{verbatim}
25DWORK_DIR=/san/home/rdword/corrk_data/CO2_H2Ovar
26KSPEC_DIR=/san/home/rdword/kspectrum/kspec_1
27BANDS_DIR=32x36
28\end{verbatim}
29
30We then create a directory that includes files \verb+Q.dat+, \verb+p.dat+ and \verb+T.dat+ to define the number of gaseous species and pressure and temperature gridpoints. For each file the first number gives the number of points / species.   See the folder \verb+corrk_example+ in \verb+utilities+ for the example we will describe here.
31
32Typing {\tt prekspectrum} results in the following prompt:
33
34\begin{verbatim}
35Name of atmosphere / planet:
36\end{verbatim}
37
38The planet name is for reference only and does not affect the results. After this, the values of the temperature, pressure and variable gas (H2O) grids are displayed, and you are asked for the CO2 mixing ratio:
39
40\begin{verbatim}
41 Correlated-k temperature grid:
42 1.  100.0 K
43 2.  150.0 K
44 3.  200.0 K
45 4.  250.0 K
46 5.  300.0 K
47 6.  350.0 K
48 7.  400.0 K
49
50 Correlated-k pressure grid (mBar):
51 1. 1 x 10 ^-3 mBar
52 2. 1 x 10 ^-2 mBar
53 3. 1 x 10 ^-1 mBar
54 4. 1 x 10 ^ 0 mBar
55 5. 1 x 10 ^ 1 mBar
56 6. 1 x 10 ^ 2 mBar
57 7. 1 x 10 ^ 3 mBar
58 8. 1 x 10 ^ 4 mBar
59 9. 1 x 10 ^ 5 mBar
60
61 nmolec=           2
62 Temperature layers:             7
63 Pressure layers:                9
64 Mixing ratio layers:            7
65 Total:                        441
66
67 Please enter vmr of CO2
68\end{verbatim}
69
70We chose {\tt 1.0} as there are no other gases (the mixing ratio is automatically changed to take into account the variable gas). After {\tt prekspectrum} exits, we can view the resulting \verb+composition.in+ file stored in the \verb+data/+ directory of \verb+kspectrum+:
71
72\begin{verbatim}
73Atmospheric composition input data file for planet: Zarmina
74Number of atmospheric levels: 441
75Number of molecules:   2
76
77       z (km)     /    P (atm)     /  T (K)   /  x[CO2]    /  x[H2O]
78  0.000000000E+00  0.986923267E-06  0.100E+03  0.99999E+00  0.10000E-06
79  0.000000000E+00  0.986923267E-06  0.150E+03  0.99999E+00  0.10000E-06
80  0.000000000E+00  0.986923267E-06  0.200E+03  0.99999E+00  0.10000E-06
81  ...
82\end{verbatim}
83
84Typing \verb+run_kspectrum+ in the \verb+kspectrum+ directory then submits the process as a batch job. Beware: calculating LBL coefficients for multiple gases and several hundred $p$, $T$ values can take several weeks at current processing speeds!
85
86\section{Performing the correlated-k conversion}
87
88Once the LBL data is calculated, it's time to convert it to correlated-k format. We do this using a program \verb+generate_kmatrix.F90+ which is also stored in the \verb+utilities+ folder and is called by \verb+postkspectrum+. In addition to the data generated by \verb+kspectrum+ and the original \verb+.dat+ files, it requires definition of the spectral bands to be used in the GCM. In this example we use a folder \verb+32x36+, containing files \verb+narrowbands_VI.in+ and \verb+narrowbands_IR.in+. These files define the number and widths all all bands in the visible and infrared, respectively. They can of course be modified depending on blackbody temperatures and the tradeoff required between model speed and accuracy - the
89 examples given provide accurate results for planets around Sun-like or M-class stars with surface temperatures in the 200-350 K range. {\tt postkspectrum} moves the LBL database to the {\tt DWORK\_DIR} directory along with the script {\tt run\_kmatrix}. When {\tt run\_kmatrix} is submitted in batch mode, it calls \verb+generate_kmatrix.exe+ automatically for both the visible and the infrared.
90Correlated-k conversion is much quicker than the LBL calculation - for this database on current (2011) systems it should take only a few hours.
91
92\section{Implementing the absorption data in the GCM}
93
94To use our new correlated-k coefficients, we symbolically link the correlated-k folder to the {\tt datagcm} directory defined in the GCM file \verb+phystd/datafile.h+ (it's best to avoid copying the data directly due to space considerations). All that is left is to change {\tt corrkdir} in \verb+callphys.def+ to the correct name (\verb+CO2_H2Ovar+ in this example). Provided that we compile the GCM with the correct number of bands, e.g.
95
96\begin{verbatim}
97makegcm -d 32x32x20 -t 1 -b 32x36 -p std gcm
98\end{verbatim}
99
100it will run automatically with the new radiative transfer. The GCM checks the radiative transfer data on initialization vs. the values given in
101\verb+gases.def+, to verify that thermodynamic values (e.g. $\mu_{gas}$, $c_p$) match the correlated-k data in the model.
Note: See TracBrowser for help on using the repository browser.