source: LMDZ5/trunk/libf/phylmd/rrtm/aeropt_6bands_rrtm.F90 @ 2694

Last change on this file since 2694 was 2644, checked in by oboucher, 8 years ago

I introduced flag_bc_internal_mixture for BC/sulphate internal mixture.
Only works for iflag_rrtm=y, NSW=6 and flag_aerosol=6 or aerosol_couple.
It has no impact at the moment as LUT for aerosol properties will have to
be changed. But the plumbing work is already done....

  • 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:keywords set to Author Date Id Revi
File size: 40.8 KB
Line 
1!
2! $Id: aeropt_6bands_rrtm.F90 2644 2016-10-02 16:55:08Z oboucher $
3!
4SUBROUTINE AEROPT_6BANDS_RRTM ( &
5     pdel, m_allaer, RHcl, &
6     tau_allaer, piz_allaer, &
7     cg_allaer, m_allaer_pi, &
8     flag_aerosol, flag_bc_internal_mixture, zrho )
9
10  USE dimphy
11  USE aero_mod
12  USE phys_local_var_mod, only: absvisaer
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  !    Olivier Boucher février 2014 pour passage à RRTM
19  !    a partir des propriétés optiques fournies par Yves Balkanski
20  !
21  IMPLICIT NONE
22
23  INCLUDE "YOMCST.h"
24  INCLUDE "clesphys.h"
25
26  !
27  ! Input arguments:
28  !
29  REAL, DIMENSION(klon,klev),     INTENT(in)  :: pdel
30  REAL, DIMENSION(klon,klev,naero_tot),   INTENT(in)  :: m_allaer
31  REAL, DIMENSION(klon,klev,naero_tot),   INTENT(in)  :: m_allaer_pi
32  REAL, DIMENSION(klon,klev),     INTENT(in)  :: RHcl       ! humidite relative ciel clair
33  INTEGER,                        INTENT(in)  :: flag_aerosol
34  LOGICAL,                        INTENT(in)  :: flag_bc_internal_mixture
35  REAL, DIMENSION(klon,klev),     INTENT(in)  :: zrho
36  !
37  ! Output arguments:
38  ! 2= total aerosols
39  ! 1= natural aerosols
40  !
41  REAL, DIMENSION(klon,klev,2,nbands_sw_rrtm), INTENT(out) :: tau_allaer ! epaisseur optique aerosol
42  REAL, DIMENSION(klon,klev,2,nbands_sw_rrtm), INTENT(out) :: piz_allaer ! single scattering albedo aerosol
43  REAL, DIMENSION(klon,klev,2,nbands_sw_rrtm), INTENT(out) :: cg_allaer  ! asymmetry parameter aerosol
44
45  !
46  ! Local
47  !
48  LOGICAL ::  soluble
49  INTEGER :: i, k,n, inu, m
50  INTEGER :: spsol, spinsol
51  INTEGER :: RH_num(klon,klev)
52
53  INTEGER, PARAMETER :: nb_level=19 ! number of vertical levels in DATA
54
55  INTEGER, PARAMETER :: naero_soluble=7    ! 1- BC soluble; 2- POM soluble; 3- SO4. acc. 4- SO4 coarse
56                                           ! 5- seasalt super coarse  6- seasalt coarse   7- seasalt acc.
57  INTEGER, PARAMETER :: naero_insoluble=3  ! 1- Dust; 2- BC insoluble; 3- POM insoluble
58
59  INTEGER, PARAMETER :: nbre_RH=12
60  REAL,PARAMETER :: RH_tab(nbre_RH)=(/0.,10.,20.,30.,40.,50.,60.,70.,80.,85.,90.,95./)
61  REAL, PARAMETER :: RH_MAX=95.
62  REAL :: delta(klon,klev), rh(klon,klev)
63  REAL :: tau_ae2b_int   ! Intermediate computation of epaisseur optique aerosol
64  REAL :: piz_ae2b_int   ! Intermediate computation of Single scattering albedo
65  REAL :: cg_ae2b_int    ! Intermediate computation of Assymetry parameter
66  REAL :: Fact_RH(nbre_RH)
67  REAL :: fac
68  REAL :: zdh(klon,klev)
69  INTEGER, ALLOCATABLE, DIMENSION(:)   :: aerosol_name
70  INTEGER :: nb_aer
71
72  REAL, DIMENSION(klon,klev,naero_tot,nbands_sw_rrtm) ::  tau_ae
73  REAL, DIMENSION(klon,klev,naero_tot,nbands_sw_rrtm) ::  piz_ae
74  REAL, DIMENSION(klon,klev,naero_tot,nbands_sw_rrtm) ::  cg_ae
75
76  REAL, DIMENSION(klon,klev,naero_tot,nbands_sw_rrtm) ::  tau_ae_pi
77  REAL, DIMENSION(klon,klev,id_ASBCM_phy:id_ASBCM_phy,nbands_sw_rrtm) :: piz_ae_pi
78  REAL, DIMENSION(klon,klev,id_ASBCM_phy:id_ASBCM_phy,nbands_sw_rrtm) :: cg_ae_pi
79  !
80  ! Proprietes optiques
81  !
82  REAL:: alpha_aers_6bands(nbre_RH,nbands_sw_rrtm,naero_soluble)   !--unit m2/g SO4
83  REAL:: alpha_aeri_6bands(nbands_sw_rrtm,naero_insoluble)
84  REAL:: cg_aers_6bands(nbre_RH,nbands_sw_rrtm,naero_soluble)      !--unit
85  REAL:: cg_aeri_6bands(nbands_sw_rrtm,naero_insoluble)
86  REAL:: piz_aers_6bands(nbre_RH,nbands_sw_rrtm,naero_soluble)     !-- unit
87  REAL:: piz_aeri_6bands(nbands_sw_rrtm,naero_insoluble)        !-- unit
88  !
89  ! BC internal mixture
90  !
91  INTEGER, PARAMETER ::  nbclassbc = 5  ! Added by Rong Wang/OB for the 5 fractions
92                                       ! of BC in the soluble mode:
93                                       ! bc_content/0.001, 0.01, 0.02, 0.05, 0.1/
94  ! for Maxwell-Garnet internal mixture
95  ! Detailed theory can be found in R. Wang Estimation of global black carbon direct
96  ! radiative forcing and its uncertainty constrained by observations. J.
97  ! Geophys. Res. Atmos. Added by R. Wang and OB
98  REAL :: alpha_MG_6bands(nbre_RH,nbands_sw_rrtm,nbclassbc)
99  REAL :: cg_MG_6bands(nbre_RH,nbands_sw_rrtm,nbclassbc)
100  REAL :: piz_MG_6bands(nbre_RH,nbands_sw_rrtm,nbclassbc)
101  !
102  INTEGER :: id, classbc, classbc_pi
103  REAL :: tmp_var, tmp_var_pi, BC_massfra, BC_massfra_pi
104
105  !
106  REAL, PARAMETER :: tau_min = 1.e-15
107!  REAL, PARAMETER :: tau_min = 1.e-7
108
109!***************************************************************************
110!--the order of the soluble   species has to follow the spsol   index below
111!--the order of the insoluble species has to follow the spinsol index below
112
113  DATA alpha_aers_6bands/  &
114       ! bc soluble AS
115  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
116  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
117  5.900, 5.900, 5.900, 5.900, 5.900, 6.502, 7.151, 8.496, 9.818, 9.965,10.124,11.564, &
118  4.284, 4.284, 4.284, 4.284, 4.284, 4.721, 5.193, 6.169, 7.129, 7.236, 7.352, 8.397, &
119  2.163, 2.163, 2.163, 2.163, 2.163, 2.384, 2.622, 3.115, 3.600, 3.654, 3.712, 4.240, &
120  0.966, 0.966, 0.966, 0.966, 0.966, 1.065, 1.171, 1.392, 1.608, 1.632, 1.658, 1.894, &
121       ! pom soluble AS
122  6.443, 6.443, 6.443, 6.443, 6.443, 7.100, 7.809, 9.277,10.721,10.882,11.056,12.628, &
123  6.443, 6.443, 6.443, 6.443, 6.443, 7.100, 7.809, 9.277,10.721,10.882,11.056,12.628, &
124  4.381, 4.381, 4.381, 4.381, 4.381, 4.828, 5.310, 6.309, 7.290, 7.400, 7.518, 8.587, &
125  1.846, 1.846, 1.846, 1.846, 1.846, 2.034, 2.237, 2.658, 3.072, 3.118, 3.168, 3.618, &
126  0.377, 0.377, 0.377, 0.377, 0.377, 0.415, 0.456, 0.542, 0.627, 0.636, 0.646, 0.738, &
127  0.052, 0.052, 0.052, 0.052, 0.052, 0.057, 0.063, 0.075, 0.087, 0.088, 0.089, 0.102, &
128       ! sulfate AS   
129  6.554, 6.554, 6.554, 7.223, 7.931, 8.665, 9.438,10.736,14.275,17.755,17.755,31.722, &
130  6.554, 6.554, 6.554, 7.223, 7.931, 8.665, 9.438,10.736,14.275,17.755,17.755,31.722, &
131  4.381, 4.381, 4.381, 4.828, 5.301, 5.792, 6.309, 7.176, 9.542,11.868,11.868,21.204, &
132  1.727, 1.727, 1.727, 1.903, 2.090, 2.283, 2.487, 2.829, 3.762, 4.679, 4.679, 8.359, &
133  0.312, 0.312, 0.312, 0.344, 0.378, 0.413, 0.450, 0.511, 0.680, 0.846, 0.846, 1.511, &
134  0.121, 0.121, 0.121, 0.134, 0.147, 0.161, 0.175, 0.199, 0.264, 0.329, 0.329, 0.588, &
135       ! sulfate coarse CS
136  0.693, 0.693, 0.693, 0.764, 0.839, 0.917, 0.999, 1.136, 1.510, 1.879, 1.879, 3.356, &
137  0.693, 0.693, 0.693, 0.764, 0.839, 0.917, 0.999, 1.136, 1.510, 1.879, 1.879, 3.356, &
138  0.715, 0.715, 0.715, 0.788, 0.865, 0.945, 1.029, 1.171, 1.557, 1.936, 1.936, 3.459, &
139  0.736, 0.736, 0.736, 0.811, 0.891, 0.973, 1.060, 1.206, 1.603, 1.994, 1.994, 3.563, &
140  0.711, 0.711, 0.711, 0.783, 0.860, 0.939, 1.023, 1.164, 1.548, 1.925, 1.925, 3.439, &
141  0.602, 0.602, 0.602, 0.664, 0.729, 0.796, 0.867, 0.986, 1.312, 1.631, 1.631, 2.915, &
142        ! seasalt seasalt Super Coarse Soluble (SS)
143  0.214, 0.267, 0.287, 0.310, 0.337, 0.373, 0.421, 0.494, 0.625, 0.742, 0.956, 1.480, &
144  0.217, 0.270, 0.291, 0.314, 0.341, 0.377, 0.426, 0.499, 0.632, 0.751, 0.963, 1.490, &
145  0.221, 0.275, 0.297, 0.320, 0.348, 0.384, 0.434, 0.507, 0.642, 0.762, 0.976, 1.506, &
146  0.230, 0.285, 0.308, 0.331, 0.359, 0.396, 0.447, 0.522, 0.658, 0.780, 0.997, 1.536, &
147  0.250, 0.307, 0.330, 0.354, 0.384, 0.424, 0.477, 0.556, 0.696, 0.822, 1.044, 1.592, &
148  0.279, 0.347, 0.373, 0.401, 0.434, 0.478, 0.537, 0.625, 0.781, 0.918, 1.158, 1.744, &
149        ! seasalt seasalt Coarse Soluble (CS)     
150  0.550, 0.676, 0.724, 0.779, 0.841, 0.925, 1.040, 1.213, 1.523, 1.803, 2.306, 3.535, &
151  0.568, 0.695, 0.744, 0.798, 0.863, 0.950, 1.066, 1.240, 1.556, 1.839, 2.342, 3.588, &
152  0.599, 0.727, 0.779, 0.834, 0.901, 0.993, 1.111, 1.290, 1.612, 1.899, 2.411, 3.669, &
153  0.647, 0.786, 0.841, 0.899, 0.969, 1.069, 1.193, 1.384, 1.717, 2.015, 2.543, 3.842, &
154  0.663, 0.825, 0.889, 0.957, 1.038, 1.126, 1.268, 1.483, 1.862, 2.196, 2.780, 4.183, &
155  0.479, 0.644, 0.711, 0.785, 0.873, 0.904, 1.048, 1.275, 1.692, 2.072, 2.753, 4.430, &
156        ! seasalt seasalt Accumulation Soluble (AS)
157  6.128, 7.564, 8.127, 8.723, 9.421,10.014,11.250,13.113,16.320,19.061,23.675,34.158, &
158  5.080, 6.586, 7.197, 7.856, 8.645, 8.820,10.115,12.140,15.775,18.983,24.499,36.993, &
159  3.290, 4.541, 5.073, 5.663, 6.387, 6.227, 7.339, 9.161,12.645,15.918,21.908,36.673, &
160  1.389, 2.066, 2.371, 2.719, 3.161, 2.970, 3.623, 4.747, 7.064, 9.419,14.120,27.565, &
161  0.309, 0.497, 0.587, 0.693, 0.832, 0.777, 0.986, 1.364, 2.207, 3.136, 5.174,12.065, &
162  0.021, 0.037, 0.045, 0.054, 0.067, 0.065, 0.087, 0.129, 0.230, 0.353, 0.654, 1.885  /
163
164  DATA alpha_aeri_6bands/  &
165       ! dust insoluble CI
166  0.751, 0.751, 0.769, 0.772, 0.672, 0.437, &
167       ! bc insoluble AI
168  6.497, 6.497, 5.900, 4.284, 2.163, 0.966, &
169       ! pom insoluble AI
170  6.443, 6.443, 4.381, 1.846, 0.377, 0.052 /
171
172  DATA cg_aers_6bands/ &
173       ! bc soluble AS
174  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
175  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
176  0.643, 0.643, 0.643, 0.654, 0.662, 0.670, 0.677, 0.688, 0.698, 0.704, 0.707, 0.715, &
177  0.513, 0.513, 0.513, 0.522, 0.530, 0.536, 0.542, 0.552, 0.560, 0.565, 0.568, 0.575, &
178  0.321, 0.321, 0.321, 0.323, 0.325, 0.327, 0.328, 0.331, 0.333, 0.334, 0.335, 0.337, &
179  0.153, 0.153, 0.153, 0.149, 0.145, 0.142, 0.139, 0.135, 0.130, 0.128, 0.127, 0.123, &
180       ! pom soluble AS
181  0.687, 0.687, 0.687, 0.687, 0.687, 0.700, 0.710, 0.726, 0.736, 0.737, 0.738, 0.745, &
182  0.687, 0.687, 0.687, 0.687, 0.687, 0.700, 0.710, 0.726, 0.736, 0.737, 0.738, 0.745, &
183  0.658, 0.658, 0.658, 0.658, 0.658, 0.667, 0.674, 0.685, 0.692, 0.692, 0.693, 0.698, &
184  0.564, 0.564, 0.564, 0.564, 0.564, 0.566, 0.568, 0.571, 0.573, 0.573, 0.573, 0.574, &
185  0.363, 0.363, 0.363, 0.363, 0.363, 0.360, 0.357, 0.352, 0.350, 0.349, 0.349, 0.347, &
186  0.142, 0.142, 0.142, 0.142, 0.142, 0.139, 0.137, 0.133, 0.131, 0.131, 0.130, 0.129, &
187       ! sulfate AS
188  0.675, 0.675, 0.675, 0.689, 0.701, 0.711, 0.720, 0.735, 0.748, 0.756, 0.760, 0.771, &
189  0.675, 0.675, 0.675, 0.689, 0.701, 0.711, 0.720, 0.735, 0.748, 0.756, 0.760, 0.771, &
190  0.653, 0.653, 0.653, 0.662, 0.670, 0.676, 0.683, 0.692, 0.701, 0.706, 0.709, 0.716, &
191  0.563, 0.563, 0.563, 0.565, 0.567, 0.569, 0.570, 0.573, 0.575, 0.576, 0.577, 0.579, &
192  0.362, 0.362, 0.362, 0.359, 0.356, 0.354, 0.352, 0.348, 0.345, 0.343, 0.342, 0.340, &
193  0.137, 0.137, 0.137, 0.135, 0.133, 0.132, 0.130, 0.128, 0.126, 0.125, 0.124, 0.122, &
194       ! sulfate coarse CS
195  0.803, 0.803, 0.803, 0.792, 0.783, 0.776, 0.769, 0.758, 0.747, 0.742, 0.738, 0.730, &
196  0.803, 0.803, 0.803, 0.792, 0.783, 0.776, 0.769, 0.758, 0.747, 0.742, 0.738, 0.730, &
197  0.799, 0.799, 0.799, 0.787, 0.777, 0.768, 0.760, 0.747, 0.736, 0.729, 0.725, 0.716, &
198  0.797, 0.797, 0.797, 0.782, 0.770, 0.760, 0.750, 0.735, 0.722, 0.714, 0.709, 0.698, &
199  0.810, 0.810, 0.810, 0.794, 0.781, 0.770, 0.759, 0.743, 0.728, 0.719, 0.714, 0.702, &
200  0.803, 0.803, 0.803, 0.790, 0.779, 0.770, 0.762, 0.748, 0.736, 0.729, 0.725, 0.715, &
201        ! seasalt seasalt Super Coarse Soluble (SS)
202  0.797, 0.800, 0.801, 0.802, 0.804, 0.822, 0.825, 0.828, 0.832, 0.835, 0.838, 0.843, &
203  0.788, 0.792, 0.794, 0.795, 0.796, 0.815, 0.818, 0.822, 0.827, 0.829, 0.833, 0.838, &
204  0.773, 0.778, 0.780, 0.782, 0.783, 0.802, 0.806, 0.811, 0.817, 0.820, 0.825, 0.832, &
205  0.746, 0.753, 0.755, 0.759, 0.760, 0.781, 0.787, 0.792, 0.800, 0.805, 0.811, 0.820, &
206  0.706, 0.714, 0.716, 0.720, 0.722, 0.749, 0.753, 0.761, 0.769, 0.774, 0.783, 0.797, &
207  0.681, 0.682, 0.682, 0.683, 0.684, 0.723, 0.727, 0.732, 0.738, 0.741, 0.748, 0.757, &
208        ! seasalt seasalt Coarse Soluble (CS)     
209  0.756, 0.761, 0.764, 0.766, 0.769, 0.790, 0.793, 0.799, 0.805, 0.810, 0.815, 0.823, &
210  0.736, 0.743, 0.747, 0.749, 0.751, 0.773, 0.778, 0.784, 0.793, 0.797, 0.804, 0.815, &
211  0.712, 0.719, 0.721, 0.725, 0.726, 0.752, 0.758, 0.764, 0.773, 0.779, 0.786, 0.800, &
212  0.690, 0.694, 0.695, 0.698, 0.699, 0.731, 0.738, 0.742, 0.751, 0.756, 0.764, 0.776, &
213  0.682, 0.683, 0.683, 0.683, 0.684, 0.725, 0.729, 0.733, 0.737, 0.740, 0.744, 0.752, &
214  0.669, 0.673, 0.674, 0.675, 0.676, 0.718, 0.724, 0.730, 0.736, 0.739, 0.742, 0.746, &
215        ! seasalt seasalt Accumulation Soluble (AS)
216  0.694, 0.692, 0.692, 0.691, 0.689, 0.737, 0.740, 0.742, 0.742, 0.740, 0.737, 0.731, &
217  0.685, 0.690, 0.691, 0.692, 0.692, 0.735, 0.741, 0.746, 0.750, 0.751, 0.750, 0.744, &
218  0.650, 0.662, 0.666, 0.670, 0.673, 0.710, 0.719, 0.729, 0.741, 0.747, 0.754, 0.757, &
219  0.561, 0.585, 0.593, 0.601, 0.609, 0.637, 0.651, 0.669, 0.691, 0.705, 0.723, 0.745, &
220  0.392, 0.427, 0.439, 0.451, 0.464, 0.480, 0.500, 0.526, 0.563, 0.588, 0.621, 0.671, &
221  0.144, 0.170, 0.179, 0.189, 0.201, 0.207, 0.224, 0.248, 0.285, 0.315, 0.359, 0.439 /
222
223  DATA cg_aeri_6bands/ &
224       ! dust insoluble CI
225  0.718, 0.718, 0.699, 0.661, 0.676, 0.670, &
226       ! bc insoluble AI
227  0.721, 0.721, 0.643, 0.513, 0.321, 0.153, &
228       ! pom insoluble AI
229  0.687, 0.687, 0.658, 0.564, 0.363, 0.142  /
230
231  DATA piz_aers_6bands/&
232       ! bc soluble AS
233  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
234  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
235  0.445, 0.445, 0.445, 0.445, 0.445, 0.521, 0.583, 0.679, 0.741, 0.747, 0.753, 0.798, &
236  0.394, 0.394, 0.394, 0.394, 0.394, 0.477, 0.545, 0.649, 0.718, 0.724, 0.730, 0.779, &
237  0.267, 0.267, 0.267, 0.267, 0.267, 0.365, 0.446, 0.571, 0.652, 0.660, 0.667, 0.725, &
238  0.121, 0.121, 0.121, 0.121, 0.121, 0.139, 0.155, 0.178, 0.193, 0.195, 0.196, 0.207, &
239       ! pom soluble AS
240  0.973, 0.973, 0.973, 0.973, 0.973, 0.977, 0.980, 0.984, 0.987, 0.988, 0.988, 0.990, &
241  0.973, 0.973, 0.973, 0.973, 0.973, 0.977, 0.980, 0.984, 0.987, 0.988, 0.988, 0.990, &
242  0.972, 0.972, 0.972, 0.972, 0.972, 0.976, 0.979, 0.984, 0.987, 0.987, 0.988, 0.990, &
243  0.940, 0.940, 0.940, 0.940, 0.940, 0.948, 0.955, 0.965, 0.972, 0.973, 0.973, 0.978, &
244  0.816, 0.816, 0.816, 0.816, 0.816, 0.839, 0.859, 0.888, 0.908, 0.910, 0.911, 0.925, &
245  0.663, 0.663, 0.663, 0.663, 0.663, 0.607, 0.562, 0.492, 0.446, 0.441, 0.437, 0.404, &
246       ! sulfate AS
247  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
248  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
249  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
250  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
251  0.988, 0.988, 0.988, 0.989, 0.990, 0.990, 0.991, 0.992, 0.993, 0.993, 0.994, 0.994, &
252  0.256, 0.256, 0.256, 0.263, 0.268, 0.273, 0.277, 0.284, 0.290, 0.294, 0.296, 0.301, &
253       ! sulfate coarse CS
254  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
255  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
256  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
257  1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
258  0.996, 0.996, 0.996, 0.996, 0.996, 0.996, 0.996, 0.996, 0.996, 0.996, 0.996, 0.996, &
259  0.877, 0.877, 0.877, 0.873, 0.870, 0.867, 0.864, 0.860, 0.856, 0.854, 0.852, 0.849, &
260        ! seasalt seasalt Super Coarse Soluble (SS)
261  0.983, 0.982, 0.982, 0.982, 0.982, 0.992, 0.993, 0.994, 0.995, 0.996, 0.997, 0.998, &
262  0.984, 0.983, 0.983, 0.983, 0.983, 0.993, 0.994, 0.995, 0.996, 0.996, 0.997, 0.998, &
263  0.986, 0.985, 0.985, 0.985, 0.984, 0.993, 0.994, 0.995, 0.996, 0.997, 0.997, 0.998, &
264  0.989, 0.988, 0.988, 0.988, 0.987, 0.995, 0.996, 0.996, 0.997, 0.997, 0.998, 0.999, &
265  0.994, 0.993, 0.992, 0.992, 0.992, 0.997, 0.997, 0.998, 0.998, 0.998, 0.999, 0.999, &
266  0.997, 0.997, 0.997, 0.996, 0.996, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 1.000, &
267        ! seasalt seasalt Coarse Soluble (CS)     
268  0.988, 0.987, 0.987, 0.987, 0.986, 0.995, 0.995, 0.996, 0.997, 0.997, 0.998, 0.999, &
269  0.990, 0.989, 0.989, 0.989, 0.989, 0.995, 0.996, 0.997, 0.997, 0.998, 0.998, 0.999, &
270  0.993, 0.992, 0.992, 0.992, 0.991, 0.997, 0.997, 0.997, 0.998, 0.998, 0.998, 0.999, &
271  0.996, 0.995, 0.995, 0.995, 0.994, 0.998, 0.998, 0.998, 0.999, 0.999, 0.999, 0.999, &
272  0.998, 0.997, 0.997, 0.997, 0.997, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 1.000, &
273  0.999, 0.998, 0.998, 0.998, 0.998, 0.999, 0.999, 1.000, 1.000, 1.000, 1.000, 1.000, &
274        ! seasalt seasalt Accumulation Soluble (AS)
275  0.999, 0.998, 0.998, 0.998, 0.998, 0.999, 0.999, 1.000, 1.000, 1.000, 1.000, 1.000, &
276  0.999, 0.999, 0.999, 0.999, 0.999, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
277  0.999, 0.999, 0.999, 0.999, 0.999, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
278  0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, &
279  0.997, 0.998, 0.998, 0.998, 0.998, 0.999, 0.999, 0.999, 1.000, 1.000, 1.000, 1.000, &
280  0.985, 0.989, 0.990, 0.990, 0.991, 0.996, 0.997, 0.998, 0.999, 0.999, 0.999, 1.000 /
281
282  DATA piz_aeri_6bands/ &
283       ! dust insoluble CI
284  0.954, 0.954, 0.965, 0.981, 0.996, 0.990, &
285       ! bc insoluble AI
286  0.460, 0.460, 0.445, 0.394, 0.267, 0.121, &
287       ! pom insoluble AI
288  0.973, 0.973, 0.972, 0.940, 0.816, 0.663 /
289
290! Added by R. Wang (July 31 2016)
291! properties for BC assuming Maxwell-Garnett rule and internal mixture
292
293  DATA alpha_MG_6bands/ &
294     ! bc content = 0.001
295  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
296  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
297  5.900, 5.900, 5.900, 5.900, 5.900, 6.502, 7.151, 8.496, 9.818, 9.965,10.124,11.564, &
298  4.284, 4.284, 4.284, 4.284, 4.284, 4.721, 5.193, 6.169, 7.129, 7.236, 7.352, 8.397, &
299  2.163, 2.163, 2.163, 2.163, 2.163, 2.384, 2.622, 3.115, 3.600, 3.654, 3.712, 4.240, &
300  0.966, 0.966, 0.966, 0.966, 0.966, 1.065, 1.171, 1.392, 1.608, 1.632, 1.658, 1.894, &
301     ! bc content = 0.01
302  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
303  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
304  5.900, 5.900, 5.900, 5.900, 5.900, 6.502, 7.151, 8.496, 9.818, 9.965,10.124,11.564, &
305  4.284, 4.284, 4.284, 4.284, 4.284, 4.721, 5.193, 6.169, 7.129, 7.236, 7.352, 8.397, &
306  2.163, 2.163, 2.163, 2.163, 2.163, 2.384, 2.622, 3.115, 3.600, 3.654, 3.712, 4.240, &
307  0.966, 0.966, 0.966, 0.966, 0.966, 1.065, 1.171, 1.392, 1.608, 1.632, 1.658, 1.894, &
308     ! bc content = 0.02
309  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
310  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
311  5.900, 5.900, 5.900, 5.900, 5.900, 6.502, 7.151, 8.496, 9.818, 9.965,10.124,11.564, &
312  4.284, 4.284, 4.284, 4.284, 4.284, 4.721, 5.193, 6.169, 7.129, 7.236, 7.352, 8.397, &
313  2.163, 2.163, 2.163, 2.163, 2.163, 2.384, 2.622, 3.115, 3.600, 3.654, 3.712, 4.240, &
314  0.966, 0.966, 0.966, 0.966, 0.966, 1.065, 1.171, 1.392, 1.608, 1.632, 1.658, 1.894, &
315     ! bc content = 0.05
316  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
317  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
318  5.900, 5.900, 5.900, 5.900, 5.900, 6.502, 7.151, 8.496, 9.818, 9.965,10.124,11.564, &
319  4.284, 4.284, 4.284, 4.284, 4.284, 4.721, 5.193, 6.169, 7.129, 7.236, 7.352, 8.397, &
320  2.163, 2.163, 2.163, 2.163, 2.163, 2.384, 2.622, 3.115, 3.600, 3.654, 3.712, 4.240, &
321  0.966, 0.966, 0.966, 0.966, 0.966, 1.065, 1.171, 1.392, 1.608, 1.632, 1.658, 1.894, &
322     ! bc content = 0.10
323  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
324  6.497, 6.497, 6.497, 6.497, 6.497, 7.160, 7.875, 9.356,10.811,10.974,11.149,12.734, &
325  5.900, 5.900, 5.900, 5.900, 5.900, 6.502, 7.151, 8.496, 9.818, 9.965,10.124,11.564, &
326  4.284, 4.284, 4.284, 4.284, 4.284, 4.721, 5.193, 6.169, 7.129, 7.236, 7.352, 8.397, &
327  2.163, 2.163, 2.163, 2.163, 2.163, 2.384, 2.622, 3.115, 3.600, 3.654, 3.712, 4.240, &
328  0.966, 0.966, 0.966, 0.966, 0.966, 1.065, 1.171, 1.392, 1.608, 1.632, 1.658, 1.894 /
329
330  DATA cg_MG_6bands/ &
331     ! bc content = 0.001
332  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
333  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
334  0.643, 0.643, 0.643, 0.654, 0.662, 0.670, 0.677, 0.688, 0.698, 0.704, 0.707, 0.715, &
335  0.513, 0.513, 0.513, 0.522, 0.530, 0.536, 0.542, 0.552, 0.560, 0.565, 0.568, 0.575, &
336  0.321, 0.321, 0.321, 0.323, 0.325, 0.327, 0.328, 0.331, 0.333, 0.334, 0.335, 0.337, &
337  0.153, 0.153, 0.153, 0.149, 0.145, 0.142, 0.139, 0.135, 0.130, 0.128, 0.127, 0.123, &
338     ! bc content = 0.01
339  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
340  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
341  0.643, 0.643, 0.643, 0.654, 0.662, 0.670, 0.677, 0.688, 0.698, 0.704, 0.707, 0.715, &
342  0.513, 0.513, 0.513, 0.522, 0.530, 0.536, 0.542, 0.552, 0.560, 0.565, 0.568, 0.575, &
343  0.321, 0.321, 0.321, 0.323, 0.325, 0.327, 0.328, 0.331, 0.333, 0.334, 0.335, 0.337, &
344  0.153, 0.153, 0.153, 0.149, 0.145, 0.142, 0.139, 0.135, 0.130, 0.128, 0.127, 0.123, &
345     ! bc content = 0.02
346  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
347  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
348  0.643, 0.643, 0.643, 0.654, 0.662, 0.670, 0.677, 0.688, 0.698, 0.704, 0.707, 0.715, &
349  0.513, 0.513, 0.513, 0.522, 0.530, 0.536, 0.542, 0.552, 0.560, 0.565, 0.568, 0.575, &
350  0.321, 0.321, 0.321, 0.323, 0.325, 0.327, 0.328, 0.331, 0.333, 0.334, 0.335, 0.337, &
351  0.153, 0.153, 0.153, 0.149, 0.145, 0.142, 0.139, 0.135, 0.130, 0.128, 0.127, 0.123, &
352     ! bc content = 0.05
353  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
354  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
355  0.643, 0.643, 0.643, 0.654, 0.662, 0.670, 0.677, 0.688, 0.698, 0.704, 0.707, 0.715, &
356  0.513, 0.513, 0.513, 0.522, 0.530, 0.536, 0.542, 0.552, 0.560, 0.565, 0.568, 0.575, &
357  0.321, 0.321, 0.321, 0.323, 0.325, 0.327, 0.328, 0.331, 0.333, 0.334, 0.335, 0.337, &
358  0.153, 0.153, 0.153, 0.149, 0.145, 0.142, 0.139, 0.135, 0.130, 0.128, 0.127, 0.123, &
359     ! bc content = 0.10
360  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
361  0.721, 0.721, 0.721, 0.729, 0.735, 0.741, 0.746, 0.754, 0.762, 0.766, 0.769, 0.775, &
362  0.643, 0.643, 0.643, 0.654, 0.662, 0.670, 0.677, 0.688, 0.698, 0.704, 0.707, 0.715, &
363  0.513, 0.513, 0.513, 0.522, 0.530, 0.536, 0.542, 0.552, 0.560, 0.565, 0.568, 0.575, &
364  0.321, 0.321, 0.321, 0.323, 0.325, 0.327, 0.328, 0.331, 0.333, 0.334, 0.335, 0.337, &
365  0.153, 0.153, 0.153, 0.149, 0.145, 0.142, 0.139, 0.135, 0.130, 0.128, 0.127, 0.123 /
366
367  DATA piz_MG_6bands/ &
368     ! bc content = 0.001
369  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
370  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
371  0.445, 0.445, 0.445, 0.445, 0.445, 0.521, 0.583, 0.679, 0.741, 0.747, 0.753, 0.798, &
372  0.394, 0.394, 0.394, 0.394, 0.394, 0.477, 0.545, 0.649, 0.718, 0.724, 0.730, 0.779, &
373  0.267, 0.267, 0.267, 0.267, 0.267, 0.365, 0.446, 0.571, 0.652, 0.660, 0.667, 0.725, &
374  0.121, 0.121, 0.121, 0.121, 0.121, 0.139, 0.155, 0.178, 0.193, 0.195, 0.196, 0.207, &
375     ! bc content = 0.01
376  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
377  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
378  0.445, 0.445, 0.445, 0.445, 0.445, 0.521, 0.583, 0.679, 0.741, 0.747, 0.753, 0.798, &
379  0.394, 0.394, 0.394, 0.394, 0.394, 0.477, 0.545, 0.649, 0.718, 0.724, 0.730, 0.779, &
380  0.267, 0.267, 0.267, 0.267, 0.267, 0.365, 0.446, 0.571, 0.652, 0.660, 0.667, 0.725, &
381  0.121, 0.121, 0.121, 0.121, 0.121, 0.139, 0.155, 0.178, 0.193, 0.195, 0.196, 0.207, &
382     ! bc content = 0.02
383  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
384  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
385  0.445, 0.445, 0.445, 0.445, 0.445, 0.521, 0.583, 0.679, 0.741, 0.747, 0.753, 0.798, &
386  0.394, 0.394, 0.394, 0.394, 0.394, 0.477, 0.545, 0.649, 0.718, 0.724, 0.730, 0.779, &
387  0.267, 0.267, 0.267, 0.267, 0.267, 0.365, 0.446, 0.571, 0.652, 0.660, 0.667, 0.725, &
388  0.121, 0.121, 0.121, 0.121, 0.121, 0.139, 0.155, 0.178, 0.193, 0.195, 0.196, 0.207, &
389     ! bc content = 0.05
390  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
391  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
392  0.445, 0.445, 0.445, 0.445, 0.445, 0.521, 0.583, 0.679, 0.741, 0.747, 0.753, 0.798, &
393  0.394, 0.394, 0.394, 0.394, 0.394, 0.477, 0.545, 0.649, 0.718, 0.724, 0.730, 0.779, &
394  0.267, 0.267, 0.267, 0.267, 0.267, 0.365, 0.446, 0.571, 0.652, 0.660, 0.667, 0.725, &
395  0.121, 0.121, 0.121, 0.121, 0.121, 0.139, 0.155, 0.178, 0.193, 0.195, 0.196, 0.207, &
396     ! bc content = 0.10
397  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
398  0.460, 0.460, 0.460, 0.460, 0.460, 0.534, 0.594, 0.688, 0.748, 0.754, 0.760, 0.803, &
399  0.445, 0.445, 0.445, 0.445, 0.445, 0.521, 0.583, 0.679, 0.741, 0.747, 0.753, 0.798, &
400  0.394, 0.394, 0.394, 0.394, 0.394, 0.477, 0.545, 0.649, 0.718, 0.724, 0.730, 0.779, &
401  0.267, 0.267, 0.267, 0.267, 0.267, 0.365, 0.446, 0.571, 0.652, 0.660, 0.667, 0.725, &
402  0.121, 0.121, 0.121, 0.121, 0.121, 0.139, 0.155, 0.178, 0.193, 0.195, 0.196, 0.207 /
403
404!----BEGINNING OF CALCULATIONS
405
406  spsol = 0
407  spinsol = 0
408
409  IF (NSW.NE.nbands_sw_rrtm) THEN
410     print *,'Erreur NSW doit etre egal a 6 pour cette routine'
411     stop
412  ENDIF
413
414  zdh(:,:)=pdel(:,:)/(RG*zrho(:,:))      ! m
415
416  IF (flag_aerosol .EQ. 1) THEN
417     nb_aer = 2
418     ALLOCATE (aerosol_name(nb_aer))
419     aerosol_name(1) = id_ASSO4M_phy
420     aerosol_name(2) = id_CSSO4M_phy
421  ELSEIF (flag_aerosol .EQ. 2) THEN
422     nb_aer = 2
423     ALLOCATE (aerosol_name(nb_aer))
424     aerosol_name(1) = id_ASBCM_phy
425     aerosol_name(2) = id_AIBCM_phy
426  ELSEIF (flag_aerosol .EQ. 3) THEN
427     nb_aer = 2
428     ALLOCATE (aerosol_name(nb_aer))
429     aerosol_name(1) = id_ASPOMM_phy
430     aerosol_name(2) = id_AIPOMM_phy
431  ELSEIF (flag_aerosol .EQ. 4) THEN
432     nb_aer = 3
433     ALLOCATE (aerosol_name(nb_aer))
434     aerosol_name(1) = id_CSSSM_phy
435     aerosol_name(2) = id_SSSSM_phy
436     aerosol_name(3) = id_ASSSM_phy
437  ELSEIF (flag_aerosol .EQ. 5) THEN
438     nb_aer = 1
439     ALLOCATE (aerosol_name(nb_aer))
440     aerosol_name(1) = id_CIDUSTM_phy
441  ELSEIF (flag_aerosol .EQ. 6) THEN
442     nb_aer = 10
443     ALLOCATE (aerosol_name(nb_aer))
444     aerosol_name(1) = id_ASSO4M_phy     
445     aerosol_name(2) = id_ASBCM_phy
446     aerosol_name(3) = id_AIBCM_phy
447     aerosol_name(4) = id_ASPOMM_phy
448     aerosol_name(5) = id_AIPOMM_phy
449     aerosol_name(6) = id_CSSSM_phy
450     aerosol_name(7) = id_SSSSM_phy
451     aerosol_name(8) = id_ASSSM_phy
452     aerosol_name(9) = id_CIDUSTM_phy
453     aerosol_name(10)= id_CSSO4M_phy
454  ENDIF
455
456  !
457  ! loop over modes, use of precalculated nmd and corresponding sigma
458  !    loop over wavelengths
459  !    for each mass species in mode
460  !      interpolate from Sext to retrieve Sext_at_gridpoint_per_species
461  !      compute optical_thickness_at_gridpoint_per_species
462
463  DO n=1,nbre_RH-1
464    fact_RH(n)=1./(RH_tab(n+1)-RH_tab(n))
465  ENDDO
466   
467  DO k=1, klev
468    DO i=1, klon
469      rh(i,k)=MIN(RHcl(i,k)*100.,RH_MAX)
470      RH_num(i,k) = INT(rh(i,k)/10. + 1.)
471      IF (rh(i,k).GT.85.) RH_num(i,k)=10
472      IF (rh(i,k).GT.90.) RH_num(i,k)=11
473      delta(i,k)=(rh(i,k)-RH_tab(RH_num(i,k)))*fact_RH(RH_num(i,k))
474    ENDDO
475  ENDDO
476
477  tau_ae(:,:,:,:)=0.
478  piz_ae(:,:,:,:)=0.
479  cg_ae(:,:,:,:)=0.
480
481  tau_ae_pi(:,:,:,:)=0.
482  piz_ae_pi(:,:,:,:)=0.
483  cg_ae_pi(:,:,:,:)=0.
484   
485  DO m=1,nb_aer   ! tau is only computed for each mass
486     fac=1.0
487     IF (aerosol_name(m).EQ.id_ASBCM_phy) THEN
488        soluble=.TRUE.
489        spsol=1
490     ELSEIF (aerosol_name(m).EQ.id_ASPOMM_phy) THEN
491        soluble=.TRUE.
492        spsol=2
493     ELSEIF (aerosol_name(m).EQ.id_ASSO4M_phy) THEN
494        soluble=.TRUE.
495        spsol=3
496        fac=1.375    ! (NH4)2-SO4/SO4 132/96 mass conversion factor for AOD
497     ELSEIF  (aerosol_name(m).EQ.id_CSSO4M_phy) THEN
498        soluble=.TRUE.
499        spsol=4
500        fac=1.375    ! (NH4)2-SO4/SO4 132/96 mass conversion factor for AOD
501     ELSEIF (aerosol_name(m).EQ.id_SSSSM_phy) THEN
502         soluble=.TRUE.
503         spsol=5
504     ELSEIF (aerosol_name(m).EQ.id_CSSSM_phy) THEN
505         soluble=.TRUE.
506         spsol=6
507     ELSEIF (aerosol_name(m).EQ.id_ASSSM_phy) THEN
508         soluble=.TRUE.
509         spsol=7
510     ELSEIF (aerosol_name(m).EQ.id_CIDUSTM_phy) THEN
511         soluble=.FALSE.
512         spinsol=1
513     ELSEIF  (aerosol_name(m).EQ.id_AIBCM_phy) THEN
514         soluble=.FALSE.
515         spinsol=2
516     ELSEIF (aerosol_name(m).EQ.id_AIPOMM_phy) THEN
517         soluble=.FALSE.
518         spinsol=3
519     ELSE
520         CYCLE
521     ENDIF
522
523    !--shortname for aerosol index
524    id=aerosol_name(m)
525
526    IF (soluble) THEN
527
528       !--here we treat the special case of soluble BC internal mixture with Maxwell-Garnett rule
529       IF (spsol.EQ.1 .AND. flag_bc_internal_mixture) THEN
530
531         DO k=1, klev
532           DO i=1, klon
533
534             tmp_var=m_allaer(i,k,spsol)/1.e6*zdh(i,k)*fac
535             tmp_var_pi=m_allaer_pi(i,k,spsol)/1.e6*zdh(i,k)*fac
536
537             ! Calculate the dry BC/(BC+SUL) mass ratio for all (natural+anthropogenic) aerosols
538             BC_massfra = m_allaer(i,k,id_ASBCM_phy)/(m_allaer(i,k,id_ASBCM_phy)+m_allaer(i,k,id_ASSO4M_phy))
539
540             IF (BC_massfra.GE.0.10) THEN
541               classbc = 5
542             ELSEIF  (BC_massfra.GE.0.05) THEN
543               classbc = 4
544             ELSEIF  (BC_massfra.GE.0.02) THEN
545               classbc = 3
546             ELSEIF  (BC_massfra.GE.0.01) THEN
547               classbc = 2
548             ELSE
549               classbc = 1
550             ENDIF
551
552             ! Calculate the dry BC/(BC+SUL) mass ratio for natural aerosols
553             BC_massfra_pi = m_allaer_pi(i,k,id_ASBCM_phy)/(m_allaer_pi(i,k,id_ASBCM_phy)+m_allaer_pi(i,k,id_ASSO4M_phy))
554
555             IF (BC_massfra_pi.GE.0.10) THEN
556               classbc_pi = 5
557             ELSEIF  (BC_massfra_pi.GE.0.05) THEN
558               classbc_pi = 4
559             ELSEIF  (BC_massfra_pi.GE.0.02) THEN
560               classbc_pi = 3
561             ELSEIF  (BC_massfra_pi.GE.0.01) THEN
562               classbc_pi = 2
563             ELSE
564               classbc_pi = 1
565             ENDIF
566
567             DO inu=1,NSW
568
569               !--all aerosols
570               tau_ae2b_int= alpha_MG_6bands(RH_num(i,k),inu,classbc)+                 &
571                             delta(i,k)* (alpha_MG_6bands(RH_num(i,k)+1,inu,classbc) - &
572                             alpha_MG_6bands(RH_num(i,k),inu,classbc))
573                   
574               piz_ae2b_int = piz_MG_6bands(RH_num(i,k),inu,classbc) +                 &
575                              delta(i,k)* (piz_MG_6bands(RH_num(i,k)+1,inu,classbc) -  &
576                              piz_MG_6bands(RH_num(i,k),inu,classbc))
577                   
578               cg_ae2b_int = cg_MG_6bands(RH_num(i,k),inu,classbc) +                   &
579                             delta(i,k)* (cg_MG_6bands(RH_num(i,k)+1,inu,classbc) -    &
580                             cg_MG_6bands(RH_num(i,k),inu,classbc))
581
582               tau_ae(i,k,id,inu)    = tmp_var*tau_ae2b_int
583               piz_ae(i,k,id,inu)    = piz_ae2b_int
584               cg_ae(i,k,id,inu)     = cg_ae2b_int
585
586               !--natural aerosols
587               tau_ae2b_int= alpha_MG_6bands(RH_num(i,k),inu,classbc_pi)+                 &
588                             delta(i,k)* (alpha_MG_6bands(RH_num(i,k)+1,inu,classbc_pi) - &
589                             alpha_MG_6bands(RH_num(i,k),inu,classbc_pi))
590                   
591               piz_ae2b_int = piz_MG_6bands(RH_num(i,k),inu,classbc_pi) +                 &
592                              delta(i,k)* (piz_MG_6bands(RH_num(i,k)+1,inu,classbc_pi) -  &
593                              piz_MG_6bands(RH_num(i,k),inu,classbc_pi))
594                   
595               cg_ae2b_int = cg_MG_6bands(RH_num(i,k),inu,classbc_pi) +                   &
596                             delta(i,k)* (cg_MG_6bands(RH_num(i,k)+1,inu,classbc_pi) -    &
597                             cg_MG_6bands(RH_num(i,k),inu,classbc_pi))
598
599               tau_ae_pi(i,k,id,inu) = tmp_var_pi* tau_ae2b_int
600               piz_ae_pi(i,k,id,inu) = piz_ae2b_int
601               cg_ae_pi(i,k,id,inu)  = cg_ae2b_int
602                       
603             ENDDO
604           ENDDO
605         ENDDO
606
607       !--else treat all other cases of soluble aerosols
608       ELSE
609
610         DO k=1, klev
611           DO i=1, klon
612             tmp_var=m_allaer(i,k,spsol)/1.e6*zdh(i,k)*fac
613             tmp_var_pi=m_allaer_pi(i,k,spsol)/1.e6*zdh(i,k)*fac
614
615             DO inu=1,NSW
616
617               tau_ae2b_int= alpha_aers_6bands(RH_num(i,k),inu,spsol)+ &
618                             delta(i,k)* (alpha_aers_6bands(RH_num(i,k)+1,inu,spsol) - &
619                             alpha_aers_6bands(RH_num(i,k),inu,spsol))
620                   
621               piz_ae2b_int = piz_aers_6bands(RH_num(i,k),inu,spsol) + &
622                            delta(i,k)* (piz_aers_6bands(RH_num(i,k)+1,inu,spsol) - &
623                              piz_aers_6bands(RH_num(i,k),inu,spsol))
624                   
625               cg_ae2b_int = cg_aers_6bands(RH_num(i,k),inu,spsol) + &
626                             delta(i,k)* (cg_aers_6bands(RH_num(i,k)+1,inu,spsol) - &
627                             cg_aers_6bands(RH_num(i,k),inu,spsol))
628
629               tau_ae(i,k,id,inu)    = tmp_var*tau_ae2b_int
630               tau_ae_pi(i,k,id,inu) = tmp_var_pi* tau_ae2b_int
631               piz_ae(i,k,id,inu)    = piz_ae2b_int
632               cg_ae(i,k,id,inu)     = cg_ae2b_int
633                       
634             ENDDO
635           ENDDO
636         ENDDO
637
638         !--external mixture case for soluble BC
639         IF (spsol.EQ.1) THEN
640           piz_ae_pi(:,:,id,:) = piz_ae(:,:,id,:)
641           cg_ae_pi(:,:,id,:)  = cg_ae(:,:,id,:)
642         ENDIF
643
644       ENDIF
645       
646     ELSE    ! For all aerosol insoluble components
647
648       DO k=1, klev
649         DO i=1, klon
650           tmp_var=m_allaer(i,k,naero_soluble+spinsol)/1.e6*zdh(i,k)*fac
651           tmp_var_pi=m_allaer_pi(i,k,naero_soluble+spinsol)/1.e6*zdh(i,k)*fac
652
653           DO inu=1,NSW
654             tau_ae2b_int = alpha_aeri_6bands(inu,spinsol)
655             piz_ae2b_int = piz_aeri_6bands(inu,spinsol)
656             cg_ae2b_int = cg_aeri_6bands(inu,spinsol)
657
658             tau_ae(i,k,id,inu) = tmp_var*tau_ae2b_int
659             tau_ae_pi(i,k,id,inu) = tmp_var_pi*tau_ae2b_int
660             piz_ae(i,k,id,inu) = piz_ae2b_int
661             cg_ae(i,k,id,inu)= cg_ae2b_int
662           ENDDO
663         ENDDO
664       ENDDO
665
666     ENDIF ! soluble / insoluble
667
668  ENDDO  ! nb_aer 
669
670  DO inu=1, NSW
671     DO k=1, klev
672       DO i=1, klon
673!--all (natural + anthropogenic) aerosol
674         tau_allaer(i,k,2,inu)=tau_ae(i,k,id_ASSO4M_phy,inu)+tau_ae(i,k,id_CSSO4M_phy,inu)+ &
675                               tau_ae(i,k,id_ASBCM_phy,inu)+tau_ae(i,k,id_AIBCM_phy,inu)+   &
676                               tau_ae(i,k,id_ASPOMM_phy,inu)+tau_ae(i,k,id_AIPOMM_phy,inu)+ &
677                               tau_ae(i,k,id_ASSSM_phy,inu)+tau_ae(i,k,id_CSSSM_phy,inu)+   &
678                               tau_ae(i,k,id_SSSSM_phy,inu)+ tau_ae(i,k,id_CIDUSTM_phy,inu)
679         tau_allaer(i,k,2,inu)=MAX(tau_allaer(i,k,2,inu),tau_min)
680
681         piz_allaer(i,k,2,inu)=(tau_ae(i,k,id_ASSO4M_phy,inu)*piz_ae(i,k,id_ASSO4M_phy,inu)+   &
682                                tau_ae(i,k,id_CSSO4M_phy,inu)*piz_ae(i,k,id_CSSO4M_phy,inu)+   &
683                                tau_ae(i,k,id_ASBCM_phy,inu)*piz_ae(i,k,id_ASBCM_phy,inu)+     &
684                                tau_ae(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu)+     &
685                                tau_ae(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu)+   &
686                                tau_ae(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu)+   &
687                                tau_ae(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu)+     &
688                                tau_ae(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu)+     &
689                                tau_ae(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu)+     &
690                                tau_ae(i,k,id_CIDUSTM_phy,inu)*piz_ae(i,k,id_CIDUSTM_phy,inu)) &
691                                /tau_allaer(i,k,2,inu)
692         piz_allaer(i,k,2,inu)=MIN(MAX(piz_allaer(i,k,2,inu),0.01),1.0)
693         IF (tau_allaer(i,k,2,inu).LE.tau_min) piz_allaer(i,k,2,inu)=1.0
694
695         cg_allaer(i,k,2,inu)=(tau_ae(i,k,id_ASSO4M_phy,inu)*piz_ae(i,k,id_ASSO4M_phy,inu)*cg_ae(i,k,id_ASSO4M_phy,inu)+ &
696                               tau_ae(i,k,id_CSSO4M_phy,inu)*piz_ae(i,k,id_CSSO4M_phy,inu)*cg_ae(i,k,id_CSSO4M_phy,inu)+ &
697                               tau_ae(i,k,id_ASBCM_phy,inu)*piz_ae(i,k,id_ASBCM_phy,inu)*cg_ae(i,k,id_ASBCM_phy,inu)+    &
698                               tau_ae(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu)*cg_ae(i,k,id_AIBCM_phy,inu)+    &
699                               tau_ae(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu)*cg_ae(i,k,id_ASPOMM_phy,inu)+ &
700                               tau_ae(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu)*cg_ae(i,k,id_AIPOMM_phy,inu)+ &
701                               tau_ae(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu)*cg_ae(i,k,id_ASSSM_phy,inu)+    &
702                               tau_ae(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu)*cg_ae(i,k,id_CSSSM_phy,inu)+    &
703                               tau_ae(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu)*cg_ae(i,k,id_SSSSM_phy,inu)+    &
704                               tau_ae(i,k,id_CIDUSTM_phy,inu)*piz_ae(i,k,id_CIDUSTM_phy,inu)*cg_ae(i,k,id_CIDUSTM_phy,inu))/ &
705                               (tau_allaer(i,k,2,inu)*piz_allaer(i,k,2,inu))
706         cg_allaer(i,k,2,inu)=MIN(MAX(cg_allaer(i,k,2,inu),0.0),1.0)
707
708!--natural aerosol
709!--ASBCM aerosols take _pi value because of internal mixture option
710         tau_allaer(i,k,1,inu)=tau_ae_pi(i,k,id_ASSO4M_phy,inu)+tau_ae_pi(i,k,id_CSSO4M_phy,inu)+ &
711                               tau_ae_pi(i,k,id_ASBCM_phy,inu)+tau_ae_pi(i,k,id_AIBCM_phy,inu)+   &
712                               tau_ae_pi(i,k,id_ASPOMM_phy,inu)+tau_ae_pi(i,k,id_AIPOMM_phy,inu)+ &
713                               tau_ae_pi(i,k,id_ASSSM_phy,inu)+tau_ae_pi(i,k,id_CSSSM_phy,inu)+   &
714                               tau_ae_pi(i,k,id_SSSSM_phy,inu)+ tau_ae_pi(i,k,id_CIDUSTM_phy,inu)
715         tau_allaer(i,k,1,inu)=MAX(tau_allaer(i,k,1,inu),tau_min)
716
717         piz_allaer(i,k,1,inu)=(tau_ae_pi(i,k,id_ASSO4M_phy,inu)*piz_ae(i,k,id_ASSO4M_phy,inu)+   &
718                                tau_ae_pi(i,k,id_CSSO4M_phy,inu)*piz_ae(i,k,id_CSSO4M_phy,inu)+   &
719                                tau_ae_pi(i,k,id_ASBCM_phy,inu)*piz_ae_pi(i,k,id_ASBCM_phy,inu)+  &
720                                tau_ae_pi(i,k,id_AIBCM_phy,inu)*piz_ae(i,k,id_AIBCM_phy,inu)+     &
721                                tau_ae_pi(i,k,id_ASPOMM_phy,inu)*piz_ae(i,k,id_ASPOMM_phy,inu)+   &
722                                tau_ae_pi(i,k,id_AIPOMM_phy,inu)*piz_ae(i,k,id_AIPOMM_phy,inu)+   &
723                                tau_ae_pi(i,k,id_ASSSM_phy,inu)*piz_ae(i,k,id_ASSSM_phy,inu)+     &
724                                tau_ae_pi(i,k,id_CSSSM_phy,inu)*piz_ae(i,k,id_CSSSM_phy,inu)+     &
725                                tau_ae_pi(i,k,id_SSSSM_phy,inu)*piz_ae(i,k,id_SSSSM_phy,inu)+     &
726                                tau_ae_pi(i,k,id_CIDUSTM_phy,inu)*piz_ae(i,k,id_CIDUSTM_phy,inu)) &
727                                /tau_allaer(i,k,1,inu)
728         piz_allaer(i,k,1,inu)=MIN(MAX(piz_allaer(i,k,1,inu),0.01),1.0)
729         IF (tau_allaer(i,k,1,inu).LE.tau_min) piz_allaer(i,k,1,inu)=1.0
730
731         cg_allaer(i,k,1,inu)=(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)+    &
732                               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)+    &
733                               tau_ae_pi(i,k,id_ASBCM_phy,inu)*piz_ae_pi(i,k,id_ASBCM_phy,inu)*cg_ae_pi(i,k,id_ASBCM_phy,inu)+ &
734                               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)+       &
735                               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)+    &
736                               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)+    &
737                               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)+       &
738                               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)+       &
739                               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)+       &
740                               tau_ae_pi(i,k,id_CIDUSTM_phy,inu)*piz_ae(i,k,id_CIDUSTM_phy,inu)*cg_ae(i,k,id_CIDUSTM_phy,inu))/ &
741                               (tau_allaer(i,k,1,inu)*piz_allaer(i,k,1,inu))
742         cg_allaer(i,k,1,inu)=MIN(MAX(cg_allaer(i,k,1,inu),0.0),1.0)
743
744        ENDDO
745      ENDDO
746    ENDDO
747   
748!--waveband 2 and all aerosol (third index = 2)
749  inu=2
750  DO i=1, klon
751     absvisaer(i)=SUM((1-piz_allaer(i,:,2,inu))*tau_allaer(i,:,2,inu))
752  ENDDO
753
754  DEALLOCATE(aerosol_name)
755
756END SUBROUTINE AEROPT_6BANDS_RRTM
Note: See TracBrowser for help on using the repository browser.