GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/rrtm/rrtm_taumol4.F90 Lines: 43 44 97.7 %
Date: 2023-06-30 12:51:15 Branches: 17 20 85.0 %

Line Branch Exec Source
1
!----------------------------------------------------------------------------
2
71568
SUBROUTINE RRTM_TAUMOL4 (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_COLO3,K_LAYTROP,P_SELFFAC,P_SELFFRAC,K_INDSELF,PFRAC)
5
6
!     BAND 4:  630-700 cm-1 (low - H2O,CO2; high - O3,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  ,NG4   ,NGS3
17
USE YOERRTWN , ONLY :      NSPA   ,NSPB
18
USE YOERRTA4 , ONLY : ABSA   ,ABSB   ,FRACREFA, FRACREFB,SELFREF,STRRAT1 , STRRAT2
19
20
!  Input
21
!#include "yoeratm.h"
22
23
!      REAL TAUAER(JPLAY)
24
25
IMPLICIT NONE
26
27
!  Output
28
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV
29
REAL(KIND=JPRB)   ,INTENT(OUT)   :: P_TAU(JPGPT,JPLAY)
30
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_TAUAERL(JPLAY,JPBAND)
31
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC00(JPLAY)
32
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC01(JPLAY)
33
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC10(JPLAY)
34
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC11(JPLAY)
35
REAL(KIND=JPRB)                  :: P_FORFAC(JPLAY) ! Argument NOT used
36
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JP(JPLAY)
37
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT(JPLAY)
38
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT1(JPLAY)
39
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_ONEMINUS
40
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLH2O(JPLAY)
41
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLCO2(JPLAY)
42
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLO3(JPLAY)
43
INTEGER(KIND=JPIM),INTENT(IN)    :: K_LAYTROP
44
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFAC(JPLAY)
45
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFRAC(JPLAY)
46
INTEGER(KIND=JPIM),INTENT(IN)    :: K_INDSELF(JPLAY)
47
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFRAC(JPGPT,JPLAY)
48
!- from AER
49
!- from INTFAC
50
!- from INTIND
51
!- from PRECISE
52
!- from PROFDATA
53
!- from SELF
54
!- from SP
55
INTEGER(KIND=JPIM) :: IJS(JPLAY)
56
REAL(KIND=JPRB) :: ZFS(JPLAY),Z_SPECCOMB(JPLAY)
57
INTEGER(KIND=JPIM) :: IND0(JPLAY),IND1(JPLAY),INDS(JPLAY)
58
59
INTEGER(KIND=JPIM) :: IG, JS, I_LAY
60
61
REAL(KIND=JPRB) :: Z_FAC000, Z_FAC001, Z_FAC010, Z_FAC011, Z_FAC100, Z_FAC101,&
62
 & Z_FAC110, Z_FAC111, Z_FS, Z_SPECMULT, Z_SPECPARM
63
REAL(KIND=JPRB) :: ZHOOK_HANDLE
64
65
!      EQUIVALENCE (TAUAERL(1,4),TAUAER)
66
67
!     Compute the optical depth by interpolating in ln(pressure),
68
!     temperature, and appropriate species.  Below LAYTROP, the water
69
!     vapor self-continuum is interpolated (in temperature) separately.
70
71
71568
IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL4',0,ZHOOK_HANDLE)
72
1574496
DO I_LAY = 1, K_LAYTROP
73
1502928
  Z_SPECCOMB(I_LAY) = P_COLH2O(I_LAY) + STRRAT1*P_COLCO2(I_LAY)
74
1502928
  Z_SPECPARM = P_COLH2O(I_LAY)/Z_SPECCOMB(I_LAY)
75
1502928
  Z_SPECPARM=MIN(P_ONEMINUS,Z_SPECPARM)
76
1502928
  Z_SPECMULT = 8._JPRB*(Z_SPECPARM)
77
1502928
  JS = 1 + INT(Z_SPECMULT)
78
1502928
  Z_FS = MOD(Z_SPECMULT,1.0_JPRB)
79
1502928
  IND0(I_LAY) = ((K_JP(I_LAY)-1)*5+(K_JT(I_LAY)-1))*NSPA(4) + JS
80
1502928
  IND1(I_LAY) = (K_JP(I_LAY)*5+(K_JT1(I_LAY)-1))*NSPA(4) + JS
81
1502928
  INDS(I_LAY) = K_INDSELF(I_LAY)
82
83
1502928
  ZFS(I_LAY)=Z_FS
84
1574496
  IJS(I_LAY)=JS
85
86
ENDDO
87
88
!-- DS_000515
89
1073520
DO IG = 1, NG4
90
22114512
  DO I_LAY = 1, K_LAYTROP
91
!-- DS_000515
92
93
21040992
    Z_FS=ZFS(I_LAY)
94
21040992
    JS=IJS(I_LAY)
95
!--jjm
96
!    FAC000 = (_ONE_ - FS) * FAC00(LAY)
97
!    FAC010 = (_ONE_ - FS) * FAC10(LAY)
98
!    FAC100 = FS * FAC00(LAY)
99
!    FAC110 = FS * FAC10(LAY)
100
!    FAC001 = (_ONE_ - FS) * FAC01(LAY)
101
!    FAC011 = (_ONE_ - FS) * FAC11(LAY)
102
!    FAC101 = FS * FAC01(LAY)
103
!    FAC111 = FS * FAC11(LAY)
104
!---
105
106
    P_TAU (NGS3+IG,I_LAY) = Z_SPECCOMB(I_LAY) *    &
107
     !-- DS_000515
108
     & ((1. - Z_FS) *(P_FAC00(I_LAY) * ABSA(IND0(I_LAY)   ,IG) +   &
109
     & P_FAC10(I_LAY) * ABSA(IND0(I_LAY)+ 9,IG) +   &
110
     & P_FAC01(I_LAY) * ABSA(IND1(I_LAY)   ,IG) +    &
111
     & P_FAC11(I_LAY) * ABSA(IND1(I_LAY)+ 9,IG))+   &
112
     & Z_FS     *(P_FAC00(I_LAY) * ABSA(IND0(I_LAY)+ 1,IG) +   &
113
     & P_FAC10(I_LAY) * ABSA(IND0(I_LAY)+10,IG) +   &
114
     & P_FAC01(I_LAY) * ABSA(IND1(I_LAY)+ 1,IG) +   &
115
     & P_FAC11(I_LAY) * ABSA(IND1(I_LAY)+10,IG))) + &
116
     !     &(Z_FAC000 * ABSA(IND0(I_LAY)   ,IG) +&
117
     !     & Z_FAC100 * ABSA(IND0(I_LAY)+ 1,IG) +&
118
     !     & Z_FAC010 * ABSA(IND0(I_LAY)+ 9,IG) +&
119
     !     & Z_FAC110 * ABSA(IND0(I_LAY)+10,IG) +&
120
     !     & Z_FAC001 * ABSA(IND1(I_LAY)   ,IG) +&
121
     !     & Z_FAC101 * ABSA(IND1(I_LAY)+ 1,IG) +&
122
     !     & Z_FAC011 * ABSA(IND1(I_LAY)+ 9,IG) +&
123
     !     & Z_FAC111 * ABSA(IND1(I_LAY)+10,IG))+&
124
     !-- DS_000515
125
     & P_COLH2O(I_LAY) * &
126
     & P_SELFFAC(I_LAY) * (SELFREF(INDS(I_LAY),IG) + &
127
     & P_SELFFRAC(I_LAY) *&
128
     & (SELFREF(INDS(I_LAY)+1,IG) - SELFREF(INDS(I_LAY),IG)))&
129
21040992
     & + P_TAUAERL(I_LAY,4)
130
    PFRAC(NGS3+IG,I_LAY) = FRACREFA(IG,JS) + Z_FS *&
131
22042944
     & (FRACREFA(IG,JS+1) - FRACREFA(IG,JS))
132
  ENDDO
133
ENDDO
134
135
1359792
DO I_LAY = K_LAYTROP+1, KLEV
136
1288224
  Z_SPECCOMB(I_LAY) = P_COLO3(I_LAY) + STRRAT2*P_COLCO2(I_LAY)
137
1288224
  Z_SPECPARM = P_COLO3(I_LAY)/Z_SPECCOMB(I_LAY)
138
1288224
  Z_SPECPARM=MIN(P_ONEMINUS,Z_SPECPARM)
139
1288224
  Z_SPECMULT = 4._JPRB*(Z_SPECPARM)
140
1288224
  JS = 1 + INT(Z_SPECMULT)
141
1288224
  Z_FS = MOD(Z_SPECMULT,1.0_JPRB)
142
1288224
  IF (JS  >  1) THEN
143
    JS = JS + 1
144
1288224
  ELSEIF (Z_FS  >=  0.0024_JPRB) THEN
145
    JS = 2
146
126720
    Z_FS = (Z_FS - 0.0024_JPRB)/0.9976_JPRB
147
  ELSE
148
    JS = 1
149
1161504
    Z_FS = Z_FS/0.0024_JPRB
150
  ENDIF
151
1288224
  IND0(I_LAY) = ((K_JP(I_LAY)-13)*5+(K_JT(I_LAY)-1))*NSPB(4) + JS
152
1288224
  IND1(I_LAY) = ((K_JP(I_LAY)-12)*5+(K_JT1(I_LAY)-1))*NSPB(4) + JS
153
1288224
  ZFS(I_LAY)=Z_FS
154
1359792
  IJS(I_LAY)=JS
155
ENDDO
156
157
1359792
DO I_LAY = K_LAYTROP+1, KLEV
158
1288224
  Z_FS=ZFS(I_LAY)
159
1288224
  JS=IJS(I_LAY)
160
!--- jjm
161
!  FAC000 = (_ONE_ - FS) * FAC00(LAY)
162
!  FAC010 = (_ONE_ - FS) * FAC10(LAY)
163
!  FAC100 = FS * FAC00(LAY)
164
!  FAC110 = FS * FAC10(LAY)
165
!  FAC001 = (_ONE_ - FS) * FAC01(LAY)
166
!  FAC011 = (_ONE_ - FS) * FAC11(LAY)
167
!  FAC101 = FS * FAC01(LAY)
168
!  FAC111 = FS * FAC11(LAY)
169
!------
170
19394928
  DO IG = 1, NG4
171
    P_TAU (NGS3+IG,I_LAY) = Z_SPECCOMB(I_LAY) *   &
172
     !-- DS_000515
173
     & ( (1. - Z_FS) *(P_FAC00(I_LAY) * ABSB(IND0(I_LAY)  ,IG) +   &
174
     & P_FAC10(I_LAY) * ABSB(IND0(I_LAY)+6,IG) +   &
175
     & P_FAC01(I_LAY) * ABSB(IND1(I_LAY)  ,IG) +    &
176
     & P_FAC11(I_LAY) * ABSB(IND1(I_LAY)+6,IG))+   &
177
     & Z_FS     *(P_FAC00(I_LAY) * ABSB(IND0(I_LAY)+1,IG) +   &
178
     & P_FAC10(I_LAY) * ABSB(IND0(I_LAY)+7,IG) +   &
179
     & P_FAC01(I_LAY) * ABSB(IND1(I_LAY)+1,IG) +   &
180
     & P_FAC11(I_LAY) * ABSB(IND1(I_LAY)+7,IG)))   &
181
     !     &(Z_FAC000 * ABSB(IND0(I_LAY)   ,IG) +&
182
     !     & Z_FAC100 * ABSB(IND0(I_LAY)+ 1,IG) +&
183
     !     & Z_FAC010 * ABSB(IND0(I_LAY)+ 6,IG) +&
184
     !     & Z_FAC110 * ABSB(IND0(I_LAY)+ 7,IG) +&
185
     !     & Z_FAC001 * ABSB(IND1(I_LAY)   ,IG) +&
186
     !     & Z_FAC101 * ABSB(IND1(I_LAY)+ 1,IG) +&
187
     !     & Z_FAC011 * ABSB(IND1(I_LAY)+ 6,IG) +&
188
     !     & Z_FAC111 * ABSB(IND1(I_LAY)+ 7,IG))&
189
     !-- DS_000515
190
18035136
     & + P_TAUAERL(I_LAY,4)
191
    PFRAC(NGS3+IG,I_LAY) = FRACREFB(IG,JS) + Z_FS *&
192
19323360
     & (FRACREFB(IG,JS+1) - FRACREFB(IG,JS))
193
  ENDDO
194
ENDDO
195
196
71568
IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL4',1,ZHOOK_HANDLE)
197
71568
END SUBROUTINE RRTM_TAUMOL4