LMDZ
rrtm_rrtm_140gp.F90
Go to the documentation of this file.
1 !***************************************************************************
2 ! *
3 ! RRTM : RAPID RADIATIVE TRANSFER MODEL *
4 ! *
5 ! ATMOSPHERIC AND ENVIRONMENTAL RESEARCH, INC. *
6 ! 840 MEMORIAL DRIVE *
7 ! CAMBRIDGE, MA 02139 *
8 ! *
9 ! ELI J. MLAWER *
10 ! STEVEN J. TAUBMAN~ *
11 ! SHEPARD A. CLOUGH *
12 ! *
13 ! ~currently at GFDL *
14 ! *
15 ! email: mlawer@aer.com *
16 ! *
17 ! The authors wish to acknowledge the contributions of the *
18 ! following people: Patrick D. Brown, Michael J. Iacono, *
19 ! Ronald E. Farren, Luke Chen, Robert Bergstrom. *
20 ! *
21 !***************************************************************************
22 ! Reformatted for F90 by JJMorcrette, ECMWF, 980714 *
23 ! *
24 !***************************************************************************
25 ! *** mji ***
26 ! *** This version of RRTM has been altered to interface with either
27 ! the ECMWF numerical weather prediction model or the ECMWF column
28 ! radiation model (ECRT) package.
29 
30 ! Revised, April, 1997; Michael J. Iacono, AER, Inc.
31 ! - initial implementation of RRTM in ECRT code
32 ! Revised, June, 1999; Michael J. Iacono and Eli J. Mlawer, AER, Inc.
33 ! - to implement generalized maximum/random cloud overlap
34 
35 SUBROUTINE rrtm_rrtm_140gp &
36  &( kidia , kfdia , klon , klev &
37  &, paer , paph , pap &
38  &, pts , pth , pt &
39  &, zemis , zemiw &
40  &, pq , pcco2 , pozn &
41  &, pcldf , ptaucld &
42  &, pemit , pflux , pfluc, ptclear &
43  &)
44 
45 ! *** This program is the driver for RRTM, the AER rapid model.
46 ! For each atmosphere the user wishes to analyze, this routine
47 ! a) calls ECRTATM to read in the atmospheric profile
48 ! b) calls SETCOEF to calculate various quantities needed for
49 ! the radiative transfer algorithm
50 ! c) calls RTRN to do the radiative transfer calculation for
51 ! clear or cloudy sky
52 ! d) writes out the upward, downward, and net flux for each
53 ! level and the heating rate for each layer
54 
55 
56 #include "tsmbkind.h"
57 
58 USE parrrtm , ONLY : jpband ,jpg ,jpxsec ,jpgpt ,jplay ,&
59  &jpinpx
60 USE yoerrtwn , ONLY : wavenum1 ,wavenum2 ,delwave ,ng ,nspa ,nspb
61 
62 !------------------------------Arguments--------------------------------
63 
64 ! Input arguments
65 
66 
67 IMPLICIT NONE
68 integer_m :: kidia ! First atmosphere index
69 integer_m :: kfdia ! Last atmosphere index
70 integer_m :: klon ! Number of atmospheres (longitudes)
71 integer_m :: klev ! Number of atmospheric layers
72 real_b :: paer(klon,6,klev) ! Aerosol optical thickness
73 real_b :: pap(klon,klev) ! Layer pressures (Pa)
74 real_b :: paph(klon,klev+1) ! Interface pressures (Pa)
75 real_b :: pts(klon) ! Surface temperature (K)
76 real_b :: pt(klon,klev) ! Layer temperature (K)
77 real_b :: zemis(klon) ! Non-window surface emissivity
78 real_b :: zemiw(klon) ! Window surface emissivity
79 real_b :: pth(klon,klev+1) ! Interface temperatures (K)
80 real_b :: pq(klon,klev) ! H2O specific humidity (mmr)
81 real_b :: pozn(klon,klev) ! O3 mass mixing ratio
82 real_b :: pcco2 ! CO2 mass mixing ratio
83 real_b :: rch4 ! CH4 mass mixing ratio
84 real_b :: rn2o ! N2O mass mixing ratio
85 real_b :: rcfc11 ! CFC11 mass mixing ratio
86 real_b :: rcfc12 ! CFC12 mass mixing ratio
87 real_b :: pcldf(klon,klev) ! Cloud fraction
88 real_b :: ptaucld(klon,klev,jpband)! Cloud optical depth
89 real_b :: pflux(klon,2,klev+1) ! LW total sky flux (1=up, 2=down)
90 real_b :: pfluc(klon,2,klev+1) ! LW clear sky flux (1=up, 2=down)
91 real_b :: pemit(klon) ! Surface LW emissivity
92 real_b :: ptclear(klon) ! clear-sky fraction of column
93 
94 integer_m :: icldlyr(jplay) ! Cloud indicator
95 real_b :: cldfrac(jplay) ! Cloud fraction
96 real_b :: taucld(jplay,jpband) ! Spectral optical thickness
97 
98 real_b :: abss1(jpgpt*jplay)
99 real_b :: atr1(jpgpt,jplay)
100 equivalence(abss1(1),atr1(1,1))
101 
102 real_b :: od(jpgpt,jplay)
103 
104 real_b :: tausf1(jpgpt*jplay)
105 real_b :: tf1(jpgpt,jplay)
106 equivalence(tausf1(1),tf1(1,1))
107 
108 real_b :: coldry(jplay)
109 real_b :: wkl(jpinpx,jplay)
110 
111 real_b :: wx(jpxsec,jplay) ! Amount of trace gases
112 
113 real_b :: clfnet(0:jplay)
114 real_b :: clhtr(0:jplay)
115 real_b :: fnet(0:jplay)
116 real_b :: htr(0:jplay)
117 real_b :: totdfluc(0:jplay)
118 real_b :: totdflux(0:jplay)
119 real_b :: totufluc(0:jplay)
120 real_b :: totuflux(0:jplay)
121 
122 ! LOCAL INTEGER SCALARS
123 integer_m :: i, icld, iplon, k
124 integer_m :: istart
125 integer_m :: iend
126 
127 ! LOCAL REAL SCALARS
128 real_b :: fluxfac, heatfac, pi, zepsec, ztclear
129 
130 !- from AER
131 real_b :: tauaerl(jplay,jpband)
132 
133 !- from INTFAC
134 real_b :: fac00(jplay)
135 real_b :: fac01(jplay)
136 real_b :: fac10(jplay)
137 real_b :: fac11(jplay)
138 real_b :: forfac(jplay)
139 
140 !- from INTIND
141 integer_m :: jp(jplay)
142 integer_m :: jt(jplay)
143 integer_m :: jt1(jplay)
144 
145 !- from PRECISE
146 real_b :: oneminus
147 
148 !- from PROFDATA
149 real_b :: colh2o(jplay)
150 real_b :: colco2(jplay)
151 real_b :: colo3(jplay)
152 real_b :: coln2o(jplay)
153 real_b :: colch4(jplay)
154 real_b :: colo2(jplay)
155 real_b :: co2mult(jplay)
156 integer_m :: laytrop
157 integer_m :: layswtch
158 integer_m :: laylow
159 
160 !- from PROFILE
161 real_b :: pavel(jplay)
162 real_b :: tavel(jplay)
163 real_b :: pz(0:jplay)
164 real_b :: tz(0:jplay)
165 real_b :: tbound
166 integer_m :: nlayers
167 
168 !- from SELF
169 real_b :: selffac(jplay)
170 real_b :: selffrac(jplay)
171 integer_m :: indself(jplay)
172 
173 !- from SP
174 real_b :: pfrac(jpgpt,jplay)
175 
176 !- from SURFACE
177 real_b :: semiss(jpband)
178 real_b :: semislw
179 integer_m :: ireflect
180 
181 
182 ! HEATFAC is the factor by which one must multiply delta-flux/
183 ! delta-pressure, with flux in w/m-2 and pressure in mbar, to get
184 ! the heating rate in units of degrees/day. It is equal to
185 ! (g)x(#sec/day)x(1e-5)/(specific heat of air at const. p)
186 ! = (9.8066)(86400)(1e-5)/(1.004)
187 
188 zepsec = 1.e-06_jprb
189 oneminus = _one_ - zepsec
190 pi = _two_*asin(_one_)
191 fluxfac = pi * 2.d4
192 heatfac = 8.4391_jprb
193 
194 ! *** mji ***
195 ! For use with ECRT, this loop is over atmospheres (or longitudes)
196 DO iplon = kidia,kfdia
197 
198 ! *** mji ***
199 !- Prepare atmospheric profile from ECRT for use in RRTM, and define
200 ! other RRTM input parameters. Arrays are passed back through the
201 ! existing RRTM commons and arrays.
202  ztclear=_one_
203 
204 ! print *,'before RRTM_ECRT_140GP'
205 
206  CALL rrtm_ecrt_140gp &
207  &( iplon, klon , klev, icld &
208  &, paer , paph , pap &
209  &, pts , pth , pt &
210  &, zemis, zemiw &
211  &, pq , pcco2, pozn, pcldf, ptaucld, ztclear &
212  &, cldfrac,taucld,coldry,wkl,wx &
213  &, tauaerl,pavel,tavel,pz,tz,tbound,nlayers,semiss,ireflect)
214 
215  ptclear(iplon)=ztclear
216 
217  istart = 1
218  iend = 16
219 
220 ! Calculate information needed by the radiative transfer routine
221 ! that is specific to this atmosphere, especially some of the
222 ! coefficients and indices needed to compute the optical depths
223 ! by interpolating data from stored reference atmospheres.
224 
225 ! print *,'before RRTM_SETCOEF_140GP'
226 
227  CALL rrtm_setcoef_140gp (klev,coldry,wkl &
228  &, fac00,fac01,fac10,fac11,forfac,jp,jt,jt1 &
229  &, colh2o,colco2,colo3,coln2o,colch4,colo2,co2mult &
230  &, laytrop,layswtch,laylow,pavel,tavel,selffac,selffrac,indself)
231 
232 ! print *,'before RRTM_GASABS1A_140GP'
233 
234  CALL rrtm_gasabs1a_140gp (klev,atr1,od,tf1,coldry,wx &
235  &, tauaerl,fac00,fac01,fac10,fac11,forfac,jp,jt,jt1,oneminus &
236  &, colh2o,colco2,colo3,coln2o,colch4,colo2,co2mult &
237  &, laytrop,layswtch,laylow,selffac,selffrac,indself,pfrac)
238 
239 !- Call the radiative transfer routine.
240 
241 ! *** mji ***
242 ! Check for cloud in column. Use ECRT threshold set as flag icld in
243 ! routine ECRTATM. If icld=1 then column is cloudy, otherwise it is
244 ! clear. Also, set up flag array, icldlyr, for use in radiative
245 ! transfer. Set icldlyr to one for each layer with non-zero cloud
246 ! fraction.
247 
248  DO k = 1, klev
249  IF (icld == 1.AND.cldfrac(k) > zepsec) THEN
250  icldlyr(k) = 1
251  ELSE
252  icldlyr(k) = 0
253  ENDIF
254  ENDDO
255 
256 ! Clear and cloudy parts of column are treated together in RTRN.
257 ! Clear radiative transfer is done for clear layers and cloudy radiative
258 ! transfer is done for cloudy layers as identified by icldlyr.
259 
260 ! print *,'before RRTM_RTRN1A_140GP'
261 
262  CALL rrtm_rtrn1a_140gp (klev,istart,iend,icldlyr,cldfrac,taucld,abss1 &
263  &, od,tausf1,clfnet,clhtr,fnet,htr,totdfluc,totdflux,totufluc,totuflux &
264  &, tavel,pz,tz,tbound,pfrac,semiss,semislw,ireflect)
265 
266 ! *** Pass clear sky and total sky up and down flux profiles to ECRT
267 ! output arrays (zflux, zfluc). Array indexing from bottom to top
268 ! is preserved for ECRT.
269 ! Invert down flux arrays for consistency with ECRT sign conventions.
270 
271  pemit(iplon) = semislw
272  DO i = 0, klev
273  pfluc(iplon,1,i+1) = totufluc(i)*fluxfac
274  pfluc(iplon,2,i+1) = -totdfluc(i)*fluxfac
275  pflux(iplon,1,i+1) = totuflux(i)*fluxfac
276  pflux(iplon,2,i+1) = -totdflux(i)*fluxfac
277  ENDDO
278 ENDDO
279 
280 RETURN
281 END SUBROUTINE rrtm_rrtm_140gp
subroutine rrtm_setcoef_140gp(KLEV, P_COLDRY, P_WKL, P_FAC00, P_FAC01, P_FAC10, P_FAC11, P_FORFAC, K_JP, K_JT, K_JT1, P_COLH2O, P_COLCO2, P_COLO3, P_COLN2O, P_COLCH4, P_COLO2, P_CO2MULT, K_LAYTROP, K_LAYSWTCH, K_LAYLOW, PAVEL, P_TAVEL, P_SELFFAC, P_SELFFRAC, K_INDSELF)
INTERFACE SUBROUTINE RRTM_ECRT_140GP pcco2
INTERFACE SUBROUTINE RRTM_ECRT_140GP pth
real(kind=jprb), dimension(16) wavenum2
Definition: yoerrtwn.F90:16
integer, save kidia
Definition: dimphy.F90:6
integer, save klon
Definition: dimphy.F90:3
integer, save klev
Definition: dimphy.F90:7
integer(kind=jpim), parameter jpinpx
Definition: parrrtm.F90:20
!$Id mode_top_bound COMMON comconstr && pi
Definition: comconst.h:7
integer(kind=jpim), parameter jpgpt
Definition: parrrtm.F90:21
integer(kind=jpim), parameter jpband
Definition: parrrtm.F90:18
INTERFACE SUBROUTINE RRTM_ECRT_140GP pozn
integer, save kfdia
Definition: dimphy.F90:5
subroutine rrtm_ecrt_140gp(K_IPLON, klon, klev, kcld, paer, paph, pap, pts, pth, pt, P_ZEMIS, P_ZEMIW, pq, pcco2, pozn, pcldf, ptaucld, ptclear, P_CLDFRAC, P_TAUCLD, PTAU_LW, P_COLDRY, P_WKL, P_WX, P_TAUAERL, PAVEL, P_TAVEL, PZ, P_TZ, P_TBOUND, K_NLAYERS, P_SEMISS, K_IREFLECT)
integer(kind=jpim), dimension(16) nspb
Definition: yoerrtwn.F90:13
integer(kind=jpim), dimension(16) ng
Definition: yoerrtwn.F90:11
INTERFACE SUBROUTINE RRTM_ECRT_140GP ptclear
integer(kind=jpim), dimension(16) nspa
Definition: yoerrtwn.F90:12
subroutine rrtm_rrtm_140gp(KIDIA, KFDIA, KLON, KLEV, PAER, PAPH, PAP, PTS, PTH, PT, P_ZEMIS, P_ZEMIW, PQ, PCCO2, POZN, PCLDF, PTAUCLD, PTAU_LW, PEMIT, PFLUX, PFLUC, PTCLEAR)
INTERFACE SUBROUTINE RRTM_ECRT_140GP pcldf
subroutine rrtm_gasabs1a_140gp(KLEV, P_ATR1, P_OD, P_TF1, P_COLDRY, P_WX, P_TAUAERL, P_FAC00, P_FAC01, P_FAC10, P_FAC11, P_FORFAC, K_JP, K_JT, K_JT1, P_ONEMINUS, P_COLH2O, P_COLCO2, P_COLO3, P_COLN2O, P_COLCH4, P_COLO2, P_CO2MULT, K_LAYTROP, K_LAYSWTCH, K_LAYLOW, P_SELFFAC, P_SELFFRAC, K_INDSELF, PFRAC)
INTERFACE SUBROUTINE RRTM_ECRT_140GP paph
integer(kind=jpim), parameter jplay
Definition: parrrtm.F90:15
real(kind=jprb), dimension(16) delwave
Definition: yoerrtwn.F90:17
INTERFACE SUBROUTINE RRTM_ECRT_140GP pt
INTERFACE SUBROUTINE RRTM_ECRT_140GP ptaucld
integer(kind=jpim), parameter jpg
Definition: parrrtm.F90:17
INTERFACE SUBROUTINE RRTM_ECRT_140GP pap
INTERFACE SUBROUTINE RRTM_ECRT_140GP && paer
INTERFACE SUBROUTINE RRTM_ECRT_140GP && pts
real(kind=jprb), dimension(16) wavenum1
Definition: yoerrtwn.F90:15
INTERFACE SUBROUTINE RRTM_ECRT_140GP && pq
subroutine rrtm_rtrn1a_140gp(KLEV, K_ISTART, K_IEND, K_ICLDLYR, P_CLDFRAC, P_TAUCLD, P_ABSS1, P_OD, P_TAUSF1, P_CLFNET, P_CLHTR, P_FNET, P_HTR, P_TOTDFLUC, P_TOTDFLUX, P_TOTUFLUC, P_TOTUFLUX, P_TAVEL, PZ, P_TZ, P_TBOUND, PFRAC, P_SEMISS, P_SEMISLW, K_IREFLECT)
integer(kind=jpim), parameter jpxsec
Definition: parrrtm.F90:19