GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/rrtm/rrtm_taumol3.F90 Lines: 64 67 95.5 %
Date: 2023-06-30 12:56:34 Branches: 20 24 83.3 %

Line Branch Exec Source
1
!----------------------------------------------------------------------------
2
71568
SUBROUTINE RRTM_TAUMOL3 (KLEV,P_TAU,&
3
 & P_TAUAERL,P_FAC00,P_FAC01,P_FAC10,P_FAC11,P_FORFAC,K_JP,K_JT,K_JT1,P_ONEMINUS,&
4
 & P_COLH2O,P_COLCO2,P_COLN2O,K_LAYTROP,P_SELFFAC,P_SELFFRAC,K_INDSELF,PFRAC)
5
6
!     BAND 3:  500-630 cm-1 (low - H2O,CO2; high - H2O,CO2)
7
8
! Modifications
9
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
10
11
!     D Salmond 2000-05-15 speed-up
12
13
USE PARKIND1  ,ONLY : JPIM     ,JPRB
14
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
15
16
USE PARRRTM  , ONLY : JPLAY  ,JPBAND ,JPGPT  ,NG3   ,NGS2
17
USE YOERRTWN , ONLY :      NSPA   ,NSPB
18
USE YOERRTA3 , ONLY : ABSA   ,ABSB   ,FRACREFA, FRACREFB,&
19
 & FORREF   ,SELFREF , ABSN2OA ,&
20
 & ABSN2OB  ,ETAREF ,H2OREF ,N2OREF  , CO2REF  ,&
21
 & STRRAT
22
23
!  Input
24
!#include "yoeratm.h"
25
26
!      REAL TAUAER(JPLAY)
27
28
IMPLICIT NONE
29
30
!  Output
31
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV
32
REAL(KIND=JPRB)   ,INTENT(OUT)   :: P_TAU(JPGPT,JPLAY)
33
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_TAUAERL(JPLAY,JPBAND)
34
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC00(JPLAY)
35
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC01(JPLAY)
36
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC10(JPLAY)
37
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC11(JPLAY)
38
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FORFAC(JPLAY)
39
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JP(JPLAY)
40
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT(JPLAY)
41
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT1(JPLAY)
42
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_ONEMINUS
43
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLH2O(JPLAY)
44
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLCO2(JPLAY)
45
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLN2O(JPLAY)
46
INTEGER(KIND=JPIM),INTENT(IN)    :: K_LAYTROP
47
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFAC(JPLAY)
48
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFRAC(JPLAY)
49
INTEGER(KIND=JPIM),INTENT(IN)    :: K_INDSELF(JPLAY)
50
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFRAC(JPGPT,JPLAY)
51
!- from AER
52
!- from INTFAC
53
!- from INTIND
54
!- from PRECISE
55
!- from PROFDATA
56
!- from SELF
57
!- from SP
58
INTEGER(KIND=JPIM) :: IJS(JPLAY)
59
REAL(KIND=JPRB) :: ZFS(JPLAY),Z_SPECCOMB(JPLAY)
60
INTEGER(KIND=JPIM) :: IND0(JPLAY),IND1(JPLAY),INDS(JPLAY)
61
REAL(KIND=JPRB) :: Z_N2OMULT(JPLAY)
62
63
INTEGER(KIND=JPIM) :: IG, JS, I_LAY, I_NS
64
65
REAL(KIND=JPRB) :: Z_COLREF1, Z_COLREF2, Z_CURRN2O, Z_FAC000, Z_FAC001,&
66
 & Z_FAC010, Z_FAC011, Z_FAC100, Z_FAC101, Z_FAC110, Z_FAC111, &
67
 & Z_FP, Z_FS, Z_RATIO, Z_SPECMULT, Z_SPECPARM, Z_WCOMB1, &
68
 & Z_WCOMB2
69
REAL(KIND=JPRB) :: ZHOOK_HANDLE
70
71
!      EQUIVALENCE (TAUAERL(1,3),TAUAER)
72
73
!     Compute the optical depth by interpolating in ln(pressure),
74
!     temperature, and appropriate species.  Below LAYTROP, the water
75
!     vapor self-continuum is interpolated (in temperature) separately.
76
77
71568
IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL3',0,ZHOOK_HANDLE)
78
1574496
DO I_LAY = 1, K_LAYTROP
79
1502928
  Z_SPECCOMB(I_LAY) = P_COLH2O(I_LAY) + STRRAT*P_COLCO2(I_LAY)
80
1502928
  Z_SPECPARM = P_COLH2O(I_LAY)/Z_SPECCOMB(I_LAY)
81
1502928
  Z_SPECPARM=MIN(P_ONEMINUS,Z_SPECPARM)
82
1502928
  Z_SPECMULT = 8._JPRB*(Z_SPECPARM)
83
1502928
  JS = 1 + INT(Z_SPECMULT)
84
1502928
  Z_FS = MOD(Z_SPECMULT,1.0_JPRB)
85
1502928
  IF (JS  ==  8) THEN
86
530779
    IF (Z_FS  >=  0.9_JPRB) THEN
87
      JS = 9
88
      Z_FS = 10._JPRB * (Z_FS - 0.9_JPRB)
89
    ELSE
90
530779
      Z_FS = Z_FS/0.9_JPRB
91
    ENDIF
92
  ENDIF
93
94
1502928
  I_NS = JS + INT(Z_FS + 0.5_JPRB)
95
1502928
  Z_FP = P_FAC01(I_LAY) + P_FAC11(I_LAY)
96
1502928
  IND0(I_LAY) = ((K_JP(I_LAY)-1)*5+(K_JT(I_LAY)-1))*NSPA(3) + JS
97
1502928
  IND1(I_LAY) = (K_JP(I_LAY)*5+(K_JT1(I_LAY)-1))*NSPA(3) + JS
98
1502928
  INDS(I_LAY) = K_INDSELF(I_LAY)
99
1502928
  Z_COLREF1 = N2OREF(K_JP(I_LAY))
100
1502928
  Z_COLREF2 = N2OREF(K_JP(I_LAY)+1)
101
1502928
  IF (I_NS  ==  10) THEN
102
    Z_WCOMB1 = 1.0_JPRB/H2OREF(K_JP(I_LAY))
103
    Z_WCOMB2 = 1.0_JPRB/H2OREF(K_JP(I_LAY)+1)
104
  ELSE
105
1502928
    Z_WCOMB1 = (1.0_JPRB-ETAREF(I_NS))/(STRRAT * CO2REF(K_JP(I_LAY)))
106
1502928
    Z_WCOMB2 = (1.0_JPRB-ETAREF(I_NS))/(STRRAT * CO2REF(K_JP(I_LAY)+1))
107
  ENDIF
108
1502928
  Z_RATIO = (Z_COLREF1*Z_WCOMB1)+Z_FP*((Z_COLREF2*Z_WCOMB2)-(Z_COLREF1*Z_WCOMB1))
109
1502928
  Z_CURRN2O = Z_SPECCOMB(I_LAY) * Z_RATIO
110
1502928
  Z_N2OMULT(I_LAY) = P_COLN2O(I_LAY) - Z_CURRN2O
111
112
1502928
  ZFS(I_LAY)=Z_FS
113
1574496
  IJS(I_LAY)=JS
114
115
ENDDO
116
117
!-- DS_000515
118
1216656
DO IG = 1, NG3
119
25263504
  DO I_LAY = 1, K_LAYTROP
120
!-- DS_000515
121
122
24046848
    Z_FS=ZFS(I_LAY)
123
24046848
    JS=IJS(I_LAY)
124
125
!---jjm
126
!    FAC000 = (_ONE_ - FS) * FAC00(LAY)
127
!    FAC010 = (_ONE_ - FS) * FAC10(LAY)
128
!    FAC100 = FS * FAC00(LAY)
129
!    FAC110 = FS * FAC10(LAY)
130
!    FAC001 = (_ONE_ - FS) * FAC01(LAY)
131
!    FAC011 = (_ONE_ - FS) * FAC11(LAY)
132
!    FAC101 = FS * FAC01(LAY)
133
!    FAC111 = FS * FAC11(LAY)
134
!------
135
136
    P_TAU (NGS2+IG,I_LAY) = Z_SPECCOMB(I_LAY) *   &
137
     !-- DS_000515
138
     & ( (1. - Z_FS) *(P_FAC00(I_LAY) * ABSA(IND0(I_LAY)   ,IG) +   &
139
     & P_FAC10(I_LAY) * ABSA(IND0(I_LAY)+10,IG) +   &
140
     & P_FAC01(I_LAY) * ABSA(IND1(I_LAY)   ,IG) +   &
141
     & P_FAC11(I_LAY) * ABSA(IND1(I_LAY)+10,IG))+   &
142
     & Z_FS     *(P_FAC00(I_LAY) * ABSA(IND0(I_LAY)+ 1,IG) +   &
143
     & P_FAC10(I_LAY) * ABSA(IND0(I_LAY)+11,IG) +   &
144
     & P_FAC01(I_LAY) * ABSA(IND1(I_LAY)+ 1,IG) +   &
145
     & P_FAC11(I_LAY) * ABSA(IND1(I_LAY)+11,IG))) + &
146
     !     &(Z_FAC000 * ABSA(IND0(I_LAY)   ,IG) +&
147
     !     & Z_FAC100 * ABSA(IND0(I_LAY)+ 1,IG) +&
148
     !     & Z_FAC010 * ABSA(IND0(I_LAY)+10,IG) +&
149
     !     & Z_FAC110 * ABSA(IND0(I_LAY)+11,IG) +&
150
     !     & Z_FAC001 * ABSA(IND1(I_LAY),   IG) +&
151
     !     & Z_FAC101 * ABSA(IND1(I_LAY)+ 1,IG) +&
152
     !     & Z_FAC011 * ABSA(IND1(I_LAY)+10,IG) +&
153
     !     & Z_FAC111 * ABSA(IND1(I_LAY)+11,IG))+&
154
     !-- DS_000515
155
     & P_COLH2O(I_LAY) * &
156
     & P_SELFFAC(I_LAY) * (SELFREF(INDS(I_LAY),IG) + &
157
     & P_SELFFRAC(I_LAY) *&
158
     & (SELFREF(INDS(I_LAY)+1,IG) - SELFREF(INDS(I_LAY),IG))&
159
     & + P_FORFAC(I_LAY) * FORREF(IG) ) &
160
     & + Z_N2OMULT(I_LAY) * ABSN2OA(IG) &
161
24046848
     & + P_TAUAERL(I_LAY,3)
162
    PFRAC(NGS2+IG,I_LAY) = FRACREFA(IG,JS) + Z_FS *&
163
25191936
     & (FRACREFA(IG,JS+1) - FRACREFA(IG,JS))
164
  ENDDO
165
ENDDO
166
167
1359792
DO I_LAY = K_LAYTROP+1, KLEV
168
1288224
  Z_SPECCOMB(I_LAY) = P_COLH2O(I_LAY) + STRRAT*P_COLCO2(I_LAY)
169
1288224
  Z_SPECPARM = P_COLH2O(I_LAY)/Z_SPECCOMB(I_LAY)
170
1288224
  Z_SPECPARM=MIN(P_ONEMINUS,Z_SPECPARM)
171
1288224
  Z_SPECMULT = 4._JPRB*(Z_SPECPARM)
172
1288224
  JS = 1 + INT(Z_SPECMULT)
173
1288224
  Z_FS = MOD(Z_SPECMULT,1.0_JPRB)
174
1288224
  I_NS = JS + INT(Z_FS + 0.5_JPRB)
175
1288224
  Z_FP = P_FAC01(I_LAY) + P_FAC11(I_LAY)
176
1288224
  IND0(I_LAY) = ((K_JP(I_LAY)-13)*5+(K_JT(I_LAY)-1))*NSPB(3) + JS
177
1288224
  IND1(I_LAY) = ((K_JP(I_LAY)-12)*5+(K_JT1(I_LAY)-1))*NSPB(3) + JS
178
1288224
  Z_COLREF1 = N2OREF(K_JP(I_LAY))
179
1288224
  Z_COLREF2 = N2OREF(K_JP(I_LAY)+1)
180
1288224
  IF (I_NS  ==  5) THEN
181
27631
    Z_WCOMB1 = 1.0_JPRB/H2OREF(K_JP(I_LAY))
182
27631
    Z_WCOMB2 = 1.0_JPRB/H2OREF(K_JP(I_LAY)+1)
183
  ELSE
184
1260593
    Z_WCOMB1 = (1.0_JPRB-ETAREF(I_NS))/(STRRAT * CO2REF(K_JP(I_LAY)))
185
1260593
    Z_WCOMB2 = (1.0_JPRB-ETAREF(I_NS))/(STRRAT * CO2REF(K_JP(I_LAY)+1))
186
  ENDIF
187
1288224
  Z_RATIO = (Z_COLREF1*Z_WCOMB1)+Z_FP*((Z_COLREF2*Z_WCOMB2)-(Z_COLREF1*Z_WCOMB1))
188
1288224
  Z_CURRN2O = Z_SPECCOMB(I_LAY) * Z_RATIO
189
1288224
  Z_N2OMULT(I_LAY) = P_COLN2O(I_LAY) - Z_CURRN2O
190
191
1288224
  ZFS(I_LAY)=Z_FS
192
1359792
  IJS(I_LAY)=JS
193
194
ENDDO
195
196
1359792
DO I_LAY = K_LAYTROP+1, KLEV
197
198
1288224
  Z_FS=ZFS(I_LAY)
199
1288224
  JS=IJS(I_LAY)
200
!---jjm
201
!  FAC000 = (_ONE_ - FS) * FAC00(LAY)
202
!  FAC010 = (_ONE_ - FS) * FAC10(LAY)
203
!  FAC100 = FS * FAC00(LAY)
204
!  FAC110 = FS * FAC10(LAY)
205
!  FAC001 = (_ONE_ - FS) * FAC01(LAY)
206
!  FAC011 = (_ONE_ - FS) * FAC11(LAY)
207
!  FAC101 = FS * FAC01(LAY)
208
!  FAC111 = FS * FAC11(LAY)
209
!---
210
211
21971376
  DO IG = 1, NG3
212
    P_TAU (NGS2+IG,I_LAY) = Z_SPECCOMB(I_LAY) *   &
213
     !-- DS_000515
214
     & ( (1. - Z_FS) *(P_FAC00(I_LAY) * ABSB(IND0(I_LAY)  ,IG) +   &
215
     & P_FAC10(I_LAY) * ABSB(IND0(I_LAY)+5,IG) +   &
216
     & P_FAC01(I_LAY) * ABSB(IND1(I_LAY)  ,IG) +    &
217
     & P_FAC11(I_LAY) * ABSB(IND1(I_LAY)+5,IG))+   &
218
     & Z_FS     *(P_FAC00(I_LAY) * ABSB(IND0(I_LAY)+1,IG) +   &
219
     & P_FAC10(I_LAY) * ABSB(IND0(I_LAY)+6,IG) +   &
220
     & P_FAC01(I_LAY) * ABSB(IND1(I_LAY)+1,IG) +   &
221
     & P_FAC11(I_LAY) * ABSB(IND1(I_LAY)+6,IG)))   &
222
     !     &(Z_FAC000 * ABSB(IND0(I_LAY)  ,IG) +&
223
     !     & Z_FAC100 * ABSB(IND0(I_LAY)+1,IG) +&
224
     !     & Z_FAC010 * ABSB(IND0(I_LAY)+5,IG) +&
225
     !     & Z_FAC110 * ABSB(IND0(I_LAY)+6,IG) +&
226
     !     & Z_FAC001 * ABSB(IND1(I_LAY)  ,IG) +&
227
     !     & Z_FAC101 * ABSB(IND1(I_LAY)+1,IG) +&
228
     !     & Z_FAC011 * ABSB(IND1(I_LAY)+5,IG) +&
229
     !     & Z_FAC111 * ABSB(IND1(I_LAY)+6,IG))&
230
     !-- DS_000515
231
     & + P_COLH2O(I_LAY)*P_FORFAC(I_LAY)*FORREF(IG) &
232
     & + Z_N2OMULT(I_LAY) * ABSN2OB(IG)&
233
20611584
     & + P_TAUAERL(I_LAY,3)
234
    PFRAC(NGS2+IG,I_LAY) = FRACREFB(IG,JS) + Z_FS *&
235
21899808
     & (FRACREFB(IG,JS+1) - FRACREFB(IG,JS))
236
  ENDDO
237
ENDDO
238
239
71568
IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL3',1,ZHOOK_HANDLE)
240
71568
END SUBROUTINE RRTM_TAUMOL3