source: LMDZ6/branches/Amaury_dev/libf/phylmd/rrtm/rrtm_taumol2.F90 @ 5154

Last change on this file since 5154 was 5133, checked in by abarral, 5 months ago

Fix 1D, rrtm & ecrad compilation

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 6.2 KB
Line 
1!----------------------------------------------------------------------------
2SUBROUTINE 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
16USE PARKIND1  ,ONLY : JPIM     ,JPRB
17USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
18
19USE PARRRTM  , ONLY : JPLAY  ,JPBAND ,JPGPT  ,NG2   ,NGS1
20USE YOERRTWN , ONLY :      NSPA   ,NSPB
21USE YOERRTA2 , ONLY : ABSA   ,ABSB   ,FRACREFA, FRACREFB,&
22 & FORREF   ,SELFREF , REFPARAM 
23USE YOERRTBG2, ONLY : CORR1  ,CORR2
24
25USE lmdz_print_control, ONLY: mydebug=>debug , lunout, prt_level, &
26 & alert_first_call, call_alert, prt_alerte
27
28!  Input
29!#include "yoeratm.h"
30
31IMPLICIT NONE
32
33INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV
34REAL(KIND=JPRB)   ,INTENT(OUT)   :: P_TAU(JPGPT,JPLAY)
35REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLDRY(JPLAY)
36REAL(KIND=JPRB)   ,INTENT(IN)    :: P_TAUAERL(JPLAY,JPBAND)
37REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC00(JPLAY)
38REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC01(JPLAY)
39REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC10(JPLAY)
40REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC11(JPLAY)
41REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FORFAC(JPLAY)
42INTEGER(KIND=JPIM),INTENT(IN)    :: K_JP(JPLAY)
43INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT(JPLAY)
44INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT1(JPLAY)
45REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLH2O(JPLAY)
46INTEGER(KIND=JPIM),INTENT(IN)    :: K_LAYTROP
47REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFAC(JPLAY)
48REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFRAC(JPLAY)
49INTEGER(KIND=JPIM),INTENT(IN)    :: K_INDSELF(JPLAY)
50REAL(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             
58REAL(KIND=JPRB) :: Z_FC00(JPLAY),Z_FC01(JPLAY),Z_FC10(JPLAY),Z_FC11(JPLAY)
59!      REAL TAUAER(JPLAY)
60REAL(KIND=JPRB) :: Z_FRACINT(JPLAY)
61INTEGER(KIND=JPIM) :: IND0(JPLAY),IND1(JPLAY),INDS(JPLAY), INDEX(JPLAY)
62
63INTEGER(KIND=JPIM) :: IFP, IFRAC, IG, JFRAC, I_LAY
64
65REAL(KIND=JPRB) :: Z_FP, Z_H2OPARAM, Z_WATER
66REAL(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
77IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL2',0,ZHOOK_HANDLE)
78DO I_LAY = 1, K_LAYTROP
79  Z_WATER = 1.E20_JPRB * P_COLH2O(I_LAY) / P_COLDRY(I_LAY)
80  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  IFRAC=INDEX(I_LAY)
89  IF (Z_H2OPARAM >= REFPARAM(2)) THEN
90          IFRAC=2
91  ELSE
92!cdir unroll=11
93    DO JFRAC = 2, 12
94      IF (Z_H2OPARAM < REFPARAM(JFRAC)) THEN
95         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  INDEX(I_LAY)=IFRAC
104
105  Z_FRACINT(I_LAY) = (Z_H2OPARAM-REFPARAM(IFRAC))/&
106   & (REFPARAM(IFRAC-1)-REFPARAM(IFRAC)) 
107ENDDO
108
109DO I_LAY = 1, K_LAYTROP
110
111  Z_FP = P_FAC11(I_LAY) + P_FAC01(I_LAY)
112  IFP = 2.E2_JPRB*Z_FP+0.5_JPRB
113
114!---MI 981104       
115!       IF (IFP.LE.0) IFP=0
116
117  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  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  Z_FC00(I_LAY) = P_FAC00(I_LAY) * CORR2(IFP)
132  Z_FC10(I_LAY) = P_FAC10(I_LAY) * CORR2(IFP)
133  Z_FC01(I_LAY) = P_FAC01(I_LAY) * CORR1(IFP)
134  Z_FC11(I_LAY) = P_FAC11(I_LAY) * CORR1(IFP)
135  IND0(I_LAY) = ((K_JP(I_LAY)-1)*5+(K_JT(I_LAY)-1))*NSPA(2) + 1
136  IND1(I_LAY) = (K_JP(I_LAY)*5+(K_JT1(I_LAY)-1))*NSPA(2) + 1
137  INDS(I_LAY) = K_INDSELF(I_LAY)
138ENDDO
139
140!-- DS_000515 
141DO IG = 1, NG2
142  DO I_LAY = 1, K_LAYTROP
143!-- JJM_000714
144    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     & + P_TAUAERL(I_LAY,2) 
156    PFRAC(NGS1+IG,I_LAY) = FRACREFA(IG,IFRAC) + Z_FRACINT(I_LAY) *&
157     & (FRACREFA(IG,IFRAC-1)-FRACREFA(IG,IFRAC)) 
158  ENDDO
159ENDDO
160
161DO I_LAY = K_LAYTROP+1, KLEV
162  Z_FP = P_FAC11(I_LAY) + P_FAC01(I_LAY)
163  IFP = 2.E2_JPRB*Z_FP+0.5_JPRB
164
165!---MI 981104       
166  IF (IFP <= 0) IFP=0
167  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  Z_FC00(I_LAY) = P_FAC00(I_LAY) * CORR2(IFP)
177  Z_FC10(I_LAY) = P_FAC10(I_LAY) * CORR2(IFP)
178  Z_FC01(I_LAY) = P_FAC01(I_LAY) * CORR1(IFP)
179  Z_FC11(I_LAY) = P_FAC11(I_LAY) * CORR1(IFP)
180  IND0(I_LAY) = ((K_JP(I_LAY)-13)*5+(K_JT(I_LAY)-1))*NSPB(2) + 1
181  IND1(I_LAY) = ((K_JP(I_LAY)-12)*5+(K_JT1(I_LAY)-1))*NSPB(2) + 1
182ENDDO
183
184!-- JJM_000517
185DO IG = 1, NG2
186  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     & + P_TAUAERL(I_LAY,2) 
195    PFRAC(NGS1+IG,I_LAY) = FRACREFB(IG)
196  ENDDO
197ENDDO
198
199IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL2',1,ZHOOK_HANDLE)
200END SUBROUTINE RRTM_TAUMOL2
Note: See TracBrowser for help on using the repository browser.