source: LMDZ6/trunk/libf/phylmd/ecrad/rrtm_taumol16.F90 @ 4062

Last change on this file since 4062 was 3908, checked in by idelkadi, 3 years ago

Online implementation of the radiative transfer code ECRAD in the LMDZ model.

  • Inclusion of the ecrad directory containing the sources of the ECRAD code
    • interface routine : radiation_scheme.F90
  • Adaptation of compilation scripts :
    • compilation under CPP key CPP_ECRAD
    • compilation with option "-rad ecard" or "-ecard true"
    • The "-rad old/rtm/ecran" build option will need to replace the "-rrtm true" and "-ecrad true" options in the future.
  • Runing LMDZ simulations with ecrad, you need :
    • logical key iflag_rrtm = 2 in physiq.def
    • namelist_ecrad (DefLists?)
    • the directory "data" containing the configuration files is temporarily placed in ../libfphylmd/ecrad/
  • Compilation and execution are tested in the 1D case. The repository under svn would allow to continue the implementation work: tests, verification of the results, ...
File size: 10.7 KB
Line 
1!----------------------------------------------------------------------------
2SUBROUTINE RRTM_TAUMOL16 (KIDIA,KFDIA,KLEV,P_TAU,&
3 & P_TAUAERL,P_FAC00,P_FAC01,P_FAC10,P_FAC11,P_FORFAC,P_FORFRAC,K_INDFOR,K_JP,K_JT,K_JT1,P_ONEMINUS,&
4 & P_COLH2O,P_COLCH4,K_LAYTROP,P_SELFFAC,P_SELFFRAC,K_INDSELF,PFRAC, &
5 & P_RAT_H2OCH4,P_RAT_H2OCH4_1) 
6
7!     BAND 16:  2600-3000 cm-1 (low - H2O,CH4; high - nothing)
8
9!     AUTHOR.
10!     -------
11!      JJMorcrette, ECMWF
12
13!     MODIFICATIONS.
14!     --------------
15!      M.Hamrud      01-Oct-2003 CY28 Cleaning
16!      NEC           25-Oct-2007 Optimisations
17!      JJMorcrette 20110613 flexible number of g-points
18!      ABozzo 201306 updated to rrtmg v4.85
19!      band 16:  2600-3250 cm-1 (low key- h2o,ch4; high key - ch4)
20! ---------------------------------------------------------------------------
21
22USE PARKIND1  ,ONLY : JPIM     ,JPRB
23USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
24
25USE PARRRTM  , ONLY : JPBAND
26USE YOERRTM  , ONLY : JPGPT  ,NGS15  ,NG16
27USE YOERRTWN , ONLY : NSPA,NSPB   
28USE YOERRTA16, ONLY : ABSA,ABSB,FRACREFA,FRACREFB,SELFREF,FORREF
29USE YOERRTRF, ONLY : CHI_MLS
30
31IMPLICIT NONE
32
33INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA
34INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA
35INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV
36REAL(KIND=JPRB)   ,INTENT(OUT)   :: P_TAU(KIDIA:KFDIA,JPGPT,KLEV)
37REAL(KIND=JPRB)   ,INTENT(IN)    :: P_TAUAERL(KIDIA:KFDIA,KLEV,JPBAND)
38REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC00(KIDIA:KFDIA,KLEV)
39REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC01(KIDIA:KFDIA,KLEV)
40REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC10(KIDIA:KFDIA,KLEV)
41REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC11(KIDIA:KFDIA,KLEV)
42INTEGER(KIND=JPIM),INTENT(IN)    :: K_JP(KIDIA:KFDIA,KLEV)
43INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT(KIDIA:KFDIA,KLEV)
44INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT1(KIDIA:KFDIA,KLEV)
45REAL(KIND=JPRB)   ,INTENT(IN)    :: P_ONEMINUS
46REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLH2O(KIDIA:KFDIA,KLEV)
47REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLCH4(KIDIA:KFDIA,KLEV)
48INTEGER(KIND=JPIM),INTENT(IN)    :: K_LAYTROP(KIDIA:KFDIA)
49REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFAC(KIDIA:KFDIA,KLEV)
50REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFRAC(KIDIA:KFDIA,KLEV)
51INTEGER(KIND=JPIM),INTENT(IN)    :: K_INDSELF(KIDIA:KFDIA,KLEV)
52REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFRAC(KIDIA:KFDIA,JPGPT,KLEV)
53
54REAL(KIND=JPRB)   ,INTENT(IN)   :: P_RAT_H2OCH4(KIDIA:KFDIA,KLEV)
55REAL(KIND=JPRB)   ,INTENT(IN)   :: P_RAT_H2OCH4_1(KIDIA:KFDIA,KLEV)
56INTEGER(KIND=JPIM),INTENT(IN)   :: K_INDFOR(KIDIA:KFDIA,KLEV)
57REAL(KIND=JPRB)   ,INTENT(IN)   :: P_FORFAC(KIDIA:KFDIA,KLEV)
58REAL(KIND=JPRB)   ,INTENT(IN)   :: P_FORFRAC(KIDIA:KFDIA,KLEV)
59
60! ---------------------------------------------------------------------------
61
62INTEGER(KIND=JPIM) :: IG, IND0, IND1, INDS,INDF, JS,JS1,JPL,JLAY
63INTEGER(KIND=JPIM) :: JLON
64
65REAL(KIND=JPRB) ::  Z_FAC000, Z_FAC100, Z_FAC200,&
66 & Z_FAC010, Z_FAC110, Z_FAC210, &
67 & Z_FAC001, Z_FAC101, Z_FAC201, &
68 & Z_FAC011, Z_FAC111, Z_FAC211
69REAL(KIND=JPRB) :: ZP, ZP4, ZFK0, ZFK1, ZFK2
70
71REAL(KIND=JPRB) :: ZREFRAT_PLANCK_A
72REAL(KIND=JPRB) :: ZTAUFOR,ZTAUSELF,ZTAU_MAJOR,ZTAU_MAJOR1
73REAL(KIND=JPRB) :: Z_FS, Z_SPECMULT, Z_SPECPARM,Z_SPECCOMB,  &
74& Z_FS1, Z_SPECMULT1, Z_SPECPARM1,Z_SPECCOMB1, &
75& Z_FPL, Z_SPECMULT_PLANCK, Z_SPECPARM_PLANCK,Z_SPECCOMB_PLANCK
76REAL(KIND=JPRB) :: ZHOOK_HANDLE
77
78 
79ASSOCIATE(NFLEVG=>KLEV)
80IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL16',0,ZHOOK_HANDLE)
81
82! Calculate reference ratio to be used in calculation of Planck
83! fraction in lower atmosphere.
84
85! P = 387. mb (Level 6)
86      Zrefrat_planck_a = chi_mls(1,6)/chi_mls(6,6)
87
88! Compute the optical depth by interpolating in ln(pressure),
89! temperature,and appropriate species.  Below laytrop, the water
90! vapor self-continuum and foreign continuum is interpolated
91! (in temperature) separately. 
92
93
94DO JLAY = 1, KLEV
95  DO JLON = KIDIA, KFDIA
96    IF (JLAY <= K_LAYTROP(JLON)) THEN
97      Z_SPECCOMB = P_COLH2O(JLON,JLAY) + P_RAT_H2OCH4(JLON,JLAY)*P_COLCH4(JLON,JLAY)
98      Z_SPECPARM = P_COLH2O(JLON,JLAY)/Z_SPECCOMB
99      Z_SPECPARM = MIN(Z_SPECPARM,P_ONEMINUS)
100      Z_SPECMULT = 8._JPRB*(Z_SPECPARM)
101      JS = 1 + INT(Z_SPECMULT)
102      Z_FS = MOD(Z_SPECMULT,1.0_JPRB)
103
104      Z_SPECCOMB1 = P_COLH2O(JLON,JLAY) + P_RAT_H2OCH4_1(JLON,JLAY)*P_COLCH4(JLON,JLAY)
105      Z_SPECPARM1 = P_COLH2O(JLON,JLAY)/Z_SPECCOMB1
106      IF (Z_SPECPARM1 >= P_ONEMINUS) Z_SPECPARM1 = P_ONEMINUS
107      Z_SPECMULT1 = 8._JPRB*(Z_SPECPARM1)
108      JS1 = 1 + INT(Z_SPECMULT1)
109      Z_FS1 = MOD(Z_SPECMULT1,1.0_JPRB)
110
111      Z_SPECCOMB_PLANCK = P_COLH2O(JLON,JLAY)+ZREFRAT_PLANCK_A*P_COLCH4(JLON,JLAY)
112      Z_SPECPARM_PLANCK = P_COLH2O(JLON,JLAY)/Z_SPECCOMB_PLANCK
113      IF (Z_SPECPARM_PLANCK >= P_ONEMINUS) Z_SPECPARM_PLANCK=P_ONEMINUS
114      Z_SPECMULT_PLANCK = 8._JPRB*Z_SPECPARM_PLANCK
115      JPL= 1 + INT(Z_SPECMULT_PLANCK)
116      Z_FPL = MOD(Z_SPECMULT_PLANCK,1.0_JPRB)
117
118      IND0 = ((K_JP(JLON,JLAY)-1)*5+(K_JT(JLON,JLAY)-1))*NSPA(16) + JS
119      IND1 = (K_JP(JLON,JLAY)*5+(K_JT1(JLON,JLAY)-1))*NSPA(16) + JS1
120      INDS = K_INDSELF(JLON,JLAY)
121      INDF = K_INDFOR(JLON,JLAY)
122
123IF (Z_SPECPARM < 0.125_JPRB) THEN
124            ZP = Z_FS - 1
125            ZP4 = ZP**4
126            ZFK0 = ZP4
127            ZFK1 = 1 - ZP - 2.0_JPRB*ZP4
128            ZFK2 = ZP + ZP4
129            Z_FAC000 = ZFK0*P_FAC00(JLON,JLAY)
130            Z_FAC100 = ZFK1*P_FAC00(JLON,JLAY)
131            Z_FAC200 = ZFK2*P_FAC00(JLON,JLAY)
132            Z_FAC010 = ZFK0*P_FAC10(JLON,JLAY)
133            Z_FAC110 = ZFK1*P_FAC10(JLON,JLAY)
134            Z_FAC210 = ZFK2*P_FAC10(JLON,JLAY)
135      ELSEIF (Z_SPECPARM > 0.875_JPRB) THEN
136            ZP = -Z_FS
137            ZP4 = ZP**4
138            ZFK0 = ZP4
139            ZFK1 = 1 - ZP - 2.0_JPRB*ZP4
140            ZFK2 = ZP + ZP4
141            Z_FAC000 = ZFK0*P_FAC00(JLON,JLAY)
142            Z_FAC100 = ZFK1*P_FAC00(JLON,JLAY)
143            Z_FAC200 = ZFK2*P_FAC00(JLON,JLAY)
144            Z_FAC010 = ZFK0*P_FAC10(JLON,JLAY)
145            Z_FAC110 = ZFK1*P_FAC10(JLON,JLAY)
146            Z_FAC210 = ZFK2*P_FAC10(JLON,JLAY)
147      ELSE
148            Z_FAC000 = (1._JPRB - Z_FS) * P_FAC00(JLON,JLAY)
149            Z_FAC010 = (1._JPRB - Z_FS) * P_FAC10(JLON,JLAY)
150            Z_FAC100 = Z_FS * P_FAC00(JLON,JLAY)
151            Z_FAC110 = Z_FS * P_FAC10(JLON,JLAY)
152      ENDIF
153      IF (Z_SPECPARM1 < 0.125_JPRB) THEN
154            ZP = Z_FS1 - 1
155            ZP4 = ZP**4
156            ZFK0 = ZP4
157            ZFK1 = 1 - ZP - 2.0_JPRB*ZP4
158            ZFK2 = ZP + ZP4
159            Z_FAC001 = ZFK0*P_FAC01(JLON,JLAY)
160            Z_FAC101 = ZFK1*P_FAC01(JLON,JLAY)
161            Z_FAC201 = ZFK2*P_FAC01(JLON,JLAY)
162            Z_FAC011 = ZFK0*P_FAC11(JLON,JLAY)
163            Z_FAC111 = ZFK1*P_FAC11(JLON,JLAY)
164            Z_FAC211 = ZFK2*P_FAC11(JLON,JLAY)
165      ELSEIF (Z_SPECPARM1 > 0.875_JPRB) THEN
166            ZP = -Z_FS1
167            ZP4 = ZP**4
168            ZFK0 = ZP4
169            ZFK1 = 1 - ZP - 2.0_JPRB*ZP4
170            ZFK2 = ZP + ZP4
171            Z_FAC001 = ZFK0*P_FAC01(JLON,JLAY)
172            Z_FAC101 = ZFK1*P_FAC01(JLON,JLAY)
173            Z_FAC201 = ZFK2*P_FAC01(JLON,JLAY)
174            Z_FAC011 = ZFK0*P_FAC11(JLON,JLAY)
175            Z_FAC111 = ZFK1*P_FAC11(JLON,JLAY)
176            Z_FAC211 = ZFK2*P_FAC11(JLON,JLAY)
177      ELSE
178            Z_FAC001 = (1._JPRB - Z_FS1) * P_FAC01(JLON,JLAY)
179            Z_FAC011 = (1._JPRB - Z_FS1) * P_FAC11(JLON,JLAY)
180            Z_FAC101 = Z_FS1 * P_FAC01(JLON,JLAY)
181            Z_FAC111 = Z_FS1 * P_FAC11(JLON,JLAY)
182      ENDIF
183
184
185      DO IG = 1, NG16
186!- - DS_990714
187        ZTAUSELF = P_SELFFAC(JLON,JLAY)* (SELFREF(INDS,IG) + P_SELFFRAC(JLON,JLAY) * &
188          &       (SELFREF(INDS+1,IG) - SELFREF(INDS,IG)))
189        ZTAUFOR = P_FORFAC(JLON,JLAY) * (FORREF(INDF,IG) + P_FORFRAC(JLON,JLAY) * &
190          &       (FORREF(INDF+1,IG) - FORREF(INDF,IG)))
191
192     IF (Z_SPECPARM < 0.125_JPRB) THEN
193               ZTAU_MAJOR = Z_SPECCOMB * &
194                 &   (Z_FAC000 * ABSA(IND0,IG) + &
195                 &   Z_FAC100 * ABSA(IND0+1,IG) + &
196                 &   Z_FAC200 * ABSA(IND0+2,IG) + &
197                 &   Z_FAC010 * ABSA(IND0+9,IG) + &
198                 &   Z_FAC110 * ABSA(IND0+10,IG) + &
199                 &   Z_FAC210 * ABSA(IND0+11,IG))
200            ELSEIF (Z_SPECPARM > 0.875_JPRB) THEN
201               ZTAU_MAJOR = Z_SPECCOMB * &
202                 &   (Z_FAC200 * ABSA(IND0-1,IG) + &
203                 &   Z_FAC100 * ABSA(IND0,IG) + &
204                 &   Z_FAC000 * ABSA(IND0+1,IG) + &
205                 &   Z_FAC210 * ABSA(IND0+8,IG) + &
206                 &   Z_FAC110 * ABSA(IND0+9,IG) + &
207                 &   Z_FAC010 * ABSA(IND0+10,IG))
208            ELSE
209               ZTAU_MAJOR = Z_SPECCOMB * &
210                 &   (Z_FAC000 * ABSA(IND0,IG) + &
211                 &   Z_FAC100 * ABSA(IND0+1,IG) + &
212                 &   Z_FAC010 * ABSA(IND0+9,IG) + &
213                 &   Z_FAC110 * ABSA(IND0+10,IG))
214            ENDIF
215
216            IF (Z_SPECPARM1 < 0.125_JPRB) THEN
217               ZTAU_MAJOR1 = Z_SPECCOMB1 * &
218                &    (Z_FAC001 * ABSA(IND1,IG) + &
219                &    Z_FAC101 * ABSA(IND1+1,IG) + &
220                &    Z_FAC201 * ABSA(IND1+2,IG) + &
221                &    Z_FAC011 * ABSA(IND1+9,IG) + &
222                &    Z_FAC111 * ABSA(IND1+10,IG) + &
223                &    Z_FAC211 * ABSA(IND1+11,IG))
224            ELSEIF (Z_SPECPARM1 > 0.875_JPRB) THEN
225               ZTAU_MAJOR1 = Z_SPECCOMB1 * &
226                &    (Z_FAC201 * ABSA(IND1-1,IG) + &
227                &    Z_FAC101 * ABSA(IND1,IG) + &
228                &    Z_FAC001 * ABSA(IND1+1,IG) + &
229                &    Z_FAC211 * ABSA(IND1+8,IG) + &
230                &    Z_FAC111 * ABSA(IND1+9,IG) + &
231                &    Z_FAC011 * ABSA(IND1+10,IG))
232            ELSE
233               ZTAU_MAJOR1 = Z_SPECCOMB1 * &
234                &    (Z_FAC001 * ABSA(IND1,IG) +  &
235                &    Z_FAC101 * ABSA(IND1+1,IG) + &
236                &    Z_FAC011 * ABSA(IND1+9,IG) + &
237                &    Z_FAC111 * ABSA(IND1+10,IG))
238            ENDIF
239
240
241        P_TAU(JLON,NGS15+IG,JLAY) = ZTAU_MAJOR + ZTAU_MAJOR1 &
242                & + ZTAUSELF + ZTAUFOR &
243                & + P_TAUAERL(JLON,JLAY,16) 
244        PFRAC(JLON,NGS15+IG,JLAY) = FRACREFA(IG,JPL) + Z_FPL * &
245         & (FRACREFA(IG,JPL+1) - FRACREFA(IG,JPL))
246
247        ENDDO
248
249!-- DS_990714
250    ENDIF
251
252    IF (JLAY > K_LAYTROP(JLON)) THEN
253      IND0 = ((K_JP(JLON,JLAY)-13)*5+(K_JT(JLON,JLAY)-1))*NSPB(16) + 1
254      IND1 = ((K_JP(JLON,JLAY)-12)*5+(K_JT1(JLON,JLAY)-1))*NSPB(16) + 1
255      DO IG = 1, NG16
256
257        P_TAU(JLON,NGS15+IG,JLAY) =  P_COLCH4(JLON,JLAY) * &
258               &  (P_FAC00(JLON,JLAY) * ABSB(IND0,IG) + &
259               &  P_FAC10(JLON,JLAY) * ABSB(IND0+1,IG) + &
260               &  P_FAC01(JLON,JLAY) * ABSB(IND1,IG) + &
261               &  P_FAC11(JLON,JLAY) * ABSB(IND1+1,IG)) + &
262               &  P_TAUAERL(JLON,JLAY,16)
263        PFRAC(JLON,NGS15+IG,JLAY) = FRACREFB(IG)
264
265      ENDDO
266    ENDIF
267  ENDDO
268ENDDO
269
270IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL16',1,ZHOOK_HANDLE)
271
272END ASSOCIATE
273END SUBROUTINE RRTM_TAUMOL16
Note: See TracBrowser for help on using the repository browser.