source: LMDZ6/trunk/libf/phylmd/aeropt_2bands.F90 @ 4831

Last change on this file since 4831 was 2842, checked in by oboucher, 8 years ago

Removing absvisaer from calculations and outputs
Adding abs550aer in rrtm/aeropt_5wv_rrtm and outputs
Absorption aerosol optical depth at 550 nm

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 53.6 KB
Line 
1!
2! $Id: aeropt_2bands.F90 2842 2017-04-01 16:09:13Z evignon $
3!
4SUBROUTINE AEROPT_2BANDS( &
5     pdel, m_allaer, delt, RHcl, &
6     tau_allaer, piz_allaer, &
7     cg_allaer, m_allaer_pi, &
8     flag_aerosol, pplay, t_seri, presnivs)
9
10  USE dimphy
11  USE aero_mod
12  USE pres2lev_mod
13
14  !    Yves Balkanski le 12 avril 2006
15  !    Celine Deandreis
16  !    Anne Cozic Avril 2009
17  !    a partir d'une sous-routine de Johannes Quaas pour les sulfates
18  !
19  IMPLICIT NONE
20
21  INCLUDE "YOMCST.h"
22
23  !
24  ! Input arguments:
25  !
26  REAL, DIMENSION(klon,klev),     INTENT(in)  :: pdel
27  REAL,                           INTENT(in)  :: delt
28  REAL, DIMENSION(klon,klev,naero_tot),   INTENT(in)  :: m_allaer
29  REAL, DIMENSION(klon,klev,naero_tot),   INTENT(in)  :: m_allaer_pi
30  REAL, DIMENSION(klon,klev),     INTENT(in)  :: RHcl       ! humidite relative ciel clair
31  INTEGER,                        INTENT(in)  :: flag_aerosol
32  REAL, DIMENSION(klon,klev),     INTENT(in)  :: pplay
33  REAL, DIMENSION(klon,klev),     INTENT(in)  :: t_seri
34  REAL, DIMENSION(klev),          INTENT(in)  :: presnivs
35  !
36  ! Output arguments:
37  !
38  REAL, DIMENSION(klon,klev,naero_grp,nbands), INTENT(out) :: tau_allaer ! epaisseur optique aerosol
39  REAL, DIMENSION(klon,klev,naero_grp,nbands), INTENT(out) :: piz_allaer ! single scattering albedo aerosol
40  REAL, DIMENSION(klon,klev,naero_grp,nbands), INTENT(out) :: cg_allaer  ! asymmetry parameter aerosol
41
42  !
43  ! Local
44  !
45  REAL, DIMENSION(klon,klev,naero_tot,nbands) ::  tau_ae
46  REAL, DIMENSION(klon,klev,naero_tot,nbands) ::  tau_ae_pi
47  REAL, DIMENSION(klon,klev,naero_tot,nbands) ::  piz_ae
48  REAL, DIMENSION(klon,klev,naero_tot,nbands) ::  cg_ae
49  LOGICAL ::  soluble
50  INTEGER :: i, k,n, ierr, inu, m, mrfspecies
51  INTEGER :: spsol, spinsol, spss
52  INTEGER :: RH_num(klon,klev)
53  INTEGER, PARAMETER :: nb_level=19 ! number of vertical levels in DATA
54
55  INTEGER, PARAMETER :: nbre_RH=12
56  INTEGER, PARAMETER :: naero_soluble=7    ! 1- BC soluble; 2- POM soluble; 3- SO4. acc. 4- SO4 coarse
57                                           ! 5- seasalt super coarse  6- seasalt coarse   7- seasalt acc.
58  INTEGER, PARAMETER :: naero_insoluble=3  ! 1- Dust; 2- BC insoluble; 3- POM insoluble
59  LOGICAL, SAVE :: firstcall=.TRUE.
60!$OMP THREADPRIVATE(firstcall)
61
62! Coefficient optiques sur 19 niveaux
63  REAL, SAVE, DIMENSION(nb_level) :: presnivs_19  ! Pression milieux couche pour 19 niveaux (nb_level)
64!$OMP THREADPRIVATE(presnivs_19)
65
66  REAL, SAVE, DIMENSION(nb_level) :: A1_ASSSM_b1_19, A2_ASSSM_b1_19, A3_ASSSM_b1_19,&
67          B1_ASSSM_b1_19, B2_ASSSM_b1_19, C1_ASSSM_b1_19, C2_ASSSM_b1_19,&
68          A1_CSSSM_b1_19, A2_CSSSM_b1_19, A3_CSSSM_b1_19,&
69          B1_CSSSM_b1_19, B2_CSSSM_b1_19, C1_CSSSM_b1_19, C2_CSSSM_b1_19,&
70          A1_SSSSM_b1_19, A2_SSSSM_b1_19, A3_SSSSM_b1_19,&
71          B1_SSSSM_b1_19, B2_SSSSM_b1_19, C1_SSSSM_b1_19, C2_SSSSM_b1_19,&
72          A1_ASSSM_b2_19, A2_ASSSM_b2_19, A3_ASSSM_b2_19,&
73          B1_ASSSM_b2_19, B2_ASSSM_b2_19, C1_ASSSM_b2_19, C2_ASSSM_b2_19,&
74          A1_CSSSM_b2_19, A2_CSSSM_b2_19, A3_CSSSM_b2_19,&
75          B1_CSSSM_b2_19, B2_CSSSM_b2_19, C1_CSSSM_b2_19, C2_CSSSM_b2_19,&
76          A1_SSSSM_b2_19, A2_SSSSM_b2_19, A3_SSSSM_b2_19,&
77          B1_SSSSM_b2_19, B2_SSSSM_b2_19, C1_SSSSM_b2_19, C2_SSSSM_b2_19
78!$OMP THREADPRIVATE(A1_ASSSM_b1_19, A2_ASSSM_b1_19, A3_ASSSM_b1_19)
79!$OMP THREADPRIVATE(B1_ASSSM_b1_19, B2_ASSSM_b1_19, C1_ASSSM_b1_19, C2_ASSSM_b1_19)
80!$OMP THREADPRIVATE(A1_CSSSM_b1_19, A2_CSSSM_b1_19, A3_CSSSM_b1_19)
81!$OMP THREADPRIVATE(B1_CSSSM_b1_19, B2_CSSSM_b1_19, C1_CSSSM_b1_19, C2_CSSSM_b1_19)
82!$OMP THREADPRIVATE(A1_SSSSM_b1_19, A2_SSSSM_b1_19, A3_SSSSM_b1_19)
83!$OMP THREADPRIVATE(B1_SSSSM_b1_19, B2_SSSSM_b1_19, C1_SSSSM_b1_19, C2_SSSSM_b1_19)
84!$OMP THREADPRIVATE(A1_ASSSM_b2_19, A2_ASSSM_b2_19, A3_ASSSM_b2_19)
85!$OMP THREADPRIVATE(B1_ASSSM_b2_19, B2_ASSSM_b2_19, C1_ASSSM_b2_19, C2_ASSSM_b2_19)
86!$OMP THREADPRIVATE(A1_CSSSM_b2_19, A2_CSSSM_b2_19, A3_CSSSM_b2_19)
87!$OMP THREADPRIVATE(B1_CSSSM_b2_19, B2_CSSSM_b2_19, C1_CSSSM_b2_19, C2_CSSSM_b2_19)
88!$OMP THREADPRIVATE(A1_SSSSM_b2_19, A2_SSSSM_b2_19, A3_SSSSM_b2_19)
89!$OMP THREADPRIVATE(B1_SSSSM_b2_19, B2_SSSSM_b2_19, C1_SSSSM_b2_19, C2_SSSSM_b2_19)
90
91
92! Coefficient optiques interpole sur le nombre de niveau du modele
93  REAL, ALLOCATABLE, DIMENSION(:), SAVE :: &
94          A1_ASSSM_b1, A2_ASSSM_b1, A3_ASSSM_b1,&
95          B1_ASSSM_b1, B2_ASSSM_b1, C1_ASSSM_b1, C2_ASSSM_b1,&
96          A1_CSSSM_b1, A2_CSSSM_b1, A3_CSSSM_b1,&
97          B1_CSSSM_b1, B2_CSSSM_b1, C1_CSSSM_b1, C2_CSSSM_b1,&
98          A1_SSSSM_b1, A2_SSSSM_b1, A3_SSSSM_b1,&
99          B1_SSSSM_b1, B2_SSSSM_b1, C1_SSSSM_b1, C2_SSSSM_b1,&
100          A1_ASSSM_b2, A2_ASSSM_b2, A3_ASSSM_b2,&
101          B1_ASSSM_b2, B2_ASSSM_b2, C1_ASSSM_b2, C2_ASSSM_b2,&
102          A1_CSSSM_b2, A2_CSSSM_b2, A3_CSSSM_b2,&
103          B1_CSSSM_b2, B2_CSSSM_b2, C1_CSSSM_b2, C2_CSSSM_b2,&
104          A1_SSSSM_b2, A2_SSSSM_b2, A3_SSSSM_b2,&
105          B1_SSSSM_b2, B2_SSSSM_b2, C1_SSSSM_b2, C2_SSSSM_b2
106!$OMP THREADPRIVATE(A1_ASSSM_b1, A2_ASSSM_b1, A3_ASSSM_b1)
107!$OMP THREADPRIVATE(B1_ASSSM_b1, B2_ASSSM_b1, C1_ASSSM_b1, C2_ASSSM_b1)
108!$OMP THREADPRIVATE(A1_CSSSM_b1, A2_CSSSM_b1, A3_CSSSM_b1)
109!$OMP THREADPRIVATE(B1_CSSSM_b1, B2_CSSSM_b1, C1_CSSSM_b1, C2_CSSSM_b1)
110!$OMP THREADPRIVATE(A1_SSSSM_b1, A2_SSSSM_b1, A3_SSSSM_b1)
111!$OMP THREADPRIVATE(B1_SSSSM_b1, B2_SSSSM_b1, C1_SSSSM_b1, C2_SSSSM_b1)
112!$OMP THREADPRIVATE(A1_ASSSM_b2, A2_ASSSM_b2, A3_ASSSM_b2)
113!$OMP THREADPRIVATE(B1_ASSSM_b2, B2_ASSSM_b2, C1_ASSSM_b2, C2_ASSSM_b2)
114!$OMP THREADPRIVATE(A1_CSSSM_b2, A2_CSSSM_b2, A3_CSSSM_b2)
115!$OMP THREADPRIVATE(B1_CSSSM_b2, B2_CSSSM_b2, C1_CSSSM_b2, C2_CSSSM_b2)
116!$OMP THREADPRIVATE(A1_SSSSM_b2, A2_SSSSM_b2, A3_SSSSM_b2)
117!$OMP THREADPRIVATE(B1_SSSSM_b2, B2_SSSSM_b2, C1_SSSSM_b2, C2_SSSSM_b2)
118 
119  REAL,PARAMETER :: RH_tab(nbre_RH)=(/0.,10.,20.,30.,40.,50.,60.,70.,80.,85.,90.,95./)
120  REAL, PARAMETER :: RH_MAX=95.
121  REAL:: DELTA(klon,klev), rh(klon,klev), H
122  REAL:: tau_ae2b_int   ! Intermediate computation of epaisseur optique aerosol
123  REAL:: piz_ae2b_int   ! Intermediate computation of Single scattering albedo
124  REAL:: cg_ae2b_int    ! Intermediate computation of Assymetry parameter
125  REAL :: Fact_RH(nbre_RH)
126  REAL :: zrho
127  REAL :: fac
128  REAL :: zdh(klon,klev)
129  INTEGER, ALLOCATABLE, DIMENSION(:)   :: aerosol_name
130  INTEGER :: nb_aer
131
132  !
133  ! Proprietes optiques
134  !
135  REAL:: alpha_aers_2bands(nbre_RH,nbands,naero_soluble)   !--unit m2/g SO4
136  REAL:: alpha_aeri_2bands(nbands,naero_insoluble)
137  REAL:: cg_aers_2bands(nbre_RH,nbands,naero_soluble)      !--unit
138  REAL:: cg_aeri_2bands(nbands,naero_insoluble)
139  REAL:: piz_aers_2bands(nbre_RH,nbands,naero_soluble)     !-- unit
140  REAL:: piz_aeri_2bands(nbands,naero_insoluble)           !-- unit
141
142  INTEGER :: id
143  LOGICAL :: used_aer(naero_tot)
144  REAL :: tmp_var, tmp_var_pi
145
146  DATA presnivs_19/&
147       100426.5,  98327.6, 95346.5, 90966.8, 84776.9, &
148       76536.5,   66292.2, 54559.3, 42501.8, 31806, &
149       23787.5,   18252.7, 13996,   10320.8, 7191.1, &
150       4661.7,    2732.9,  1345.6,  388.2/ 
151
152
153!***********************BAND 1***********************************
154!ACCUMULATION MODE
155  DATA A1_ASSSM_b1_19/ 4.373E+00,  4.361E+00,  4.331E+00, &
156                    4.278E+00,  4.223E+00,  4.162E+00, &
157                    4.103E+00,  4.035E+00,  3.962E+00, &
158                    3.904E+00,  3.871E+00,  3.847E+00, &
159                    3.824E+00,  3.780E+00,  3.646E+00, &
160                    3.448E+00,  3.179E+00,  2.855E+00,  2.630E+00/
161  DATA A2_ASSSM_b1_19/ 2.496E+00,  2.489E+00,  2.472E+00, &
162                    2.442E+00,  2.411E+00,  2.376E+00, &
163                    2.342E+00,  2.303E+00,  2.261E+00, &
164                    2.228E+00,  2.210E+00,  2.196E+00, &
165                    2.183E+00,  2.158E+00,  2.081E+00, &
166                    1.968E+00,  1.814E+00,  1.630E+00,  1.501E+00/
167  DATA A3_ASSSM_b1_19/-4.688E-02, -4.676E-02, -4.644E-02, &
168                   -4.587E-02, -4.528E-02, -4.463E-02, &
169                   -4.399E-02, -4.326E-02, -4.248E-02, &
170                   -4.186E-02, -4.151E-02, -4.125E-02, &
171                   -4.100E-02, -4.053E-02, -3.910E-02, &
172                   -3.697E-02, -3.408E-02, -3.061E-02, -2.819E-02/
173  DATA B1_ASSSM_b1_19/ 1.165E-08,  1.145E-08,  1.097E-08, &
174                    1.012E-08,  9.233E-09,  8.261E-09, &
175                    7.297E-09,  6.201E-09,  5.026E-09, &
176                    4.098E-09,  3.567E-09,  3.187E-09, &
177                    2.807E-09,  2.291E-09,  2.075E-09, &
178                    1.756E-09,  1.322E-09,  8.011E-10, 4.379E-10/
179  DATA B2_ASSSM_b1_19/ 2.193E-08,  2.192E-08,  2.187E-08, &
180                    2.179E-08,  2.171E-08,  2.162E-08, &
181                    2.153E-08,  2.143E-08,  2.132E-08, &
182                    2.124E-08,  2.119E-08,  2.115E-08, &
183                    2.112E-08,  2.106E-08,  2.100E-08, &
184                    2.090E-08,  2.077E-08,  2.061E-08,  2.049E-08/
185  DATA C1_ASSSM_b1_19/ 7.365E-01,  7.365E-01,  7.365E-01, &
186                    7.364E-01,  7.363E-01,  7.362E-01, &
187                    7.361E-01,  7.359E-01,  7.358E-01, &
188                    7.357E-01,  7.356E-01,  7.356E-01, &
189                    7.356E-01,  7.355E-01,  7.354E-01, &
190                    7.352E-01,  7.350E-01,  7.347E-01,  7.345E-01/
191  DATA C2_ASSSM_b1_19/ 5.833E-02,  5.835E-02,  5.841E-02, &
192                    5.850E-02,  5.859E-02,  5.870E-02, &
193                    5.880E-02,  5.891E-02,  5.904E-02, &
194                    5.914E-02,  5.920E-02,  5.924E-02, &
195                    5.928E-02,  5.934E-02,  5.944E-02, &
196                    5.959E-02,  5.979E-02,  6.003E-02,  6.020E-02/
197!COARSE MODE
198  DATA A1_CSSSM_b1_19/ 7.403E-01,  7.422E-01,  7.626E-01, &
199                    8.019E-01,  8.270E-01,  8.527E-01, &
200                    8.702E-01,  8.806E-01,  8.937E-01, &
201                    9.489E-01,  1.030E+00,  1.105E+00, &
202                    1.199E+00,  1.357E+00,  1.660E+00, &
203                    2.540E+00,  4.421E+00,  2.151E+00,  9.518E-01/
204  DATA A2_CSSSM_b1_19/ 4.522E-01,  4.532E-01,  4.644E-01, &
205                    4.859E-01,  4.996E-01,  5.137E-01, &
206                    5.233E-01,  5.290E-01,  5.361E-01, &
207                    5.655E-01,  6.085E-01,  6.483E-01, &
208                    6.979E-01,  7.819E-01,  9.488E-01, &
209                    1.450E+00,  2.523E+00,  1.228E+00,  5.433E-01/
210  DATA A3_CSSSM_b1_19/-8.516E-03, -8.535E-03, -8.744E-03, &
211                   -9.148E-03, -9.406E-03, -9.668E-03, &
212                   -9.848E-03, -9.955E-03, -1.009E-02, &
213                   -1.064E-02, -1.145E-02, -1.219E-02, &
214                   -1.312E-02, -1.470E-02, -1.783E-02, &
215                   -2.724E-02, -4.740E-02, -2.306E-02, -1.021E-02/
216  DATA B1_CSSSM_b1_19/ 2.535E-07,  2.530E-07,  2.479E-07, &
217                    2.380E-07,  2.317E-07,  2.252E-07, &
218                    2.208E-07,  2.182E-07,  2.149E-07, &
219                    2.051E-07,  1.912E-07,  1.784E-07, &
220                    1.624E-07,  1.353E-07,  1.012E-07, &
221                    6.016E-08,  2.102E-08,  0.000E+00,  0.000E+00/
222  DATA B2_CSSSM_b1_19/ 1.221E-07,  1.217E-07,  1.179E-07, &
223                    1.104E-07,  1.056E-07,  1.008E-07, &
224                    9.744E-08,  9.546E-08,  9.299E-08, &
225                    8.807E-08,  8.150E-08,  7.544E-08, &
226                    6.786E-08,  5.504E-08,  4.080E-08, &
227                    2.960E-08,  2.300E-08,  2.030E-08,  1.997E-08/
228  DATA C1_CSSSM_b1_19/ 7.659E-01,  7.658E-01,  7.652E-01, &
229                    7.639E-01,  7.631E-01,  7.623E-01, &
230                    7.618E-01,  7.614E-01,  7.610E-01, &
231                    7.598E-01,  7.581E-01,  7.566E-01, &
232                    7.546E-01,  7.513E-01,  7.472E-01, &
233                    7.423E-01,  7.376E-01,  7.342E-01,  7.334E-01/
234  DATA C2_CSSSM_b1_19/ 3.691E-02,  3.694E-02,  3.729E-02, &
235                    3.796E-02,  3.839E-02,  3.883E-02, &
236                    3.913E-02,  3.931E-02,  3.953E-02, &
237                    4.035E-02,  4.153E-02,  4.263E-02, &
238                    4.400E-02,  4.631E-02,  4.933E-02, &
239                    5.331E-02,  5.734E-02,  6.053E-02,  6.128E-02/
240!SUPER COARSE MODE
241  DATA A1_SSSSM_b1_19/ 2.836E-01,  2.876E-01,  2.563E-01, &
242                    2.414E-01,  2.541E-01,  2.546E-01, &
243                    2.572E-01,  2.638E-01,  2.781E-01, &
244                    3.167E-01,  4.209E-01,  5.286E-01, &
245                    6.959E-01,  9.233E-01,  1.282E+00, &
246                    1.836E+00,  2.981E+00,  4.355E+00,  4.059E+00/
247  DATA A2_SSSSM_b1_19/ 1.608E-01,  1.651E-01,  1.577E-01, &
248                    1.587E-01,  1.686E-01,  1.690E-01, &
249                    1.711E-01,  1.762E-01,  1.874E-01, &
250                    2.138E-01,  2.751E-01,  3.363E-01, &
251                    4.279E-01,  5.519E-01,  7.421E-01, &
252                    1.048E+00,  1.702E+00,  2.485E+00,  2.317E+00/
253  DATA A3_SSSSM_b1_19/-3.025E-03, -3.111E-03, -2.981E-03, &
254                   -3.005E-03, -3.193E-03, -3.200E-03, &
255                   -3.239E-03, -3.336E-03, -3.548E-03, &
256                   -4.047E-03, -5.196E-03, -6.345E-03, &
257                   -8.061E-03, -1.038E-02, -1.395E-02, &
258                   -1.970E-02, -3.197E-02, -4.669E-02, -4.352E-02/
259  DATA B1_SSSSM_b1_19/ 6.759E-07,  6.246E-07,  5.542E-07, &
260                    4.953E-07,  4.746E-07,  4.738E-07, &
261                    4.695E-07,  4.588E-07,  4.354E-07, &
262                    3.947E-07,  3.461E-07,  3.067E-07, &
263                    2.646E-07,  2.095E-07,  1.481E-07, &
264                    9.024E-08,  5.747E-08,  2.384E-08,  6.599E-09/
265  DATA B2_SSSSM_b1_19/ 5.977E-07,  5.390E-07,  4.468E-07, &
266                    3.696E-07,  3.443E-07,  3.433E-07, &
267                    3.380E-07,  3.249E-07,  2.962E-07, &
268                    2.483E-07,  1.989E-07,  1.623E-07, &
269                    1.305E-07,  9.015E-08,  6.111E-08, &
270                    3.761E-08,  2.903E-08,  2.337E-08,  2.147E-08/
271  DATA C1_SSSSM_b1_19/ 8.120E-01,  8.084E-01,  8.016E-01, &
272                    7.953E-01,  7.929E-01,  7.928E-01, &
273                    7.923E-01,  7.910E-01,  7.882E-01, &
274                    7.834E-01,  7.774E-01,  7.725E-01, &
275                    7.673E-01,  7.604E-01,  7.529E-01, &
276                    7.458E-01,  7.419E-01,  7.379E-01,  7.360E-01/
277  DATA C2_SSSSM_b1_19/ 2.388E-02,  2.392E-02,  2.457E-02,  2.552E-02, &
278                    2.615E-02,  2.618E-02,  2.631E-02,  2.663E-02, &
279                    2.735E-02,  2.875E-02,  3.113E-02,  3.330E-02, &
280                    3.615E-02,  3.997E-02,  4.521E-02,  5.038E-02, &
281                    5.358E-02,  5.705E-02,  5.887E-02/
282!*********************BAND 2************************************************
283!ACCUMULATION MODE
284  DATA A1_ASSSM_b2_19/1.256E+00, 1.246E+00, 1.226E+00, 1.187E+00, 1.148E+00, &
285                   1.105E+00, 1.062E+00, 1.014E+00, 9.616E-01, 9.205E-01, &
286                   8.970E-01, 8.800E-01, 8.632E-01, 8.371E-01, 7.943E-01, &
287                   7.308E-01, 6.448E-01, 5.414E-01, 4.693E-01/
288  DATA A2_ASSSM_b2_19/5.321E-01, 5.284E-01, 5.196E-01, 5.036E-01, 4.872E-01, &
289                   4.691E-01, 4.512E-01, 4.308E-01, 4.089E-01, 3.917E-01, &
290                   3.818E-01, 3.747E-01, 3.676E-01, 3.567E-01, 3.385E-01, &
291                   3.116E-01, 2.751E-01, 2.312E-01, 2.006E-01/
292  DATA A3_ASSSM_b2_19/-1.053E-02, -1.046E-02, -1.028E-02, -9.964E-03, -9.637E-03, &
293                   -9.279E-03, -8.923E-03, -8.518E-03, -8.084E-03, -7.741E-03, &
294                   -7.545E-03, -7.405E-03, -7.265E-03, -7.048E-03, -6.687E-03, &
295                   -6.156E-03, -5.433E-03, -4.565E-03, -3.961E-03/
296  DATA B1_ASSSM_b2_19/1.560E-02, 1.560E-02, 1.561E-02, 1.565E-02, 1.568E-02, &
297                   1.572E-02, 1.576E-02, 1.580E-02, 1.584E-02, 1.588E-02, &
298                   1.590E-02, 1.592E-02, 1.593E-02, 1.595E-02, 1.599E-02, &
299                   1.605E-02, 1.612E-02, 1.621E-02, 1.627E-02/
300  DATA B2_ASSSM_b2_19/1.073E-02, 1.074E-02, 1.076E-02, 1.079E-02, 1.082E-02, &
301                   1.085E-02, 1.089E-02, 1.093E-02, 1.097E-02, 1.100E-02, &
302                   1.102E-02, 1.103E-02, 1.105E-02, 1.107E-02, 1.110E-02, &
303                   1.115E-02, 1.122E-02, 1.130E-02, 1.136E-02/
304  DATA C1_ASSSM_b2_19/7.429E-01, 7.429E-01, 7.429E-01, 7.427E-01, 7.427E-01, &
305                   7.424E-01, 7.423E-01, 7.422E-01, 7.421E-01, 7.420E-01, &
306                   7.419E-01, 7.419E-01, 7.418E-01, 7.417E-01, 7.416E-01, &
307                   7.415E-01, 7.413E-01, 7.409E-01, 7.408E-01/
308  DATA C2_ASSSM_b2_19/3.031E-02, 3.028E-02, 3.022E-02, 3.011E-02, 2.999E-02, &
309                   2.986E-02, 2.973E-02, 2.959E-02, 2.943E-02, 2.931E-02, &
310                   2.924E-02, 2.919E-02, 2.913E-02, 2.905E-02, 2.893E-02, &
311                   2.874E-02, 2.847E-02, 2.817E-02, 2.795E-02/
312!COARSE MODE
313  DATA A1_CSSSM_b2_19/7.061E-01, 7.074E-01, 7.211E-01, 7.476E-01, 7.647E-01, &
314                   7.817E-01, 7.937E-01, 8.007E-01, 8.095E-01, 8.436E-01, &
315                   8.932E-01, 9.390E-01, 9.963E-01, 1.093E+00, 1.256E+00, &
316                   1.668E+00, 1.581E+00, 3.457E-01, 1.331E-01/
317  DATA A2_CSSSM_b2_19/3.617E-01, 3.621E-01, 3.662E-01, 3.739E-01, 3.789E-01, &
318                   3.840E-01, 3.874E-01, 3.895E-01, 3.921E-01, 4.001E-01, &
319                   4.117E-01, 4.223E-01, 4.356E-01, 4.581E-01, 5.099E-01, &
320                   6.831E-01, 6.663E-01, 1.481E-01, 5.703E-02/
321  DATA A3_CSSSM_b2_19/-6.953E-03, -6.961E-03, -7.048E-03, -7.216E-03, -7.322E-03, &
322                   -7.431E-03, -7.506E-03, -7.551E-03, -7.606E-03, -7.791E-03, &
323                   -8.059E-03, -8.305E-03, -8.613E-03, -9.134E-03, -1.023E-02, &
324                   -1.365E-02, -1.320E-02, -2.922E-03, -1.125E-03/
325  DATA B1_CSSSM_b2_19/1.007E-02, 1.008E-02, 1.012E-02, 1.019E-02, 1.024E-02, &
326                   1.029E-02, 1.033E-02, 1.035E-02, 1.038E-02, 1.056E-02, &
327                   1.083E-02, 1.109E-02, 1.140E-02, 1.194E-02, 1.270E-02, &
328                   1.390E-02, 1.524E-02, 1.639E-02, 1.667E-02/
329  DATA B2_CSSSM_b2_19/4.675E-03, 4.682E-03, 4.760E-03, 4.908E-03, 5.004E-03, &
330                   5.102E-03, 5.168E-03, 5.207E-03, 5.256E-03, 5.474E-03, &
331                   5.793E-03, 6.089E-03, 6.457E-03, 7.081E-03, 7.923E-03, &
332                   9.127E-03, 1.041E-02, 1.147E-02, 1.173E-02/
333  DATA C1_CSSSM_b2_19/7.571E-01, 7.571E-01, 7.570E-01, 7.568E-01, 7.565E-01, &
334                   7.564E-01, 7.563E-01, 7.562E-01, 7.562E-01, 7.557E-01, &
335                   7.552E-01, 7.545E-01, 7.539E-01, 7.527E-01, 7.509E-01, &
336                   7.478E-01, 7.440E-01, 7.404E-01, 7.394E-01/
337  DATA C2_CSSSM_b2_19/4.464E-02, 4.465E-02, 4.468E-02, 4.474E-02, 4.477E-02, &
338                   4.480E-02, 4.482E-02, 4.484E-02, 4.486E-02, 4.448E-02, &
339                   4.389E-02, 4.334E-02, 4.264E-02, 4.148E-02, 3.957E-02, &
340                   3.588E-02, 3.149E-02, 2.751E-02, 2.650E-02/
341!SUPER COARSE MODE
342  DATA A1_SSSSM_b2_19/2.357E-01, 2.490E-01, 2.666E-01, 2.920E-01, 3.120E-01, &
343                   3.128E-01, 3.169E-01, 3.272E-01, 3.498E-01, 3.960E-01, &
344                   4.822E-01, 5.634E-01, 6.763E-01, 8.278E-01, 1.047E+00, &
345                   1.340E+00, 1.927E+00, 1.648E+00, 1.031E+00/
346  DATA A2_SSSSM_b2_19/1.219E-01, 1.337E-01, 1.633E-01, 1.929E-01, 2.057E-01, &
347                   2.062E-01, 2.089E-01, 2.155E-01, 2.300E-01, 2.560E-01, &
348                   2.908E-01, 3.199E-01, 3.530E-01, 3.965E-01, 4.475E-01, &
349                   5.443E-01, 7.943E-01, 6.928E-01, 4.381E-01/
350  DATA A3_SSSSM_b2_19/-2.387E-03, -2.599E-03, -3.092E-03, -3.599E-03, -3.832E-03, &
351                   -3.842E-03, -3.890E-03, -4.012E-03, -4.276E-03, -4.763E-03, &
352                   -5.455E-03, -6.051E-03, -6.763E-03, -7.708E-03, -8.887E-03, &
353                   -1.091E-02, -1.585E-02, -1.373E-02, -8.665E-03/
354  DATA B1_SSSSM_b2_19/1.260E-02, 1.211E-02, 1.126E-02, 1.056E-02, 1.038E-02, &
355                   1.037E-02, 1.033E-02, 1.023E-02, 1.002E-02, 9.717E-03, &
356                   9.613E-03, 9.652E-03, 9.983E-03, 1.047E-02, 1.168E-02, &
357                   1.301E-02, 1.399E-02, 1.514E-02, 1.578E-02/
358  DATA B2_SSSSM_b2_19/2.336E-03, 2.419E-03, 2.506E-03, 2.610E-03, 2.690E-03, &
359                   2.694E-03, 2.711E-03, 2.752E-03, 2.844E-03, 3.043E-03, &
360                   3.455E-03, 3.871E-03, 4.507E-03, 5.373E-03, 6.786E-03, &
361                   8.238E-03, 9.208E-03, 1.032E-02, 1.091E-02/
362  DATA C1_SSSSM_b2_19/7.832E-01, 7.787E-01, 7.721E-01, 7.670E-01, 7.657E-01, &
363                   7.657E-01, 7.654E-01, 7.648E-01, 7.634E-01, 7.613E-01, &
364                   7.596E-01, 7.585E-01, 7.574E-01, 7.560E-01, 7.533E-01, &
365                   7.502E-01, 7.476E-01, 7.443E-01, 7.423E-01/
366  DATA C2_SSSSM_b2_19/3.144E-02, 3.268E-02, 3.515E-02, 3.748E-02, 3.837E-02, &
367                   3.840E-02, 3.860E-02, 3.906E-02, 4.006E-02, 4.173E-02, &
368                   4.338E-02, 4.435E-02, 4.459E-02, 4.467E-02, 4.202E-02, &
369                   3.864E-02, 3.559E-02, 3.183E-02, 2.964E-02/
370!***************************************************************************
371
372  spsol = 0
373  spinsol = 0
374  spss = 0
375
376  DATA alpha_aers_2bands/  &
377       ! bc soluble
378       7.675,7.675,7.675,7.675,7.675,7.675,    &
379       7.675,7.675,10.433,11.984,13.767,15.567,&
380       4.720,4.720,4.720,4.720,4.720,4.720,    &
381       4.720,4.720,6.081,6.793,7.567,9.344,    &
382       ! pom soluble
383       5.503,5.503,5.503,5.503,5.588,5.957,    &
384       6.404,7.340,8.545,10.319,13.595,20.398, &
385       1.402,1.402,1.402,1.402,1.431,1.562,    &
386       1.715,2.032,2.425,2.991,4.193,7.133,    &
387       ! sulfate   
388       4.681,5.062,5.460,5.798,6.224,6.733,    &
389       7.556,8.613,10.687,12.265,16.32,21.692, &
390       1.107,1.239,1.381,1.490,1.635,1.8030,   &
391       2.071,2.407,3.126,3.940,5.539,7.921,    &
392                                ! sulfate coarse
393       4.681,5.062,5.460,5.798,6.224,6.733,    &
394       7.556,8.613,10.687,12.265,16.32,21.692, &
395       1.107,1.239,1.381,1.490,1.635,1.8030,   &
396       2.071,2.407,3.126,3.940,5.539,7.921,    &
397                                ! seasalt Super Coarse Soluble (SS)
398       0.5090,0.6554,0.7129,0.7767,0.8529,1.2728, &
399       1.3820,1.5792,1.9173,2.2002,2.7173,4.1487, &
400       0.5167,0.6613,0.7221,0.7868,0.8622,1.3027, &
401       1.4227,1.6317,1.9887,2.2883,2.8356,4.3453, &
402                                ! seasalt  Coarse Soluble (CS)
403       0.5090,0.6554,0.7129,0.7767,0.8529,1.2728, &
404       1.3820,1.5792,1.9173,2.2002,2.7173,4.1487, &
405       0.5167,0.6613,0.7221,0.7868,0.8622,1.3027, &
406       1.4227,1.6317,1.9887,2.2883,2.8356,4.3453, &
407                                ! seasalt  Accumulation Soluble (AS)
408       4.125, 4.674, 5.005, 5.434, 5.985, 10.006, &
409       11.175,13.376,17.264,20.540,26.604, 42.349,&
410       4.187, 3.939, 3.919, 3.937, 3.995,  5.078, &
411       5.511, 6.434, 8.317,10.152,14.024, 26.537/
412
413  DATA alpha_aeri_2bands/  &
414       ! dust insoluble
415       0.7661,0.7123,&
416       ! bc insoluble
417       10.360,4.437, &
418       ! pom insoluble
419       3.741,0.606/
420
421  DATA cg_aers_2bands/ &
422       ! bc soluble
423       .612, .612, .612, .612, .612, .612, &
424       .612, .612, .702, .734, .760, .796, &
425       .433, .433, .433, .433, .433, .433, &
426       .433, .433, .534, .575, .613, .669, &
427       ! pom soluble
428       .663, .663, .663, .663, .666, .674, &
429       .685, .702, .718, .737, .757, .777, &
430       .544, .544, .544, .544, .547, .554, &
431       .565, .583, .604, .631, .661, .698, &
432       ! sulfate   
433       .658, .669, .680, .688, .698, .707, &
434       .719, .733, .752, .760, .773, .786, &
435       .544, .555, .565, .573, .583, .593, &
436       .610, .628, .655, .666, .692, .719, &
437                                ! sulfate coarse
438       .658, .669, .680, .688, .698, .707, &
439       .719, .733, .752, .760, .773, .786, &
440       .544, .555, .565, .573, .583, .593, &
441       .610, .628, .655, .666, .692, .719, &
442                                ! seasalt Super Coarse soluble (SS)
443       .727, .747, .755, .761, .770, .788, &
444       .792, .799, .805, .809, .815, .826, &
445       .717, .738, .745, .752, .761, .779, &
446       .781, .786, .793, .797, .803, .813, &
447                                ! seasalt Coarse soluble (CS)
448       .727, .747, .755, .761, .770, .788, &
449       .792, .799, .805, .809, .815, .826, &
450       .717, .738, .745, .752, .761, .779, &
451       .781, .786, .793, .797, .803, .813, &
452                                ! Sesalt Accumulation Soluble (AS)
453       .727, .741, .748, .754, .761, .782, &
454       .787, .792, .797, .799, .801, .799, &
455       .606, .645, .658, .669, .681, .726, &
456       .734, .746, .761, .770, .782, .798/
457
458  DATA cg_aeri_2bands/ &
459       ! dust insoluble
460       .701, .670, &
461       ! bc insoluble
462       .471, .297, &
463       ! pom insoluble
464       .568, .365/
465
466  DATA piz_aers_2bands/&
467       ! bc soluble
468       .445, .445, .445, .445, .445, .445, &
469       .445, .445, .461, .480, .505, .528, &
470       .362, .362, .362, .362, .362, .362, &
471       .362, .362, .381, .405, .437, .483, &
472       ! pom soluble
473       .972, .972, .972, .972, .972, .974, &
474       .976, .979, .982, .986, .989, .992, &
475       .924, .924, .924, .924, .925, .927, &
476       .932, .938, .945, .952, .961, .970, &
477       ! sulfate
478       1.000,1.000,1.000,1.000,1.000,1.000, &
479       1.000,1.000,1.000,1.000,1.000,1.000, &
480       .992, .988, .988, .987, .986, .985,  &
481       .985, .985, .984, .984, .984, .984,  &
482                                ! sulfate coarse
483       1.000,1.000,1.000,1.000,1.000,1.000, &
484       1.000,1.000,1.000,1.000,1.000,1.000, &
485       .992, .988, .988, .987, .986, .985,  &
486       .985, .985, .984, .984, .984, .984,  &
487                                ! seasalt Super Coarse Soluble (SS)
488       1.000,1.000,1.000,1.000,1.000,1.000, &
489       1.000,1.000,1.000,1.000,1.000,1.000, &
490       0.992,0.989,0.987,0.986,0.986,0.980, &
491       0.980,0.978,0.976,0.976,0.974,0.971, &
492                                ! seasalt Coarse soluble (CS)
493       1.000,1.000,1.000,1.000,1.000,1.000, &
494       1.000,1.000,1.000,1.000,1.000,1.000, &
495       0.992,0.989,0.987,0.986,0.986,0.980, &
496       0.980,0.978,0.976,0.976,0.974,0.971, &
497                                ! seasalt Accumulation Soluble (AS)
498       1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
499       1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
500       0.970, 0.975, 0.976, 0.977, 0.978, 0.982, &
501       0.982, 0.983, 0.984, 0.984, 0.985, 0.985/
502
503  DATA piz_aeri_2bands/ &
504       ! dust insoluble
505       .963, .987, &
506       ! bc insoluble
507       .395, .264, &
508       ! pom insoluble
509       .966, .859/
510
511! Interpolation des coefficients optiques de 19 niveaux vers le nombre des niveaux du model
512  IF (firstcall) THEN
513     firstcall=.FALSE.
514     
515     IF (.NOT. ALLOCATED(A1_ASSSM_b1)) THEN
516        ALLOCATE(A1_ASSSM_b1(klev),A2_ASSSM_b1(klev), A3_ASSSM_b1(klev),&
517          B1_ASSSM_b1(klev), B2_ASSSM_b1(klev), C1_ASSSM_b1(klev), C2_ASSSM_b1(klev),&
518          A1_CSSSM_b1(klev), A2_CSSSM_b1(klev), A3_CSSSM_b1(klev),&
519          B1_CSSSM_b1(klev), B2_CSSSM_b1(klev), C1_CSSSM_b1(klev), C2_CSSSM_b1(klev),&
520          A1_SSSSM_b1(klev), A2_SSSSM_b1(klev), A3_SSSSM_b1(klev),&
521          B1_SSSSM_b1(klev), B2_SSSSM_b1(klev), C1_SSSSM_b1(klev), C2_SSSSM_b1(klev),&
522          A1_ASSSM_b2(klev), A2_ASSSM_b2(klev), A3_ASSSM_b2(klev),&
523          B1_ASSSM_b2(klev), B2_ASSSM_b2(klev), C1_ASSSM_b2(klev), C2_ASSSM_b2(klev),&
524          A1_CSSSM_b2(klev), A2_CSSSM_b2(klev), A3_CSSSM_b2(klev),&
525          B1_CSSSM_b2(klev), B2_CSSSM_b2(klev), C1_CSSSM_b2(klev), C2_CSSSM_b2(klev),&
526          A1_SSSSM_b2(klev), A2_SSSSM_b2(klev), A3_SSSSM_b2(klev),&
527          B1_SSSSM_b2(klev), B2_SSSSM_b2(klev), C1_SSSSM_b2(klev), C2_SSSSM_b2(klev), stat=ierr)
528        IF (ierr /= 0) CALL abort_physic('aeropt_2bands', 'pb in allocation 1',1)
529     END IF
530     
531! bande 1
532     CALL pres2lev(A1_ASSSM_b1_19, A1_ASSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
533     CALL pres2lev(A2_ASSSM_b1_19, A2_ASSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
534     CALL pres2lev(A3_ASSSM_b1_19, A3_ASSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
535     CALL pres2lev(B1_ASSSM_b1_19, B1_ASSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
536     CALL pres2lev(B2_ASSSM_b1_19, B2_ASSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
537     CALL pres2lev(C1_ASSSM_b1_19, C1_ASSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
538     CALL pres2lev(C2_ASSSM_b1_19, C2_ASSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
539
540     CALL pres2lev(A1_CSSSM_b1_19, A1_CSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
541     CALL pres2lev(A2_CSSSM_b1_19, A2_CSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
542     CALL pres2lev(A3_CSSSM_b1_19, A3_CSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
543     CALL pres2lev(B1_CSSSM_b1_19, B1_CSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
544     CALL pres2lev(B2_CSSSM_b1_19, B2_CSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
545     CALL pres2lev(C1_CSSSM_b1_19, C1_CSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
546     CALL pres2lev(C2_CSSSM_b1_19, C2_CSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
547
548     CALL pres2lev(A1_SSSSM_b1_19, A1_SSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
549     CALL pres2lev(A2_SSSSM_b1_19, A2_SSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
550     CALL pres2lev(A3_SSSSM_b1_19, A3_SSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
551     CALL pres2lev(B1_SSSSM_b1_19, B1_SSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
552     CALL pres2lev(B2_SSSSM_b1_19, B2_SSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
553     CALL pres2lev(C1_SSSSM_b1_19, C1_SSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
554     CALL pres2lev(C2_SSSSM_b1_19, C2_SSSSM_b1, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
555
556! bande 2
557     CALL pres2lev(A1_ASSSM_b2_19, A1_ASSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
558     CALL pres2lev(A2_ASSSM_b2_19, A2_ASSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
559     CALL pres2lev(A3_ASSSM_b2_19, A3_ASSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
560     CALL pres2lev(B1_ASSSM_b2_19, B1_ASSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
561     CALL pres2lev(B2_ASSSM_b2_19, B2_ASSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
562     CALL pres2lev(C1_ASSSM_b2_19, C1_ASSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
563     CALL pres2lev(C2_ASSSM_b2_19, C2_ASSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
564
565     CALL pres2lev(A1_CSSSM_b2_19, A1_CSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
566     CALL pres2lev(A2_CSSSM_b2_19, A2_CSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
567     CALL pres2lev(A3_CSSSM_b2_19, A3_CSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
568     CALL pres2lev(B1_CSSSM_b2_19, B1_CSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
569     CALL pres2lev(B2_CSSSM_b2_19, B2_CSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
570     CALL pres2lev(C1_CSSSM_b2_19, C1_CSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
571     CALL pres2lev(C2_CSSSM_b2_19, C2_CSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
572
573     CALL pres2lev(A1_SSSSM_b2_19, A1_SSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
574     CALL pres2lev(A2_SSSSM_b2_19, A2_SSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
575     CALL pres2lev(A3_SSSSM_b2_19, A3_SSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
576     CALL pres2lev(B1_SSSSM_b2_19, B1_SSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
577     CALL pres2lev(B2_SSSSM_b2_19, B2_SSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
578     CALL pres2lev(C1_SSSSM_b2_19, C1_SSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
579     CALL pres2lev(C2_SSSSM_b2_19, C2_SSSSM_b2, nb_level, klev, presnivs_19, presnivs, 1, 1, .FALSE.)
580
581  END IF ! firstcall
582
583  DO k=1, klev
584    DO i=1, klon
585      zrho=pplay(i,k)/t_seri(i,k)/RD    ! kg/m3
586      zdh(i,k)=pdel(i,k)/(RG*zrho)      ! m
587    ENDDO
588  ENDDO
589
590  IF (flag_aerosol .EQ. 1) THEN
591     nb_aer = 2
592     ALLOCATE (aerosol_name(nb_aer))
593     aerosol_name(1) = id_ASSO4M_phy
594     aerosol_name(2) = id_CSSO4M_phy
595  ELSEIF (flag_aerosol .EQ. 2) THEN
596     nb_aer = 2
597     ALLOCATE (aerosol_name(nb_aer))
598     aerosol_name(1) = id_ASBCM_phy
599     aerosol_name(2) = id_AIBCM_phy
600  ELSEIF (flag_aerosol .EQ. 3) THEN
601     nb_aer = 2
602     ALLOCATE (aerosol_name(nb_aer))
603     aerosol_name(1) = id_ASPOMM_phy
604     aerosol_name(2) = id_AIPOMM_phy
605  ELSEIF (flag_aerosol .EQ. 4) THEN
606     nb_aer = 3
607     ALLOCATE (aerosol_name(nb_aer))
608     aerosol_name(1) = id_CSSSM_phy
609     aerosol_name(2) = id_SSSSM_phy
610     aerosol_name(3) = id_ASSSM_phy
611  ELSEIF (flag_aerosol .EQ. 5) THEN
612     nb_aer = 1
613     ALLOCATE (aerosol_name(nb_aer))
614     aerosol_name(1) = id_CIDUSTM_phy
615  ELSEIF (flag_aerosol .EQ. 6) THEN
616     nb_aer = 10
617     ALLOCATE (aerosol_name(nb_aer))
618     aerosol_name(1) = id_ASSO4M_phy
619     aerosol_name(2) = id_ASBCM_phy
620     aerosol_name(3) = id_AIBCM_phy
621     aerosol_name(4) = id_ASPOMM_phy
622     aerosol_name(5) = id_AIPOMM_phy
623     aerosol_name(6) = id_CSSSM_phy
624     aerosol_name(7) = id_SSSSM_phy
625     aerosol_name(8) = id_ASSSM_phy
626     aerosol_name(9) = id_CIDUSTM_phy
627     aerosol_name(10)= id_CSSO4M_phy
628  ENDIF
629
630
631  !
632  ! loop over modes, use of precalculated nmd and corresponding sigma
633  !    loop over wavelengths
634  !    for each mass species in mode
635  !      interpolate from Sext to retrieve Sext_at_gridpoint_per_species
636  !      compute optical_thickness_at_gridpoint_per_species
637
638!CDIR ON_ADB(fact_RH)
639!CDIR SHORTLOOP
640  DO n=1,nbre_RH-1
641    fact_RH(n)=1./(RH_tab(n+1)-RH_tab(n))
642  ENDDO
643   
644  DO k=1, KLEV
645!CDIR ON_ADB(fact_RH)
646    DO i=1, KLON
647      rh(i,k)=MIN(RHcl(i,k)*100.,RH_MAX)
648      RH_num(i,k) = INT( rh(i,k)/10. + 1.)
649      IF (rh(i,k).GT.85.) RH_num(i,k)=10
650      IF (rh(i,k).GT.90.) RH_num(i,k)=11
651      DELTA(i,k)=(rh(i,k)-RH_tab(RH_num(i,k)))*fact_RH(RH_num(i,k))
652    ENDDO
653  ENDDO
654
655  used_aer(:)=.FALSE.
656   
657  DO m=1,nb_aer   ! tau is only computed for each mass
658    fac=1.0
659     IF (aerosol_name(m).EQ.id_ASBCM_phy) THEN
660         soluble=.TRUE.
661         spsol=1
662         spss=0
663     ELSEIF (aerosol_name(m).EQ.id_ASPOMM_phy) THEN
664        soluble=.TRUE.
665        spsol=2
666        spss=0
667     ELSEIF (aerosol_name(m).EQ.id_ASSO4M_phy) THEN
668        soluble=.TRUE.
669        spsol=3
670        spss=0
671        fac=1.375    ! (NH4)2-SO4/SO4 132/96 mass conversion factor for OD
672     ELSEIF  (aerosol_name(m).EQ.id_CSSO4M_phy) THEN
673        soluble=.TRUE.
674        spsol=4
675        spss=0
676        fac=1.375    ! (NH4)2-SO4/SO4 132/96 mass conversion factor for OD
677     ELSEIF (aerosol_name(m).EQ.id_SSSSM_phy) THEN
678         soluble=.TRUE.
679         spsol=5
680         spss=3
681     ELSEIF (aerosol_name(m).EQ.id_CSSSM_phy) THEN
682         soluble=.TRUE.
683         spsol=6
684         spss=2
685     ELSEIF (aerosol_name(m).EQ.id_ASSSM_phy) THEN
686         soluble=.TRUE.
687         spsol=7
688         spss=1
689     ELSEIF (aerosol_name(m).EQ.id_CIDUSTM_phy) THEN
690         soluble=.FALSE.
691         spinsol=1
692         spss=0
693     ELSEIF  (aerosol_name(m).EQ.id_AIBCM_phy) THEN
694         soluble=.FALSE.
695         spinsol=2
696         spss=0
697     ELSEIF (aerosol_name(m).EQ.id_AIPOMM_phy) THEN
698         soluble=.FALSE.
699         spinsol=3
700         spss=0
701     ELSE
702         CYCLE
703     ENDIF
704
705    id=aerosol_name(m)
706    used_aer(id)=.TRUE.
707
708    IF (soluble) THEN
709
710      IF (spss.NE.0) THEN
711
712         IF (spss.EQ.1) THEN !accumulation mode
713            DO k=1, KLEV
714!CDIR ON_ADB(A1_ASSSM_b1)
715!CDIR ON_ADB(A2_ASSSM_b1)
716!CDIR ON_ADB(A3_ASSSM_b1)
717!CDIR ON_ADB(B1_ASSSM_b1)
718!CDIR ON_ADB(B2_ASSSM_b1)
719!CDIR ON_ADB(C1_ASSSM_b1)
720!CDIR ON_ADB(C2_ASSSM_b2)
721!CDIR ON_ADB(A1_ASSSM_b2)
722!CDIR ON_ADB(A2_ASSSM_b2)
723!CDIR ON_ADB(A3_ASSSM_b2)
724!CDIR ON_ADB(B1_ASSSM_b2)
725!CDIR ON_ADB(B2_ASSSM_b2)
726!CDIR ON_ADB(C1_ASSSM_b2)
727!CDIR ON_ADB(C2_ASSSM_b2)
728
729              DO i=1, KLON
730
731                H=rh(i,k)/100
732                tmp_var=m_allaer(i,k,spsol)/1.e6*zdh(i,k)*fac
733                tmp_var_pi=m_allaer_pi(i,k,spsol)/1.e6*zdh(i,k)*fac
734
735                ! band 1
736                tau_ae2b_int=A1_ASSSM_b1(k)+A2_ASSSM_b1(k)*H+A3_ASSSM_b1(k)/(H-1.05)
737                piz_ae2b_int=1-B1_ASSSM_b1(k)-B2_ASSSM_b1(k)*H
738                cg_ae2b_int=C1_ASSSM_b1(k)+C2_ASSSM_b1(k)*H
739
740                tau_ae(i,k,id,1) = tmp_var*tau_ae2b_int
741                tau_ae_pi(i,k,id,1) =  tmp_var_pi* tau_ae2b_int
742                piz_ae(i,k,id,1) = piz_ae2b_int
743                cg_ae(i,k,id,1)= cg_ae2b_int
744               
745                !band 2
746                tau_ae2b_int=A1_ASSSM_b2(k)+A2_ASSSM_b2(k)*H+A3_ASSSM_b2(k)/(H-1.05)
747                piz_ae2b_int=1-B1_ASSSM_b2(k)-B2_ASSSM_b2(k)*H
748                cg_ae2b_int=C1_ASSSM_b2(k)+C2_ASSSM_b2(k)*H
749
750                tau_ae(i,k,id,2) = tmp_var*tau_ae2b_int
751                tau_ae_pi(i,k,id,2) =  tmp_var_pi* tau_ae2b_int
752                piz_ae(i,k,id,2) = piz_ae2b_int
753                cg_ae(i,k,id,2)= cg_ae2b_int
754
755              ENDDO
756            ENDDO
757          ENDIF
758
759          IF (spss.EQ.2) THEN !coarse mode
760            DO k=1, KLEV
761!CDIR ON_ADB(A1_CSSSM_b1)
762!CDIR ON_ADB(A2_CSSSM_b1)
763!CDIR ON_ADB(A3_CSSSM_b1)
764!CDIR ON_ADB(B1_CSSSM_b1)
765!CDIR ON_ADB(B2_CSSSM_b1)
766!CDIR ON_ADB(C1_CSSSM_b1)
767!CDIR ON_ADB(C2_CSSSM_b2)
768!CDIR ON_ADB(A1_CSSSM_b2)
769!CDIR ON_ADB(A2_CSSSM_b2)
770!CDIR ON_ADB(A3_CSSSM_b2)
771!CDIR ON_ADB(B1_CSSSM_b2)
772!CDIR ON_ADB(B2_CSSSM_b2)
773!CDIR ON_ADB(C1_CSSSM_b2)
774!CDIR ON_ADB(C2_CSSSM_b2)
775
776              DO i=1, KLON
777
778                H=rh(i,k)/100
779                tmp_var=m_allaer(i,k,spsol)/1.e6*zdh(i,k)*fac
780                tmp_var_pi=m_allaer_pi(i,k,spsol)/1.e6*zdh(i,k)*fac
781                ! band 1
782                tau_ae2b_int=A1_CSSSM_b1(k)+A2_CSSSM_b1(k)*H+A3_CSSSM_b1(k)/(H-1.05)
783                piz_ae2b_int=1-B1_CSSSM_b1(k)-B2_CSSSM_b1(k)*H
784                cg_ae2b_int=C1_CSSSM_b1(k)+C2_CSSSM_b1(k)*H
785
786                tau_ae(i,k,id,1) = tmp_var*tau_ae2b_int
787                tau_ae_pi(i,k,id,1) =  tmp_var_pi* tau_ae2b_int
788                piz_ae(i,k,id,1) = piz_ae2b_int
789                cg_ae(i,k,id,1)= cg_ae2b_int
790
791                ! band 2
792                tau_ae2b_int=A1_CSSSM_b2(k)+A2_CSSSM_b2(k)*H+A3_CSSSM_b2(k)/(H-1.05)
793                piz_ae2b_int=1-B1_CSSSM_b2(k)-B2_CSSSM_b2(k)*H
794                cg_ae2b_int=C1_CSSSM_b2(k)+C2_CSSSM_b2(k)*H
795
796                tau_ae(i,k,id,2) = tmp_var*tau_ae2b_int
797                tau_ae_pi(i,k,id,2) =  tmp_var_pi* tau_ae2b_int
798                piz_ae(i,k,id,2) = piz_ae2b_int
799                cg_ae(i,k,id,2)= cg_ae2b_int
800
801             ENDDO
802           ENDDO
803         ENDIF
804
805         IF (spss.EQ.3) THEN !super coarse mode
806            DO k=1, KLEV
807!CDIR ON_ADB(A1_SSSSM_b1)
808!CDIR ON_ADB(A2_SSSSM_b1)
809!CDIR ON_ADB(A3_SSSSM_b1)
810!CDIR ON_ADB(B1_SSSSM_b1)
811!CDIR ON_ADB(B2_SSSSM_b1)
812!CDIR ON_ADB(C1_SSSSM_b1)
813!CDIR ON_ADB(C2_SSSSM_b2)
814!CDIR ON_ADB(A1_SSSSM_b2)
815!CDIR ON_ADB(A2_SSSSM_b2)
816!CDIR ON_ADB(A3_SSSSM_b2)
817!CDIR ON_ADB(B1_SSSSM_b2)
818!CDIR ON_ADB(B2_SSSSM_b2)
819!CDIR ON_ADB(C1_SSSSM_b2)
820!CDIR ON_ADB(C2_SSSSM_b2)
821
822              DO i=1, KLON
823
824                H=rh(i,k)/100
825                tmp_var=m_allaer(i,k,spsol)/1.e6*zdh(i,k)*fac
826                tmp_var_pi=m_allaer_pi(i,k,spsol)/1.e6*zdh(i,k)*fac
827
828                ! band 1
829                tau_ae2b_int=A1_SSSSM_b1(k)+A2_SSSSM_b1(k)*H+A3_SSSSM_b1(k)/(H-1.05)
830                piz_ae2b_int=1-B1_SSSSM_b1(k)-B2_SSSSM_b1(k)*H
831                cg_ae2b_int=C1_SSSSM_b1(k)+C2_SSSSM_b1(k)*H
832
833                tau_ae(i,k,id,1) = tmp_var*tau_ae2b_int
834                tau_ae_pi(i,k,id,1) =  tmp_var_pi* tau_ae2b_int
835                piz_ae(i,k,id,1) = piz_ae2b_int
836                cg_ae(i,k,id,1)= cg_ae2b_int
837
838                ! band 2
839                tau_ae2b_int=A1_SSSSM_b2(k)+A2_SSSSM_b2(k)*H+A3_SSSSM_b2(k)/(H-1.05)
840                piz_ae2b_int=1-B1_SSSSM_b2(k)-B2_SSSSM_b2(k)*H
841                cg_ae2b_int=C1_SSSSM_b2(k)+C2_SSSSM_b2(k)*H
842
843                tau_ae(i,k,id,2) = tmp_var*tau_ae2b_int
844                tau_ae_pi(i,k,id,2) =  tmp_var_pi* tau_ae2b_int
845                piz_ae(i,k,id,2) = piz_ae2b_int
846                cg_ae(i,k,id,2)= cg_ae2b_int
847
848              ENDDO
849            ENDDO
850          ENDIF
851
852        ELSE
853                       
854!CDIR ON_ADB(alpha_aers_2bands)
855!CDIR ON_ADB(piz_aers_2bands)
856!CDIR ON_ADB(cg_aers_2bands)
857          DO k=1, KLEV
858            DO i=1, KLON
859              tmp_var=m_allaer(i,k,spsol)/1.e6*zdh(i,k)*fac
860              tmp_var_pi=m_allaer_pi(i,k,spsol)/1.e6*zdh(i,k)*fac
861!CDIR UNROLL=nbands
862              DO inu=1,nbands
863
864                tau_ae2b_int= alpha_aers_2bands(RH_num(i,k),inu,spsol)+ &
865                              DELTA(i,k)* (alpha_aers_2bands(RH_num(i,k)+1,inu,spsol) - &
866                              alpha_aers_2bands(RH_num(i,k),inu,spsol))
867                     
868                piz_ae2b_int = piz_aers_2bands(RH_num(i,k),inu,spsol) + &
869                               DELTA(i,k)* (piz_aers_2bands(RH_num(i,k)+1,inu,spsol) - &
870                               piz_aers_2bands(RH_num(i,k),inu,spsol))
871                     
872                cg_ae2b_int = cg_aers_2bands(RH_num(i,k),inu,spsol) + &
873                              DELTA(i,k)* (cg_aers_2bands(RH_num(i,k)+1,inu,spsol) - &
874                              cg_aers_2bands(RH_num(i,k),inu,spsol))
875
876                tau_ae(i,k,id,inu) = tmp_var*tau_ae2b_int
877                tau_ae_pi(i,k,id,inu) =  tmp_var_pi* tau_ae2b_int
878                piz_ae(i,k,id,inu) = piz_ae2b_int
879                cg_ae(i,k,id,inu)= cg_ae2b_int
880                         
881              ENDDO
882            ENDDO
883          ENDDO
884       
885        ENDIF                     
886
887      ELSE                                                    ! For all aerosol insoluble components
888
889!CDIR ON_ADB(alpha_aers_2bands)
890!CDIR ON_ADB(piz_aers_2bands)
891!CDIR ON_ADB(cg_aers_2bands)
892        DO k=1, KLEV
893          DO i=1, KLON
894            tmp_var=m_allaer(i,k,naero_soluble+spinsol)/1.e6*zdh(i,k)*fac
895            tmp_var_pi=m_allaer_pi(i,k,naero_soluble+spinsol)/1.e6*zdh(i,k)*fac
896!CDIR UNROLL=nbands
897            DO inu=1,nbands
898              tau_ae2b_int = alpha_aeri_2bands(inu,spinsol)
899              piz_ae2b_int = piz_aeri_2bands(inu,spinsol)
900              cg_ae2b_int = cg_aeri_2bands(inu,spinsol)
901
902              tau_ae(i,k,id,inu) = tmp_var*tau_ae2b_int
903              tau_ae_pi(i,k,id,inu) = tmp_var_pi*tau_ae2b_int
904              piz_ae(i,k,id,inu) = piz_ae2b_int
905              cg_ae(i,k,id,inu)= cg_ae2b_int
906            ENDDO
907          ENDDO
908        ENDDO
909
910      ENDIF ! soluble
911
912    ENDDO  ! nb_aer 
913
914!correction bug OB
915!  DO m=1,nb_aer   
916  DO m=1,naero_tot   
917    IF (.NOT. used_aer(m)) THEN
918      tau_ae(:,:,m,:)=0.
919      tau_ae_pi(:,:,m,:)=0.
920      piz_ae(:,:,m,:)=0.
921      cg_ae(:,:,m,:)=0.
922    ENDIF
923  ENDDO
924
925  DO inu=1, nbands
926
927    !!DO mrfspecies=1,naero_grp
928    DO mrfspecies=2,3    !--only deal with total and natural aerosols
929
930      IF (mrfspecies .EQ. 2) THEN             ! = total aerosol AER     
931
932        DO k=1, KLEV
933          DO i=1, KLON
934            tau_allaer(i,k,mrfspecies,inu)=tau_ae(i,k,id_ASSO4M_phy,inu)+tau_ae(i,k,id_CSSO4M_phy,inu)+ &
935                                           tau_ae(i,k,id_ASBCM_phy,inu)+tau_ae(i,k,id_AIBCM_phy,inu)+   &
936                                           tau_ae(i,k,id_ASPOMM_phy,inu)+tau_ae(i,k,id_AIPOMM_phy,inu)+ &
937                                           tau_ae(i,k,id_ASSSM_phy,inu)+tau_ae(i,k,id_CSSSM_phy,inu)+   &
938                                           tau_ae(i,k,id_SSSSM_phy,inu)+ tau_ae(i,k,id_CIDUSTM_phy,inu)
939            tau_allaer(i,k,mrfspecies,inu)=MAX(tau_allaer(i,k,mrfspecies,inu),1e-5)
940                 
941            piz_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_ASSO4M_phy,inu)*piz_ae(i,k,id_ASSO4M_phy,inu)+ &
942                                            tau_ae(i,k,id_CSSO4M_phy,inu)*piz_ae(i,k,id_CSSO4M_phy,inu)+ &
943                                            tau_ae(i,k,id_ASBCM_phy,inu)*piz_ae(i,k,id_ASBCM_phy,inu)+   &
944                                            tau_ae(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu)+   &
945                                            tau_ae(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu)+ &
946                                            tau_ae(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu)+ &
947                                            tau_ae(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu)+   &
948                                            tau_ae(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu)+   &
949                                            tau_ae(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu)+   &
950                                            tau_ae(i,k,id_CIDUSTM_phy,inu)*piz_ae(i,k,id_CIDUSTM_phy,inu)) &
951                                            /tau_allaer(i,k,mrfspecies,inu)
952            piz_allaer(i,k,mrfspecies,inu)=MAX(piz_allaer(i,k,mrfspecies,inu),0.1)
953
954            cg_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_ASSO4M_phy,inu)* &
955              piz_ae(i,k,id_ASSO4M_phy,inu)*cg_ae(i,k,id_ASSO4M_phy,inu)+ &
956              tau_ae(i,k,id_CSSO4M_phy,inu)*piz_ae(i,k,id_CSSO4M_phy,inu)* &
957              cg_ae(i,k,id_CSSO4M_phy,inu)+ &
958              tau_ae(i,k,id_ASBCM_phy,inu)*piz_ae(i,k,id_ASBCM_phy,inu)* &
959              cg_ae(i,k,id_ASBCM_phy,inu)+ &
960              tau_ae(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu)* &
961              cg_ae(i,k,id_AIBCM_phy,inu)+ &
962              tau_ae(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu)* &
963              cg_ae(i,k,id_ASPOMM_phy,inu)+ &
964              tau_ae(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu)* &
965              cg_ae(i,k,id_AIPOMM_phy,inu)+ &
966              tau_ae(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu)* &
967              cg_ae(i,k,id_ASSSM_phy,inu)+ &
968              tau_ae(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu)* &
969              cg_ae(i,k,id_CSSSM_phy,inu)+ &
970              tau_ae(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu)* &
971              cg_ae(i,k,id_SSSSM_phy,inu)+ &
972              tau_ae(i,k,id_CIDUSTM_phy,inu)*piz_ae(i,k,id_CIDUSTM_phy,inu)* &
973              cg_ae(i,k,id_CIDUSTM_phy,inu))/ &
974              (tau_allaer(i,k,mrfspecies,inu)*piz_allaer(i,k,mrfspecies,inu))
975          ENDDO   
976        ENDDO
977
978      ELSEIF (mrfspecies .EQ. 3) THEN             ! = natural aerosol NAT
979
980        DO k=1, KLEV
981          DO i=1, KLON
982
983              tau_allaer(i,k,mrfspecies,inu)=tau_ae_pi(i,k,id_ASSO4M_phy,inu)+ &
984                      tau_ae_pi(i,k,id_CSSO4M_phy,inu)+ &
985                      tau_ae_pi(i,k,id_ASBCM_phy,inu)+  &
986                      tau_ae_pi(i,k,id_AIBCM_phy,inu)+  &
987                      tau_ae_pi(i,k,id_ASPOMM_phy,inu)+ &
988                      tau_ae_pi(i,k,id_AIPOMM_phy,inu)+ &
989                      tau_ae_pi(i,k,id_ASSSM_phy,inu)+  &
990                      tau_ae_pi(i,k,id_CSSSM_phy,inu)+  &
991                      tau_ae_pi(i,k,id_SSSSM_phy,inu)+  &
992                      tau_ae_pi(i,k,id_CIDUSTM_phy,inu)
993              tau_allaer(i,k,mrfspecies,inu)=MAX(tau_allaer(i,k,mrfspecies,inu),1e-5)
994
995              piz_allaer(i,k,mrfspecies,inu)=(tau_ae_pi(i,k,id_ASSO4M_phy,inu)*piz_ae(i,k,id_ASSO4M_phy,inu)+ &
996                      tau_ae_pi(i,k,id_CSSO4M_phy,inu)*piz_ae(i,k,id_CSSO4M_phy,inu)+ &
997                      tau_ae_pi(i,k,id_ASBCM_phy,inu)*piz_ae(i,k,id_ASBCM_phy,inu)+   &
998                      tau_ae_pi(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu)+   &
999                      tau_ae_pi(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu)+ &
1000                      tau_ae_pi(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu)+ &
1001                      tau_ae_pi(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu)+   &
1002                      tau_ae_pi(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu)+   &
1003                      tau_ae_pi(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu)+   &
1004                      tau_ae_pi(i,k,id_CIDUSTM_phy,inu)*piz_ae(i,k,id_CIDUSTM_phy,inu)) &
1005                      /tau_allaer(i,k,mrfspecies,inu)
1006              piz_allaer(i,k,mrfspecies,inu)=MAX(piz_allaer(i,k,mrfspecies,inu),0.1)
1007
1008              cg_allaer(i,k,mrfspecies,inu)=(&
1009                      tau_ae_pi(i,k,id_ASSO4M_phy,inu)*piz_ae(i,k,id_ASSO4M_phy,inu)*cg_ae(i,k,id_ASSO4M_phy,inu)+ &
1010                      tau_ae_pi(i,k,id_CSSO4M_phy,inu)*piz_ae(i,k,id_CSSO4M_phy,inu)*cg_ae(i,k,id_CSSO4M_phy,inu)+ &
1011                      tau_ae_pi(i,k,id_ASBCM_phy,inu)*piz_ae(i,k,id_ASBCM_phy,inu)*cg_ae(i,k,id_ASBCM_phy,inu)+ &
1012                      tau_ae_pi(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu)*cg_ae(i,k,id_AIBCM_phy,inu)+ &
1013                      tau_ae_pi(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu)*cg_ae(i,k,id_ASPOMM_phy,inu)+ &
1014                      tau_ae_pi(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu)*cg_ae(i,k,id_AIPOMM_phy,inu)+ &
1015                      tau_ae_pi(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu)*cg_ae(i,k,id_ASSSM_phy,inu)+ &
1016                      tau_ae_pi(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu)*cg_ae(i,k,id_CSSSM_phy,inu)+ &
1017                      tau_ae_pi(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu)*cg_ae(i,k,id_SSSSM_phy,inu)+ &
1018                      tau_ae_pi(i,k,id_CIDUSTM_phy,inu)*piz_ae(i,k,id_CIDUSTM_phy,inu)*&
1019                      cg_ae(i,k,id_CIDUSTM_phy,inu))/ &
1020                      (tau_allaer(i,k,mrfspecies,inu)*piz_allaer(i,k,mrfspecies,inu))
1021          ENDDO
1022        ENDDO
1023                   
1024      ELSEIF (mrfspecies .EQ. 4) THEN             ! = BC
1025
1026        DO k=1, KLEV
1027          DO i=1, KLON
1028            tau_allaer(i,k,mrfspecies,inu)=tau_ae(i,k,id_ASBCM_phy,inu)+tau_ae(i,k,id_AIBCM_phy,inu)
1029            tau_allaer(i,k,mrfspecies,inu)=MAX(tau_allaer(i,k,mrfspecies,inu),1e-5)
1030            piz_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_ASBCM_phy,inu)*piz_ae(i,k,id_ASBCM_phy,inu) &
1031                      +tau_ae(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu))/ &
1032                      tau_allaer(i,k,mrfspecies,inu)
1033            piz_allaer(i,k,mrfspecies,inu)=MAX(piz_allaer(i,k,mrfspecies,inu),0.1)
1034            cg_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_ASBCM_phy,inu)*piz_ae(i,k,id_ASBCM_phy,inu) *cg_ae(i,k,id_ASBCM_phy,inu)&
1035                      +tau_ae(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu)*cg_ae(i,k,id_AIBCM_phy,inu))/ &
1036                      (tau_allaer(i,k,mrfspecies,inu)*piz_allaer(i,k,mrfspecies,inu))
1037          ENDDO
1038        ENDDO
1039             
1040      ELSEIF (mrfspecies .EQ. 5) THEN             ! = SO4
1041
1042        DO k=1, KLEV
1043          DO i=1, KLON
1044            tau_allaer(i,k,mrfspecies,inu)=tau_ae(i,k,id_ASSO4M_phy,inu)+tau_ae(i,k,id_CSSO4M_phy,inu)
1045            tau_allaer(i,k,mrfspecies,inu)=MAX(tau_allaer(i,k,mrfspecies,inu),1e-5)
1046            piz_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_CSSO4M_phy,inu)*piz_ae(i,k,id_CSSO4M_phy,inu) &
1047                      +tau_ae(i,k,id_ASSO4M_phy,inu)*piz_ae(i,k,id_ASSO4M_phy,inu))/ &
1048                      tau_allaer(i,k,mrfspecies,inu)
1049            piz_allaer(i,k,mrfspecies,inu)=MAX(piz_allaer(i,k,mrfspecies,inu),0.1)
1050            cg_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_CSSO4M_phy,inu)* &
1051            piz_ae(i,k,id_CSSO4M_phy,inu) *cg_ae(i,k,id_CSSO4M_phy,inu)&
1052            +tau_ae(i,k,id_ASSO4M_phy,inu)*piz_ae(i,k,id_ASSO4M_phy,inu)* &
1053            cg_ae(i,k,id_ASSO4M_phy,inu))/ &
1054            (tau_allaer(i,k,mrfspecies,inu)*piz_allaer(i,k,mrfspecies,inu))
1055          ENDDO
1056        ENDDO
1057
1058      ELSEIF (mrfspecies .EQ. 6) THEN             ! = POM
1059
1060        DO k=1, KLEV
1061          DO i=1, KLON
1062            tau_allaer(i,k,mrfspecies,inu)=tau_ae(i,k,id_ASPOMM_phy,inu)+tau_ae(i,k,id_AIPOMM_phy,inu)
1063            tau_allaer(i,k,mrfspecies,inu)=MAX(tau_allaer(i,k,mrfspecies,inu),1e-5)
1064            piz_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu) &
1065                      +tau_ae(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu))/ &
1066                      tau_allaer(i,k,mrfspecies,inu)
1067            piz_allaer(i,k,mrfspecies,inu)=MAX(piz_allaer(i,k,mrfspecies,inu),0.1)
1068            cg_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu)*cg_ae(i,k,id_ASPOMM_phy,inu)&
1069                      +tau_ae(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu)*cg_ae(i,k,id_AIPOMM_phy,inu))/ &
1070                      (tau_allaer(i,k,mrfspecies,inu)*piz_allaer(i,k,mrfspecies,inu))
1071          ENDDO
1072        ENDDO
1073             
1074      ELSEIF (mrfspecies .EQ. 7) THEN             ! = DUST
1075
1076        DO k=1, KLEV
1077          DO i=1, KLON
1078            tau_allaer(i,k,mrfspecies,inu)=tau_ae(i,k,id_CIDUSTM_phy,inu)
1079            tau_allaer(i,k,mrfspecies,inu)=MAX(tau_allaer(i,k,mrfspecies,inu),1e-5)
1080            piz_allaer(i,k,mrfspecies,inu)=piz_ae(i,k,id_CIDUSTM_phy,inu)
1081            cg_allaer(i,k,mrfspecies,inu)=cg_ae(i,k,id_CIDUSTM_phy,inu)
1082          ENDDO
1083        ENDDO
1084
1085      ELSEIF (mrfspecies .EQ. 8) THEN             ! = SS
1086
1087        DO k=1, KLEV
1088          DO i=1, KLON
1089            tau_allaer(i,k,mrfspecies,inu)=tau_ae(i,k,id_ASSSM_phy,inu)+tau_ae(i,k,id_CSSSM_phy,inu)+tau_ae(i,k,id_SSSSM_phy,inu)
1090            tau_allaer(i,k,mrfspecies,inu)=MAX(tau_allaer(i,k,mrfspecies,inu),1e-5)
1091            piz_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu) &
1092                    +tau_ae(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu) &
1093                    +tau_ae(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu))/ &
1094                    tau_allaer(i,k,mrfspecies,inu)
1095            piz_allaer(i,k,mrfspecies,inu)=MAX(piz_allaer(i,k,mrfspecies,inu),0.1)
1096            cg_allaer(i,k,mrfspecies,inu)=(tau_ae(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu) *cg_ae(i,k,id_ASSSM_phy,inu)&
1097                    +tau_ae(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu)*cg_ae(i,k,id_CSSSM_phy,inu) &
1098                    +tau_ae(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu)*cg_ae(i,k,id_SSSSM_phy,inu))/ &
1099                    (tau_allaer(i,k,mrfspecies,inu)*piz_allaer(i,k,mrfspecies,inu))
1100          ENDDO
1101        ENDDO
1102     
1103      ELSEIF (mrfspecies .EQ. 9) THEN             ! = NO3
1104     
1105        DO k=1, KLEV
1106          DO i=1, KLON
1107            tau_allaer(i,k,mrfspecies,inu)=0.   ! preliminary
1108            piz_allaer(i,k,mrfspecies,inu)=0.
1109            cg_allaer(i,k,mrfspecies,inu)=0.
1110          ENDDO
1111        ENDDO
1112     
1113      ELSE
1114
1115        DO k=1, KLEV
1116          DO i=1, KLON
1117            tau_allaer(i,k,mrfspecies,inu)=0. 
1118            piz_allaer(i,k,mrfspecies,inu)=0.
1119            cg_allaer(i,k,mrfspecies,inu)=0.
1120          ENDDO
1121        ENDDO
1122           
1123      ENDIF
1124
1125    ENDDO
1126  ENDDO
1127
1128  DEALLOCATE(aerosol_name)
1129
1130END SUBROUTINE AEROPT_2BANDS
Note: See TracBrowser for help on using the repository browser.