source: LMDZ4/branches/LMDZ4-dev-20091210/libf/phylmd/radlwsw.F90 @ 4104

Last change on this file since 4104 was 1263, checked in by lguez, 15 years ago

1) Reactivated ability to read ozone (that was deactivated because of
dependency on version of IOIPSL). Added ability to read a pressure
coordinate in Pa in "regr_lat_time_climoz".

2) Added the ability to read a second ozone climatology, corresponding to
daylight ozone:

-- "read_climoz" is now an integer variable, instead of a logical
variable.

-- Added argument "read_climoz" to "phys_state_var_init",
"phys_output_open" and "regr_lat_time_climoz".

-- Created new variable "ozone_daylight" for "hist*.nc" output files.

-- Added a third dimension to variable "wo" in module
"phys_state_var_mod" and variable "POZON" in "radlwsw": index 1 for
average day-night ozone, index 2 for daylight ozone.

-- Added a fourth dimension to variables "o3_in", "o3_regr_lat" and
"o3_out" in "regr_lat_time_climoz": index 1 for average day-night
ozone, index 2 for daylight ozone.

-- In "physiq", moved call to "conf_phys" before call to
"phys_state_var_init". Thus, "conf_phys" is now inside the block "if
(first)" instead of "IF (debut)". There were definitions of "bl95_b0"
and "bl95_b1" that were useless because the variables were overwritten
by "conf_phys". Removed those definitions.

-- In "radlwsw", we pass the average day-night ozone to "LW_LMDAR4"
and the daylight ozone, if we have it, to "SW_LMDAR4" or
"SW_AEROAR4". If we do not have a specific field for daylight ozone
then "SW_LMDAR4" or "SW_AEROAR4" just get the average day-night ozone.

-- "regr_lat_time_climoz" now manages latitudes where the input ozone
field is missing at all levels (polar night).

-- Encapsulated "radlwsw" in a module.

3) Modifications to make sequential and parallel versions of
"create_etat0_limit" almost identical:

-- In "dyn3dpar/create_etat0_limit.F". No need to call
"phys_state_var_init", removed "use phys_state_var_mod" statement. No
need for "clesphys.h", removed "include" statement.

-- In "dyn3dpar/etat0_netcdf.F". Added argument "tau_ratqs" in call to
"conf_phys" (this bug was already corrected in "dyn3d"). Moved call to
"inifilr" after call to "infotrac_init" (as in "dyn3d").

4) Other peripheral modifications:

-- Added procedures "nf95_get_att" and "nf95_def_var_scalar" in
NetCDF95 interface. Overloaded "nf95_put_var" with three more
procedures: "nf95_put_var_FourByteReal", "nf95_put_var_FourByteInt",
"nf95_put_var_1D_FourByteInt".

-- Overloaded "regr1_step_av" with one more procedure:
"regr14_step_av". Overloaded "regr3_lint" with one more procedure:
"regr34_lint".

-- Corrected call to "Init_Phys_lmdz" in "dyn3d/create_etat0_limit.F":
the last argument should be an array, not a scalar.

-- Encapsulated "conf_phys" in a module.

-- Splitted module "regr_pr" into "regr_pr_av_m" and "regr_pr_int_m".

5) Tests:

This revision was compared to revision 1259, with optimization options
"debug" and "dev", parallelization options "none", "mpi", "omp" and
"mpi_omp", 1 and 2 MPI processes, 1 and 2 OpenMP threads, with the
compiler "FORTRAN90/SX Version 2.0 for SX-8". Both programs
"create_etat0_limit" and "gcm" were tested. In all cases,
parallelization does not change the results. With "read_climoz = 0" in
the ".def" files, the results of revision 1259 and of this revision
are the same.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 17.7 KB
Line 
1module radlwsw_m
2
3  IMPLICIT NONE
4
5contains
6
7SUBROUTINE radlwsw( &
8   dist, rmu0, fract, &
9   paprs, pplay,tsol,alb1, alb2, &
10   t,q,wo,&
11   cldfra, cldemi, cldtaupd,&
12   ok_ade, ok_aie,&
13   tau_aero, piz_aero, cg_aero,&
14   cldtaupi, new_aod, &
15   qsat, flwc, fiwc, &
16   heat,heat0,cool,cool0,radsol,albpla,&
17   topsw,toplw,solsw,sollw,&
18   sollwdown,&
19   topsw0,toplw0,solsw0,sollw0,&
20   lwdn0, lwdn, lwup0, lwup,&
21   swdn0, swdn, swup0, swup,&
22   topswad_aero, solswad_aero,&
23   topswai_aero, solswai_aero, &
24   topswad0_aero, solswad0_aero,&
25   topsw_aero, topsw0_aero,&
26   solsw_aero, solsw0_aero, &
27   topswcf_aero, solswcf_aero)
28
29
30
31  USE DIMPHY
32  use assert_m, only: assert
33
34  !======================================================================
35  ! Auteur(s): Z.X. Li (LMD/CNRS) date: 19960719
36  ! Objet: interface entre le modele et les rayonnements
37  ! Arguments:
38  ! dist-----input-R- distance astronomique terre-soleil
39  ! rmu0-----input-R- cosinus de l'angle zenithal
40  ! fract----input-R- duree d'ensoleillement normalisee
41  ! co2_ppm--input-R- concentration du gaz carbonique (en ppm)
42  ! paprs----input-R- pression a inter-couche (Pa)
43  ! pplay----input-R- pression au milieu de couche (Pa)
44  ! tsol-----input-R- temperature du sol (en K)
45  ! alb1-----input-R- albedo du sol(entre 0 et 1) dans l'interval visible
46  ! alb2-----input-R- albedo du sol(entre 0 et 1) dans l'interval proche infra-rouge   
47  ! t--------input-R- temperature (K)
48  ! q--------input-R- vapeur d'eau (en kg/kg)
49  ! cldfra---input-R- fraction nuageuse (entre 0 et 1)
50  ! cldtaupd---input-R- epaisseur optique des nuages dans le visible (present-day value)
51  ! cldemi---input-R- emissivite des nuages dans l'IR (entre 0 et 1)
52  ! ok_ade---input-L- apply the Aerosol Direct Effect or not?
53  ! ok_aie---input-L- apply the Aerosol Indirect Effect or not?
54  ! tau_ae, piz_ae, cg_ae-input-R- aerosol optical properties (calculated in aeropt.F)
55  ! cldtaupi-input-R- epaisseur optique des nuages dans le visible
56  !                   calculated for pre-industrial (pi) aerosol concentrations, i.e. with smaller
57  !                   droplet concentration, thus larger droplets, thus generally cdltaupi cldtaupd
58  !                   it is needed for the diagnostics of the aerosol indirect radiative forcing     
59  !
60  ! heat-----output-R- echauffement atmospherique (visible) (K/jour)
61  ! cool-----output-R- refroidissement dans l'IR (K/jour)
62  ! radsol---output-R- bilan radiatif net au sol (W/m**2) (+ vers le bas)
63  ! albpla---output-R- albedo planetaire (entre 0 et 1)
64  ! topsw----output-R- flux solaire net au sommet de l'atm.
65  ! toplw----output-R- ray. IR montant au sommet de l'atmosphere
66  ! solsw----output-R- flux solaire net a la surface
67  ! sollw----output-R- ray. IR montant a la surface
68  ! solswad---output-R- ray. solaire net absorbe a la surface (aerosol dir)
69  ! topswad---output-R- ray. solaire absorbe au sommet de l'atm. (aerosol dir)
70  ! solswai---output-R- ray. solaire net absorbe a la surface (aerosol ind)
71  ! topswai---output-R- ray. solaire absorbe au sommet de l'atm. (aerosol ind)
72  !
73  ! ATTENTION: swai and swad have to be interpreted in the following manner:
74  ! ---------
75  ! ok_ade=F & ok_aie=F -both are zero
76  ! ok_ade=T & ok_aie=F -aerosol direct forcing is F_{AD} = topsw-topswad
77  !                        indirect is zero
78  ! ok_ade=F & ok_aie=T -aerosol indirect forcing is F_{AI} = topsw-topswai
79  !                        direct is zero
80  ! ok_ade=T & ok_aie=T -aerosol indirect forcing is F_{AI} = topsw-topswai
81  !                        aerosol direct forcing is F_{AD} = topswai-topswad
82  !
83 
84  !======================================================================
85 
86  ! ====================================================================
87  ! Adapte au modele de chimie INCA par Celine Deandreis & Anne Cozic -- 2009
88  ! 1 = ZERO   
89  ! 2 = AER total   
90  ! 3 = NAT   
91  ! 4 = BC   
92  ! 5 = SO4   
93  ! 6 = POM   
94  ! 7 = DUST   
95  ! 8 = SS   
96  ! 9 = NO3   
97  !
98  ! ====================================================================
99  include "YOETHF.h"
100  include "YOMCST.h"
101  include "clesphys.h"
102  include "iniprint.h"
103
104! Input arguments
105  REAL,    INTENT(in)  :: dist
106  REAL,    INTENT(in)  :: rmu0(KLON), fract(KLON)
107  REAL,    INTENT(in)  :: paprs(KLON,KLEV+1), pplay(KLON,KLEV)
108  REAL,    INTENT(in)  :: alb1(KLON), alb2(KLON), tsol(KLON)
109  REAL,    INTENT(in)  :: t(KLON,KLEV), q(KLON,KLEV)
110
111  REAL, INTENT(in):: wo(:, :, :) ! dimension(KLON,KLEV, 1 or 2)
112  ! column-density of ozone in a layer, in kilo-Dobsons
113  ! "wo(:, :, 1)" is for the average day-night field,
114  ! "wo(:, :, 2)" is for daylight time.
115
116  LOGICAL, INTENT(in)  :: ok_ade, ok_aie                                 ! switches whether to use aerosol direct (indirect) effects or not
117  REAL,    INTENT(in)  :: cldfra(KLON,KLEV), cldemi(KLON,KLEV), cldtaupd(KLON,KLEV)
118  REAL,    INTENT(in)  :: tau_aero(KLON,KLEV,9,2)                        ! aerosol optical properties (see aeropt.F)
119  REAL,    INTENT(in)  :: piz_aero(KLON,KLEV,9,2)                        ! aerosol optical properties (see aeropt.F)
120  REAL,    INTENT(in)  :: cg_aero(KLON,KLEV,9,2)                         ! aerosol optical properties (see aeropt.F)
121  REAL,    INTENT(in)  :: cldtaupi(KLON,KLEV)                            ! cloud optical thickness for pre-industrial aerosol concentrations
122  LOGICAL, INTENT(in)  :: new_aod                                        ! flag pour retrouver les resultats exacts de l'AR4 dans le cas ou l'on ne travaille qu'avec les sulfates
123  REAL,    INTENT(in)  :: qsat(klon,klev) ! Variable pour iflag_rrtm=1
124  REAL,    INTENT(in)  :: flwc(klon,klev) ! Variable pour iflag_rrtm=1
125  REAL,    INTENT(in)  :: fiwc(klon,klev) ! Variable pour iflag_rrtm=1
126
127! Output arguments
128  REAL,    INTENT(out) :: heat(KLON,KLEV), cool(KLON,KLEV)
129  REAL,    INTENT(out) :: heat0(KLON,KLEV), cool0(KLON,KLEV)
130  REAL,    INTENT(out) :: radsol(KLON), topsw(KLON), toplw(KLON)
131  REAL,    INTENT(out) :: solsw(KLON), sollw(KLON), albpla(KLON)
132  REAL,    INTENT(out) :: topsw0(KLON), toplw0(KLON), solsw0(KLON), sollw0(KLON)
133  REAL,    INTENT(out) :: sollwdown(KLON)
134  REAL,    INTENT(out) :: swdn(KLON,kflev+1),swdn0(KLON,kflev+1)
135  REAL,    INTENT(out) :: swup(KLON,kflev+1),swup0(KLON,kflev+1)
136  REAL,    INTENT(out) :: lwdn(KLON,kflev+1),lwdn0(KLON,kflev+1)
137  REAL,    INTENT(out) :: lwup(KLON,kflev+1),lwup0(KLON,kflev+1)
138  REAL,    INTENT(out) :: topswad_aero(KLON), solswad_aero(KLON)         ! output: aerosol direct forcing at TOA and surface
139  REAL,    INTENT(out) :: topswai_aero(KLON), solswai_aero(KLON)         ! output: aerosol indirect forcing atTOA and surface
140  REAL, DIMENSION(klon), INTENT(out)    :: topswad0_aero
141  REAL, DIMENSION(klon), INTENT(out)    :: solswad0_aero
142  REAL, DIMENSION(kdlon,9), INTENT(out) :: topsw_aero
143  REAL, DIMENSION(kdlon,9), INTENT(out) :: topsw0_aero
144  REAL, DIMENSION(kdlon,9), INTENT(out) :: solsw_aero
145  REAL, DIMENSION(kdlon,9), INTENT(out) :: solsw0_aero
146  REAL, DIMENSION(kdlon,3), INTENT(out) :: topswcf_aero
147  REAL, DIMENSION(kdlon,3), INTENT(out) :: solswcf_aero
148
149! Local variables
150  REAL(KIND=8) ZFSUP(KDLON,KFLEV+1)
151  REAL(KIND=8) ZFSDN(KDLON,KFLEV+1)
152  REAL(KIND=8) ZFSUP0(KDLON,KFLEV+1)
153  REAL(KIND=8) ZFSDN0(KDLON,KFLEV+1)
154  REAL(KIND=8) ZFLUP(KDLON,KFLEV+1)
155  REAL(KIND=8) ZFLDN(KDLON,KFLEV+1)
156  REAL(KIND=8) ZFLUP0(KDLON,KFLEV+1)
157  REAL(KIND=8) ZFLDN0(KDLON,KFLEV+1)
158  REAL(KIND=8) zx_alpha1, zx_alpha2
159  INTEGER k, kk, i, j, iof, nb_gr
160  REAL(KIND=8) PSCT
161  REAL(KIND=8) PALBD(kdlon,2), PALBP(kdlon,2)
162  REAL(KIND=8) PEMIS(kdlon), PDT0(kdlon), PVIEW(kdlon)
163  REAL(KIND=8) PPSOL(kdlon), PDP(kdlon,KLEV)
164  REAL(KIND=8) PTL(kdlon,kflev+1), PPMB(kdlon,kflev+1)
165  REAL(KIND=8) PTAVE(kdlon,kflev)
166  REAL(KIND=8) PWV(kdlon,kflev), PQS(kdlon,kflev)
167
168  real(kind=8) POZON(kdlon, kflev, size(wo, 3)) ! mass fraction of ozone
169  ! "POZON(:, :, 1)" is for the average day-night field,
170  ! "POZON(:, :, 2)" is for daylight time.
171
172  REAL(KIND=8) PAER(kdlon,kflev,5)
173  REAL(KIND=8) PCLDLD(kdlon,kflev)
174  REAL(KIND=8) PCLDLU(kdlon,kflev)
175  REAL(KIND=8) PCLDSW(kdlon,kflev)
176  REAL(KIND=8) PTAU(kdlon,2,kflev)
177  REAL(KIND=8) POMEGA(kdlon,2,kflev)
178  REAL(KIND=8) PCG(kdlon,2,kflev)
179  REAL(KIND=8) zfract(kdlon), zrmu0(kdlon), zdist
180  REAL(KIND=8) zheat(kdlon,kflev), zcool(kdlon,kflev)
181  REAL(KIND=8) zheat0(kdlon,kflev), zcool0(kdlon,kflev)
182  REAL(KIND=8) ztopsw(kdlon), ztoplw(kdlon)
183  REAL(KIND=8) zsolsw(kdlon), zsollw(kdlon), zalbpla(kdlon)
184  REAL(KIND=8) zsollwdown(kdlon)
185  REAL(KIND=8) ztopsw0(kdlon), ztoplw0(kdlon)
186  REAL(KIND=8) zsolsw0(kdlon), zsollw0(kdlon)
187  REAL(KIND=8) zznormcp
188  REAL(KIND=8) tauaero(kdlon,kflev,9,2)                     ! aer opt properties
189  REAL(KIND=8) pizaero(kdlon,kflev,9,2)
190  REAL(KIND=8) cgaero(kdlon,kflev,9,2)
191  REAL(KIND=8) PTAUA(kdlon,2,kflev)                         ! present-day value of cloud opt thickness (PTAU is pre-industrial value), local use
192  REAL(KIND=8) POMEGAA(kdlon,2,kflev)                       ! dito for single scatt albedo
193  REAL(KIND=8) ztopswadaero(kdlon), zsolswadaero(kdlon)     ! Aerosol direct forcing at TOAand surface
194  REAL(KIND=8) ztopswad0aero(kdlon), zsolswad0aero(kdlon)   ! Aerosol direct forcing at TOAand surface
195  REAL(KIND=8) ztopswaiaero(kdlon), zsolswaiaero(kdlon)     ! dito, indirect
196  REAL(KIND=8) ztopsw_aero(kdlon,9), ztopsw0_aero(kdlon,9)
197  REAL(KIND=8) zsolsw_aero(kdlon,9), zsolsw0_aero(kdlon,9)
198  REAL(KIND=8) ztopswcf_aero(kdlon,3), zsolswcf_aero(kdlon,3)     
199  real, parameter:: dobson_u = 2.1415e-05 ! Dobson unit, in kg m-2
200
201  call assert(size(wo, 1) == klon, size(wo, 2) == klev, "radlwsw wo")
202  ! initialisation
203  tauaero(:,:,:,:)=0.
204  pizaero(:,:,:,:)=0.
205  cgaero(:,:,:,:)=0.
206 
207  !
208  !-------------------------------------------
209  nb_gr = KLON / kdlon
210  IF (nb_gr*kdlon .NE. KLON) THEN
211      PRINT*, "kdlon mauvais:", KLON, kdlon, nb_gr
212      CALL abort
213  ENDIF
214  IF (kflev .NE. KLEV) THEN
215      PRINT*, "kflev differe de KLEV, kflev, KLEV"
216      CALL abort
217  ENDIF
218  !-------------------------------------------
219  DO k = 1, KLEV
220    DO i = 1, KLON
221      heat(i,k)=0.
222      cool(i,k)=0.
223      heat0(i,k)=0.
224      cool0(i,k)=0.
225    ENDDO
226  ENDDO
227  !
228  zdist = dist
229  !
230  PSCT = solaire/zdist/zdist
231  DO j = 1, nb_gr
232    iof = kdlon*(j-1)
233    DO i = 1, kdlon
234      zfract(i) = fract(iof+i)
235      zrmu0(i) = rmu0(iof+i)
236      PALBD(i,1) = alb1(iof+i)
237      PALBD(i,2) = alb2(iof+i)
238      PALBP(i,1) = alb1(iof+i)
239      PALBP(i,2) = alb2(iof+i)
240      PEMIS(i) = 1.0
241      PVIEW(i) = 1.66
242      PPSOL(i) = paprs(iof+i,1)
243      zx_alpha1 = (paprs(iof+i,1)-pplay(iof+i,2))/(pplay(iof+i,1)-pplay(iof+i,2))
244      zx_alpha2 = 1.0 - zx_alpha1
245      PTL(i,1) = t(iof+i,1) * zx_alpha1 + t(iof+i,2) * zx_alpha2
246      PTL(i,KLEV+1) = t(iof+i,KLEV)
247      PDT0(i) = tsol(iof+i) - PTL(i,1)
248    ENDDO
249    DO k = 2, kflev
250      DO i = 1, kdlon
251        PTL(i,k) = (t(iof+i,k)+t(iof+i,k-1))*0.5
252      ENDDO
253    ENDDO
254    DO k = 1, kflev
255      DO i = 1, kdlon
256        PDP(i,k) = paprs(iof+i,k)-paprs(iof+i,k+1)
257        PTAVE(i,k) = t(iof+i,k)
258        PWV(i,k) = MAX (q(iof+i,k), 1.0e-12)
259        PQS(i,k) = PWV(i,k)
260        POZON(i,k, :) = wo(iof+i, k, :) * RG * dobson_u * 1e3 &
261             / (paprs(iof+i, k) - paprs(iof+i, k+1))
262        PCLDLD(i,k) = cldfra(iof+i,k)*cldemi(iof+i,k)
263        PCLDLU(i,k) = cldfra(iof+i,k)*cldemi(iof+i,k)
264        PCLDSW(i,k) = cldfra(iof+i,k)
265        PTAU(i,1,k) = MAX(cldtaupi(iof+i,k), 1.0e-05)! 1e-12 serait instable
266        PTAU(i,2,k) = MAX(cldtaupi(iof+i,k), 1.0e-05)! pour 32-bit machines
267        POMEGA(i,1,k) = 0.9999 - 5.0e-04 * EXP(-0.5 * PTAU(i,1,k))
268        POMEGA(i,2,k) = 0.9988 - 2.5e-03 * EXP(-0.05 * PTAU(i,2,k))
269        PCG(i,1,k) = 0.865
270        PCG(i,2,k) = 0.910
271        !-
272        ! Introduced for aerosol indirect forcings.
273        ! The following values use the cloud optical thickness calculated from
274        ! present-day aerosol concentrations whereas the quantities without the
275        ! "A" at the end are for pre-industial (natural-only) aerosol concentrations
276        !
277        PTAUA(i,1,k) = MAX(cldtaupd(iof+i,k), 1.0e-05)! 1e-12 serait instable
278        PTAUA(i,2,k) = MAX(cldtaupd(iof+i,k), 1.0e-05)! pour 32-bit machines
279        POMEGAA(i,1,k) = 0.9999 - 5.0e-04 * EXP(-0.5 * PTAUA(i,1,k))
280        POMEGAA(i,2,k) = 0.9988 - 2.5e-03 * EXP(-0.05 * PTAUA(i,2,k))
281      ENDDO
282    ENDDO
283    !
284    DO k = 1, kflev+1
285      DO i = 1, kdlon
286        PPMB(i,k) = paprs(iof+i,k)/100.0
287      ENDDO
288    ENDDO
289    !
290    DO kk = 1, 5
291      DO k = 1, kflev
292        DO i = 1, kdlon
293          PAER(i,k,kk) = 1.0E-15
294        ENDDO
295      ENDDO
296    ENDDO
297    DO k = 1, kflev
298      DO i = 1, kdlon
299        tauaero(i,k,:,1)=tau_aero(iof+i,k,:,1)
300        pizaero(i,k,:,1)=piz_aero(iof+i,k,:,1)
301        cgaero(i,k,:,1) =cg_aero(iof+i,k,:,1)
302        tauaero(i,k,:,2)=tau_aero(iof+i,k,:,2)
303        pizaero(i,k,:,2)=piz_aero(iof+i,k,:,2)
304        cgaero(i,k,:,2) =cg_aero(iof+i,k,:,2)
305      ENDDO
306    ENDDO
307
308!
309!===== iflag_rrtm ================================================
310!     
311    IF (iflag_rrtm == 0) THEN
312       ! Old radiation scheme, used for AR4 runs
313       ! average day-night ozone for longwave
314       CALL LW_LMDAR4(&
315            PPMB, PDP,&
316            PPSOL,PDT0,PEMIS,&
317            PTL, PTAVE, PWV, POZON(:, :, 1), PAER,&
318            PCLDLD,PCLDLU,&
319            PVIEW,&
320            zcool, zcool0,&
321            ztoplw,zsollw,ztoplw0,zsollw0,&
322            zsollwdown,&
323            ZFLUP, ZFLDN, ZFLUP0,ZFLDN0)
324
325       ! daylight ozone, if we have it, for short wave
326       IF (.NOT. new_aod) THEN
327          ! use old version
328          CALL SW_LMDAR4(PSCT, zrmu0, zfract,&
329               PPMB, PDP, &
330               PPSOL, PALBD, PALBP,&
331               PTAVE, PWV, PQS, POZON(:, :, size(wo, 3)), PAER,&
332               PCLDSW, PTAU, POMEGA, PCG,&
333               zheat, zheat0,&
334               zalbpla,ztopsw,zsolsw,ztopsw0,zsolsw0,&
335               ZFSUP,ZFSDN,ZFSUP0,ZFSDN0,&
336               tau_aero(:,:,5,:), piz_aero(:,:,5,:), cg_aero(:,:,5,:),&
337               PTAUA, POMEGAA,&
338               ztopswadaero,zsolswadaero,&
339               ztopswaiaero,zsolswaiaero,&
340               ok_ade, ok_aie)
341         
342       ELSE ! new_aod=T         
343          CALL SW_AEROAR4(PSCT, zrmu0, zfract,&
344               PPMB, PDP,&
345               PPSOL, PALBD, PALBP,&
346               PTAVE, PWV, PQS, POZON(:, :, size(wo, 3)), PAER,&
347               PCLDSW, PTAU, POMEGA, PCG,&
348               zheat, zheat0,&
349               zalbpla,ztopsw,zsolsw,ztopsw0,zsolsw0,&
350               ZFSUP,ZFSDN,ZFSUP0,ZFSDN0,&
351               tauaero, pizaero, cgaero, &
352               PTAUA, POMEGAA,&
353               ztopswadaero,zsolswadaero,&
354               ztopswad0aero,zsolswad0aero,&
355               ztopswaiaero,zsolswaiaero, &
356               ztopsw_aero,ztopsw0_aero,&
357               zsolsw_aero,zsolsw0_aero,&
358               ztopswcf_aero,zsolswcf_aero, &
359               ok_ade, ok_aie)
360         
361       ENDIF
362
363    ELSE 
364!===== iflag_rrtm=1, on passe dans SW via RECMWFL ===============
365       WRITE(lunout,*) "Option iflag_rrtm=T ne fonctionne pas encore !!!"
366       CALL abort_gcm('radlwsw','iflag_rrtm=T not valid',1)
367
368    ENDIF ! iflag_rrtm
369!======================================================================
370
371    DO i = 1, kdlon
372      radsol(iof+i) = zsolsw(i) + zsollw(i)
373      topsw(iof+i) = ztopsw(i)
374      toplw(iof+i) = ztoplw(i)
375      solsw(iof+i) = zsolsw(i)
376      sollw(iof+i) = zsollw(i)
377      sollwdown(iof+i) = zsollwdown(i)
378      DO k = 1, kflev+1
379        lwdn0 ( iof+i,k)   = ZFLDN0 ( i,k)
380        lwdn  ( iof+i,k)   = ZFLDN  ( i,k)
381        lwup0 ( iof+i,k)   = ZFLUP0 ( i,k)
382        lwup  ( iof+i,k)   = ZFLUP  ( i,k)
383      ENDDO
384      topsw0(iof+i) = ztopsw0(i)
385      toplw0(iof+i) = ztoplw0(i)
386      solsw0(iof+i) = zsolsw0(i)
387      sollw0(iof+i) = zsollw0(i)
388      albpla(iof+i) = zalbpla(i)
389
390      DO k = 1, kflev+1
391        swdn0 ( iof+i,k)   = ZFSDN0 ( i,k)
392        swdn  ( iof+i,k)   = ZFSDN  ( i,k)
393        swup0 ( iof+i,k)   = ZFSUP0 ( i,k)
394        swup  ( iof+i,k)   = ZFSUP  ( i,k)
395      ENDDO
396    ENDDO
397    !-transform the aerosol forcings, if they have
398    ! to be calculated
399    IF (ok_ade) THEN
400        DO i = 1, kdlon
401          topswad_aero(iof+i) = ztopswadaero(i)
402          topswad0_aero(iof+i) = ztopswad0aero(i)
403          solswad_aero(iof+i) = zsolswadaero(i)
404          solswad0_aero(iof+i) = zsolswad0aero(i)
405! MS the following lines seem to be wrong, why is iof on right hand side???
406!          topsw_aero(iof+i,:) = ztopsw_aero(iof+i,:)
407!          topsw0_aero(iof+i,:) = ztopsw0_aero(iof+i,:)
408!          solsw_aero(iof+i,:) = zsolsw_aero(iof+i,:)
409!          solsw0_aero(iof+i,:) = zsolsw0_aero(iof+i,:)
410          topsw_aero(iof+i,:) = ztopsw_aero(i,:)
411          topsw0_aero(iof+i,:) = ztopsw0_aero(i,:)
412          solsw_aero(iof+i,:) = zsolsw_aero(i,:)
413          solsw0_aero(iof+i,:) = zsolsw0_aero(i,:)
414          topswcf_aero(iof+i,:) = ztopswcf_aero(i,:)
415          solswcf_aero(iof+i,:) = zsolswcf_aero(i,:)         
416        ENDDO
417    ELSE
418        DO i = 1, kdlon
419          topswad_aero(iof+i) = 0.0
420          solswad_aero(iof+i) = 0.0
421          topswad0_aero(iof+i) = 0.0
422          solswad0_aero(iof+i) = 0.0
423          topsw_aero(iof+i,:) = 0.
424          topsw0_aero(iof+i,:) =0.
425          solsw_aero(iof+i,:) = 0.
426          solsw0_aero(iof+i,:) = 0.
427        ENDDO
428    ENDIF
429    IF (ok_aie) THEN
430        DO i = 1, kdlon
431          topswai_aero(iof+i) = ztopswaiaero(i)
432          solswai_aero(iof+i) = zsolswaiaero(i)
433        ENDDO
434    ELSE
435        DO i = 1, kdlon
436          topswai_aero(iof+i) = 0.0
437          solswai_aero(iof+i) = 0.0
438        ENDDO
439    ENDIF
440    DO k = 1, kflev
441      DO i = 1, kdlon
442        !        scale factor to take into account the difference between
443        !        dry air and watter vapour scpecifi! heat capacity
444        zznormcp=1.0+RVTMP2*PWV(i,k)
445        heat(iof+i,k) = zheat(i,k)/zznormcp
446        cool(iof+i,k) = zcool(i,k)/zznormcp
447        heat0(iof+i,k) = zheat0(i,k)/zznormcp
448        cool0(iof+i,k) = zcool0(i,k)/zznormcp
449      ENDDO
450    ENDDO
451
452 ENDDO ! j = 1, nb_gr
453
454END SUBROUTINE radlwsw
455
456end module radlwsw_m
Note: See TracBrowser for help on using the repository browser.