source: dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/rrtm/recmwf_aero.F90

Last change on this file was 3990, checked in by millour, 8 years ago

An updated LMDZ5 (based on LMDZ rev 2786) to play with.
EM

File size: 33.8 KB
Line 
1!
2! $Id: recmwf_aero.F90 2529 2016-05-30 20:46:40Z oboucher $
3!
4!OPTIONS XOPT(NOEVAL)
5SUBROUTINE RECMWF_AERO (KST, KEND, KPROMA, KTDIA , KLEV,&
6 & KMODE,&
7 & PALBD , PALBP , PAPRS , PAPRSF , PCCO2 , PCLFR,&
8 & PQO3  , PAER  , PDP   , PEMIS  , PMU0,&
9 & PQ    , PQS   , PQIWP , PQLWP , PSLM   , PT    , PTS,&
10 & PREF_LIQ, PREF_ICE,&
11!--OB
12 & PREF_LIQ_PI, PREF_ICE_PI,&
13!--fin
14 & PEMTD , PEMTU , PTRSO,&
15 & PTH   , PCTRSO, PCEMTR, PTRSOD,&
16 & PLWFC, PLWFT, PSWFC, PSWFT, PSFSWDIR, PSFSWDIF,&
17 & PFSDNN, PFSDNV,& 
18 & PPIZA_TOT,PCGA_TOT,PTAU_TOT, &
19!--OB
20 & PPIZA_NAT,PCGA_NAT,PTAU_NAT, &
21!--fin OB
22!--C.Kleinschmitt
23 & PTAU_LW_TOT, PTAU_LW_NAT, &
24!--end
25 & PFLUX,PFLUC,&
26 & PFSDN ,PFSUP , PFSCDN , PFSCUP,&
27!--OB diagnostics
28 & PTOPSWADAERO,PSOLSWADAERO,&
29 & PTOPSWAD0AERO,PSOLSWAD0AERO,&
30 & PTOPSWAIAERO,PSOLSWAIAERO,&
31 & PTOPSWCFAERO,PSOLSWCFAERO,&
32!--LW diagnostics CK
33 & PTOPLWADAERO,PSOLLWADAERO,&
34 & PTOPLWAD0AERO,PSOLLWAD0AERO,&
35 & PTOPLWAIAERO,PSOLLWAIAERO,&
36!..end
37 & ok_ade, ok_aie, flag_aerosol,flag_aerosol_strat)
38!--fin
39
40!**** *RECMWF* - METEO-FRANCE RADIATION INTERFACE TO ECMWF RADIATION SCHEME
41
42!     PURPOSE.
43!     --------
44!           SIMPLE INTERFACE TO RADLSW (NO INTERPOLATION)
45
46!**   INTERFACE.
47!     ----------
48
49!     EXPLICIT ARGUMENTS :
50!        --------------------
51! KST    : START INDEX OF DATA IN KPROMA-LONG VECTOR
52! KEND   : END   INDEX OF DATA IN KPROMA-LONG VECTOR
53! KPROMA : VECTOR LENGTH
54! KTDIA  : INDEX OF TOP LEVEL FROM WHICH COMPUTATIONS ARE ACTIVE
55! KLEV   : NUMBER OF LEVELS
56! PAER   : (KPROMA,KLEV ,6)     ; OPTICAL THICKNESS OF THE AEROSOLS
57! PALBD  : (KPROMA,NSW)         ; DIFFUSE ALBEDO IN THE 2 SW INTERVALS
58! PALBP  : (KPROMA,NSW)         ; PARALLEL ALBEDO IN THE 2 SW INTERVALS
59! PAPRS  : (KPROMA,KLEV+1)      ; HALF LEVEL PRESSURE
60! PAPRSF : (KPROMA,KLEV )       ; FULL LEVEL PRESSURE
61! PCCO2  :                      ; CONCENTRATION IN CO2 (PA/PA)
62! PCLFR  : (KPROMA,KLEV )       ; CLOUD FRACTIONAL COVER
63! PQO3   : (KPROMA,KLEV )       ; OZONE MIXING RATIO (MASS)
64! PDP    : (KPROMA,KLEV)        ; LAYER PRESSURE THICKNESS
65! PEMIS  : (KPROMA)             ; SURFACE EMISSIVITY
66! PMU0   : (KPROMA)             ; SOLAR ANGLE
67! PQ     : (KPROMA,KLEV )       ; SPECIFIC HUMIDITY PA/PA
68! PQS    : (KPROMA,KLEV )       ; SATURATION SPECIFIC HUMIDITY PA/PA
69! PQIWP  : (KPROMA,KLEV )       ; ICE    WATER KG/KG
70! PQLWP  : (KPROMA,KLEV )       ; LIQUID WATER KG/KG
71! PSLM   : (KPROMA)             ; LAND-SEA MASK
72! PT     : (KPROMA,KLEV)        ; FULL LEVEL TEMPERATURE
73! PTS    : (KPROMA)             ; SURFACE TEMPERATURE
74! PPIZA_TOT  : (KPROMA,KLEV,NSW); Single scattering albedo of total aerosol
75! PCGA_TOT   : (KPROMA,KLEV,NSW); Assymetry factor for total aerosol
76! PTAU_TOT: (KPROMA,KLEV,NSW)   ; Optical depth of total aerosol
77! PREF_LIQ (KPROMA,KLEV)        ; Liquid droplet radius (um) - present-day
78! PREF_ICE (KPROMA,KLEV)        ; Ice crystal radius (um) - present-day
79!--OB
80! PREF_LIQ_PI (KPROMA,KLEV)     ; Liquid droplet radius (um) - pre-industrial
81! PREF_ICE_PI (KPROMA,KLEV)     ; Ice crystal radius (um) - pre-industrial
82! ok_ade---input-L- apply the Aerosol Direct Effect or not?
83! ok_aie---input-L- apply the Aerosol Indirect Effect or not?
84! flag_aerosol-input-I- aerosol flag from 0 to 6
85! flag_aerosol_strat-input-I- use stratospheric aerosols flag (T/F)
86! PPIZA_NAT  : (KPROMA,KLEV,NSW); Single scattering albedo of natural aerosol
87! PCGA_NAT   : (KPROMA,KLEV,NSW); Assymetry factor for natural aerosol
88! PTAU_NAT: (KPROMA,KLEV,NSW)   ; Optical depth of natural aerosol
89! PTAU_LW_TOT  (KPROMA,KLEV,NLW); LW Optical depth of total aerosols 
90! PTAU_LW_NAT  (KPROMA,KLEV,NLW); LW Optical depth of natural aerosols
91!--fin OB
92
93!     ==== OUTPUTS ===
94! PEMTD (KPROMA,KLEV+1)         ; TOTAL DOWNWARD LONGWAVE EMISSIVITY
95! PEMTU (KPROMA,KLEV+1)         ; TOTAL UPWARD   LONGWAVE EMISSIVITY
96! PTRSO (KPROMA,KLEV+1)         ; TOTAL SHORTWAVE TRANSMISSIVITY
97! PTH   (KPROMA,KLEV+1)         ; HALF LEVEL TEMPERATURE
98! PCTRSO(KPROMA,2)              ; CLEAR-SKY SHORTWAVE TRANSMISSIVITY
99! PCEMTR(KPROMA,2)              ; CLEAR-SKY NET LONGWAVE EMISSIVITY
100! PTRSOD(KPROMA)                ; TOTAL-SKY SURFACE SW TRANSMISSITY
101! PLWFC (KPROMA,2)              ; CLEAR-SKY LONGWAVE FLUXES
102! PLWFT (KPROMA,KLEV+1)         ; TOTAL-SKY LONGWAVE FLUXES
103! PSWFC (KPROMA,2)              ; CLEAR-SKY SHORTWAVE FLUXES
104! PSWFT (KPROMA,KLEV+1)         ; TOTAL-SKY SHORTWAVE FLUXES
105! Ajout flux LW et SW montants et descendants, et ciel clair (MPL 19.12.08)
106! PFLUX (KPROMA,2,KLEV+1)       ; LW total sky flux (1=up, 2=down)
107! PFLUC (KPROMA,2,KLEV+1)       ; LW clear sky flux (1=up, 2=down)
108! PFSDN(KPROMA,KLEV+1)          ; SW total sky flux down
109! PFSUP(KPROMA,KLEV+1)          ; SW total sky flux up
110! PFSCDN(KPROMA,KLEV+1)         ; SW clear sky flux down
111! PFSCUP(KPROMA,KLEV+1)         ; SW clear sky flux up
112
113
114!        IMPLICIT ARGUMENTS :   NONE
115!        --------------------
116
117!     METHOD.
118!     -------
119!     SEE DOCUMENTATION
120
121!     EXTERNALS.
122!     ----------
123
124!     REFERENCE.
125!     ----------
126!     ECMWF RESEARCH DEPARTMENT DOCUMENTATION OF THE IFS
127
128!     AUTHORS.
129!     --------
130!     ORIGINAL BY  B. RITTER   *ECMWF*        83-10-13
131!     REWRITING FOR IFS BY J.-J. MORCRETTE    94-11-15
132!     96-11: Ph. Dandin. Meteo-France
133!     REWRITING FOR DM  BY J.PH. PIEDELIEVRE   1998-07
134!     Duplication of RFMR to use present (cy25) ECMWF radiation scheme : Y. Bouteloup 09-2003
135!     Use of 6 aerosols & introduce NSW : F. Bouyssel 09-2004
136!     04-11-18 : 4 New arguments for AROME : Y. Seity
137!     2005-10-10 Y. Seity : 3 optional arguments for dust optical properties
138!     JJMorcrette 20060721 PP of clear-sky PAR and TOA incident solar radiation (ECMWF)
139!     Olivier Boucher: added LMD radiation diagnostics 2014-03
140
141!-----------------------------------------------------------------------
142
143USE PARKIND1  ,ONLY : JPIM     ,JPRB
144USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
145USE YOEAERD  , ONLY : RCAEROS
146USE YOMCST   , ONLY :         RMD      ,RMO3
147USE YOMPHY3  , ONLY : RII0
148USE YOERAD   , ONLY : NLW, NAER, RCCNLND  ,RCCNSEA 
149USE YOERAD   , ONLY : NAER, RCCNLND  ,RCCNSEA 
150USE YOERDU   , ONLY : REPSCQ
151USE YOMGEM   , ONLY : NGPTOT
152USE YOERDI   , ONLY : RRAE   ,REPCLC    ,REPH2O
153USE YOMARPHY , ONLY : LRDUST
154USE phys_output_mod, ONLY : swaero_diag
155
156!-----------------------------------------------------------------------
157
158!*       0.1   ARGUMENTS.
159!              ----------
160
161IMPLICIT NONE
162INCLUDE "clesphys.h"
163
164INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA
165INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV
166INTEGER(KIND=JPIM),INTENT(IN)    :: KST
167INTEGER(KIND=JPIM),INTENT(IN)    :: KEND
168INTEGER(KIND=JPIM)               :: KTDIA ! Argument NOT used
169INTEGER(KIND=JPIM),INTENT(IN)    :: KMODE
170REAL(KIND=JPRB)   ,INTENT(IN)    :: PALBD(KPROMA,NSW)
171REAL(KIND=JPRB)   ,INTENT(IN)    :: PALBP(KPROMA,NSW)
172REAL(KIND=JPRB)   ,INTENT(IN)    :: PAPRS(KPROMA,KLEV+1)
173REAL(KIND=JPRB)   ,INTENT(IN)    :: PAPRSF(KPROMA,KLEV)
174REAL(KIND=JPRB)   ,INTENT(IN)    :: PCCO2
175REAL(KIND=JPRB)   ,INTENT(IN)    :: PCLFR(KPROMA,KLEV)
176REAL(KIND=JPRB)   ,INTENT(IN)    :: PQO3(KPROMA,KLEV)
177REAL(KIND=JPRB)   ,INTENT(IN)    :: PAER(KPROMA,KLEV,6)
178REAL(KIND=JPRB)   ,INTENT(IN)    :: PDP(KPROMA,KLEV)
179REAL(KIND=JPRB)   ,INTENT(IN)    :: PEMIS(KPROMA)
180REAL(KIND=JPRB)   ,INTENT(IN)    :: PMU0(KPROMA)
181REAL(KIND=JPRB)   ,INTENT(IN)    :: PQ(KPROMA,KLEV)
182REAL(KIND=JPRB)   ,INTENT(IN)    :: PQS(KPROMA,KLEV)
183REAL(KIND=JPRB)   ,INTENT(IN)    :: PQIWP(KPROMA,KLEV)
184REAL(KIND=JPRB)   ,INTENT(IN)    :: PQLWP(KPROMA,KLEV)
185REAL(KIND=JPRB)   ,INTENT(IN)    :: PSLM(KPROMA)
186REAL(KIND=JPRB)   ,INTENT(IN)    :: PT(KPROMA,KLEV)
187REAL(KIND=JPRB)   ,INTENT(IN)    :: PTS(KPROMA)
188REAL(KIND=JPRB)   ,INTENT(IN)    :: PPIZA_TOT(KPROMA,KLEV,NSW)
189REAL(KIND=JPRB)   ,INTENT(IN)    :: PCGA_TOT(KPROMA,KLEV,NSW)
190REAL(KIND=JPRB)   ,INTENT(IN)    :: PTAU_TOT(KPROMA,KLEV,NSW)
191!--OB
192REAL(KIND=JPRB)   ,INTENT(IN)    :: PPIZA_NAT(KPROMA,KLEV,NSW)
193REAL(KIND=JPRB)   ,INTENT(IN)    :: PCGA_NAT(KPROMA,KLEV,NSW)
194REAL(KIND=JPRB)   ,INTENT(IN)    :: PTAU_NAT(KPROMA,KLEV,NSW)
195REAL(KIND=JPRB)                  :: PPIZA_ZERO(KPROMA,KLEV,NSW)
196REAL(KIND=JPRB)                  :: PCGA_ZERO(KPROMA,KLEV,NSW)
197REAL(KIND=JPRB)                  :: PTAU_ZERO(KPROMA,KLEV,NSW)
198!--fin
199!--C.Kleinschmitt
200REAL(KIND=JPRB)                  :: PTAU_LW_ZERO(KPROMA,KLEV,NLW)
201REAL(KIND=JPRB)   ,INTENT(IN)    :: PTAU_LW_TOT(KPROMA,KLEV,NLW)
202REAL(KIND=JPRB)   ,INTENT(IN)    :: PTAU_LW_NAT(KPROMA,KLEV,NLW)
203!--end
204REAL(KIND=JPRB)   ,INTENT(IN)    :: PREF_LIQ(KPROMA,KLEV)
205REAL(KIND=JPRB)   ,INTENT(IN)    :: PREF_ICE(KPROMA,KLEV)
206!--OB
207REAL(KIND=JPRB)   ,INTENT(IN)    :: PREF_LIQ_PI(KPROMA,KLEV)
208REAL(KIND=JPRB)   ,INTENT(IN)    :: PREF_ICE_PI(KPROMA,KLEV)
209LOGICAL, INTENT(in)  :: ok_ade, ok_aie         ! switches whether to use aerosol direct (indirect) effects or not
210INTEGER, INTENT(in)  :: flag_aerosol           ! takes value 0 (no aerosol) or 1 to 6 (aerosols)
211LOGICAL, INTENT(in)  :: flag_aerosol_strat     ! use stratospheric aerosols
212REAL(KIND=JPRB)   ,INTENT(out)   :: PTOPSWADAERO(KPROMA), PSOLSWADAERO(KPROMA)       ! Aerosol direct forcing at TOA and surface
213REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTOPSWAD0AERO(KPROMA), PSOLSWAD0AERO(KPROMA)     ! Aerosol direct forcing at TOA and surface
214REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTOPSWAIAERO(KPROMA), PSOLSWAIAERO(KPROMA)       ! ditto, indirect
215REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTOPSWCFAERO(KPROMA,3), PSOLSWCFAERO(KPROMA,3) !--do we keep this ?
216!--fin
217!--CK
218REAL(KIND=JPRB)   ,INTENT(out)   :: PTOPLWADAERO(KPROMA), PSOLLWADAERO(KPROMA)       ! LW Aerosol direct forcing at TOA + surface
219REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTOPLWAD0AERO(KPROMA), PSOLLWAD0AERO(KPROMA)     ! LW Aerosol direct forcing at TOA + surface
220REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTOPLWAIAERO(KPROMA), PSOLLWAIAERO(KPROMA)       ! LW Aer. indirect forcing at TOA + surface
221!--end
222REAL(KIND=JPRB)   ,INTENT(OUT)   :: PEMTD(KPROMA,KLEV+1)
223REAL(KIND=JPRB)   ,INTENT(OUT)   :: PEMTU(KPROMA,KLEV+1)
224REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTRSO(KPROMA,KLEV+1)
225REAL(KIND=JPRB)   ,INTENT(INOUT) :: PTH(KPROMA,KLEV+1)
226REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCTRSO(KPROMA,2)
227REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCEMTR(KPROMA,2)
228REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTRSOD(KPROMA)
229REAL(KIND=JPRB)   ,INTENT(OUT)   :: PLWFC(KPROMA,2)
230REAL(KIND=JPRB)   ,INTENT(OUT)   :: PLWFT(KPROMA,KLEV+1)
231REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSWFC(KPROMA,2)
232REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSWFT(KPROMA,KLEV+1)
233REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSFSWDIR(KPROMA,NSW)
234REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSFSWDIF(KPROMA,NSW)
235REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFSDNN(KPROMA)
236REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFSDNV(KPROMA)
237REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFLUX(KPROMA,2,KLEV+1) ! LW total sky flux (1=up, 2=down)
238REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFLUC(KPROMA,2,KLEV+1) ! LW clear sky flux (1=up, 2=down)
239REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFSDN(KPROMA,KLEV+1)   ! SW total sky flux down
240REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFSUP(KPROMA,KLEV+1)   ! SW total sky flux up
241REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFSCDN(KPROMA,KLEV+1)  ! SW clear sky flux down
242REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFSCUP(KPROMA,KLEV+1)  ! SW clear sky flux up
243
244!     ==== COMPUTED IN RADITE ===
245!     ------------------------------------------------------------------
246!*       0.2   LOCAL ARRAYS.
247!              -------------
248REAL(KIND=JPRB) :: ZRAER  (KPROMA,6,KLEV)
249REAL(KIND=JPRB) :: ZRCLC  (KPROMA,KLEV)
250REAL(KIND=JPRB) :: ZRMU0  (KPROMA)
251REAL(KIND=JPRB) :: ZRPR   (KPROMA,KLEV)
252REAL(KIND=JPRB) :: ZRTI   (KPROMA,KLEV)
253REAL(KIND=JPRB) :: ZQLWP (KPROMA,KLEV ) , ZQIWP (KPROMA,KLEV )
254
255REAL(KIND=JPRB) :: ZPQO3 (KPROMA,KLEV)
256REAL(KIND=JPRB) :: ZQOZ (NGPTOT,KLEV)
257REAL(KIND=JPRB) :: ZQS    (KPROMA,KLEV)
258REAL(KIND=JPRB) :: ZQ     (KPROMA,KLEV)
259REAL(KIND=JPRB) :: ZEMTD  (KPROMA,KLEV+1)
260REAL(KIND=JPRB) :: ZEMTU  (KPROMA,KLEV+1)
261REAL(KIND=JPRB) :: ZTRSOC (KPROMA,2)
262REAL(KIND=JPRB) :: ZEMTC  (KPROMA,2)
263
264REAL(KIND=JPRB) :: ZNBAS  (KPROMA)
265REAL(KIND=JPRB) :: ZNTOP  (KPROMA)
266REAL(KIND=JPRB) :: ZQRAIN (KPROMA,KLEV)
267REAL(KIND=JPRB) :: ZQRAINT(KPROMA,KLEV)
268REAL(KIND=JPRB) :: ZCCNL  (KPROMA)
269REAL(KIND=JPRB) :: ZCCNO  (KPROMA)
270
271!  output of radlsw
272
273REAL(KIND=JPRB) :: ZEMIT  (KPROMA)
274REAL(KIND=JPRB) :: ZFCT   (KPROMA,KLEV+1)
275REAL(KIND=JPRB) :: ZFLT   (KPROMA,KLEV+1)
276REAL(KIND=JPRB) :: ZFCS   (KPROMA,KLEV+1)
277REAL(KIND=JPRB) :: ZFLS   (KPROMA,KLEV+1)
278REAL(KIND=JPRB) :: ZFRSOD (KPROMA),ZSUDU(KPROMA)
279REAL(KIND=JPRB) :: ZPARF  (KPROMA),ZUVDF(KPROMA),ZPARCF(KPROMA),ZTINCF(KPROMA)
280
281INTEGER(KIND=JPIM) :: IBEG, IEND, JK, JL
282
283REAL(KIND=JPRB) :: ZCRAE, ZRII0, ZEMIW(KPROMA)
284REAL(KIND=JPRB) :: ZHOOK_HANDLE
285
286!---aerosol radiative diagnostics
287! Key to define the aerosol effect acting on climate
288! OB: AEROSOLFEEDBACK_ACTIVE is now a LOGICAL
289! TRUE: fluxes use natural and/or anthropogenic aerosols according to ok_ade and ok_aie, DEFAULT
290! FALSE: fluxes use no aerosols (case 1)
291! to be used only for maintaining bit reproducibility with aerosol diagnostics activated
292LOGICAL :: AEROSOLFEEDBACK_ACTIVE = .TRUE.
293
294!OB - Fluxes including aerosol effects
295!              |        direct effect
296!ind effect    | no aerosol  NATural  TOTal
297!standard      |   5
298!natural (PI)  |               1       3     
299!total   (PD)  |               2       4   
300! so we need which case when ?
301! if flag_aerosol is on
302! ok_ade and ok_aie         = 4-2, 4-3 and 4 to proceed
303! ok_ade and not ok_aie     = 3-1 and 3 to proceed
304! not ok_ade and ok_aie     = 2-1 and 2 to proceed
305! not ok_ade and not ok_aie = 1 to proceed
306! therefore the cases have the following corresponding switches
307! 1 = not ok_ade and not ok_aie OR not ok_ade and ok_aie and swaero_diag OR ok_ade and not ok_aie and swaero_diag
308! 2 = not ok_ade and ok_aie OR ok_aie and ok_ade and swaero_diag
309! 3 = ok_ade and not ok_aie OR ok_aie and ok_ade and swaero_diag
310! 4 = ok_ade and ok_aie
311! 5 = no aerosol feedback wanted or no aerosol at all
312! if they are called in this order then the correct call is used to proceed
313
314REAL(KIND=JPRB) ::  ZFSUP_AERO(KPROMA,KLEV+1,5)
315REAL(KIND=JPRB) ::  ZFSDN_AERO(KPROMA,KLEV+1,5)
316REAL(KIND=JPRB) ::  ZFSUP0_AERO(KPROMA,KLEV+1,5)
317REAL(KIND=JPRB) ::  ZFSDN0_AERO(KPROMA,KLEV+1,5)
318!--LW (CK):
319REAL(KIND=JPRB) ::  LWUP_AERO(KPROMA,KLEV+1,5)
320REAL(KIND=JPRB) ::  LWDN_AERO(KPROMA,KLEV+1,5)
321REAL(KIND=JPRB) ::  LWUP0_AERO(KPROMA,KLEV+1,5)
322REAL(KIND=JPRB) ::  LWDN0_AERO(KPROMA,KLEV+1,5)
323
324#include "radlsw.intfb.h"
325
326IF (LHOOK) CALL DR_HOOK('RECMWF_AERO',0,ZHOOK_HANDLE)
327IBEG=KST
328IEND=KEND
329
330!*       1.    PREPARATORY WORK
331!              ----------------
332!--OB
333!        1.0    INITIALIZATIONS
334!               --------------
335
336ZFSUP_AERO (:,:,:)=0.
337ZFSDN_AERO (:,:,:)=0.
338ZFSUP0_AERO(:,:,:)=0.
339ZFSDN0_AERO(:,:,:)=0.
340
341LWUP_AERO (:,:,:)=0.
342LWDN_AERO (:,:,:)=0.
343LWUP0_AERO(:,:,:)=0.
344LWDN0_AERO(:,:,:)=0.
345
346PTAU_ZERO(:,:,:) =1.e-15
347PPIZA_ZERO(:,:,:)=1.0
348PCGA_ZERO(:,:,:) =0.0
349
350PTAU_LW_ZERO(:,:,:) =1.e-15
351
352
353!*       1.1    LOCAL CONSTANTS
354!                ---------------
355
356ZRII0=RII0
357ZCRAE=RRAE*(RRAE+2.0_JPRB)
358
359!*       2.1    FULL-LEVEL QUANTITIES
360
361ZRPR =PAPRSF
362
363DO JK=1,KLEV
364  DO JL=IBEG,IEND
365!   ZPQO3(JL,JK)=PQO3(JL,JK)*PDP(JL,JK)*RMD/RMO3
366    ZPQO3(JL,JK)=PQO3(JL,JK)*PDP(JL,JK)
367    ZRCLC(JL,JK)=MAX( 0.0_JPRB ,MIN( 1.0_JPRB ,PCLFR(JL,JK)))
368    IF (ZRCLC(JL,JK) > REPCLC) THEN
369      ZQLWP(JL,JK)=PQLWP(JL,JK)
370      ZQIWP(JL,JK)=PQIWP(JL,JK)
371    ELSE
372      ZQLWP(JL,JK)=REPH2O*ZRCLC(JL,JK)
373      ZQIWP(JL,JK)=REPH2O*ZRCLC(JL,JK)
374    ENDIF
375    ZQRAIN(JL,JK)=0.
376    ZQRAINT(JL,JK)=0.
377    ZRTI(JL,JK) =PT(JL,JK)
378    ZQS (JL,JK)=MAX(2.0_JPRB*REPH2O,PQS(JL,JK))
379    ZQ  (JL,JK)=MAX(REPH2O,MIN(PQ(JL,JK),ZQS(JL,JK)*(1.0_JPRB-REPH2O)))
380    ZEMIW(JL)=PEMIS(JL)
381  ENDDO
382ENDDO
383
384IF (NAER == 0) THEN
385  ZRAER=RCAEROS
386ELSE
387  DO JK=1,KLEV
388    DO JL=IBEG,IEND
389      ZRAER(JL,1,JK)=PAER(JL,JK,1)
390      ZRAER(JL,2,JK)=PAER(JL,JK,2)
391      ZRAER(JL,3,JK)=PAER(JL,JK,3)
392      ZRAER(JL,4,JK)=PAER(JL,JK,4)
393      ZRAER(JL,5,JK)=RCAEROS
394      ZRAER(JL,6,JK)=PAER(JL,JK,6)
395    ENDDO
396  ENDDO
397ENDIF
398
399!*       2.2    HALF-LEVEL QUANTITIES
400
401DO JK=2,KLEV
402  DO JL=IBEG,IEND
403    PTH(JL,JK)=&
404     & (PT(JL,JK-1)*PAPRSF(JL,JK-1)*(PAPRSF(JL,JK)-PAPRS(JL,JK))&
405     & +PT(JL,JK)*PAPRSF(JL,JK)*(PAPRS(JL,JK)-PAPRSF(JL,JK-1)))&
406     & *(1.0_JPRB/(PAPRS(JL,JK)*(PAPRSF(JL,JK)-PAPRSF(JL,JK-1)))) 
407  ENDDO
408ENDDO
409
410!*       2.3     QUANTITIES AT BOUNDARIES
411
412DO JL=IBEG,IEND
413  PTH(JL,KLEV+1)=PTS(JL)
414  PTH(JL,1)=PT(JL,1)-PAPRSF(JL,1)*(PT(JL,1)-PTH(JL,2))&
415   & /(PAPRSF(JL,1)-PAPRS(JL,2)) 
416  ZNBAS(JL)=1.
417  ZNTOP(JL)=1.
418  ZCCNL(JL)=RCCNLND
419  ZCCNO(JL)=RCCNSEA
420ENDDO
421
422!*       3.1     SOLAR ZENITH ANGLE IS EARTH'S CURVATURE
423!                CORRECTED
424
425! CCMVAL: on impose ZRMU0=PMU0 MPL 25032010
426! 2eme essai en 3D MPL 20052010
427!DO JL=IBEG,IEND
428! ZRMU0(JL)=PMU0(JL)
429!ENDDO
430!!!!! A REVOIR MPL 20091201: enleve cette correction pour comparer a AR4
431 DO JL=IBEG,IEND
432   IF (PMU0(JL) > 1.E-10_JPRB) THEN
433     ZRMU0(JL)=RRAE/(SQRT(PMU0(JL)**2+ZCRAE)-PMU0(JL))
434   ELSE
435     ZRMU0(JL)= RRAE/SQRT(ZCRAE)
436   ENDIF   
437 ENDDO   
438
439!*         4.1     CALL TO ACTUAL RADIATION SCHEME
440!
441!----now we make multiple calls to the radiation according to which
442!----aerosol flags are on
443
444IF (flag_aerosol .GT. 0 .OR. flag_aerosol_strat) THEN
445
446!--Case 1
447IF ( ( .not. ok_ade .AND. .not. ok_aie ) .OR.             &
448   & ( .not. ok_ade .AND. ok_aie .AND. swaero_diag ) .OR. &
449   & ( ok_ade .AND. .not. ok_aie .AND. swaero_diag ) ) THEN
450
451! natural aerosols for direct and indirect effect
452! PI cloud optical properties
453! use PREF_LIQ_PI and PREF_ICE_PI
454! use NAT aerosol optical properties
455! store fluxes in index 1
456
457CALL RADLSW (&
458 & IBEG  , IEND   , KPROMA  , KLEV  , KMODE , NAER,&
459 & ZRII0 ,&
460 & ZRAER , PALBD  , PALBP   , PAPRS , ZRPR  ,&
461 & ZCCNL , ZCCNO  ,&
462 & PCCO2 , ZRCLC  , PDP     , PEMIS , ZEMIW ,PSLM    , ZRMU0 , ZPQO3,&
463 & ZQ    , ZQIWP  , ZQLWP   , ZQS   , ZQRAIN,ZQRAINT ,&
464 & PTH   , ZRTI   , PTS     , ZNBAS , ZNTOP ,&
465 & PREF_LIQ_PI, PREF_ICE_PI,&
466 & ZEMIT , ZFCT   , ZFLT    , ZFCS    , ZFLS  ,&
467 & ZFRSOD, ZSUDU  , ZUVDF   , ZPARF   , ZPARCF, ZTINCF, PSFSWDIR,&
468 & PSFSWDIF,PFSDNN, PFSDNV  ,& 
469 & LRDUST,PPIZA_NAT,PCGA_NAT,PTAU_NAT,PTAU_LW_NAT,PFLUX,PFLUC,&
470 & PFSDN , PFSUP  , PFSCDN  , PFSCUP )
471
472!* SAVE VARIABLES IN INTERIM VARIABLES A LA SW_AEROAR4
473ZFSUP0_AERO(:,:,1) = PFSCUP(:,:)
474ZFSDN0_AERO(:,:,1) = PFSCDN(:,:)
475
476ZFSUP_AERO(:,:,1) =  PFSUP(:,:)
477ZFSDN_AERO(:,:,1) =  PFSDN(:,:)
478
479LWUP0_AERO(:,:,1) = PFLUC(:,1,:)
480LWDN0_AERO(:,:,1) = PFLUC(:,2,:)
481
482LWUP_AERO(:,:,1) = PFLUX(:,1,:)
483LWDN_AERO(:,:,1) = PFLUX(:,2,:)
484
485ENDIF
486
487!--Case 2
488IF ( ( .not. ok_ade .AND. ok_aie ) .OR. &
489   & ( ok_ade .AND. ok_aie .AND. swaero_diag ) ) THEN
490
491! natural aerosols for direct indirect effect
492! use NAT aerosol optical properties
493! PD cloud optical properties
494! use PREF_LIQ and PREF_ICE
495! store fluxes in index 2
496
497CALL RADLSW (&
498 & IBEG  , IEND   , KPROMA  , KLEV  , KMODE , NAER,&
499 & ZRII0 ,&
500 & ZRAER , PALBD  , PALBP   , PAPRS , ZRPR  ,&
501 & ZCCNL , ZCCNO  ,&
502 & PCCO2 , ZRCLC  , PDP     , PEMIS , ZEMIW ,PSLM    , ZRMU0 , ZPQO3,&
503 & ZQ    , ZQIWP  , ZQLWP   , ZQS   , ZQRAIN,ZQRAINT ,&
504 & PTH   , ZRTI   , PTS     , ZNBAS , ZNTOP ,&
505 & PREF_LIQ, PREF_ICE,&
506 & ZEMIT , ZFCT   , ZFLT    , ZFCS    , ZFLS  ,&
507 & ZFRSOD, ZSUDU  , ZUVDF   , ZPARF   , ZPARCF, ZTINCF, PSFSWDIR,&
508 & PSFSWDIF,PFSDNN, PFSDNV  ,& 
509 & LRDUST,PPIZA_NAT,PCGA_NAT,PTAU_NAT,PTAU_LW_NAT,PFLUX,PFLUC,&
510 & PFSDN , PFSUP  , PFSCDN  , PFSCUP )
511
512!* SAVE VARIABLES IN INTERIM VARIABLES A LA SW_AEROAR4
513ZFSUP0_AERO(:,:,2) = PFSCUP(:,:)
514ZFSDN0_AERO(:,:,2) = PFSCDN(:,:)
515
516ZFSUP_AERO(:,:,2) =  PFSUP(:,:)
517ZFSDN_AERO(:,:,2) =  PFSDN(:,:)
518
519LWUP0_AERO(:,:,2) = PFLUC(:,1,:)
520LWDN0_AERO(:,:,2) = PFLUC(:,2,:)
521
522LWUP_AERO(:,:,2) = PFLUX(:,1,:)
523LWDN_AERO(:,:,2) = PFLUX(:,2,:)
524
525ENDIF ! ok_aie     
526
527!--Case 3
528IF ( ( ok_ade .AND. .not. ok_aie ) .OR. &
529   & ( ok_ade .AND. ok_aie .AND. swaero_diag ) ) THEN
530
531! direct effect of total aerosol activated
532! TOT aerosols for direct effect
533! PI cloud optical properties
534! use PREF_LIQ_PI and PREF_ICE_PI
535! STORE fluxes in index 3
536 
537CALL RADLSW (&
538 & IBEG  , IEND   , KPROMA  , KLEV  , KMODE , NAER,&
539 & ZRII0 ,&
540 & ZRAER , PALBD  , PALBP   , PAPRS , ZRPR  ,&
541 & ZCCNL , ZCCNO  ,&
542 & PCCO2 , ZRCLC  , PDP     , PEMIS , ZEMIW ,PSLM    , ZRMU0 , ZPQO3,&
543 & ZQ    , ZQIWP  , ZQLWP   , ZQS   , ZQRAIN,ZQRAINT ,&
544 & PTH   , ZRTI   , PTS     , ZNBAS , ZNTOP ,&
545 & PREF_LIQ_PI, PREF_ICE_PI,&
546 & ZEMIT , ZFCT   , ZFLT    , ZFCS    , ZFLS  ,&
547 & ZFRSOD, ZSUDU  , ZUVDF   , ZPARF   , ZPARCF, ZTINCF, PSFSWDIR,&
548 & PSFSWDIF,PFSDNN, PFSDNV  ,& 
549 & LRDUST,PPIZA_TOT,PCGA_TOT,PTAU_TOT,PTAU_LW_TOT,PFLUX,PFLUC,&
550 & PFSDN , PFSUP  , PFSCDN  , PFSCUP )
551
552!* SAVE VARIABLES IN INTERIM VARIABLES A LA SW_AEROAR4
553ZFSUP0_AERO(:,:,3) = PFSCUP(:,:)
554ZFSDN0_AERO(:,:,3) = PFSCDN(:,:)
555
556ZFSUP_AERO(:,:,3) =  PFSUP(:,:)
557ZFSDN_AERO(:,:,3) =  PFSDN(:,:)
558
559LWUP0_AERO(:,:,3) = PFLUC(:,1,:)
560LWDN0_AERO(:,:,3) = PFLUC(:,2,:)
561
562LWUP_AERO(:,:,3) = PFLUX(:,1,:)
563LWDN_AERO(:,:,3) = PFLUX(:,2,:)
564
565ENDIF !-end ok_ade
566
567!--Case 4
568IF (ok_ade .and. ok_aie) THEN
569
570! total aerosols for direct indirect effect
571! use TOT aerosol optical properties
572! PD cloud optical properties
573! use PREF_LIQ and PREF_ICE
574! store fluxes in index 4
575
576CALL RADLSW (&
577 & IBEG  , IEND   , KPROMA  , KLEV  , KMODE , NAER,&
578 & ZRII0 ,&
579 & ZRAER , PALBD  , PALBP   , PAPRS , ZRPR  ,&
580 & ZCCNL , ZCCNO  ,&
581 & PCCO2 , ZRCLC  , PDP     , PEMIS , ZEMIW ,PSLM    , ZRMU0 , ZPQO3,&
582 & ZQ    , ZQIWP  , ZQLWP   , ZQS   , ZQRAIN,ZQRAINT ,&
583 & PTH   , ZRTI   , PTS     , ZNBAS , ZNTOP ,&
584 & PREF_LIQ, PREF_ICE,&
585 & ZEMIT , ZFCT   , ZFLT    , ZFCS    , ZFLS  ,&
586 & ZFRSOD, ZSUDU  , ZUVDF   , ZPARF   , ZPARCF, ZTINCF, PSFSWDIR,&
587 & PSFSWDIF,PFSDNN, PFSDNV  ,& 
588 & LRDUST,PPIZA_TOT,PCGA_TOT,PTAU_TOT,PTAU_LW_TOT,PFLUX,PFLUC,&
589 & PFSDN , PFSUP  , PFSCDN  , PFSCUP )
590
591!* SAVE VARIABLES IN INTERIM VARIABLES A LA SW_AEROAR4
592ZFSUP0_AERO(:,:,4) = PFSCUP(:,:)
593ZFSDN0_AERO(:,:,4) = PFSCDN(:,:)
594
595ZFSUP_AERO(:,:,4) =  PFSUP(:,:)
596ZFSDN_AERO(:,:,4) =  PFSDN(:,:)
597
598LWUP0_AERO(:,:,4) = PFLUC(:,1,:)
599LWDN0_AERO(:,:,4) = PFLUC(:,2,:)
600
601LWUP_AERO(:,:,4) = PFLUX(:,1,:)
602LWDN_AERO(:,:,4) = PFLUX(:,2,:)
603
604ENDIF ! ok_ade .and. ok_aie
605
606ENDIF !--if flag_aerosol GT 0 OR flag_aerosol_strat
607
608! case with no aerosols at all is also computed IF ACTIVEFEEDBACK_ACTIVE is false
609!IF (swaero_diag .OR. .not. AEROSOLFEEDBACK_ACTIVE .OR. flag_aerosol .EQ. 0 ) THEN   
610IF (.not. AEROSOLFEEDBACK_ACTIVE .OR. flag_aerosol .EQ. 0 ) THEN   
611
612! ZERO aerosol effect
613! ZERO aerosol optical depth
614! STANDARD cloud optical properties
615! STORE fluxes in index 5
616
617CALL RADLSW (&
618 & IBEG  , IEND   , KPROMA  , KLEV  , KMODE , NAER,&
619 & ZRII0 ,&
620 & ZRAER , PALBD  , PALBP   , PAPRS , ZRPR  ,&
621 & ZCCNL , ZCCNO  ,&
622 & PCCO2 , ZRCLC  , PDP     , PEMIS , ZEMIW ,PSLM    , ZRMU0 , ZPQO3,&
623 & ZQ    , ZQIWP  , ZQLWP   , ZQS   , ZQRAIN,ZQRAINT ,&
624 & PTH   , ZRTI   , PTS     , ZNBAS , ZNTOP ,&
625!--this needs to be changed to fixed cloud optical properties
626 & PREF_LIQ_PI, PREF_ICE_PI,&
627 & ZEMIT , ZFCT   , ZFLT    , ZFCS    , ZFLS  ,&
628 & ZFRSOD, ZSUDU  , ZUVDF   , ZPARF   , ZPARCF, ZTINCF, PSFSWDIR,&
629 & PSFSWDIF,PFSDNN, PFSDNV  ,& 
630 & LRDUST,PPIZA_ZERO,PCGA_ZERO,PTAU_ZERO, PTAU_LW_ZERO,PFLUX,PFLUC,&
631 & PFSDN , PFSUP  , PFSCDN  , PFSCUP )
632
633!* SAVE VARIABLES IN INTERIM VARIABLES A LA SW_AEROAR4
634ZFSUP0_AERO(:,:,5) = PFSCUP(:,:)
635ZFSDN0_AERO(:,:,5) = PFSCDN(:,:)
636
637ZFSUP_AERO(:,:,5) =  PFSUP(:,:)
638ZFSDN_AERO(:,:,5) =  PFSDN(:,:)
639
640LWUP0_AERO(:,:,5) = PFLUC(:,1,:)
641LWDN0_AERO(:,:,5) = PFLUC(:,2,:)
642
643LWUP_AERO(:,:,5) = PFLUX(:,1,:)
644LWDN_AERO(:,:,5) = PFLUX(:,2,:)
645
646ENDIF ! .not. AEROSOLFEEDBACK_ACTIVE
647
648!*         4.2     TRANSFORM FLUXES TO MODEL HISTORICAL VARIABLES
649
650DO JK=1,KLEV+1
651  DO JL=IBEG,IEND
652    PSWFT(JL,JK)=ZFLS(JL,JK)/(ZRII0*ZRMU0(JL))
653    PLWFT(JL,JK)=ZFLT(JL,JK)
654  ENDDO
655ENDDO
656
657ZEMTD=PLWFT
658ZEMTU=PLWFT
659
660DO JL=IBEG,IEND
661  ZTRSOC(JL, 1)=ZFCS(JL,     1)/(ZRII0*ZRMU0(JL))
662  ZTRSOC(JL, 2)=ZFCS(JL,KLEV+1)/(ZRII0*ZRMU0(JL))
663  ZEMTC (JL, 1)=ZFCT(JL,     1)
664  ZEMTC (JL, 2)=ZFCT(JL,KLEV+1)
665ENDDO
666
667!                 ------------ -- ------- -- ---- -----
668!*         5.1    STORAGE OF TRANSMISSIVITY AND EMISSIVITIES
669!*                IN KPROMA-LONG ARRAYS
670
671DO JK=1,KLEV+1
672  DO JL=IBEG,IEND
673    PEMTD(JL,JK)=ZEMTD(JL,JK)
674    PEMTU(JL,JK)=ZEMTU(JL,JK)
675    PTRSO(JL,JK)=MAX(0.0_JPRB,MIN(1.0_JPRB,PSWFT(JL,JK)))
676  ENDDO
677ENDDO
678DO JK=1,2
679  DO JL=IBEG,IEND
680    PCEMTR(JL,JK)=ZEMTC (JL,JK)
681    PCTRSO(JL,JK)=MAX( 0.0_JPRB,MIN(1.0_JPRB,ZTRSOC(JL,JK)))
682  ENDDO
683ENDDO
684DO JL=IBEG,IEND
685  PTRSOD(JL)=MAX(0.0_JPRB,MIN(1.0_JPRB,ZFRSOD(JL)/(ZRII0*ZRMU0(JL))))
686ENDDO
687
688!*         7.3   RECONSTRUCT FLUXES FOR DIAGNOSTICS
689
690DO JL=IBEG,IEND
691  IF (PMU0(JL) < 1.E-10_JPRB) ZRMU0(JL)=0.0_JPRB
692ENDDO
693DO JK=1,KLEV+1
694  DO JL=IBEG,IEND
695    PLWFT(JL,JK)=PEMTD(JL,JK)
696    PSWFT(JL,JK)=ZRMU0(JL)*ZRII0*PTRSO(JL,JK)
697  ENDDO
698ENDDO
699DO JK=1,2
700  DO JL=IBEG,IEND
701    PSWFC(JL,JK)=ZRMU0(JL)*ZRII0*PCTRSO(JL,JK)
702    PLWFC(JL,JK)=PCEMTR(JL,JK)
703  ENDDO
704ENDDO
705
706!*  8.0 DIAGNOSTICS
707!---Now we copy back the correct fields to proceed to the next timestep
708
709IF  ( AEROSOLFEEDBACK_ACTIVE .AND. (flag_aerosol .GT. 0 .OR. flag_aerosol_strat) ) THEN
710
711  IF ( ok_ade .and. ok_aie  ) THEN
712    PFSUP(:,:) =    ZFSUP_AERO(:,:,4)
713    PFSDN(:,:) =    ZFSDN_AERO(:,:,4)
714    PFSCUP(:,:) =   ZFSUP0_AERO(:,:,4)
715    PFSCDN(:,:) =   ZFSDN0_AERO(:,:,4)
716
717    PFLUX(:,1,:) =  LWUP_AERO(:,:,4)
718    PFLUX(:,2,:) =  LWDN_AERO(:,:,4)
719    PFLUC(:,1,:) =  LWUP0_AERO(:,:,4)
720    PFLUC(:,2,:) =  LWDN0_AERO(:,:,4)   
721  ENDIF
722
723  IF ( ok_ade .and. (.not. ok_aie) )  THEN
724    PFSUP(:,:) =    ZFSUP_AERO(:,:,3)
725    PFSDN(:,:) =    ZFSDN_AERO(:,:,3)
726    PFSCUP(:,:) =   ZFSUP0_AERO(:,:,3)
727    PFSCDN(:,:) =   ZFSDN0_AERO(:,:,3)
728
729    PFLUX(:,1,:) =  LWUP_AERO(:,:,3)
730    PFLUX(:,2,:) =  LWDN_AERO(:,:,3)
731    PFLUC(:,1,:) =  LWUP0_AERO(:,:,3)
732    PFLUC(:,2,:) =  LWDN0_AERO(:,:,3)
733  ENDIF
734
735  IF ( (.not. ok_ade) .and. ok_aie  )  THEN
736    PFSUP(:,:) =    ZFSUP_AERO(:,:,2)
737    PFSDN(:,:) =    ZFSDN_AERO(:,:,2)
738    PFSCUP(:,:) =   ZFSUP0_AERO(:,:,2)
739    PFSCDN(:,:) =   ZFSDN0_AERO(:,:,2)
740
741    PFLUX(:,1,:) =  LWUP_AERO(:,:,2)
742    PFLUX(:,2,:) =  LWDN_AERO(:,:,2)
743    PFLUC(:,1,:) =  LWUP0_AERO(:,:,2)
744    PFLUC(:,2,:) =  LWDN0_AERO(:,:,2)
745  ENDiF
746
747  IF ((.not. ok_ade) .and. (.not. ok_aie)) THEN
748    PFSUP(:,:) =    ZFSUP_AERO(:,:,1)
749    PFSDN(:,:) =    ZFSDN_AERO(:,:,1)
750    PFSCUP(:,:) =   ZFSUP0_AERO(:,:,1)
751    PFSCDN(:,:) =   ZFSDN0_AERO(:,:,1)
752
753    PFLUX(:,1,:) =  LWUP_AERO(:,:,1)
754    PFLUX(:,2,:) =  LWDN_AERO(:,:,1)
755    PFLUC(:,1,:) =  LWUP0_AERO(:,:,1)
756    PFLUC(:,2,:) =  LWDN0_AERO(:,:,1)
757  ENDIF
758
759! The following allows to compute the forcing diagostics without
760! letting the aerosol forcing act on the meteorology
761! SEE logic above
762
763ELSE  !--not AEROSOLFEEDBACK_ACTIVE
764
765    PFSUP(:,:) =    ZFSUP_AERO(:,:,5)
766    PFSDN(:,:) =    ZFSDN_AERO(:,:,5)
767    PFSCUP(:,:) =   ZFSUP0_AERO(:,:,5)
768    PFSCDN(:,:) =   ZFSDN0_AERO(:,:,5)
769
770    PFLUX(:,1,:) =  LWUP_AERO(:,:,5)
771    PFLUX(:,2,:) =  LWDN_AERO(:,:,5)
772    PFLUC(:,1,:) =  LWUP0_AERO(:,:,5)
773    PFLUC(:,2,:) =  LWDN0_AERO(:,:,5)
774
775ENDIF
776
777!OB- HERE CHECK WITH MP IF BOTTOM AND TOP INDICES ARE OK !!!!!!!!!!!!!!!!!!
778! net anthropogenic forcing direct and 1st indirect effect diagnostics
779! requires a natural aerosol field read and used
780! Difference of net fluxes from double call to radiation
781! Will need to be extended to LW radiation -> done by CK (2014-05-23)
782
783IF (flag_aerosol .GT. 0 .OR. flag_aerosol_strat) THEN
784
785IF (ok_ade.AND.ok_aie) THEN
786
787! direct anthropogenic forcing
788     PSOLSWADAERO(:)  = (ZFSDN_AERO(:,1,4)      -ZFSUP_AERO(:,1,4))      -(ZFSDN_AERO(:,1,2)      -ZFSUP_AERO(:,1,2))
789     PTOPSWADAERO(:)  = (ZFSDN_AERO(:,KLEV+1,4) -ZFSUP_AERO(:,KLEV+1,4)) -(ZFSDN_AERO(:,KLEV+1,2) -ZFSUP_AERO(:,KLEV+1,2))
790     PSOLSWAD0AERO(:) = (ZFSDN0_AERO(:,1,4)     -ZFSUP0_AERO(:,1,4))     -(ZFSDN0_AERO(:,1,2)     -ZFSUP0_AERO(:,1,2))
791     PTOPSWAD0AERO(:) = (ZFSDN0_AERO(:,KLEV+1,4)-ZFSUP0_AERO(:,KLEV+1,4))-(ZFSDN0_AERO(:,KLEV+1,2)-ZFSUP0_AERO(:,KLEV+1,2))
792
793! indirect anthropogenic forcing
794     PSOLSWAIAERO(:) = (ZFSDN_AERO(:,1,4)     -ZFSUP_AERO(:,1,4))     -(ZFSDN_AERO(:,1,3)     -ZFSUP_AERO(:,1,3))
795     PTOPSWAIAERO(:) = (ZFSDN_AERO(:,KLEV+1,4)-ZFSUP_AERO(:,KLEV+1,4))-(ZFSDN_AERO(:,KLEV+1,3)-ZFSUP_AERO(:,KLEV+1,3))
796
797! Cloud radiative forcing with natural aerosol for direct effect
798     PSOLSWCFAERO(:,1) = (ZFSDN_AERO(:,1,2)     -ZFSUP_AERO(:,1,2))     -(ZFSDN0_AERO(:,1,2)     -ZFSUP0_AERO(:,1,2))
799     PTOPSWCFAERO(:,1) = (ZFSDN_AERO(:,KLEV+1,2)-ZFSUP_AERO(:,KLEV+1,2))-(ZFSDN0_AERO(:,KLEV+1,2)-ZFSUP0_AERO(:,KLEV+1,2))
800! Cloud radiative forcing with anthropogenic aerosol for direct effect
801     PSOLSWCFAERO(:,2) = (ZFSDN_AERO(:,1,4)     -ZFSUP_AERO(:,1,4))     -(ZFSDN0_AERO(:,1,4)     -ZFSUP0_AERO(:,1,4))
802     PTOPSWCFAERO(:,2) = (ZFSDN_AERO(:,KLEV+1,4)-ZFSUP_AERO(:,KLEV+1,4))-(ZFSDN0_AERO(:,KLEV+1,4)-ZFSUP0_AERO(:,KLEV+1,4))
803! Cloud radiative forcing with no direct effect at all
804     PSOLSWCFAERO(:,3) = 0.0
805     PTOPSWCFAERO(:,3) = 0.0
806
807! LW direct anthropogenic forcing
808     PSOLLWADAERO(:)  = (-LWDN_AERO(:,1,4)      -LWUP_AERO(:,1,4))      -(-LWDN_AERO(:,1,2)      -LWUP_AERO(:,1,2))
809     PTOPLWADAERO(:)  = (-LWDN_AERO(:,KLEV+1,4) -LWUP_AERO(:,KLEV+1,4)) -(-LWDN_AERO(:,KLEV+1,2) -LWUP_AERO(:,KLEV+1,2))
810     PSOLLWAD0AERO(:) = (-LWDN0_AERO(:,1,4)     -LWUP0_AERO(:,1,4))     -(-LWDN0_AERO(:,1,2)     -LWUP0_AERO(:,1,2))
811     PTOPLWAD0AERO(:) = (-LWDN0_AERO(:,KLEV+1,4)-LWUP0_AERO(:,KLEV+1,4))-(-LWDN0_AERO(:,KLEV+1,2)-LWUP0_AERO(:,KLEV+1,2))
812
813! LW indirect anthropogenic forcing
814     PSOLLWAIAERO(:) = (-LWDN_AERO(:,1,4)     -LWUP_AERO(:,1,4))     -(-LWDN_AERO(:,1,3)     -LWUP_AERO(:,1,3))
815     PTOPLWAIAERO(:) = (-LWDN_AERO(:,KLEV+1,4)-LWUP_AERO(:,KLEV+1,4))-(-LWDN_AERO(:,KLEV+1,3)-LWUP_AERO(:,KLEV+1,3))
816
817ENDIF
818
819IF (ok_ade.AND..NOT.ok_aie) THEN
820
821! direct anthropogenic forcing
822     PSOLSWADAERO(:)  = (ZFSDN_AERO(:,1,3)      -ZFSUP_AERO(:,1,3))      -(ZFSDN_AERO(:,1,1)      -ZFSUP_AERO(:,1,1))
823     PTOPSWADAERO(:)  = (ZFSDN_AERO(:,KLEV+1,3) -ZFSUP_AERO(:,KLEV+1,3)) -(ZFSDN_AERO(:,KLEV+1,1) -ZFSUP_AERO(:,KLEV+1,1))
824     PSOLSWAD0AERO(:) = (ZFSDN0_AERO(:,1,3)     -ZFSUP0_AERO(:,1,3))     -(ZFSDN0_AERO(:,1,1)     -ZFSUP0_AERO(:,1,1))
825     PTOPSWAD0AERO(:) = (ZFSDN0_AERO(:,KLEV+1,3)-ZFSUP0_AERO(:,KLEV+1,3))-(ZFSDN0_AERO(:,KLEV+1,1)-ZFSUP0_AERO(:,KLEV+1,1))
826
827! indirect anthropogenic forcing
828     PSOLSWAIAERO(:) = 0.0
829     PTOPSWAIAERO(:) = 0.0
830
831! Cloud radiative forcing with natural aerosol for direct effect
832     PSOLSWCFAERO(:,1) = (ZFSDN_AERO(:,1,1)     -ZFSUP_AERO(:,1,1))     -(ZFSDN0_AERO(:,1,1)     -ZFSUP0_AERO(:,1,1))
833     PTOPSWCFAERO(:,1) = (ZFSDN_AERO(:,KLEV+1,1)-ZFSUP_AERO(:,KLEV+1,1))-(ZFSDN0_AERO(:,KLEV+1,1)-ZFSUP0_AERO(:,KLEV+1,1))
834! Cloud radiative forcing with anthropogenic aerosol for direct effect
835     PSOLSWCFAERO(:,2) = (ZFSDN_AERO(:,1,3)     -ZFSUP_AERO(:,1,3))     -(ZFSDN0_AERO(:,1,3)     -ZFSUP0_AERO(:,1,3))
836     PTOPSWCFAERO(:,2) = (ZFSDN_AERO(:,KLEV+1,3)-ZFSUP_AERO(:,KLEV+1,3))-(ZFSDN0_AERO(:,KLEV+1,3)-ZFSUP0_AERO(:,KLEV+1,3))
837! Cloud radiative forcing with no direct effect at all
838     PSOLSWCFAERO(:,3) = 0.0
839     PTOPSWCFAERO(:,3) = 0.0
840
841! LW direct anthropogenic forcing
842     PSOLLWADAERO(:)  = (-LWDN_AERO(:,1,3)      -LWUP_AERO(:,1,3))      -(-LWDN_AERO(:,1,1)      -LWUP_AERO(:,1,1))
843     PTOPLWADAERO(:)  = (-LWDN_AERO(:,KLEV+1,3) -LWUP_AERO(:,KLEV+1,3)) -(-LWDN_AERO(:,KLEV+1,1) -LWUP_AERO(:,KLEV+1,1))
844     PSOLLWAD0AERO(:) = (-LWDN0_AERO(:,1,3)     -LWUP0_AERO(:,1,3))     -(-LWDN0_AERO(:,1,1)     -LWUP0_AERO(:,1,1))
845     PTOPLWAD0AERO(:) = (-LWDN0_AERO(:,KLEV+1,3)-LWUP0_AERO(:,KLEV+1,3))-(-LWDN0_AERO(:,KLEV+1,1)-LWUP0_AERO(:,KLEV+1,1))
846
847! LW indirect anthropogenic forcing
848     PSOLLWAIAERO(:) = 0.0
849     PTOPLWAIAERO(:) = 0.0
850
851ENDIF
852
853IF (.NOT.ok_ade.AND.ok_aie) THEN
854
855! direct anthropogenic forcing
856     PSOLSWADAERO(:)  = 0.0
857     PTOPSWADAERO(:)  = 0.0
858     PSOLSWAD0AERO(:) = 0.0
859     PTOPSWAD0AERO(:) = 0.0
860
861! indirect anthropogenic forcing
862     PSOLSWAIAERO(:) = (ZFSDN_AERO(:,1,2)     -ZFSUP_AERO(:,1,2))     -(ZFSDN_AERO(:,1,1)     -ZFSUP_AERO(:,1,1))
863     PTOPSWAIAERO(:) = (ZFSDN_AERO(:,KLEV+1,2)-ZFSUP_AERO(:,KLEV+1,2))-(ZFSDN_AERO(:,KLEV+1,1)-ZFSUP_AERO(:,KLEV+1,1))
864
865! Cloud radiative forcing with natural aerosol for direct effect
866     PSOLSWCFAERO(:,1) = (ZFSDN_AERO(:,1,2)     -ZFSUP_AERO(:,1,2))     -(ZFSDN0_AERO(:,1,2)     -ZFSUP0_AERO(:,1,2))
867     PTOPSWCFAERO(:,1) = (ZFSDN_AERO(:,KLEV+1,2)-ZFSUP_AERO(:,KLEV+1,2))-(ZFSDN0_AERO(:,KLEV+1,2)-ZFSUP0_AERO(:,KLEV+1,2))
868! Cloud radiative forcing with anthropogenic aerosol for direct effect
869     PSOLSWCFAERO(:,2) = 0.0
870     PTOPSWCFAERO(:,2) = 0.0
871! Cloud radiative forcing with no direct effect at all
872     PSOLSWCFAERO(:,3) = 0.0
873     PTOPSWCFAERO(:,3) = 0.0
874
875! LW direct anthropogenic forcing
876     PSOLLWADAERO(:)  = 0.0
877     PTOPLWADAERO(:)  = 0.0
878     PSOLLWAD0AERO(:) = 0.0
879     PTOPLWAD0AERO(:) = 0.0
880
881! LW indirect anthropogenic forcing
882     PSOLLWAIAERO(:) = (-LWDN_AERO(:,1,2)     -LWUP_AERO(:,1,2))     -(-LWDN_AERO(:,1,1)     -LWUP_AERO(:,1,1))
883     PTOPLWAIAERO(:) = (-LWDN_AERO(:,KLEV+1,2)-LWUP_AERO(:,KLEV+1,2))-(-LWDN_AERO(:,KLEV+1,1)-LWUP_AERO(:,KLEV+1,1))
884
885ENDIF
886
887IF (.NOT.ok_ade.AND..NOT.ok_aie) THEN
888
889! direct anthropogenic forcing
890     PSOLSWADAERO(:)  = 0.0
891     PTOPSWADAERO(:)  = 0.0
892     PSOLSWAD0AERO(:) = 0.0
893     PTOPSWAD0AERO(:) = 0.0
894
895! indirect anthropogenic forcing
896     PSOLSWAIAERO(:) = 0.0
897     PTOPSWAIAERO(:) = 0.0
898
899! Cloud radiative forcing with natural aerosol for direct effect
900     PSOLSWCFAERO(:,1) = (ZFSDN_AERO(:,1,1)     -ZFSUP_AERO(:,1,1))     -(ZFSDN0_AERO(:,1,1)     -ZFSUP0_AERO(:,1,1))
901     PTOPSWCFAERO(:,1) = (ZFSDN_AERO(:,KLEV+1,1)-ZFSUP_AERO(:,KLEV+1,1))-(ZFSDN0_AERO(:,KLEV+1,1)-ZFSUP0_AERO(:,KLEV+1,1))
902! Cloud radiative forcing with anthropogenic aerosol for direct effect
903     PSOLSWCFAERO(:,2) = 0.0
904     PTOPSWCFAERO(:,2) = 0.0
905! Cloud radiative forcing with no direct effect at all
906     PSOLSWCFAERO(:,3) = 0.0
907     PTOPSWCFAERO(:,3) = 0.0
908
909! LW direct anthropogenic forcing
910     PSOLLWADAERO(:)  = 0.0
911     PTOPLWADAERO(:)  = 0.0
912     PSOLLWAD0AERO(:) = 0.0
913     PTOPLWAD0AERO(:) = 0.0
914
915! LW indirect anthropogenic forcing
916     PSOLLWAIAERO(:) = 0.0
917     PTOPLWAIAERO(:) = 0.0
918
919ENDIF
920
921ENDIF
922
923!IF (swaero_diag .OR. .NOT. AEROSOLFEEDBACK_ACTIVE) THEN
924IF (.NOT. AEROSOLFEEDBACK_ACTIVE) THEN
925! Cloudforcing without aerosol at all
926     PSOLSWCFAERO(:,3) = (ZFSDN_AERO(:,1,5)     -ZFSUP_AERO(:,1,5))     -(ZFSDN0_AERO(:,1,5)     -ZFSUP0_AERO(:,1,5))
927     PTOPSWCFAERO(:,3) = (ZFSDN_AERO(:,KLEV+1,5)-ZFSUP_AERO(:,KLEV+1,5))-(ZFSDN0_AERO(:,KLEV+1,5)-ZFSUP0_AERO(:,KLEV+1,5))
928
929ENDIF
930
931IF (LHOOK) CALL DR_HOOK('RECMWF_AERO',1,ZHOOK_HANDLE)
932END SUBROUTINE RECMWF_AERO
Note: See TracBrowser for help on using the repository browser.