source: LMDZ6/trunk/libf/phylmd/aeropt_2bands.f90 @ 5322

Last change on this file since 5322 was 5285, checked in by abarral, 3 weeks ago

As discussed internally, remove generic ONLY: ... for new _mod_h modules

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