source: LMDZ6/branches/SETHET_DECOUPLE/libf/phylmd/rrtm/rrtm_taumol2.F90 @ 5441

Last change on this file since 5441 was 2871, checked in by fhourdin, 8 years ago

Modification d'une correction pour permettre au cas GABLS4 de tourner
Tres tres louche...

  • 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: 5.8 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
25!  Input
26!#include "yoeratm.h"
27
28IMPLICIT NONE
29
30INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV
31REAL(KIND=JPRB)   ,INTENT(OUT)   :: P_TAU(JPGPT,JPLAY)
32REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLDRY(JPLAY)
33REAL(KIND=JPRB)   ,INTENT(IN)    :: P_TAUAERL(JPLAY,JPBAND)
34REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC00(JPLAY)
35REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC01(JPLAY)
36REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC10(JPLAY)
37REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FAC11(JPLAY)
38REAL(KIND=JPRB)   ,INTENT(IN)    :: P_FORFAC(JPLAY)
39INTEGER(KIND=JPIM),INTENT(IN)    :: K_JP(JPLAY)
40INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT(JPLAY)
41INTEGER(KIND=JPIM),INTENT(IN)    :: K_JT1(JPLAY)
42REAL(KIND=JPRB)   ,INTENT(IN)    :: P_COLH2O(JPLAY)
43INTEGER(KIND=JPIM),INTENT(IN)    :: K_LAYTROP
44REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFAC(JPLAY)
45REAL(KIND=JPRB)   ,INTENT(IN)    :: P_SELFFRAC(JPLAY)
46INTEGER(KIND=JPIM),INTENT(IN)    :: K_INDSELF(JPLAY)
47REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFRAC(JPGPT,JPLAY)
48!  Output
49!- from AER
50!- from INTFAC     
51!- from INTIND
52!- from PROFDATA             
53!- from SELF             
54!- from SP             
55REAL(KIND=JPRB) :: Z_FC00(JPLAY),Z_FC01(JPLAY),Z_FC10(JPLAY),Z_FC11(JPLAY)
56!      REAL TAUAER(JPLAY)
57REAL(KIND=JPRB) :: Z_FRACINT(JPLAY)
58INTEGER(KIND=JPIM) :: IND0(JPLAY),IND1(JPLAY),INDS(JPLAY), INDEX(JPLAY)
59
60INTEGER(KIND=JPIM) :: IFP, IFRAC, IG, JFRAC, I_LAY
61
62REAL(KIND=JPRB) :: Z_FP, Z_H2OPARAM, Z_WATER
63REAL(KIND=JPRB) :: ZHOOK_HANDLE
64
65!      EQUIVALENCE (TAUAERL(1,2),TAUAER)
66
67!     Compute the optical depth by interpolating in ln(pressure) and
68!     temperature.  Below LAYTROP, the water vapor self-continuum is
69!     interpolated (in temperature) separately.
70
71IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL2',0,ZHOOK_HANDLE)
72DO I_LAY = 1, K_LAYTROP
73  Z_WATER = 1.E20_JPRB * P_COLH2O(I_LAY) / P_COLDRY(I_LAY)
74  Z_H2OPARAM = Z_WATER/(Z_WATER +.002_JPRB)
75 
76!  DO IFRAC = 2, 12
77!    IF (H2OPARAM  >=  REFPARAM(IFRAC)) GO TO 1900
78!  ENDDO
79!  1900 CONTINUE
80!  FRACINT(LAY) = (H2OPARAM-REFPARAM(IFRAC))/&
81!   &(REFPARAM(IFRAC-1)-REFPARAM(IFRAC))
82  IFRAC=INDEX(I_LAY)
83  IF (Z_H2OPARAM >= REFPARAM(2)) THEN
84          IFRAC=2
85  ELSE
86!cdir unroll=11
87    DO JFRAC = 2, 12
88      IF (Z_H2OPARAM < REFPARAM(JFRAC)) THEN
89         IFRAC=JFRAC+1
90      ENDIF 
91    ENDDO
92  ENDIF 
93 
94!---- JJM_000714
95! set above IFRAC instead of INDEX(I_LAY), store now - NEC jh
96! IFRAC=INDEX(I_LAY)
97  INDEX(I_LAY)=IFRAC
98
99  Z_FRACINT(I_LAY) = (Z_H2OPARAM-REFPARAM(IFRAC))/&
100   & (REFPARAM(IFRAC-1)-REFPARAM(IFRAC)) 
101ENDDO
102
103DO I_LAY = 1, K_LAYTROP
104
105  Z_FP = P_FAC11(I_LAY) + P_FAC01(I_LAY)
106  IFP = 2.E2_JPRB*Z_FP+0.5_JPRB
107
108!---MI 981104       
109!       IF (IFP.LE.0) IFP=0
110
111  IFP=MAX(0,IFP)
112
113! FH 2017/05/02
114! Modification parce qu'on avait un plantage sur un cas 1D.
115! C'est evidemment une correction suspecte
116  IF (IFP>200) THEN
117      PRINT*,'WARNING IFP=',IFP,' 2.E2_JPRB*Z_FP+0.5_JPRB avec Z_FP=',Z_FP
118      IFP=200
119  ENDIF
120
121  Z_FC00(I_LAY) = P_FAC00(I_LAY) * CORR2(IFP)
122  Z_FC10(I_LAY) = P_FAC10(I_LAY) * CORR2(IFP)
123  Z_FC01(I_LAY) = P_FAC01(I_LAY) * CORR1(IFP)
124  Z_FC11(I_LAY) = P_FAC11(I_LAY) * CORR1(IFP)
125  IND0(I_LAY) = ((K_JP(I_LAY)-1)*5+(K_JT(I_LAY)-1))*NSPA(2) + 1
126  IND1(I_LAY) = (K_JP(I_LAY)*5+(K_JT1(I_LAY)-1))*NSPA(2) + 1
127  INDS(I_LAY) = K_INDSELF(I_LAY)
128ENDDO
129
130!-- DS_000515 
131DO IG = 1, NG2
132  DO I_LAY = 1, K_LAYTROP
133!-- JJM_000714
134    IFRAC=INDEX(I_LAY) 
135!-- DS_000515 
136    P_TAU (NGS1+IG,I_LAY) = P_COLH2O(I_LAY) *&
137     & (Z_FC00(I_LAY) * ABSA(IND0(I_LAY)  ,IG) +&
138     & Z_FC10(I_LAY) * ABSA(IND0(I_LAY)+1,IG) +&
139     & Z_FC01(I_LAY) * ABSA(IND1(I_LAY)  ,IG) +&
140     & Z_FC11(I_LAY) * ABSA(IND1(I_LAY)+1,IG) +&
141     & P_SELFFAC(I_LAY) * (SELFREF(INDS(I_LAY),IG) + &
142     & P_SELFFRAC(I_LAY) *&
143     & (SELFREF(INDS(I_LAY)+1,IG) - SELFREF(INDS(I_LAY),IG)))&
144     & + P_FORFAC(I_LAY) * FORREF(IG) ) &
145     & + P_TAUAERL(I_LAY,2) 
146    PFRAC(NGS1+IG,I_LAY) = FRACREFA(IG,IFRAC) + Z_FRACINT(I_LAY) *&
147     & (FRACREFA(IG,IFRAC-1)-FRACREFA(IG,IFRAC)) 
148  ENDDO
149ENDDO
150
151DO I_LAY = K_LAYTROP+1, KLEV
152  Z_FP = P_FAC11(I_LAY) + P_FAC01(I_LAY)
153  IFP = 2.E2_JPRB*Z_FP+0.5_JPRB
154
155!---MI 981104       
156  IF (IFP <= 0) IFP=0
157  IF (IFP>200) THEN
158      PRINT*,'WARNING IFP=',IFP,' 2.E2_JPRB*Z_FP+0.5_JPRB avec Z_FP=',Z_FP
159      IFP=200
160  ENDIF
161
162  Z_FC00(I_LAY) = P_FAC00(I_LAY) * CORR2(IFP)
163  Z_FC10(I_LAY) = P_FAC10(I_LAY) * CORR2(IFP)
164  Z_FC01(I_LAY) = P_FAC01(I_LAY) * CORR1(IFP)
165  Z_FC11(I_LAY) = P_FAC11(I_LAY) * CORR1(IFP)
166  IND0(I_LAY) = ((K_JP(I_LAY)-13)*5+(K_JT(I_LAY)-1))*NSPB(2) + 1
167  IND1(I_LAY) = ((K_JP(I_LAY)-12)*5+(K_JT1(I_LAY)-1))*NSPB(2) + 1
168ENDDO
169
170!-- JJM_000517
171DO IG = 1, NG2
172  DO I_LAY = K_LAYTROP+1, KLEV
173!-- JJM_000517
174    P_TAU (NGS1+IG,I_LAY) = P_COLH2O(I_LAY) *&
175     & (Z_FC00(I_LAY) * ABSB(IND0(I_LAY)  ,IG) +&
176     & Z_FC10(I_LAY) * ABSB(IND0(I_LAY)+1,IG) +&
177     & Z_FC01(I_LAY) * ABSB(IND1(I_LAY)  ,IG) +&
178     & Z_FC11(I_LAY) * ABSB(IND1(I_LAY)+1,IG)&
179     & + P_FORFAC(I_LAY) * FORREF(IG) ) &
180     & + P_TAUAERL(I_LAY,2) 
181    PFRAC(NGS1+IG,I_LAY) = FRACREFB(IG)
182  ENDDO
183ENDDO
184
185IF (LHOOK) CALL DR_HOOK('RRTM_TAUMOL2',1,ZHOOK_HANDLE)
186END SUBROUTINE RRTM_TAUMOL2
Note: See TracBrowser for help on using the repository browser.