GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/rrtm/rrtm_taumol2.F90 Lines: 46 56 82.1 %
Date: 2023-06-30 12:56:34 Branches: 25 34 73.5 %

Line Branch Exec Source
1
!----------------------------------------------------------------------------
2
71568
SUBROUTINE RRTM_TAUMOL2 (KLEV,P_TAU,P_COLDRY,&
3
 & P_TAUAERL,P_FAC00,P_FAC01,P_FAC10,P_FAC11,P_FORFAC,K_JP,K_JT,K_JT1,&
4
 & P_COLH2O,K_LAYTROP,P_SELFFAC,P_SELFFRAC,K_INDSELF,PFRAC)
5
6
!     BAND 2:  250-500 cm-1 (low - H2O; high - H2O)
7
8
! Modifications
9
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
10
11
!     D Salmond   2000-05-15 speed-up
12
!     JJMorcrette 2000-05-17 speed-up
13
!     JJMorcrette 2000-07-14 bugfix
14
!     Y. Seity    2006-09-26 Nec optimisation
15
16
USE PARKIND1  ,ONLY : JPIM     ,JPRB
17
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
18
19
USE PARRRTM  , ONLY : JPLAY  ,JPBAND ,JPGPT  ,NG2   ,NGS1
20
USE YOERRTWN , ONLY :      NSPA   ,NSPB
21
USE YOERRTA2 , ONLY : ABSA   ,ABSB   ,FRACREFA, FRACREFB,&
22
 & FORREF   ,SELFREF , REFPARAM
23
USE YOERRTBG2, ONLY : CORR1  ,CORR2
24
25
USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level, &
26
 & alert_first_call, call_alert, prt_alerte
27
28
!  Input
29
!#include "yoeratm.h"
30
31
IMPLICIT NONE
32
33
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV
34
REAL(KIND=JPRB)   ,INTENT(OUT)   :: P_TAU(JPGPT,JPLAY)
35
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLDRY(JPLAY)
36
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_TAUAERL(JPLAY,JPBAND)
37
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC00(JPLAY)
38
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC01(JPLAY)
39
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC10(JPLAY)
40
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC11(JPLAY)
41
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FORFAC(JPLAY)
42
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JP(JPLAY)
43
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT(JPLAY)
44
INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT1(JPLAY)
45
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLH2O(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
!  Output
52
!- from AER
53
!- from INTFAC
54
!- from INTIND
55
!- from PROFDATA
56
!- from SELF
57
!- from SP
58
REAL(KIND=JPRB) :: Z_FC00(JPLAY),Z_FC01(JPLAY),Z_FC10(JPLAY),Z_FC11(JPLAY)
59
!      REAL TAUAER(JPLAY)
60
REAL(KIND=JPRB) :: Z_FRACINT(JPLAY)
61
INTEGER(KIND=JPIM) :: IND0(JPLAY),IND1(JPLAY),INDS(JPLAY), INDEX(JPLAY)
62
63
INTEGER(KIND=JPIM) :: IFP, IFRAC, IG, JFRAC, I_LAY
64
65
REAL(KIND=JPRB) :: Z_FP, Z_H2OPARAM, Z_WATER
66
REAL(KIND=JPRB) :: ZHOOK_HANDLE
67
68
!      EQUIVALENCE (TAUAERL(1,2),TAUAER)
69
70
    CHARACTER (LEN=20) :: modname='rrtm_taumol2'
71
    CHARACTER*80 message
72
73
!     Compute the optical depth by interpolating in ln(pressure) and
74
!     temperature.  Below LAYTROP, the water vapor self-continuum is
75
!     interpolated (in temperature) separately.
76
77
71568
IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL2',0,ZHOOK_HANDLE)
78
1574496
DO I_LAY = 1, K_LAYTROP
79
1502928
  Z_WATER = 1.E20_JPRB * P_COLH2O(I_LAY) / P_COLDRY(I_LAY)
80
1502928
  Z_H2OPARAM = Z_WATER/(Z_WATER +.002_JPRB)
81
82
!  DO IFRAC = 2, 12
83
!    IF (H2OPARAM  >=  REFPARAM(IFRAC)) GO TO 1900
84
!  ENDDO
85
!  1900 CONTINUE
86
!  FRACINT(LAY) = (H2OPARAM-REFPARAM(IFRAC))/&
87
!   &(REFPARAM(IFRAC-1)-REFPARAM(IFRAC))
88
1502928
  IFRAC=INDEX(I_LAY)
89
1502928
  IF (Z_H2OPARAM >= REFPARAM(2)) THEN
90
          IFRAC=2
91
  ELSE
92
!cdir unroll=11
93
15360120
    DO JFRAC = 2, 12
94
15360120
      IF (Z_H2OPARAM < REFPARAM(JFRAC)) THEN
95
6916998
         IFRAC=JFRAC+1
96
      ENDIF
97
    ENDDO
98
  ENDIF
99
100
!---- JJM_000714
101
! set above IFRAC instead of INDEX(I_LAY), store now - NEC jh
102
! IFRAC=INDEX(I_LAY)
103
1502928
  INDEX(I_LAY)=IFRAC
104
105
  Z_FRACINT(I_LAY) = (Z_H2OPARAM-REFPARAM(IFRAC))/&
106
1574496
   & (REFPARAM(IFRAC-1)-REFPARAM(IFRAC))
107
ENDDO
108
109
1574496
DO I_LAY = 1, K_LAYTROP
110
111
1502928
  Z_FP = P_FAC11(I_LAY) + P_FAC01(I_LAY)
112
1502928
  IFP = 2.E2_JPRB*Z_FP+0.5_JPRB
113
114
!---MI 981104
115
!       IF (IFP.LE.0) IFP=0
116
117
1502928
  IFP=MAX(0,IFP)
118
119
! FH 2017/05/02
120
! Modification parce qu'on avait un plantage sur un cas 1D.
121
! C'est evidemment une correction suspecte
122
1502928
  IF (IFP>200) THEN
123
   IF (call_alert) THEN
124
      message='WARNING IFP='
125
      CALL prt_alerte(message,modname,1)
126
      PRINT*,'WARNING IFP=',IFP,' 2.E2_JPRB*Z_FP+0.5_JPRB avec Z_FP=',Z_FP
127
   ENDIF
128
   IFP=200
129
  ENDIF
130
131
1502928
  Z_FC00(I_LAY) = P_FAC00(I_LAY) * CORR2(IFP)
132
1502928
  Z_FC10(I_LAY) = P_FAC10(I_LAY) * CORR2(IFP)
133
1502928
  Z_FC01(I_LAY) = P_FAC01(I_LAY) * CORR1(IFP)
134
1502928
  Z_FC11(I_LAY) = P_FAC11(I_LAY) * CORR1(IFP)
135
1502928
  IND0(I_LAY) = ((K_JP(I_LAY)-1)*5+(K_JT(I_LAY)-1))*NSPA(2) + 1
136
1502928
  IND1(I_LAY) = (K_JP(I_LAY)*5+(K_JT1(I_LAY)-1))*NSPA(2) + 1
137
1574496
  INDS(I_LAY) = K_INDSELF(I_LAY)
138
ENDDO
139
140
!-- DS_000515
141
1073520
DO IG = 1, NG2
142
22114512
  DO I_LAY = 1, K_LAYTROP
143
!-- JJM_000714
144
21040992
    IFRAC=INDEX(I_LAY)
145
!-- DS_000515
146
    P_TAU (NGS1+IG,I_LAY) = P_COLH2O(I_LAY) *&
147
     & (Z_FC00(I_LAY) * ABSA(IND0(I_LAY)  ,IG) +&
148
     & Z_FC10(I_LAY) * ABSA(IND0(I_LAY)+1,IG) +&
149
     & Z_FC01(I_LAY) * ABSA(IND1(I_LAY)  ,IG) +&
150
     & Z_FC11(I_LAY) * ABSA(IND1(I_LAY)+1,IG) +&
151
     & P_SELFFAC(I_LAY) * (SELFREF(INDS(I_LAY),IG) + &
152
     & P_SELFFRAC(I_LAY) *&
153
     & (SELFREF(INDS(I_LAY)+1,IG) - SELFREF(INDS(I_LAY),IG)))&
154
     & + P_FORFAC(I_LAY) * FORREF(IG) ) &
155
21040992
     & + P_TAUAERL(I_LAY,2)
156
    PFRAC(NGS1+IG,I_LAY) = FRACREFA(IG,IFRAC) + Z_FRACINT(I_LAY) *&
157
22042944
     & (FRACREFA(IG,IFRAC-1)-FRACREFA(IG,IFRAC))
158
  ENDDO
159
ENDDO
160
161
1359792
DO I_LAY = K_LAYTROP+1, KLEV
162
1288224
  Z_FP = P_FAC11(I_LAY) + P_FAC01(I_LAY)
163
1288224
  IFP = 2.E2_JPRB*Z_FP+0.5_JPRB
164
165
!---MI 981104
166
1288224
  IF (IFP <= 0) IFP=0
167
1288224
  IF (IFP>200) THEN
168
   IF (call_alert) THEN
169
      message='WARNING IFP='
170
      CALL prt_alerte(message,modname,1)
171
      PRINT*,'WARNING IFP=',IFP,' 2.E2_JPRB*Z_FP+0.5_JPRB avec Z_FP=',Z_FP
172
   ENDIF
173
   IFP=200
174
  ENDIF
175
176
1288224
  Z_FC00(I_LAY) = P_FAC00(I_LAY) * CORR2(IFP)
177
1288224
  Z_FC10(I_LAY) = P_FAC10(I_LAY) * CORR2(IFP)
178
1288224
  Z_FC01(I_LAY) = P_FAC01(I_LAY) * CORR1(IFP)
179
1288224
  Z_FC11(I_LAY) = P_FAC11(I_LAY) * CORR1(IFP)
180
1288224
  IND0(I_LAY) = ((K_JP(I_LAY)-13)*5+(K_JT(I_LAY)-1))*NSPB(2) + 1
181
1359792
  IND1(I_LAY) = ((K_JP(I_LAY)-12)*5+(K_JT1(I_LAY)-1))*NSPB(2) + 1
182
ENDDO
183
184
!-- JJM_000517
185
1073520
DO IG = 1, NG2
186
19108656
  DO I_LAY = K_LAYTROP+1, KLEV
187
!-- JJM_000517
188
    P_TAU (NGS1+IG,I_LAY) = P_COLH2O(I_LAY) *&
189
     & (Z_FC00(I_LAY) * ABSB(IND0(I_LAY)  ,IG) +&
190
     & Z_FC10(I_LAY) * ABSB(IND0(I_LAY)+1,IG) +&
191
     & Z_FC01(I_LAY) * ABSB(IND1(I_LAY)  ,IG) +&
192
     & Z_FC11(I_LAY) * ABSB(IND1(I_LAY)+1,IG)&
193
     & + P_FORFAC(I_LAY) * FORREF(IG) ) &
194
18035136
     & + P_TAUAERL(I_LAY,2)
195
19037088
    PFRAC(NGS1+IG,I_LAY) = FRACREFB(IG)
196
  ENDDO
197
ENDDO
198
199
71568
IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL2',1,ZHOOK_HANDLE)
200
71568
END SUBROUTINE RRTM_TAUMOL2