GCC Code Coverage Report


Directory: ./
File: phys/radlwsw_m.f90
Date: 2022-01-11 19:19:34
Exec Total Coverage
Lines: 388 535 72.5%
Branches: 249 320 77.8%

Line Branch Exec Source
1 !
2 ! $Id: radlwsw_m.F90 3989 2021-10-10 07:18:17Z oboucher $
3 !
4 module radlwsw_m
5
6 IMPLICIT NONE
7
8 contains
9
10 9423720 SUBROUTINE radlwsw( &
11 120 dist, rmu0, fract, &
12 !albedo SB >>>
13 ! paprs, pplay,tsol,alb1, alb2, &
14 120 paprs, pplay,tsol,SFRWL,alb_dir, alb_dif, &
15 !albedo SB <<<
16
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 t,q,wo,&
17 cldfra, cldemi, cldtaupd,&
18 ok_ade, ok_aie, ok_volcan, flag_volc_surfstrat, flag_aerosol,&
19 flag_aerosol_strat, flag_aer_feedback, &
20 120 tau_aero, piz_aero, cg_aero,&
21 120 tau_aero_sw_rrtm, piz_aero_sw_rrtm, cg_aero_sw_rrtm,& ! rajoute par OB RRTM
22 120 tau_aero_lw_rrtm, & ! rajoute par C.Kleinschmitt pour RRTM
23 cldtaupi, &
24 qsat, flwc, fiwc, &
25 ref_liq, ref_ice, ref_liq_pi, ref_ice_pi, &
26 120 heat,heat0,cool,cool0,albpla,&
27 heat_volc, cool_volc,&
28 topsw,toplw,solsw,solswfdiff,sollw,&
29 sollwdown,&
30 topsw0,toplw0,solsw0,sollw0,&
31 lwdnc0, lwdn0, lwdn, lwupc0, lwup0, lwup,&
32 swdnc0, swdn0, swdn, swupc0, swup0, swup,&
33 topswad_aero, solswad_aero,&
34 topswai_aero, solswai_aero, &
35 topswad0_aero, solswad0_aero,&
36 120 topsw_aero, topsw0_aero,&
37 solsw_aero, solsw0_aero, &
38 120 topswcf_aero, solswcf_aero,&
39 !-C. Kleinschmitt for LW diagnostics
40 toplwad_aero, sollwad_aero,&
41 toplwai_aero, sollwai_aero, &
42 toplwad0_aero, sollwad0_aero,&
43 !-end
44 120 ZLWFT0_i, ZFLDN0, ZFLUP0,&
45 ZSWFT0_i, ZFSDN0, ZFSUP0)
46
47 ! Modules necessaires
48 USE DIMPHY
49 USE assert_m, ONLY : assert
50 USE infotrac_phy, ONLY : type_trac
51 USE write_field_phy
52
53
54 ! modules necessaires au rayonnement
55 ! -----------------------------------------
56 USE YOERAD , ONLY : NLW, LRRTM ,LCCNL ,LCCNO ,&
57 NRADIP , NRADLP , NICEOPT, NLIQOPT ,RCCNLND , RCCNSEA
58 USE YOELW , ONLY : NSIL ,NTRA ,NUA ,TSTAND ,XP
59 USE YOESW , ONLY : RYFWCA ,RYFWCB ,RYFWCC ,RYFWCD,&
60 RYFWCE ,RYFWCF ,REBCUA ,REBCUB ,REBCUC,&
61 REBCUD ,REBCUE ,REBCUF ,REBCUI ,REBCUJ,&
62 REBCUG ,REBCUH ,RHSAVI ,RFULIO ,RFLAA0,&
63 RFLAA1 ,RFLBB0 ,RFLBB1 ,RFLBB2 ,RFLBB3,&
64 RFLCC0 ,RFLCC1 ,RFLCC2 ,RFLCC3 ,RFLDD0,&
65 RFLDD1 ,RFLDD2 ,RFLDD3 ,RFUETA ,RASWCA,&
66 RASWCB ,RASWCC ,RASWCD ,RASWCE ,RASWCF
67 USE YOERDU , ONLY : NUAER ,NTRAER ,REPLOG ,REPSC ,REPSCW ,DIFF
68 USE YOERRTWN , ONLY : DELWAVE ,TOTPLNK
69 USE YOMPHY3 , ONLY : RII0
70 USE aero_mod
71
72 ! AI 02.2021
73 ! Besoin pour ECRAD de pctsrf, zmasq, longitude, altitude
74
75 !======================================================================
76 ! Auteur(s): Z.X. Li (LMD/CNRS) date: 19960719
77 ! Objet: interface entre le modele et les rayonnements
78 ! Arguments:
79 ! INPUTS
80 ! dist----- input-R- distance astronomique terre-soleil
81 ! rmu0----- input-R- cosinus de l'angle zenithal
82 ! fract---- input-R- duree d'ensoleillement normalisee
83 ! co2_ppm-- input-R- concentration du gaz carbonique (en ppm)
84 ! paprs---- input-R- pression a inter-couche (Pa)
85 ! pplay---- input-R- pression au milieu de couche (Pa)
86 ! tsol----- input-R- temperature du sol (en K)
87 ! alb1----- input-R- albedo du sol(entre 0 et 1) dans l'interval visible
88 ! alb2----- input-R- albedo du sol(entre 0 et 1) dans l'interval proche infra-rouge
89 ! t-------- input-R- temperature (K)
90 ! q-------- input-R- vapeur d'eau (en kg/kg)
91 ! cldfra--- input-R- fraction nuageuse (entre 0 et 1)
92 ! cldtaupd- input-R- epaisseur optique des nuages dans le visible (present-day value)
93 ! cldemi--- input-R- emissivite des nuages dans l'IR (entre 0 et 1)
94 ! ok_ade--- input-L- apply the Aerosol Direct Effect or not?
95 ! ok_aie--- input-L- apply the Aerosol Indirect Effect or not?
96 ! ok_volcan input-L- activate volcanic diags (SW heat & LW cool rate, SW & LW flux)
97 ! flag_volc_surfstrat input-I- activate volcanic surf cooling or strato heating (or nothing)
98 ! flag_aerosol input-I- aerosol flag from 0 to 6
99 ! flag_aerosol_strat input-I- use stratospheric aerosols flag (0, 1, 2)
100 ! flag_aer_feedback input-I- activate aerosol radiative feedback (T, F)
101 ! tau_ae, piz_ae, cg_ae input-R- aerosol optical properties (calculated in aeropt.F)
102 ! cldtaupi input-R- epaisseur optique des nuages dans le visible
103 ! calculated for pre-industrial (pi) aerosol concentrations, i.e. with smaller
104 ! droplet concentration, thus larger droplets, thus generally cdltaupi cldtaupd
105 ! it is needed for the diagnostics of the aerosol indirect radiative forcing
106 !
107 ! OUTPUTS
108 ! heat-----output-R- echauffement atmospherique (visible) (K/jour)
109 ! cool-----output-R- refroidissement dans l'IR (K/jour)
110 ! albpla---output-R- albedo planetaire (entre 0 et 1)
111 ! topsw----output-R- flux solaire net au sommet de l'atm.
112 ! toplw----output-R- ray. IR montant au sommet de l'atmosphere
113 ! solsw----output-R- flux solaire net a la surface
114 ! solswfdiff----output-R- fraction de rayonnement diffus pour le flux solaire descendant a la surface
115 ! sollw----output-R- ray. IR montant a la surface
116 ! solswad---output-R- ray. solaire net absorbe a la surface (aerosol dir)
117 ! topswad---output-R- ray. solaire absorbe au sommet de l'atm. (aerosol dir)
118 ! solswai---output-R- ray. solaire net absorbe a la surface (aerosol ind)
119 ! topswai---output-R- ray. solaire absorbe au sommet de l'atm. (aerosol ind)
120 !
121 ! heat_volc-----output-R- echauffement atmospherique du au forcage volcanique (visible) (K/s)
122 ! cool_volc-----output-R- refroidissement dans l'IR du au forcage volcanique (K/s)
123 !
124 ! ATTENTION: swai and swad have to be interpreted in the following manner:
125 ! ---------
126 ! ok_ade=F & ok_aie=F -both are zero
127 ! ok_ade=T & ok_aie=F -aerosol direct forcing is F_{AD} = topsw-topswad
128 ! indirect is zero
129 ! ok_ade=F & ok_aie=T -aerosol indirect forcing is F_{AI} = topsw-topswai
130 ! direct is zero
131 ! ok_ade=T & ok_aie=T -aerosol indirect forcing is F_{AI} = topsw-topswai
132 ! aerosol direct forcing is F_{AD} = topswai-topswad
133 !
134 ! --------- RRTM: output RECMWFL
135 ! ZEMTD (KPROMA,KLEV+1) ; TOTAL DOWNWARD LONGWAVE EMISSIVITY
136 ! ZEMTU (KPROMA,KLEV+1) ; TOTAL UPWARD LONGWAVE EMISSIVITY
137 ! ZTRSO (KPROMA,KLEV+1) ; TOTAL SHORTWAVE TRANSMISSIVITY
138 ! ZTH (KPROMA,KLEV+1) ; HALF LEVEL TEMPERATURE
139 ! ZCTRSO(KPROMA,2) ; CLEAR-SKY SHORTWAVE TRANSMISSIVITY
140 ! ZCEMTR(KPROMA,2) ; CLEAR-SKY NET LONGWAVE EMISSIVITY
141 ! ZTRSOD(KPROMA) ; TOTAL-SKY SURFACE SW TRANSMISSITY
142 ! ZLWFC (KPROMA,2) ; CLEAR-SKY LONGWAVE FLUXES
143 ! ZLWFT (KPROMA,KLEV+1) ; TOTAL-SKY LONGWAVE FLUXES
144 ! ZLWFT0(KPROMA,KLEV+1) ; CLEAR-SKY LONGWAVE FLUXES ! added by MPL 090109
145 ! ZSWFC (KPROMA,2) ; CLEAR-SKY SHORTWAVE FLUXES
146 ! ZSWFT (KPROMA,KLEV+1) ; TOTAL-SKY SHORTWAVE FLUXES
147 ! ZSWFT0(KPROMA,KLEV+1) ; CLEAR-SKY SHORTWAVE FLUXES ! added by MPL 090109
148 ! ZFLUX (KLON,2,KLEV+1) ; TOTAL LW FLUXES 1=up, 2=DWN ! added by MPL 080411
149 ! ZFLUC (KLON,2,KLEV+1) ; CLEAR SKY LW FLUXES ! added by MPL 080411
150 ! ZFSDWN(klon,KLEV+1) ; TOTAL SW DWN FLUXES ! added by MPL 080411
151 ! ZFCDWN(klon,KLEV+1) ; CLEAR SKY SW DWN FLUXES ! added by MPL 080411
152 ! ZFCCDWN(klon,KLEV+1) ; CLEAR SKY CLEAN (NO AEROSOL) SW DWN FLUXES ! added by OB 211117
153 ! ZFSUP (klon,KLEV+1) ; TOTAL SW UP FLUXES ! added by MPL 080411
154 ! ZFCUP (klon,KLEV+1) ; CLEAR SKY SW UP FLUXES ! added by MPL 080411
155 ! ZFCCUP (klon,KLEV+1) ; CLEAR SKY CLEAN (NO AEROSOL) SW UP FLUXES ! added by OB 211117
156 ! ZFLCCDWN(klon,KLEV+1) ; CLEAR SKY CLEAN (NO AEROSOL) LW DWN FLUXES ! added by OB 211117
157 ! ZFLCCUP (klon,KLEV+1) ; CLEAR SKY CLEAN (NO AEROSOL) LW UP FLUXES ! added by OB 211117
158
159 !======================================================================
160
161 ! ====================================================================
162 ! Adapte au modele de chimie INCA par Celine Deandreis & Anne Cozic -- 2009
163 ! 1 = ZERO
164 ! 2 = AER total
165 ! 3 = NAT
166 ! 4 = BC
167 ! 5 = SO4
168 ! 6 = POM
169 ! 7 = DUST
170 ! 8 = SS
171 ! 9 = NO3
172 !
173 ! ====================================================================
174
175 ! ==============
176 ! DECLARATIONS
177 ! ==============
178 include "YOETHF.h"
179 include "YOMCST.h"
180 include "clesphys.h"
181
182 ! Input arguments
183 REAL, INTENT(in) :: dist
184 REAL, INTENT(in) :: rmu0(KLON), fract(KLON)
185 REAL, INTENT(in) :: paprs(KLON,KLEV+1), pplay(KLON,KLEV)
186 !albedo SB >>>
187 ! REAL, INTENT(in) :: alb1(KLON), alb2(KLON), tsol(KLON)
188 REAL, INTENT(in) :: tsol(KLON)
189 REAL, INTENT(in) :: alb_dir(KLON,NSW),alb_dif(KLON,NSW)
190 REAL, INTENT(in) :: SFRWL(6)
191 !albedo SB <<<
192 REAL, INTENT(in) :: t(KLON,KLEV), q(KLON,KLEV)
193
194 REAL, INTENT(in):: wo(:, :, :) ! dimension(KLON,KLEV, 1 or 2)
195 ! column-density of ozone in a layer, in kilo-Dobsons
196 ! "wo(:, :, 1)" is for the average day-night field,
197 ! "wo(:, :, 2)" is for daylight time.
198
199 LOGICAL, INTENT(in) :: ok_ade, ok_aie ! switches whether to use aerosol direct (indirect) effects or not
200 LOGICAL, INTENT(in) :: ok_volcan ! produce volcanic diags (SW/LW heat flux and rate)
201 INTEGER, INTENT(in) :: flag_volc_surfstrat ! allow to impose volcanic cooling rate at surf or heating in strato
202 LOGICAL :: lldebug=.false.
203 INTEGER, INTENT(in) :: flag_aerosol ! takes value 0 (no aerosol) or 1 to 6 (aerosols)
204 INTEGER, INTENT(in) :: flag_aerosol_strat ! use stratospheric aerosols
205 LOGICAL, INTENT(in) :: flag_aer_feedback ! activate aerosol radiative feedback
206 REAL, INTENT(in) :: cldfra(KLON,KLEV), cldemi(KLON,KLEV), cldtaupd(KLON,KLEV)
207 REAL, INTENT(in) :: tau_aero(KLON,KLEV,naero_grp,2) ! aerosol optical properties (see aeropt.F)
208 REAL, INTENT(in) :: piz_aero(KLON,KLEV,naero_grp,2) ! aerosol optical properties (see aeropt.F)
209 REAL, INTENT(in) :: cg_aero(KLON,KLEV,naero_grp,2) ! aerosol optical properties (see aeropt.F)
210 !--OB
211 REAL, INTENT(in) :: tau_aero_sw_rrtm(KLON,KLEV,2,NSW) ! aerosol optical properties RRTM
212 REAL, INTENT(in) :: piz_aero_sw_rrtm(KLON,KLEV,2,NSW) ! aerosol optical properties RRTM
213 REAL, INTENT(in) :: cg_aero_sw_rrtm(KLON,KLEV,2,NSW) ! aerosol optical properties RRTM
214 !--OB fin
215
216 !--C. Kleinschmitt
217 REAL, INTENT(in) :: tau_aero_lw_rrtm(KLON,KLEV,2,NLW) ! LW aerosol optical properties RRTM
218 !--C. Kleinschmitt end
219
220 REAL, INTENT(in) :: cldtaupi(KLON,KLEV) ! cloud optical thickness for pre-industrial aerosol concentrations
221 REAL, INTENT(in) :: qsat(klon,klev) ! Variable pour iflag_rrtm=1
222 REAL, INTENT(in) :: flwc(klon,klev) ! Variable pour iflag_rrtm=1
223 REAL, INTENT(in) :: fiwc(klon,klev) ! Variable pour iflag_rrtm=1
224 REAL, INTENT(in) :: ref_liq(klon,klev) ! cloud droplet radius present-day from newmicro
225 REAL, INTENT(in) :: ref_ice(klon,klev) ! ice crystal radius present-day from newmicro
226 REAL, INTENT(in) :: ref_liq_pi(klon,klev) ! cloud droplet radius pre-industrial from newmicro
227 REAL, INTENT(in) :: ref_ice_pi(klon,klev) ! ice crystal radius pre-industrial from newmicro
228
229 ! Output arguments
230 REAL, INTENT(out) :: heat(KLON,KLEV), cool(KLON,KLEV)
231 REAL, INTENT(out) :: heat0(KLON,KLEV), cool0(KLON,KLEV)
232 REAL, INTENT(out) :: heat_volc(KLON,KLEV), cool_volc(KLON,KLEV) !NL
233 REAL, INTENT(out) :: topsw(KLON), toplw(KLON)
234 REAL, INTENT(out) :: solsw(KLON), sollw(KLON), albpla(KLON), solswfdiff(KLON)
235 REAL, INTENT(out) :: topsw0(KLON), toplw0(KLON), solsw0(KLON), sollw0(KLON)
236 REAL, INTENT(out) :: sollwdown(KLON)
237 REAL, INTENT(out) :: swdn(KLON,kflev+1),swdn0(KLON,kflev+1), swdnc0(KLON,kflev+1)
238 REAL, INTENT(out) :: swup(KLON,kflev+1),swup0(KLON,kflev+1), swupc0(KLON,kflev+1)
239 REAL, INTENT(out) :: lwdn(KLON,kflev+1),lwdn0(KLON,kflev+1), lwdnc0(KLON,kflev+1)
240 REAL, INTENT(out) :: lwup(KLON,kflev+1),lwup0(KLON,kflev+1), lwupc0(KLON,kflev+1)
241 REAL, INTENT(out) :: topswad_aero(KLON), solswad_aero(KLON) ! output: aerosol direct forcing at TOA and surface
242 REAL, INTENT(out) :: topswai_aero(KLON), solswai_aero(KLON) ! output: aerosol indirect forcing atTOA and surface
243 REAL, INTENT(out) :: toplwad_aero(KLON), sollwad_aero(KLON) ! output: LW aerosol direct forcing at TOA and surface
244 REAL, INTENT(out) :: toplwai_aero(KLON), sollwai_aero(KLON) ! output: LW aerosol indirect forcing atTOA and surface
245 REAL, DIMENSION(klon), INTENT(out) :: topswad0_aero
246 REAL, DIMENSION(klon), INTENT(out) :: solswad0_aero
247 REAL, DIMENSION(klon), INTENT(out) :: toplwad0_aero
248 REAL, DIMENSION(klon), INTENT(out) :: sollwad0_aero
249 REAL, DIMENSION(kdlon,9), INTENT(out) :: topsw_aero
250 REAL, DIMENSION(kdlon,9), INTENT(out) :: topsw0_aero
251 REAL, DIMENSION(kdlon,9), INTENT(out) :: solsw_aero
252 REAL, DIMENSION(kdlon,9), INTENT(out) :: solsw0_aero
253 REAL, DIMENSION(kdlon,3), INTENT(out) :: topswcf_aero
254 REAL, DIMENSION(kdlon,3), INTENT(out) :: solswcf_aero
255 REAL, DIMENSION(kdlon,kflev+1), INTENT(out) :: ZSWFT0_i
256 REAL, DIMENSION(kdlon,kflev+1), INTENT(out) :: ZLWFT0_i
257
258 ! Local variables
259 240 REAL(KIND=8) ZFSUP(KDLON,KFLEV+1)
260 240 REAL(KIND=8) ZFSDN(KDLON,KFLEV+1)
261 REAL(KIND=8) ZFSUP0(KDLON,KFLEV+1)
262 REAL(KIND=8) ZFSDN0(KDLON,KFLEV+1)
263 240 REAL(KIND=8) ZFSUPC0(KDLON,KFLEV+1)
264 240 REAL(KIND=8) ZFSDNC0(KDLON,KFLEV+1)
265 240 REAL(KIND=8) ZFLUP(KDLON,KFLEV+1)
266 240 REAL(KIND=8) ZFLDN(KDLON,KFLEV+1)
267 REAL(KIND=8) ZFLUP0(KDLON,KFLEV+1)
268 REAL(KIND=8) ZFLDN0(KDLON,KFLEV+1)
269 240 REAL(KIND=8) ZFLUPC0(KDLON,KFLEV+1)
270 240 REAL(KIND=8) ZFLDNC0(KDLON,KFLEV+1)
271 REAL(KIND=8) zx_alpha1, zx_alpha2
272 INTEGER k, kk, i, j, iof, nb_gr
273 INTEGER ist,iend,ktdia,kmode
274 REAL(KIND=8) PSCT
275 240 REAL(KIND=8) PALBD(kdlon,2), PALBP(kdlon,2)
276 ! MPL 06.01.09: pour RRTM, creation de PALBD_NEW et PALBP_NEW
277 ! avec NSW en deuxieme dimension
278 240 REAL(KIND=8) PALBD_NEW(kdlon,NSW), PALBP_NEW(kdlon,NSW)
279 240 REAL(KIND=8) PEMIS(kdlon), PDT0(kdlon), PVIEW(kdlon)
280 240 REAL(KIND=8) PPSOL(kdlon), PDP(kdlon,KLEV)
281 240 REAL(KIND=8) PTL(kdlon,kflev+1), PPMB(kdlon,kflev+1)
282 240 REAL(KIND=8) PTAVE(kdlon,kflev)
283 240 REAL(KIND=8) PWV(kdlon,kflev), PQS(kdlon,kflev)
284
285 !!!!!!! Declarations specifiques pour ECRAD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
286 ! AI 02.2021
287 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
288
289 240 REAL(kind=8) POZON(kdlon, kflev, size(wo, 3)) ! mass fraction of ozone
290 ! "POZON(:, :, 1)" is for the average day-night field,
291 ! "POZON(:, :, 2)" is for daylight time.
292 !!!!! Modif MPL 6.01.09 avec RRTM, on passe de 5 a 6
293 240 REAL(KIND=8) PAER(kdlon,kflev,6)
294 240 REAL(KIND=8) PCLDLD(kdlon,kflev)
295 240 REAL(KIND=8) PCLDLU(kdlon,kflev)
296 240 REAL(KIND=8) PCLDSW(kdlon,kflev)
297 240 REAL(KIND=8) PTAU(kdlon,2,kflev)
298 240 REAL(KIND=8) POMEGA(kdlon,2,kflev)
299 240 REAL(KIND=8) PCG(kdlon,2,kflev)
300 240 REAL(KIND=8) zfract(kdlon), zrmu0(kdlon), zdist
301 240 REAL(KIND=8) zheat(kdlon,kflev), zcool(kdlon,kflev)
302 240 REAL(KIND=8) zheat0(kdlon,kflev), zcool0(kdlon,kflev)
303 240 REAL(KIND=8) zheat_volc(kdlon,kflev), zcool_volc(kdlon,kflev) !NL
304 240 REAL(KIND=8) ztopsw(kdlon), ztoplw(kdlon)
305 240 REAL(KIND=8) zsolsw(kdlon), zsollw(kdlon), zalbpla(kdlon), zsolswfdiff(kdlon)
306 240 REAL(KIND=8) zsollwdown(kdlon)
307 240 REAL(KIND=8) ztopsw0(kdlon), ztoplw0(kdlon)
308 240 REAL(KIND=8) zsolsw0(kdlon), zsollw0(kdlon)
309 REAL(KIND=8) zznormcp
310 240 REAL(KIND=8) tauaero(kdlon,kflev,naero_grp,2) ! aer opt properties
311 240 REAL(KIND=8) pizaero(kdlon,kflev,naero_grp,2)
312 240 REAL(KIND=8) cgaero(kdlon,kflev,naero_grp,2)
313 240 REAL(KIND=8) PTAUA(kdlon,2,kflev) ! present-day value of cloud opt thickness (PTAU is pre-industrial value), local use
314 240 REAL(KIND=8) POMEGAA(kdlon,2,kflev) ! dito for single scatt albedo
315 240 REAL(KIND=8) ztopswadaero(kdlon), zsolswadaero(kdlon) ! Aerosol direct forcing at TOAand surface
316 240 REAL(KIND=8) ztopswad0aero(kdlon), zsolswad0aero(kdlon) ! Aerosol direct forcing at TOAand surface
317 240 REAL(KIND=8) ztopswaiaero(kdlon), zsolswaiaero(kdlon) ! dito, indirect
318 !--NL
319 240 REAL(KIND=8) zswadaero(kdlon,kflev+1) ! SW Aerosol direct forcing
320 240 REAL(KIND=8) zlwadaero(kdlon,kflev+1) ! LW Aerosol direct forcing
321 240 REAL(KIND=8) volmip_solsw(kdlon) ! SW clear sky in the case of VOLMIP
322 !-LW by CK
323 240 REAL(KIND=8) ztoplwadaero(kdlon), zsollwadaero(kdlon) ! LW Aerosol direct forcing at TOAand surface
324 240 REAL(KIND=8) ztoplwad0aero(kdlon), zsollwad0aero(kdlon) ! LW Aerosol direct forcing at TOAand surface
325 240 REAL(KIND=8) ztoplwaiaero(kdlon), zsollwaiaero(kdlon) ! dito, indirect
326 !-end
327 240 REAL(KIND=8) ztopsw_aero(kdlon,9), ztopsw0_aero(kdlon,9)
328 240 REAL(KIND=8) zsolsw_aero(kdlon,9), zsolsw0_aero(kdlon,9)
329 240 REAL(KIND=8) ztopswcf_aero(kdlon,3), zsolswcf_aero(kdlon,3)
330 ! real, parameter:: dobson_u = 2.1415e-05 ! Dobson unit, in kg m-2 deje declare dans physiq.F MPL 20130618
331 !MPL input supplementaires pour RECMWFL
332 ! flwc, fiwc = Liquid Water Content & Ice Water Content (kg/kg)
333 REAL(KIND=8) GEMU(klon)
334 !MPL input RECMWFL:
335 ! Tableaux aux niveaux inverses pour respecter convention Arpege
336 240 REAL(KIND=8) ref_liq_i(klon,klev) ! cloud droplet radius present-day from newmicro (inverted)
337 240 REAL(KIND=8) ref_ice_i(klon,klev) ! ice crystal radius present-day from newmicro (inverted)
338 !--OB
339 240 REAL(KIND=8) ref_liq_pi_i(klon,klev) ! cloud droplet radius pre-industrial from newmicro (inverted)
340 240 REAL(KIND=8) ref_ice_pi_i(klon,klev) ! ice crystal radius pre-industrial from newmicro (inverted)
341 !--end OB
342 240 REAL(KIND=8) paprs_i(klon,klev+1)
343 240 REAL(KIND=8) pplay_i(klon,klev)
344 240 REAL(KIND=8) cldfra_i(klon,klev)
345 240 REAL(KIND=8) POZON_i(kdlon,kflev, size(wo, 3)) ! mass fraction of ozone
346 ! "POZON(:, :, 1)" is for the average day-night field,
347 ! "POZON(:, :, 2)" is for daylight time.
348 !!!!! Modif MPL 6.01.09 avec RRTM, on passe de 5 a 6
349 240 REAL(KIND=8) PAER_i(kdlon,kflev,6)
350 240 REAL(KIND=8) PDP_i(klon,klev)
351 240 REAL(KIND=8) t_i(klon,klev),q_i(klon,klev),qsat_i(klon,klev)
352 240 REAL(KIND=8) flwc_i(klon,klev),fiwc_i(klon,klev)
353 !MPL output RECMWFL:
354 240 REAL(KIND=8) ZEMTD (klon,klev+1),ZEMTD_i (klon,klev+1)
355 240 REAL(KIND=8) ZEMTU (klon,klev+1),ZEMTU_i (klon,klev+1)
356 240 REAL(KIND=8) ZTRSO (klon,klev+1),ZTRSO_i (klon,klev+1)
357 240 REAL(KIND=8) ZTH (klon,klev+1),ZTH_i (klon,klev+1)
358 240 REAL(KIND=8) ZCTRSO(klon,2)
359 240 REAL(KIND=8) ZCEMTR(klon,2)
360 240 REAL(KIND=8) ZTRSOD(klon)
361 240 REAL(KIND=8) ZLWFC (klon,2)
362 240 REAL(KIND=8) ZLWFT (klon,klev+1),ZLWFT_i (klon,klev+1)
363 240 REAL(KIND=8) ZSWFC (klon,2)
364 240 REAL(KIND=8) ZSWFT (klon,klev+1),ZSWFT_i (klon,klev+1)
365 240 REAL(KIND=8) ZFLUCDWN_i(klon,klev+1),ZFLUCUP_i(klon,klev+1)
366 240 REAL(KIND=8) PPIZA_TOT(klon,klev,NSW)
367 240 REAL(KIND=8) PCGA_TOT(klon,klev,NSW)
368 240 REAL(KIND=8) PTAU_TOT(klon,klev,NSW)
369 240 REAL(KIND=8) PPIZA_NAT(klon,klev,NSW)
370 240 REAL(KIND=8) PCGA_NAT(klon,klev,NSW)
371 240 REAL(KIND=8) PTAU_NAT(klon,klev,NSW)
372 240 REAL(KIND=8) PTAU_LW_TOT(klon,klev,NLW)
373 240 REAL(KIND=8) PTAU_LW_NAT(klon,klev,NLW)
374 240 REAL(KIND=8) PSFSWDIR(klon,NSW)
375 240 REAL(KIND=8) PSFSWDIF(klon,NSW)
376 240 REAL(KIND=8) PFSDNN(klon)
377 240 REAL(KIND=8) PFSDNV(klon)
378 !MPL On ne redefinit pas les tableaux ZFLUX,ZFLUC,
379 !MPL ZFSDWN,ZFCDWN,ZFSUP,ZFCUP car ils existent deja
380 !MPL sous les noms de ZFLDN,ZFLDN0,ZFLUP,ZFLUP0,
381 !MPL ZFSDN,ZFSDN0,ZFSUP,ZFSUP0
382 240 REAL(KIND=8) ZFLUX_i (klon,2,klev+1)
383 240 REAL(KIND=8) ZFLUC_i (klon,2,klev+1)
384 240 REAL(KIND=8) ZFSDWN_i (klon,klev+1)
385 240 REAL(KIND=8) ZFCDWN_i (klon,klev+1)
386 240 REAL(KIND=8) ZFCCDWN_i (klon,klev+1)
387 240 REAL(KIND=8) ZFSUP_i (klon,klev+1)
388 240 REAL(KIND=8) ZFCUP_i (klon,klev+1)
389 240 REAL(KIND=8) ZFCCUP_i (klon,klev+1)
390 240 REAL(KIND=8) ZFLCCDWN_i (klon,klev+1)
391 240 REAL(KIND=8) ZFLCCUP_i (klon,klev+1)
392 ! 3 lignes suivantes a activer pour CCMVAL (MPL 20100412)
393 ! REAL(KIND=8) RSUN(3,2)
394 ! REAL(KIND=8) SUN(3)
395 ! REAL(KIND=8) SUN_FRACT(2)
396 REAL, PARAMETER:: dobson_u = 2.1415e-05 ! Dobson unit, in kg m-2
397 CHARACTER (LEN=80) :: abort_message
398 CHARACTER (LEN=80) :: modname='radlwsw_m'
399
400 REAL zdir, zdif
401
402 ! ========= INITIALISATIONS ==============================================
403
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (lldebug) THEN
404 print*,'Entree dans radlwsw '
405 print*,'************* INITIALISATIONS *****************************'
406 print*,'klon, kdlon, klev, kflev =',klon, kdlon, klev, kflev
407 ENDIF
408
409 120 CALL assert(size(wo, 1) == klon, size(wo, 2) == klev, "radlwsw wo")
410
411 120 ist=1
412 120 iend=klon
413 120 ktdia=1
414 120 kmode=ist
415 ! Aeros
416
8/8
✓ Branch 0 taken 240 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 3120 times.
✓ Branch 3 taken 240 times.
✓ Branch 4 taken 121680 times.
✓ Branch 5 taken 3120 times.
✓ Branch 6 taken 120949920 times.
✓ Branch 7 taken 121680 times.
121075080 tauaero(:,:,:,:)=0.
417
8/8
✓ Branch 0 taken 240 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 3120 times.
✓ Branch 3 taken 240 times.
✓ Branch 4 taken 121680 times.
✓ Branch 5 taken 3120 times.
✓ Branch 6 taken 120949920 times.
✓ Branch 7 taken 121680 times.
121075080 pizaero(:,:,:,:)=0.
418
8/8
✓ Branch 0 taken 240 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 3120 times.
✓ Branch 3 taken 240 times.
✓ Branch 4 taken 121680 times.
✓ Branch 5 taken 3120 times.
✓ Branch 6 taken 120949920 times.
✓ Branch 7 taken 121680 times.
121075080 cgaero(:,:,:,:)=0.
419 ! lldebug=.FALSE.
420
421
4/4
✓ Branch 0 taken 1080 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 1073520 times.
✓ Branch 3 taken 1080 times.
1074720 ztopsw_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4
422
4/4
✓ Branch 0 taken 1080 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 1073520 times.
✓ Branch 3 taken 1080 times.
1074720 ztopsw0_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4
423
4/4
✓ Branch 0 taken 1080 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 1073520 times.
✓ Branch 3 taken 1080 times.
1074720 zsolsw_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4
424
4/4
✓ Branch 0 taken 1080 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 1073520 times.
✓ Branch 3 taken 1080 times.
1074720 zsolsw0_aero(:,:) = 0. !ym missing init : warning : not initialized in SW_AEROAR4
425
426
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWADAERO(:) = 0. !ym missing init
427
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWADAERO(:) = 0. !ym missing init
428
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWAD0AERO(:) = 0. !ym missing init
429
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWAD0AERO(:) = 0. !ym missing init
430
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWAIAERO(:) = 0. !ym missing init
431
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWAIAERO(:) = 0. !ym missing init
432
4/4
✓ Branch 0 taken 360 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 357840 times.
✓ Branch 3 taken 360 times.
358320 ZTOPSWCF_AERO(:,:)= 0.!ym missing init
433
4/4
✓ Branch 0 taken 360 times.
✓ Branch 1 taken 120 times.
✓ Branch 2 taken 357840 times.
✓ Branch 3 taken 360 times.
358320 ZSOLSWCF_AERO(:,:) =0. !ym missing init
434
435 !
436 !-------------------------------------------
437 120 nb_gr = KLON / kdlon
438
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (nb_gr*kdlon .NE. KLON) THEN
439 PRINT*, "kdlon mauvais:", KLON, kdlon, nb_gr
440 call abort_physic("radlwsw", "", 1)
441 ENDIF
442
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (kflev .NE. KLEV) THEN
443 PRINT*, "kflev differe de KLEV, kflev, KLEV"
444 call abort_physic("radlwsw", "", 1)
445 ENDIF
446 !-------------------------------------------
447
2/2
✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 120 times.
4800 DO k = 1, KLEV
448
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656720 DO i = 1, KLON
449 4651920 heat(i,k)=0.
450 4651920 cool(i,k)=0.
451 4651920 heat_volc(i,k)=0. !NL
452 4651920 cool_volc(i,k)=0. !NL
453 4651920 heat0(i,k)=0.
454 4656600 cool0(i,k)=0.
455 ENDDO
456 ENDDO
457 !
458 120 zdist = dist
459 !
460 120 PSCT = solaire/zdist/zdist
461
462 IF (type_trac == 'repr') THEN
463 ENDIF
464
465
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (lldebug) THEN
466 print*,'************** Debut boucle de 1 a ', nb_gr
467 ENDIF
468
469
2/2
✓ Branch 0 taken 120 times.
✓ Branch 1 taken 120 times.
240 DO j = 1, nb_gr
470 120 iof = kdlon*(j-1)
471
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 DO i = 1, kdlon
472 119280 zfract(i) = fract(iof+i)
473 119280 zrmu0(i) = rmu0(iof+i)
474
475
476
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 119280 times.
119280 IF (iflag_rrtm==0) THEN
477 ! Albedo
478 PALBD(i,1)=alb_dif(iof+i,1)
479 PALBD(i,2)=alb_dif(iof+i,2)
480 PALBP(i,1)=alb_dir(iof+i,1)
481 PALBP(i,2)=alb_dir(iof+i,2)
482 ! AI 02.2021 cas iflag_rrtm=1 et 2
483
1/2
✓ Branch 0 taken 119280 times.
✗ Branch 1 not taken.
119280 ELSEIF (iflag_rrtm==1.OR.iflag_rrtm==2) THEN
484
2/2
✓ Branch 0 taken 715680 times.
✓ Branch 1 taken 119280 times.
834960 DO kk=1,NSW
485 715680 PALBD_NEW(i,kk)=alb_dif(iof+i,kk)
486 834960 PALBP_NEW(i,kk)=alb_dir(iof+i,kk)
487 ENDDO
488 !
489 ENDIF
490 !albedo SB <<<
491
492 119280 PEMIS(i) = 1.0 !!!!! A REVOIR (MPL)
493 119280 PVIEW(i) = 1.66
494 119280 PPSOL(i) = paprs(iof+i,1)
495 119280 zx_alpha1 = (paprs(iof+i,1)-pplay(iof+i,2))/(pplay(iof+i,1)-pplay(iof+i,2))
496 119280 zx_alpha2 = 1.0 - zx_alpha1
497 119280 PTL(i,1) = t(iof+i,1) * zx_alpha1 + t(iof+i,2) * zx_alpha2
498 119280 PTL(i,KLEV+1) = t(iof+i,KLEV)
499 119400 PDT0(i) = tsol(iof+i) - PTL(i,1)
500 ENDDO
501
2/2
✓ Branch 0 taken 4560 times.
✓ Branch 1 taken 120 times.
4680 DO k = 2, kflev
502
2/2
✓ Branch 0 taken 4532640 times.
✓ Branch 1 taken 4560 times.
4537320 DO i = 1, kdlon
503 4537200 PTL(i,k) = (t(iof+i,k)+t(iof+i,k-1))*0.5
504 ENDDO
505 ENDDO
506
2/2
✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 120 times.
4800 DO k = 1, kflev
507
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656720 DO i = 1, kdlon
508 4651920 PDP(i,k) = paprs(iof+i,k)-paprs(iof+i,k+1)
509 4651920 PTAVE(i,k) = t(iof+i,k)
510 4651920 PWV(i,k) = MAX (q(iof+i,k), 1.0e-12)
511 4651920 PQS(i,k) = PWV(i,k)
512 ! Confert from column density of ozone in a cell, in kDU, to a mass fraction
513 POZON(i,k, :) = wo(iof+i, k, :) * RG * dobson_u * 1e3 &
514
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4651920 times.
9303840 / (paprs(iof+i, k) - paprs(iof+i, k+1))
515 ! A activer pour CCMVAL on prend l'ozone impose (MPL 07042010)
516 ! POZON(i,k,:) = wo(i,k,:)
517 ! print *,'RADLWSW: POZON',k, POZON(i,k,1)
518 4651920 PCLDLD(i,k) = cldfra(iof+i,k)*cldemi(iof+i,k)
519 4651920 PCLDLU(i,k) = cldfra(iof+i,k)*cldemi(iof+i,k)
520 4651920 PCLDSW(i,k) = cldfra(iof+i,k)
521 4651920 PTAU(i,1,k) = MAX(cldtaupi(iof+i,k), 1.0e-05)! 1e-12 serait instable
522 4651920 PTAU(i,2,k) = MAX(cldtaupi(iof+i,k), 1.0e-05)! pour 32-bit machines
523 4651920 POMEGA(i,1,k) = 0.9999 - 5.0e-04 * EXP(-0.5 * PTAU(i,1,k))
524 4651920 POMEGA(i,2,k) = 0.9988 - 2.5e-03 * EXP(-0.05 * PTAU(i,2,k))
525 4651920 PCG(i,1,k) = 0.865
526 4651920 PCG(i,2,k) = 0.910
527 !-
528 ! Introduced for aerosol indirect forcings.
529 ! The following values use the cloud optical thickness calculated from
530 ! present-day aerosol concentrations whereas the quantities without the
531 ! "A" at the end are for pre-industial (natural-only) aerosol concentrations
532 !
533 4651920 PTAUA(i,1,k) = MAX(cldtaupd(iof+i,k), 1.0e-05)! 1e-12 serait instable
534 4651920 PTAUA(i,2,k) = MAX(cldtaupd(iof+i,k), 1.0e-05)! pour 32-bit machines
535 4651920 POMEGAA(i,1,k) = 0.9999 - 5.0e-04 * EXP(-0.5 * PTAUA(i,1,k))
536 4656600 POMEGAA(i,2,k) = 0.9988 - 2.5e-03 * EXP(-0.05 * PTAUA(i,2,k))
537 ENDDO
538 ENDDO
539
540 IF (type_trac == 'repr') THEN
541 ENDIF
542 !
543
2/2
✓ Branch 0 taken 4800 times.
✓ Branch 1 taken 120 times.
4920 DO k = 1, kflev+1
544
2/2
✓ Branch 0 taken 4771200 times.
✓ Branch 1 taken 4800 times.
4776120 DO i = 1, kdlon
545 4776000 PPMB(i,k) = paprs(iof+i,k)/100.0
546 ENDDO
547 ENDDO
548 !
549 !!!!! Modif MPL 6.01.09 avec RRTM, on passe de 5 a 6
550
2/2
✓ Branch 0 taken 720 times.
✓ Branch 1 taken 120 times.
840 DO kk = 1, 6
551
2/2
✓ Branch 0 taken 28080 times.
✓ Branch 1 taken 720 times.
28920 DO k = 1, kflev
552
2/2
✓ Branch 0 taken 27911520 times.
✓ Branch 1 taken 28080 times.
27940320 DO i = 1, kdlon
553 27939600 PAER(i,k,kk) = 1.0E-15 !!!!! A REVOIR (MPL)
554 ENDDO
555 ENDDO
556 ENDDO
557
2/2
✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 120 times.
4800 DO k = 1, kflev
558
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656720 DO i = 1, kdlon
559
2/2
✓ Branch 0 taken 60474960 times.
✓ Branch 1 taken 4651920 times.
65126880 tauaero(i,k,:,1)=tau_aero(iof+i,k,:,1)
560
2/2
✓ Branch 0 taken 60474960 times.
✓ Branch 1 taken 4651920 times.
65126880 pizaero(i,k,:,1)=piz_aero(iof+i,k,:,1)
561
2/2
✓ Branch 0 taken 60474960 times.
✓ Branch 1 taken 4651920 times.
65126880 cgaero(i,k,:,1) =cg_aero(iof+i,k,:,1)
562
2/2
✓ Branch 0 taken 60474960 times.
✓ Branch 1 taken 4651920 times.
65126880 tauaero(i,k,:,2)=tau_aero(iof+i,k,:,2)
563
2/2
✓ Branch 0 taken 60474960 times.
✓ Branch 1 taken 4651920 times.
65126880 pizaero(i,k,:,2)=piz_aero(iof+i,k,:,2)
564
2/2
✓ Branch 0 taken 60474960 times.
✓ Branch 1 taken 4651920 times.
65131560 cgaero(i,k,:,2) =cg_aero(iof+i,k,:,2)
565 ENDDO
566 ENDDO
567 !
568 ! AI 02.2021
569 !
570 !===== iflag_rrtm ================================================
571 !
572
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (iflag_rrtm == 0) THEN !!!! remettre 0 juste pour tester l'ancien rayt via rrtm
573 !
574 !--- Mise a zero des tableaux output du rayonnement LW-AR4 ----------
575 DO k = 1, kflev+1
576 DO i = 1, kdlon
577 ! print *,'RADLWSW: boucle mise a zero i k',i,k
578 ZFLUP(i,k)=0.
579 ZFLDN(i,k)=0.
580 ZFLUP0(i,k)=0.
581 ZFLDN0(i,k)=0.
582 ZLWFT0_i(i,k)=0.
583 ZFLUCUP_i(i,k)=0.
584 ZFLUCDWN_i(i,k)=0.
585 ENDDO
586 ENDDO
587 DO k = 1, kflev
588 DO i = 1, kdlon
589 zcool(i,k)=0.
590 zcool_volc(i,k)=0. !NL
591 zcool0(i,k)=0.
592 ENDDO
593 ENDDO
594 DO i = 1, kdlon
595 ztoplw(i)=0.
596 zsollw(i)=0.
597 ztoplw0(i)=0.
598 zsollw0(i)=0.
599 zsollwdown(i)=0.
600 ENDDO
601 ! Old radiation scheme, used for AR4 runs
602 ! average day-night ozone for longwave
603 CALL LW_LMDAR4(&
604 PPMB, PDP,&
605 PPSOL,PDT0,PEMIS,&
606 PTL, PTAVE, PWV, POZON(:, :, 1), PAER,&
607 PCLDLD,PCLDLU,&
608 PVIEW,&
609 zcool, zcool0,&
610 ztoplw,zsollw,ztoplw0,zsollw0,&
611 zsollwdown,&
612 ZFLUP, ZFLDN, ZFLUP0,ZFLDN0)
613 !----- Mise a zero des tableaux output du rayonnement SW-AR4
614 DO k = 1, kflev+1
615 DO i = 1, kdlon
616 ZFSUP(i,k)=0.
617 ZFSDN(i,k)=0.
618 ZFSUP0(i,k)=0.
619 ZFSDN0(i,k)=0.
620 ZFSUPC0(i,k)=0.
621 ZFSDNC0(i,k)=0.
622 ZFLUPC0(i,k)=0.
623 ZFLDNC0(i,k)=0.
624 ZSWFT0_i(i,k)=0.
625 ZFCUP_i(i,k)=0.
626 ZFCDWN_i(i,k)=0.
627 ZFCCUP_i(i,k)=0.
628 ZFCCDWN_i(i,k)=0.
629 ZFLCCUP_i(i,k)=0.
630 ZFLCCDWN_i(i,k)=0.
631 zswadaero(i,k)=0. !--NL
632 ENDDO
633 ENDDO
634 DO k = 1, kflev
635 DO i = 1, kdlon
636 zheat(i,k)=0.
637 zheat_volc(i,k)=0.
638 zheat0(i,k)=0.
639 ENDDO
640 ENDDO
641 DO i = 1, kdlon
642 zalbpla(i)=0.
643 ztopsw(i)=0.
644 zsolsw(i)=0.
645 ztopsw0(i)=0.
646 zsolsw0(i)=0.
647 ztopswadaero(i)=0.
648 zsolswadaero(i)=0.
649 ztopswaiaero(i)=0.
650 zsolswaiaero(i)=0.
651 ENDDO
652
653 !--fraction of diffuse radiation in surface SW downward radiation
654 !--not computed with old radiation scheme
655 zsolswfdiff(:) = -999.999
656
657 ! print *,'Avant SW_LMDAR4: PSCT zrmu0 zfract',PSCT, zrmu0, zfract
658 ! daylight ozone, if we have it, for short wave
659 CALL SW_AEROAR4(PSCT, zrmu0, zfract,&
660 PPMB, PDP,&
661 PPSOL, PALBD, PALBP,&
662 PTAVE, PWV, PQS, POZON(:, :, size(wo, 3)), PAER,&
663 PCLDSW, PTAU, POMEGA, PCG,&
664 zheat, zheat0,&
665 zalbpla,ztopsw,zsolsw,ztopsw0,zsolsw0,&
666 ZFSUP,ZFSDN,ZFSUP0,ZFSDN0,&
667 tauaero, pizaero, cgaero, &
668 PTAUA, POMEGAA,&
669 ztopswadaero,zsolswadaero,&
670 ztopswad0aero,zsolswad0aero,&
671 ztopswaiaero,zsolswaiaero, &
672 ztopsw_aero,ztopsw0_aero,&
673 zsolsw_aero,zsolsw0_aero,&
674 ztopswcf_aero,zsolswcf_aero, &
675 ok_ade, ok_aie, flag_aerosol,flag_aerosol_strat)
676
677 ZSWFT0_i(:,:) = ZFSDN0(:,:)-ZFSUP0(:,:)
678 ZLWFT0_i(:,:) =-ZFLDN0(:,:)-ZFLUP0(:,:)
679
680 DO i=1,kdlon
681 DO k=1,kflev+1
682 lwdn0 ( iof+i,k) = ZFLDN0 ( i,k)
683 lwdn ( iof+i,k) = ZFLDN ( i,k)
684 lwup0 ( iof+i,k) = ZFLUP0 ( i,k)
685 lwup ( iof+i,k) = ZFLUP ( i,k)
686 swdn0 ( iof+i,k) = ZFSDN0 ( i,k)
687 swdn ( iof+i,k) = ZFSDN ( i,k)
688 swup0 ( iof+i,k) = ZFSUP0 ( i,k)
689 swup ( iof+i,k) = ZFSUP ( i,k)
690 ENDDO
691 ENDDO
692 !
693
1/2
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
120 ELSE IF (iflag_rrtm == 1) then
694 ! if (prt_level.gt.10)write(lunout,*)'CPP_RRTM=.T.'
695 !===== iflag_rrtm=1, on passe dans SW via RECMWFL ===============
696
697
2/2
✓ Branch 0 taken 4800 times.
✓ Branch 1 taken 120 times.
4920 DO k = 1, kflev+1
698
2/2
✓ Branch 0 taken 4771200 times.
✓ Branch 1 taken 4800 times.
4776120 DO i = 1, kdlon
699 4771200 ZEMTD_i(i,k)=0.
700 4771200 ZEMTU_i(i,k)=0.
701 4771200 ZTRSO_i(i,k)=0.
702 4771200 ZTH_i(i,k)=0.
703 4771200 ZLWFT_i(i,k)=0.
704 4771200 ZSWFT_i(i,k)=0.
705 4771200 ZFLUX_i(i,1,k)=0.
706 4771200 ZFLUX_i(i,2,k)=0.
707 4771200 ZFLUC_i(i,1,k)=0.
708 4771200 ZFLUC_i(i,2,k)=0.
709 4771200 ZFSDWN_i(i,k)=0.
710 4771200 ZFCDWN_i(i,k)=0.
711 4771200 ZFCCDWN_i(i,k)=0.
712 4771200 ZFSUP_i(i,k)=0.
713 4771200 ZFCUP_i(i,k)=0.
714 4771200 ZFCCUP_i(i,k)=0.
715 4771200 ZFLCCDWN_i(i,k)=0.
716 4776000 ZFLCCUP_i(i,k)=0.
717 ENDDO
718 ENDDO
719 !
720 !--OB
721 !--aerosol TOT - anthropogenic+natural - index 2
722 !--aerosol NAT - natural only - index 1
723 !
724
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 DO i = 1, kdlon
725
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 119280 times.
4771320 DO k = 1, kflev
726
2/2
✓ Branch 0 taken 27911520 times.
✓ Branch 1 taken 4651920 times.
32682720 DO kk=1, NSW
727 !
728 27911520 PTAU_TOT(i,kflev+1-k,kk)=tau_aero_sw_rrtm(i,k,2,kk)
729 27911520 PPIZA_TOT(i,kflev+1-k,kk)=piz_aero_sw_rrtm(i,k,2,kk)
730 27911520 PCGA_TOT(i,kflev+1-k,kk)=cg_aero_sw_rrtm(i,k,2,kk)
731 !
732 27911520 PTAU_NAT(i,kflev+1-k,kk)=tau_aero_sw_rrtm(i,k,1,kk)
733 27911520 PPIZA_NAT(i,kflev+1-k,kk)=piz_aero_sw_rrtm(i,k,1,kk)
734 32563440 PCGA_NAT(i,kflev+1-k,kk)=cg_aero_sw_rrtm(i,k,1,kk)
735 !
736 ENDDO
737 ENDDO
738 ENDDO
739 !-end OB
740 !
741 !--C. Kleinschmitt
742 !--aerosol TOT - anthropogenic+natural - index 2
743 !--aerosol NAT - natural only - index 1
744 !
745
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 DO i = 1, kdlon
746
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 119280 times.
4771320 DO k = 1, kflev
747
2/2
✓ Branch 0 taken 74430720 times.
✓ Branch 1 taken 4651920 times.
79201920 DO kk=1, NLW
748 !
749 74430720 PTAU_LW_TOT(i,kflev+1-k,kk)=tau_aero_lw_rrtm(i,k,2,kk)
750 79082640 PTAU_LW_NAT(i,kflev+1-k,kk)=tau_aero_lw_rrtm(i,k,1,kk)
751 !
752 ENDDO
753 ENDDO
754 ENDDO
755 !-end C. Kleinschmitt
756 !
757
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 DO i = 1, kdlon
758 119280 ZCTRSO(i,1)=0.
759 119280 ZCTRSO(i,2)=0.
760 119280 ZCEMTR(i,1)=0.
761 119280 ZCEMTR(i,2)=0.
762 119280 ZTRSOD(i)=0.
763 119280 ZLWFC(i,1)=0.
764 119280 ZLWFC(i,2)=0.
765 119280 ZSWFC(i,1)=0.
766 119280 ZSWFC(i,2)=0.
767 119280 PFSDNN(i)=0.
768 119280 PFSDNV(i)=0.
769
2/2
✓ Branch 0 taken 715680 times.
✓ Branch 1 taken 119280 times.
835080 DO kk = 1, NSW
770 715680 PSFSWDIR(i,kk)=0.
771 834960 PSFSWDIF(i,kk)=0.
772 ENDDO
773 ENDDO
774 !----- Fin des mises a zero des tableaux output de RECMWF -------------------
775 ! GEMU(1:klon)=sin(rlatd(1:klon))
776 ! On met les donnees dans l'ordre des niveaux arpege
777
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 paprs_i(:,1)=paprs(:,klev+1)
778
2/2
✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 120 times.
4800 DO k=1,klev
779
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 paprs_i(1:klon,k+1) =paprs(1:klon,klev+1-k)
780
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 pplay_i(1:klon,k) =pplay(1:klon,klev+1-k)
781
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 cldfra_i(1:klon,k) =cldfra(1:klon,klev+1-k)
782
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 PDP_i(1:klon,k) =PDP(1:klon,klev+1-k)
783
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 t_i(1:klon,k) =t(1:klon,klev+1-k)
784
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 q_i(1:klon,k) =q(1:klon,klev+1-k)
785
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 qsat_i(1:klon,k) =qsat(1:klon,klev+1-k)
786
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 flwc_i(1:klon,k) =flwc(1:klon,klev+1-k)
787
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 fiwc_i(1:klon,k) =fiwc(1:klon,klev+1-k)
788
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 ref_liq_i(1:klon,k) =ref_liq(1:klon,klev+1-k)
789
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 ref_ice_i(1:klon,k) =ref_ice(1:klon,klev+1-k)
790 !-OB
791
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656600 ref_liq_pi_i(1:klon,k) =ref_liq_pi(1:klon,klev+1-k)
792
2/2
✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 4651920 times.
4656720 ref_ice_pi_i(1:klon,k) =ref_ice_pi(1:klon,klev+1-k)
793 ENDDO
794
2/2
✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 120 times.
4800 DO k=1,kflev
795
4/4
✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 4680 times.
✓ Branch 2 taken 4651920 times.
✓ Branch 3 taken 4680 times.
4661280 POZON_i(1:klon,k,:)=POZON(1:klon,kflev+1-k,:)
796 !!! POZON_i(1:klon,k)=POZON(1:klon,k) !!! on laisse 1=sol et klev=top
797 ! print *,'Juste avant RECMWFL: k tsol temp',k,tsol,t(1,k)
798 !!!!!!! Modif MPL 6.01.09 avec RRTM, on passe de 5 a 6
799
2/2
✓ Branch 0 taken 28080 times.
✓ Branch 1 taken 4680 times.
32880 DO i=1,6
800
2/2
✓ Branch 0 taken 27911520 times.
✓ Branch 1 taken 28080 times.
27944280 PAER_i(1:klon,k,i)=PAER(1:klon,kflev+1-k,i)
801 ENDDO
802 ENDDO
803
804 ! print *,'RADLWSW: avant RECMWFL, RI0,rmu0=',solaire,rmu0
805
806 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
807 ! La version ARPEGE1D utilise differentes valeurs de la constante
808 ! solaire suivant le rayonnement utilise.
809 ! A controler ...
810 ! SOLAR FLUX AT THE TOP (/YOMPHY3/)
811 ! introduce season correction
812 !--------------------------------------
813 ! RII0 = RIP0
814 ! IF(LRAYFM)
815 ! RII0 = RIP0M ! =rip0m if Morcrette non-each time step call.
816 ! IF(LRAYFM15)
817 ! RII0 = RIP0M15 ! =rip0m if Morcrette non-each time step call.
818 120 RII0=solaire/zdist/zdist
819 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
820 ! Ancien appel a RECMWF (celui du cy25)
821 ! CALL RECMWF (ist , iend, klon , ktdia , klev , kmode ,
822 ! s PALBD , PALBP , paprs_i , pplay_i , RCO2 , cldfra_i,
823 ! s POZON_i , PAER_i , PDP_i , PEMIS , GEMU , rmu0,
824 ! s q_i , qsat_i , fiwc_i , flwc_i , zmasq , t_i ,tsol,
825 ! s ZEMTD_i , ZEMTU_i , ZTRSO_i ,
826 ! s ZTH_i , ZCTRSO , ZCEMTR , ZTRSOD ,
827 ! s ZLWFC , ZLWFT_i , ZSWFC , ZSWFT_i ,
828 ! s ZFLUX_i , ZFLUC_i , ZFSDWN_i, ZFSUP_i , ZFCDWN_i,ZFCUP_i)
829 ! s 'RECMWF ')
830 !
831
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (lldebug) THEN
832 CALL writefield_phy('paprs_i',paprs_i,klev+1)
833 CALL writefield_phy('pplay_i',pplay_i,klev)
834 CALL writefield_phy('cldfra_i',cldfra_i,klev)
835 CALL writefield_phy('pozon_i',POZON_i,klev)
836 CALL writefield_phy('paer_i',PAER_i,klev)
837 CALL writefield_phy('pdp_i',PDP_i,klev)
838 CALL writefield_phy('q_i',q_i,klev)
839 CALL writefield_phy('qsat_i',qsat_i,klev)
840 CALL writefield_phy('fiwc_i',fiwc_i,klev)
841 CALL writefield_phy('flwc_i',flwc_i,klev)
842 CALL writefield_phy('t_i',t_i,klev)
843 CALL writefield_phy('palbd_new',PALBD_NEW,NSW)
844 CALL writefield_phy('palbp_new',PALBP_NEW,NSW)
845 ENDIF
846
847 ! Nouvel appel a RECMWF (celui du cy32t0)
848 CALL RECMWF_AERO (ist , iend, klon , ktdia , klev , kmode ,&
849 PALBD_NEW,PALBP_NEW, paprs_i , pplay_i , RCO2 , cldfra_i,&
850 POZON_i , PAER_i , PDP_i , PEMIS , rmu0 ,&
851 q_i , qsat_i , fiwc_i , flwc_i , zmasq , t_i ,tsol,&
852 ref_liq_i, ref_ice_i, &
853 ref_liq_pi_i, ref_ice_pi_i, & ! rajoute par OB pour diagnostiquer effet indirect
854 ZEMTD_i , ZEMTU_i , ZTRSO_i ,&
855 ZTH_i , ZCTRSO , ZCEMTR , ZTRSOD ,&
856 ZLWFC , ZLWFT_i , ZSWFC , ZSWFT_i ,&
857 PSFSWDIR , PSFSWDIF, PFSDNN , PFSDNV ,&
858 PPIZA_TOT, PCGA_TOT,PTAU_TOT,&
859 PPIZA_NAT, PCGA_NAT,PTAU_NAT, & ! rajoute par OB pour diagnostiquer effet direct
860 PTAU_LW_TOT, PTAU_LW_NAT, & ! rajoute par C. Kleinschmitt
861 ZFLUX_i , ZFLUC_i ,&
862 ZFSDWN_i , ZFSUP_i , ZFCDWN_i, ZFCUP_i, ZFCCDWN_i, ZFCCUP_i, ZFLCCDWN_i, ZFLCCUP_i, &
863 ZTOPSWADAERO,ZSOLSWADAERO,& ! rajoute par OB pour diagnostics
864 ZTOPSWAD0AERO,ZSOLSWAD0AERO,&
865 ZTOPSWAIAERO,ZSOLSWAIAERO, &
866 ZTOPSWCF_AERO,ZSOLSWCF_AERO, &
867 ZSWADAERO, & !--NL
868 ZTOPLWADAERO,ZSOLLWADAERO,& ! rajoute par C. Kleinscmitt pour LW diagnostics
869 ZTOPLWAD0AERO,ZSOLLWAD0AERO,&
870 ZTOPLWAIAERO,ZSOLLWAIAERO, &
871 ZLWADAERO, & !--NL
872 volmip_solsw, flag_volc_surfstrat, & !--VOLMIP
873 120 ok_ade, ok_aie, ok_volcan, flag_aerosol,flag_aerosol_strat, flag_aer_feedback) ! flags aerosols
874
875 !--OB diagnostics
876 ! & PTOPSWAIAERO,PSOLSWAIAERO,&
877 ! & PTOPSWCFAERO,PSOLSWCFAERO,&
878 ! & PSWADAERO,& !--NL
879 !!--LW diagnostics CK
880 ! & PTOPLWADAERO,PSOLLWADAERO,&
881 ! & PTOPLWAD0AERO,PSOLLWAD0AERO,&
882 ! & PTOPLWAIAERO,PSOLLWAIAERO,&
883 ! & PLWADAERO,& !--NL
884 !!..end
885 ! & ok_ade, ok_aie, ok_volcan, flag_aerosol,flag_aerosol_strat,&
886 ! & flag_aer_feedback)
887
888
889 ! print *,'RADLWSW: apres RECMWF'
890
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (lldebug) THEN
891 CALL writefield_phy('zemtd_i',ZEMTD_i,klev+1)
892 CALL writefield_phy('zemtu_i',ZEMTU_i,klev+1)
893 CALL writefield_phy('ztrso_i',ZTRSO_i,klev+1)
894 CALL writefield_phy('zth_i',ZTH_i,klev+1)
895 CALL writefield_phy('zctrso',ZCTRSO,2)
896 CALL writefield_phy('zcemtr',ZCEMTR,2)
897 CALL writefield_phy('ztrsod',ZTRSOD,1)
898 CALL writefield_phy('zlwfc',ZLWFC,2)
899 CALL writefield_phy('zlwft_i',ZLWFT_i,klev+1)
900 CALL writefield_phy('zswfc',ZSWFC,2)
901 CALL writefield_phy('zswft_i',ZSWFT_i,klev+1)
902 CALL writefield_phy('psfswdir',PSFSWDIR,6)
903 CALL writefield_phy('psfswdif',PSFSWDIF,6)
904 CALL writefield_phy('pfsdnn',PFSDNN,1)
905 CALL writefield_phy('pfsdnv',PFSDNV,1)
906 CALL writefield_phy('ppiza_dst',PPIZA_TOT,klev)
907 CALL writefield_phy('pcga_dst',PCGA_TOT,klev)
908 CALL writefield_phy('ptaurel_dst',PTAU_TOT,klev)
909 CALL writefield_phy('zflux_i',ZFLUX_i,klev+1)
910 CALL writefield_phy('zfluc_i',ZFLUC_i,klev+1)
911 CALL writefield_phy('zfsdwn_i',ZFSDWN_i,klev+1)
912 CALL writefield_phy('zfsup_i',ZFSUP_i,klev+1)
913 CALL writefield_phy('zfcdwn_i',ZFCDWN_i,klev+1)
914 CALL writefield_phy('zfcup_i',ZFCUP_i,klev+1)
915 ENDIF
916
917 ! ---------
918 ! ---------
919 ! On retablit l'ordre des niveaux lmd pour les tableaux de sortie
920 ! D autre part, on multiplie les resultats SW par fract pour etre coherent
921 ! avec l ancien rayonnement AR4. Si nuit, fract=0 donc pas de
922 ! rayonnement SW. (MPL 260609)
923
2/2
✓ Branch 0 taken 4800 times.
✓ Branch 1 taken 120 times.
4920 DO k=0,klev
924
2/2
✓ Branch 0 taken 4771200 times.
✓ Branch 1 taken 4800 times.
4776120 DO i=1,klon
925 4771200 ZEMTD(i,k+1) = ZEMTD_i(i,k+1)
926 4771200 ZEMTU(i,k+1) = ZEMTU_i(i,k+1)
927 4771200 ZTRSO(i,k+1) = ZTRSO_i(i,k+1)
928 4771200 ZTH(i,k+1) = ZTH_i(i,k+1)
929 ! ZLWFT(i,k+1) = ZLWFT_i(i,klev+1-k)
930 ! ZSWFT(i,k+1) = ZSWFT_i(i,klev+1-k)
931 4771200 ZFLUP(i,k+1) = ZFLUX_i(i,1,k+1)
932 4771200 ZFLDN(i,k+1) = ZFLUX_i(i,2,k+1)
933 4771200 ZFLUP0(i,k+1) = ZFLUC_i(i,1,k+1)
934 4771200 ZFLDN0(i,k+1) = ZFLUC_i(i,2,k+1)
935 4771200 ZFSDN(i,k+1) = ZFSDWN_i(i,k+1)*fract(i)
936 4771200 ZFSDN0(i,k+1) = ZFCDWN_i(i,k+1)*fract(i)
937 4771200 ZFSDNC0(i,k+1)= ZFCCDWN_i(i,k+1)*fract(i)
938 4771200 ZFSUP (i,k+1) = ZFSUP_i(i,k+1)*fract(i)
939 4771200 ZFSUP0(i,k+1) = ZFCUP_i(i,k+1)*fract(i)
940 4771200 ZFSUPC0(i,k+1)= ZFCCUP_i(i,k+1)*fract(i)
941 4771200 ZFLDNC0(i,k+1)= ZFLCCDWN_i(i,k+1)
942 4771200 ZFLUPC0(i,k+1)= ZFLCCUP_i(i,k+1)
943
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4771200 times.
4771200 IF (ok_volcan) THEN
944 ZSWADAERO(i,k+1)=ZSWADAERO(i,k+1)*fract(i) !--NL
945 ENDIF
946
947 ! Nouveau calcul car visiblement ZSWFT et ZSWFC sont nuls dans RRTM cy32
948 ! en sortie de radlsw.F90 - MPL 7.01.09
949 4771200 ZSWFT(i,k+1) = (ZFSDWN_i(i,k+1)-ZFSUP_i(i,k+1))*fract(i)
950 4771200 ZSWFT0_i(i,k+1) = (ZFCDWN_i(i,k+1)-ZFCUP_i(i,k+1))*fract(i)
951 ! WRITE(*,'("FSDN FSUP FCDN FCUP: ",4E12.5)') ZFSDWN_i(i,k+1),&
952 ! ZFSUP_i(i,k+1),ZFCDWN_i(i,k+1),ZFCUP_i(i,k+1)
953 4771200 ZLWFT(i,k+1) =-ZFLUX_i(i,2,k+1)-ZFLUX_i(i,1,k+1)
954 4776000 ZLWFT0_i(i,k+1)=-ZFLUC_i(i,2,k+1)-ZFLUC_i(i,1,k+1)
955 ! print *,'FLUX2 FLUX1 FLUC2 FLUC1',ZFLUX_i(i,2,k+1),&
956 ! & ZFLUX_i(i,1,k+1),ZFLUC_i(i,2,k+1),ZFLUC_i(i,1,k+1)
957 ENDDO
958 ENDDO
959
960 !--ajout OB
961
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWADAERO(:) =ZTOPSWADAERO(:) *fract(:)
962
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWADAERO(:) =ZSOLSWADAERO(:) *fract(:)
963
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWAD0AERO(:)=ZTOPSWAD0AERO(:)*fract(:)
964
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWAD0AERO(:)=ZSOLSWAD0AERO(:)*fract(:)
965
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWAIAERO(:) =ZTOPSWAIAERO(:) *fract(:)
966
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWAIAERO(:) =ZSOLSWAIAERO(:) *fract(:)
967
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWCF_AERO(:,1)=ZTOPSWCF_AERO(:,1)*fract(:)
968
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWCF_AERO(:,2)=ZTOPSWCF_AERO(:,2)*fract(:)
969
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZTOPSWCF_AERO(:,3)=ZTOPSWCF_AERO(:,3)*fract(:)
970
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWCF_AERO(:,1)=ZSOLSWCF_AERO(:,1)*fract(:)
971
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWCF_AERO(:,2)=ZSOLSWCF_AERO(:,2)*fract(:)
972
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 ZSOLSWCF_AERO(:,3)=ZSOLSWCF_AERO(:,3)*fract(:)
973
974 ! ---------
975 ! ---------
976 ! On renseigne les champs LMDz, pour avoir la meme chose qu'en sortie de
977 ! LW_LMDAR4 et SW_LMDAR4
978
979 !--fraction of diffuse radiation in surface SW downward radiation
980
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 DO i = 1, kdlon
981
2/2
✓ Branch 0 taken 63319 times.
✓ Branch 1 taken 55961 times.
119400 IF (fract(i).GT.0.0) THEN
982
2/2
✓ Branch 0 taken 63319 times.
✓ Branch 1 taken 379914 times.
443233 zdir=SUM(PSFSWDIR(i,:))
983
2/2
✓ Branch 0 taken 379914 times.
✓ Branch 1 taken 63319 times.
443233 zdif=SUM(PSFSWDIF(i,:))
984 63319 zsolswfdiff(i) = zdif/(zdir+zdif)
985 ELSE !--night
986 55961 zsolswfdiff(i) = 1.0
987 ENDIF
988 ENDDO
989 !
990
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 DO i = 1, kdlon
991 119280 zsolsw(i) = ZSWFT(i,1)
992 119280 zsolsw0(i) = ZSWFT0_i(i,1)
993 ! zsolsw0(i) = ZFSDN0(i,1) -ZFSUP0(i,1)
994 119280 ztopsw(i) = ZSWFT(i,klev+1)
995 119280 ztopsw0(i) = ZSWFT0_i(i,klev+1)
996 ! ztopsw0(i) = ZFSDN0(i,klev+1)-ZFSUP0(i,klev+1)
997 !
998 ! zsollw(i) = ZFLDN(i,1) -ZFLUP(i,1)
999 ! zsollw0(i) = ZFLDN0(i,1) -ZFLUP0(i,1)
1000 ! ztoplw(i) = ZFLDN(i,klev+1) -ZFLUP(i,klev+1)
1001 ! ztoplw0(i) = ZFLDN0(i,klev+1)-ZFLUP0(i,klev+1)
1002 119280 zsollw(i) = ZLWFT(i,1)
1003 119280 zsollw0(i) = ZLWFT0_i(i,1)
1004 119280 ztoplw(i) = ZLWFT(i,klev+1)*(-1)
1005 119280 ztoplw0(i) = ZLWFT0_i(i,klev+1)*(-1)
1006 !
1007
2/2
✓ Branch 0 taken 55961 times.
✓ Branch 1 taken 63319 times.
119280 IF (fract(i) == 0.) THEN
1008 !!!!! A REVOIR MPL (20090630) ca n a pas de sens quand fract=0
1009 ! pas plus que dans le sw_AR4
1010 55961 zalbpla(i) = 1.0e+39
1011 ELSE
1012 63319 zalbpla(i) = ZFSUP(i,klev+1)/ZFSDN(i,klev+1)
1013 ENDIF
1014 !!! 5 juin 2015
1015 !!! Correction MP bug RRTM
1016 119400 zsollwdown(i)= -1.*ZFLDN(i,1)
1017 ENDDO
1018 ! print*,'OK2'
1019
1020 !--add VOLMIP (surf cool or strat heat activate)
1021
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (flag_volc_surfstrat > 0) THEN
1022 DO i = 1, kdlon
1023 zsolsw(i) = volmip_solsw(i)*fract(i)
1024 ENDDO
1025 ENDIF
1026
1027 ! extrait de SW_AR4
1028 ! DO k = 1, KFLEV
1029 ! kpl1 = k+1
1030 ! DO i = 1, KDLON
1031 ! PHEAT(i,k) = -(ZFSUP(i,kpl1)-ZFSUP(i,k)) -(ZFSDN(i,k)-ZFSDN(i,kpl1))
1032 ! PHEAT(i,k) = PHEAT(i,k) * RDAY*RG/RCPD / PDP(i,k)
1033 ! ZLWFT(klon,k),ZSWFT
1034
1035
2/2
✓ Branch 0 taken 120 times.
✓ Branch 1 taken 4680 times.
4800 DO k=1,kflev
1036
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656720 DO i=1,kdlon
1037 4651920 zheat(i,k)=(ZSWFT(i,k+1)-ZSWFT(i,k))*RDAY*RG/RCPD/PDP(i,k)
1038 4651920 zheat0(i,k)=(ZSWFT0_i(i,k+1)-ZSWFT0_i(i,k))*RDAY*RG/RCPD/PDP(i,k)
1039 4651920 zcool(i,k)=(ZLWFT(i,k)-ZLWFT(i,k+1))*RDAY*RG/RCPD/PDP(i,k)
1040 4651920 zcool0(i,k)=(ZLWFT0_i(i,k)-ZLWFT0_i(i,k+1))*RDAY*RG/RCPD/PDP(i,k)
1041
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4651920 times.
4656600 IF (ok_volcan) THEN
1042 zheat_volc(i,k)=(ZSWADAERO(i,k+1)-ZSWADAERO(i,k))*RG/RCPD/PDP(i,k) !NL
1043 zcool_volc(i,k)=(ZLWADAERO(i,k)-ZLWADAERO(i,k+1))*RG/RCPD/PDP(i,k) !NL
1044 ENDIF
1045 ! print *,'heat cool heat0 cool0 ',zheat(i,k),zcool(i,k),zheat0(i,k),zcool0(i,k)
1046 ! ZFLUCUP_i(i,k)=ZFLUC_i(i,1,k)
1047 ! ZFLUCDWN_i(i,k)=ZFLUC_i(i,2,k)
1048 ENDDO
1049 ENDDO
1050 !======================================================================
1051 ! AI fev 2021
1052 ELSE IF(iflag_rrtm == 2) THEN
1053 print*,'Traitement cas iflag_rrtm = ',iflag_rrtm
1054 ! print*,'Mise a zero des flux '
1055 print*,'Fin traitement ECRAD'
1056 ! Fin ECRAD
1057 ENDIF ! iflag_rrtm
1058 ! ecrad
1059 !======================================================================
1060
1061
2/2
✓ Branch 0 taken 119280 times.
✓ Branch 1 taken 120 times.
119400 DO i = 1, kdlon
1062 119280 topsw(iof+i) = ztopsw(i)
1063 119280 toplw(iof+i) = ztoplw(i)
1064 119280 solsw(iof+i) = zsolsw(i)
1065 119280 solswfdiff(iof+i) = zsolswfdiff(i)
1066 119280 sollw(iof+i) = zsollw(i)
1067 119280 sollwdown(iof+i) = zsollwdown(i)
1068
2/2
✓ Branch 0 taken 4771200 times.
✓ Branch 1 taken 119280 times.
4890480 DO k = 1, kflev+1
1069 4771200 lwdn0 ( iof+i,k) = ZFLDN0 ( i,k)
1070 4771200 lwdn ( iof+i,k) = ZFLDN ( i,k)
1071 4771200 lwup0 ( iof+i,k) = ZFLUP0 ( i,k)
1072 4890480 lwup ( iof+i,k) = ZFLUP ( i,k)
1073 ENDDO
1074 119280 topsw0(iof+i) = ztopsw0(i)
1075 119280 toplw0(iof+i) = ztoplw0(i)
1076 119280 solsw0(iof+i) = zsolsw0(i)
1077 119280 sollw0(iof+i) = zsollw0(i)
1078 119280 albpla(iof+i) = zalbpla(i)
1079
1080
2/2
✓ Branch 0 taken 4771200 times.
✓ Branch 1 taken 119280 times.
4890600 DO k = 1, kflev+1
1081 4771200 swdnc0( iof+i,k) = ZFSDNC0( i,k)
1082 4771200 swdn0 ( iof+i,k) = ZFSDN0 ( i,k)
1083 4771200 swdn ( iof+i,k) = ZFSDN ( i,k)
1084 4771200 swupc0( iof+i,k) = ZFSUPC0( i,k)
1085 4771200 swup0 ( iof+i,k) = ZFSUP0 ( i,k)
1086 4771200 swup ( iof+i,k) = ZFSUP ( i,k)
1087 4771200 lwdnc0( iof+i,k) = ZFLDNC0( i,k)
1088 4890480 lwupc0( iof+i,k) = ZFLUPC0( i,k)
1089 ENDDO
1090 ENDDO
1091 !-transform the aerosol forcings, if they have
1092 ! to be calculated
1093
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (ok_ade) THEN
1094 DO i = 1, kdlon
1095 topswad_aero(iof+i) = ztopswadaero(i)
1096 topswad0_aero(iof+i) = ztopswad0aero(i)
1097 solswad_aero(iof+i) = zsolswadaero(i)
1098 solswad0_aero(iof+i) = zsolswad0aero(i)
1099 topsw_aero(iof+i,:) = ztopsw_aero(i,:)
1100 topsw0_aero(iof+i,:) = ztopsw0_aero(i,:)
1101 solsw_aero(iof+i,:) = zsolsw_aero(i,:)
1102 solsw0_aero(iof+i,:) = zsolsw0_aero(i,:)
1103 topswcf_aero(iof+i,:) = ztopswcf_aero(i,:)
1104 solswcf_aero(iof+i,:) = zsolswcf_aero(i,:)
1105 !-LW
1106 toplwad_aero(iof+i) = ztoplwadaero(i)
1107 toplwad0_aero(iof+i) = ztoplwad0aero(i)
1108 sollwad_aero(iof+i) = zsollwadaero(i)
1109 sollwad0_aero(iof+i) = zsollwad0aero(i)
1110 ENDDO
1111 ELSE
1112
2/2
✓ Branch 0 taken 120 times.
✓ Branch 1 taken 119280 times.
119400 DO i = 1, kdlon
1113 119280 topswad_aero(iof+i) = 0.0
1114 119280 solswad_aero(iof+i) = 0.0
1115 119280 topswad0_aero(iof+i) = 0.0
1116 119280 solswad0_aero(iof+i) = 0.0
1117
2/2
✓ Branch 0 taken 1073520 times.
✓ Branch 1 taken 119280 times.
1192800 topsw_aero(iof+i,:) = 0.
1118
2/2
✓ Branch 0 taken 1073520 times.
✓ Branch 1 taken 119280 times.
1192800 topsw0_aero(iof+i,:) =0.
1119
2/2
✓ Branch 0 taken 1073520 times.
✓ Branch 1 taken 119280 times.
1192800 solsw_aero(iof+i,:) = 0.
1120
2/2
✓ Branch 0 taken 1073520 times.
✓ Branch 1 taken 119280 times.
1192800 solsw0_aero(iof+i,:) = 0.
1121 !-LW
1122 119280 toplwad_aero(iof+i) = 0.0
1123 119280 sollwad_aero(iof+i) = 0.0
1124 119280 toplwad0_aero(iof+i) = 0.0
1125 119400 sollwad0_aero(iof+i) = 0.0
1126 ENDDO
1127 ENDIF
1128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 IF (ok_aie) THEN
1129 DO i = 1, kdlon
1130 topswai_aero(iof+i) = ztopswaiaero(i)
1131 solswai_aero(iof+i) = zsolswaiaero(i)
1132 !-LW
1133 toplwai_aero(iof+i) = ztoplwaiaero(i)
1134 sollwai_aero(iof+i) = zsollwaiaero(i)
1135 ENDDO
1136 ELSE
1137
2/2
✓ Branch 0 taken 120 times.
✓ Branch 1 taken 119280 times.
119400 DO i = 1, kdlon
1138 119280 topswai_aero(iof+i) = 0.0
1139 119280 solswai_aero(iof+i) = 0.0
1140 !-LW
1141 119280 toplwai_aero(iof+i) = 0.0
1142 119400 sollwai_aero(iof+i) = 0.0
1143 ENDDO
1144 ENDIF
1145
2/2
✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 120 times.
4920 DO k = 1, kflev
1146
2/2
✓ Branch 0 taken 4651920 times.
✓ Branch 1 taken 4680 times.
4656720 DO i = 1, kdlon
1147 ! scale factor to take into account the difference between
1148 ! dry air and watter vapour scpecifi! heat capacity
1149 4651920 zznormcp=1.0+RVTMP2*PWV(i,k)
1150 4651920 heat(iof+i,k) = zheat(i,k)/zznormcp
1151 4651920 cool(iof+i,k) = zcool(i,k)/zznormcp
1152 4651920 heat0(iof+i,k) = zheat0(i,k)/zznormcp
1153 4651920 cool0(iof+i,k) = zcool0(i,k)/zznormcp
1154
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4651920 times.
4656600 IF(ok_volcan) THEN !NL
1155 heat_volc(iof+i,k) = zheat_volc(i,k)/zznormcp
1156 cool_volc(iof+i,k) = zcool_volc(i,k)/zznormcp
1157 ENDIF
1158 ENDDO
1159 ENDDO
1160
1161 ENDDO ! j = 1, nb_gr
1162
1163 IF (lldebug) THEN
1164 if (0.eq.1) then
1165 ! Verifs dans le cas 1D
1166 print*,'================== Sortie de radlw ================='
1167 print*,'******** LW LW LW *******************'
1168 print*,'ZLWFT =',ZLWFT
1169 print*,'ZLWFT0_i =',ZLWFT0_i
1170 print*,'ZFLUP0 =',ZFLUP0
1171 print*,'ZFLDN0 =',ZFLDN0
1172 print*,'ZFLDNC0 =',ZFLDNC0
1173 print*,'ZFLUPC0 =',ZFLUPC0
1174
1175 print*,'******** SW SW SW *******************'
1176 print*,'ZSWFT =',ZSWFT
1177 print*,'ZSWFT0_i =',ZSWFT0_i
1178 print*,'ZFSDN =',ZFSDN
1179 print*,'ZFSDN0 =',ZFSDN0
1180 print*,'ZFSDNC0 =',ZFSDNC0
1181 print*,'ZFSUP =',ZFSUP
1182 print*,'ZFSUP0 =',ZFSUP0
1183 print*,'ZFSUPC0 =',ZFSUPC0
1184
1185 print*,'******** LMDZ *******************'
1186 print*,'cool = ', cool
1187 print*,'heat = ', heat
1188 print*,'topsw = ', topsw
1189 print*,'toplw = ', toplw
1190 print*,'sollw = ', sollw
1191 print*,'solsw = ', solsw
1192 print*,'lwdn = ', lwdn
1193 print*,'lwup = ', lwup
1194 print*,'swdn = ', swdn
1195 print*,'swup =', swup
1196 endif
1197 ENDIF
1198
1199 120 END SUBROUTINE radlwsw
1200
1201 end module radlwsw_m
1202