source: LMDZ6/branches/LMDZ_cdrag_LSCE/libf/phylmd/ecrad/rrtm_taumol12.F90 @ 5456

Last change on this file since 5456 was 3908, checked in by idelkadi, 4 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.8 KB
Line 
1!----------------------------------------------------------------------------
2SUBROUTINE RRTM_TAUMOL12 (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_COLCO2,K_LAYTROP,P_SELFFAC,P_SELFFRAC,K_INDSELF,PFRAC, & 
5 & PRAT_H2OCO2, PRAT_H2OCO2_1)
6
7!     BAND 12:  1800-2080 cm-1 (low - H2O,CO2; 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 updated to rrtmg v4.85
19! ---------------------------------------------------------------------------
20
21USE PARKIND1  ,ONLY : JPIM     ,JPRB
22USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
23
24USE PARRRTM  , ONLY : JPBAND
25USE YOERRTM  , ONLY : JPGPT  ,NG12 ,NGS11
26USE YOERRTWN , ONLY :      NSPA   
27USE YOERRTA12, ONLY : ABSA   ,FRACREFA,SELFREF,FORREF
28USE YOERRTRF, ONLY : CHI_MLS
29
30IMPLICIT NONE
31
32INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA
33INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA
34INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV
35REAL(KIND=JPRB)   ,INTENT(OUT)   :: P_TAU(KIDIA:KFDIA,JPGPT,KLEV)
36REAL(KIND=JPRB)   ,INTENT(IN)    :: P_TAUAERL(KIDIA:KFDIA,KLEV,JPBAND)
37REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC00(KIDIA:KFDIA,KLEV)
38REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC01(KIDIA:KFDIA,KLEV)
39REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC10(KIDIA:KFDIA,KLEV)
40REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC11(KIDIA:KFDIA,KLEV)
41INTEGER(KIND=JPIM),INTENT(IN)    :: K_JP(KIDIA:KFDIA,KLEV)
42INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT(KIDIA:KFDIA,KLEV)
43INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT1(KIDIA:KFDIA,KLEV)
44REAL(KIND=JPRB)   ,INTENT(IN)    :: P_ONEMINUS
45REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLH2O(KIDIA:KFDIA,KLEV)
46REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLCO2(KIDIA:KFDIA,KLEV)
47INTEGER(KIND=JPIM),INTENT(IN)    :: K_LAYTROP(KIDIA:KFDIA)
48REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFAC(KIDIA:KFDIA,KLEV)
49REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFRAC(KIDIA:KFDIA,KLEV)
50INTEGER(KIND=JPIM),INTENT(IN)    :: K_INDSELF(KIDIA:KFDIA,KLEV)
51REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFRAC(KIDIA:KFDIA,JPGPT,KLEV)
52
53REAL(KIND=JPRB)   ,INTENT(IN)   :: PRAT_H2OCO2(KIDIA:KFDIA,KLEV)
54REAL(KIND=JPRB)   ,INTENT(IN)   :: PRAT_H2OCO2_1(KIDIA:KFDIA,KLEV)
55INTEGER(KIND=JPIM),INTENT(IN)   :: K_INDFOR(KIDIA:KFDIA,KLEV)
56REAL(KIND=JPRB)   ,INTENT(IN)   :: P_FORFRAC(KIDIA:KFDIA,KLEV)
57REAL(KIND=JPRB)   ,INTENT(IN)   :: P_FORFAC(KIDIA:KFDIA,KLEV)
58
59
60! ---------------------------------------------------------------------------
61
62REAL(KIND=JPRB) :: Z_SPECCOMB(KLEV),Z_SPECCOMB1(KLEV),Z_SPECCOMB_PLANCK(KLEV)
63INTEGER(KIND=JPIM) :: IND0(KLEV),IND1(KLEV),INDS(KLEV),INDF(KLEV)
64
65INTEGER(KIND=JPIM) :: IG, JS, JLAY,JS1, JPL
66INTEGER(KIND=JPIM) :: JLON
67
68! REAL(KIND=JPRB) :: Z_FAC000, Z_FAC001, Z_FAC010, Z_FAC011, Z_FAC100, Z_FAC101,&
69!  & Z_FAC110, Z_FAC111
70REAL(KIND=JPRB) :: Z_FS, Z_SPECMULT, Z_SPECPARM,  &
71& Z_FS1, Z_SPECMULT1, Z_SPECPARM1, &
72& Z_FPL, Z_SPECMULT_PLANCK, Z_SPECPARM_PLANCK
73
74REAL(KIND=JPRB) ::  Z_FAC000, Z_FAC100, Z_FAC200,&
75 & Z_FAC010, Z_FAC110, Z_FAC210, &
76 & Z_FAC001, Z_FAC101, Z_FAC201, &
77 & Z_FAC011, Z_FAC111, Z_FAC211
78REAL(KIND=JPRB) :: ZP, ZP4, ZFK0, ZFK1, ZFK2
79REAL(KIND=JPRB) :: ZTAUFOR,ZTAUSELF,ZTAU_MAJOR,ZTAU_MAJOR1
80REAL(KIND=JPRB) :: ZREFRAT_PLANCK_A
81
82REAL(KIND=JPRB) :: ZHOOK_HANDLE
83
84!  ----------------------------------------------------------
85
86ASSOCIATE(NFLEVG=>KLEV)
87IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL12',0,ZHOOK_HANDLE)
88
89! Calculate reference ratio to be used in calculation of Planck
90! fraction in lower/upper atmosphere.
91
92! P =   174.164 mb
93      Zrefrat_planck_a = chi_mls(1,10)/chi_mls(2,10)
94
95! Compute the optical depth by interpolating in ln(pressure),
96! temperature, and appropriate species.  Below laytrop, the water
97! vapor self-continuum adn foreign continuum is interpolated
98! (in temperature) separately. 
99
100DO JLAY = 1, KLEV
101  DO JLON = KIDIA, KFDIA
102    IF (JLAY <= K_LAYTROP(JLON)) THEN
103      Z_SPECCOMB(JLAY) = P_COLH2O(JLON,JLAY) + PRAT_H2OCO2(JLON,JLAY)*P_COLCO2(JLON,JLAY)
104      Z_SPECPARM = P_COLH2O(JLON,JLAY)/Z_SPECCOMB(JLAY)
105      Z_SPECPARM=MIN(P_ONEMINUS,Z_SPECPARM)
106      Z_SPECMULT = 8._JPRB*(Z_SPECPARM)
107      JS = 1 + INT(Z_SPECMULT)
108      Z_FS = MOD(Z_SPECMULT,1.0_JPRB)
109
110      Z_SPECCOMB1(JLAY) = P_COLH2O(JLON,JLAY) + PRAT_H2OCO2_1(JLON,JLAY)*P_COLCO2(JLON,JLAY)
111      Z_SPECPARM1 = P_COLH2O(JLON,JLAY)/Z_SPECCOMB1(JLAY)
112      IF (Z_SPECPARM1 >= P_ONEMINUS) Z_SPECPARM1 = P_ONEMINUS
113      Z_SPECMULT1 = 8._JPRB*(Z_SPECPARM1)
114      JS1 = 1 + INT(Z_SPECMULT1)
115      Z_FS1 = MOD(Z_SPECMULT1,1.0_JPRB)
116
117      Z_SPECCOMB_PLANCK(JLAY) = P_COLH2O(JLON,JLAY)+ZREFRAT_PLANCK_A*P_COLCO2(JLON,JLAY)
118      Z_SPECPARM_PLANCK = P_COLH2O(JLON,JLAY)/Z_SPECCOMB_PLANCK(JLAY)
119      IF (Z_SPECPARM_PLANCK >= P_ONEMINUS) Z_SPECPARM_PLANCK=P_ONEMINUS
120      Z_SPECMULT_PLANCK = 8._JPRB*Z_SPECPARM_PLANCK
121      JPL= 1 + INT(Z_SPECMULT_PLANCK)
122      Z_FPL = MOD(Z_SPECMULT_PLANCK,1.0_JPRB)
123
124      IND0(JLAY) = ((K_JP(JLON,JLAY)-1)*5+(K_JT(JLON,JLAY)-1))*NSPA(12) + JS
125      IND1(JLAY) = (K_JP(JLON,JLAY)*5+(K_JT1(JLON,JLAY)-1))*NSPA(12) + JS1
126      INDS(JLAY) = K_INDSELF(JLON,JLAY)
127      INDF(JLAY) = K_INDFOR(JLON,JLAY)
128
129  IF (Z_SPECPARM < 0.125_JPRB) THEN
130            ZP = Z_FS - 1
131            ZP4 = ZP**4
132            ZFK0 = ZP4
133            ZFK1 = 1 - ZP - 2.0_JPRB*ZP4
134            ZFK2 = ZP + ZP4
135            Z_FAC000 = ZFK0*P_FAC00(JLON,JLAY)
136            Z_FAC100 = ZFK1*P_FAC00(JLON,JLAY)
137            Z_FAC200 = ZFK2*P_FAC00(JLON,JLAY)
138            Z_FAC010 = ZFK0*P_FAC10(JLON,JLAY)
139            Z_FAC110 = ZFK1*P_FAC10(JLON,JLAY)
140            Z_FAC210 = ZFK2*P_FAC10(JLON,JLAY)
141      ELSEIF (Z_SPECPARM > 0.875_JPRB) THEN
142            ZP = -Z_FS
143            ZP4 = ZP**4
144            ZFK0 = ZP4
145            ZFK1 = 1 - ZP - 2.0_JPRB*ZP4
146            ZFK2 = ZP + ZP4
147            Z_FAC000 = ZFK0*P_FAC00(JLON,JLAY)
148            Z_FAC100 = ZFK1*P_FAC00(JLON,JLAY)
149            Z_FAC200 = ZFK2*P_FAC00(JLON,JLAY)
150            Z_FAC010 = ZFK0*P_FAC10(JLON,JLAY)
151            Z_FAC110 = ZFK1*P_FAC10(JLON,JLAY)
152            Z_FAC210 = ZFK2*P_FAC10(JLON,JLAY)
153      ELSE
154            Z_FAC000 = (1._JPRB - Z_FS) * P_FAC00(JLON,JLAY)
155            Z_FAC010 = (1._JPRB - Z_FS) * P_FAC10(JLON,JLAY)
156            Z_FAC100 = Z_FS * P_FAC00(JLON,JLAY)
157            Z_FAC110 = Z_FS * P_FAC10(JLON,JLAY)
158      ENDIF
159      IF (Z_SPECPARM1 < 0.125_JPRB) THEN
160            ZP = Z_FS1 - 1
161            ZP4 = ZP**4
162            ZFK0 = ZP4
163            ZFK1 = 1 - ZP - 2.0_JPRB*ZP4
164            ZFK2 = ZP + ZP4
165            Z_FAC001 = ZFK0*P_FAC01(JLON,JLAY)
166            Z_FAC101 = ZFK1*P_FAC01(JLON,JLAY)
167            Z_FAC201 = ZFK2*P_FAC01(JLON,JLAY)
168            Z_FAC011 = ZFK0*P_FAC11(JLON,JLAY)
169            Z_FAC111 = ZFK1*P_FAC11(JLON,JLAY)
170            Z_FAC211 = ZFK2*P_FAC11(JLON,JLAY)
171      ELSEIF (Z_SPECPARM1 > 0.875_JPRB) THEN
172            ZP = -Z_FS1
173            ZP4 = ZP**4
174            ZFK0 = ZP4
175            ZFK1 = 1 - ZP - 2.0_JPRB*ZP4
176            ZFK2 = ZP + ZP4
177            Z_FAC001 = ZFK0*P_FAC01(JLON,JLAY)
178            Z_FAC101 = ZFK1*P_FAC01(JLON,JLAY)
179            Z_FAC201 = ZFK2*P_FAC01(JLON,JLAY)
180            Z_FAC011 = ZFK0*P_FAC11(JLON,JLAY)
181            Z_FAC111 = ZFK1*P_FAC11(JLON,JLAY)
182            Z_FAC211 = ZFK2*P_FAC11(JLON,JLAY)
183      ELSE
184            Z_FAC001 = (1._JPRB - Z_FS1) * P_FAC01(JLON,JLAY)
185            Z_FAC011 = (1._JPRB - Z_FS1) * P_FAC11(JLON,JLAY)
186            Z_FAC101 = Z_FS1 * P_FAC01(JLON,JLAY)
187            Z_FAC111 = Z_FS1 * P_FAC11(JLON,JLAY)
188      ENDIF
189
190
191
192!-- DS_000515
193!CDIR UNROLL=NG12
194      DO IG = 1, NG12
195!-- DS_000515
196        ZTAUSELF = P_SELFFAC(JLON,JLAY)* (SELFREF(INDS(JLAY),IG) + P_SELFFRAC(JLON,JLAY) * &
197          &       (SELFREF(INDS(JLAY)+1,IG) - SELFREF(INDS(JLAY),IG)))
198        ZTAUFOR = P_FORFAC(JLON,JLAY) * (FORREF(INDF(JLAY),IG) + P_FORFRAC(JLON,JLAY) * &
199          &       (FORREF(INDF(JLAY)+1,IG) - FORREF(INDF(JLAY),IG)))
200
201            IF (Z_SPECPARM < 0.125_JPRB) THEN
202               ZTAU_MAJOR = Z_SPECCOMB(JLAY) * &
203                 &   (Z_FAC000 * ABSA(IND0(JLAY),IG) + &
204                 &   Z_FAC100 * ABSA(IND0(JLAY)+1,IG) + &
205                 &   Z_FAC200 * ABSA(IND0(JLAY)+2,IG) + &
206                 &   Z_FAC010 * ABSA(IND0(JLAY)+9,IG) + &
207                 &   Z_FAC110 * ABSA(IND0(JLAY)+10,IG) + &
208                 &   Z_FAC210 * ABSA(IND0(JLAY)+11,IG))
209            ELSEIF (Z_SPECPARM > 0.875_JPRB) THEN
210               ZTAU_MAJOR = Z_SPECCOMB(JLAY) * &
211                 &   (Z_FAC200 * ABSA(IND0(JLAY)-1,IG) + &
212                 &   Z_FAC100 * ABSA(IND0(JLAY),IG) + &
213                 &   Z_FAC000 * ABSA(IND0(JLAY)+1,IG) + &
214                 &   Z_FAC210 * ABSA(IND0(JLAY)+8,IG) + &
215                 &   Z_FAC110 * ABSA(IND0(JLAY)+9,IG) + &
216                 &   Z_FAC010 * ABSA(IND0(JLAY)+10,IG))
217            ELSE
218               ZTAU_MAJOR = Z_SPECCOMB(JLAY) * &
219                 &   (Z_FAC000 * ABSA(IND0(JLAY),IG) + &
220                 &   Z_FAC100 * ABSA(IND0(JLAY)+1,IG) + &
221                 &   Z_FAC010 * ABSA(IND0(JLAY)+9,IG) + &
222                 &   Z_FAC110 * ABSA(IND0(JLAY)+10,IG))
223            ENDIF
224
225            IF (Z_SPECPARM1 < 0.125_JPRB) THEN
226               ZTAU_MAJOR1 = Z_SPECCOMB1(JLAY) * &
227                &    (Z_FAC001 * ABSA(IND1(JLAY),IG) + &
228                &    Z_FAC101 * ABSA(IND1(JLAY)+1,IG) + &
229                &    Z_FAC201 * ABSA(IND1(JLAY)+2,IG) + &
230                &    Z_FAC011 * ABSA(IND1(JLAY)+9,IG) + &
231                &    Z_FAC111 * ABSA(IND1(JLAY)+10,IG) + &
232                &    Z_FAC211 * ABSA(IND1(JLAY)+11,IG))
233            ELSEIF (Z_SPECPARM1 > 0.875_JPRB) THEN
234               ZTAU_MAJOR1 = Z_SPECCOMB1(JLAY) * &
235                &    (Z_FAC201 * ABSA(IND1(JLAY)-1,IG) + &
236                &    Z_FAC101 * ABSA(IND1(JLAY),IG) + &
237                &    Z_FAC001 * ABSA(IND1(JLAY)+1,IG) + &
238                &    Z_FAC211 * ABSA(IND1(JLAY)+8,IG) + &
239                &    Z_FAC111 * ABSA(IND1(JLAY)+9,IG) + &
240                &    Z_FAC011 * ABSA(IND1(JLAY)+10,IG))
241            ELSE
242               ZTAU_MAJOR1 = Z_SPECCOMB1(JLAY) * &
243                &    (Z_FAC001 * ABSA(IND1(JLAY),IG) +  &
244                &    Z_FAC101 * ABSA(IND1(JLAY)+1,IG) + &
245                &    Z_FAC011 * ABSA(IND1(JLAY)+9,IG) + &
246                &    Z_FAC111 * ABSA(IND1(JLAY)+10,IG))
247            ENDIF
248
249        P_TAU(JLON,NGS11+IG,JLAY) = ZTAU_MAJOR + ZTAU_MAJOR1 &
250         & + ZTAUSELF + ZTAUFOR &
251         & + P_TAUAERL(JLON,JLAY,12) 
252        PFRAC(JLON,NGS11+IG,JLAY) = FRACREFA(IG,JPL) + Z_FPL *&
253         & (FRACREFA(IG,JPL+1) - FRACREFA(IG,JPL))
254      ENDDO
255    ENDIF
256
257!-- JJM_000517
258    IF (JLAY > K_LAYTROP(JLON)) THEN
259!CDIR UNROLL=NG12
260      DO IG = 1, NG12
261!-- JJM_000517
262        P_TAU(JLON,NGS11+IG,JLAY) = P_TAUAERL(JLON,JLAY,12)
263        PFRAC(JLON,NGS11+IG,JLAY) = 0.0_JPRB
264      ENDDO
265    ENDIF
266  ENDDO
267ENDDO
268
269IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL12',1,ZHOOK_HANDLE)
270
271END ASSOCIATE
272END SUBROUTINE RRTM_TAUMOL12
Note: See TracBrowser for help on using the repository browser.