1 | ! |
---|
2 | ! $Id: readaerosolstrato2_rrtm.F90 2526 2016-05-26 22:13:40Z oboucher $ |
---|
3 | ! |
---|
4 | SUBROUTINE readaerosolstrato2_rrtm(debut, ok_volcan) |
---|
5 | |
---|
6 | USE netcdf95, ONLY: nf95_close, nf95_gw_var, nf95_inq_dimid, & |
---|
7 | nf95_inq_varid, nf95_open |
---|
8 | USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_nowrite |
---|
9 | |
---|
10 | USE phys_cal_mod, ONLY : mth_cur |
---|
11 | USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid2dTo1d_glo, grid_type, unstructured |
---|
12 | USE mod_phys_lmdz_mpi_data |
---|
13 | USE mod_phys_lmdz_omp_data |
---|
14 | USE mod_phys_lmdz_para |
---|
15 | USE phys_state_var_mod |
---|
16 | USE phys_local_var_mod |
---|
17 | USE aero_mod |
---|
18 | USE dimphy |
---|
19 | USE YOERAD, ONLY : NLW |
---|
20 | USE YOMCST |
---|
21 | USE lmdz_xios |
---|
22 | ! Temporary fix waiting for cleaner interface (or not) |
---|
23 | USE clesphys_mod_h, ONLY: NSW |
---|
24 | |
---|
25 | IMPLICIT NONE |
---|
26 | |
---|
27 | !! INCLUDE "clesphys.h" |
---|
28 | |
---|
29 | CHARACTER (len = 80) :: abort_message |
---|
30 | CHARACTER (LEN=20) :: modname = 'readaerosolstrato2' |
---|
31 | |
---|
32 | ! Variable input |
---|
33 | LOGICAL, INTENT(IN) :: debut |
---|
34 | LOGICAL, INTENT(IN) :: ok_volcan !activate volcanic diags |
---|
35 | |
---|
36 | ! Variables locales |
---|
37 | INTEGER n_lat ! number of latitudes in the input data |
---|
38 | INTEGER n_lon ! number of longitudes |
---|
39 | INTEGER n_lev ! number of levels in the input data |
---|
40 | INTEGER n_month ! number of months in the input data |
---|
41 | INTEGER n_wav ! number of wavelengths in the input data |
---|
42 | REAL, ALLOCATABLE:: latitude(:) |
---|
43 | REAL, ALLOCATABLE:: time(:) |
---|
44 | REAL, ALLOCATABLE:: lev(:) |
---|
45 | REAL, ALLOCATABLE:: wav(:) |
---|
46 | INTEGER i,k,wave,band |
---|
47 | INTEGER, SAVE :: mth_pre=1 |
---|
48 | !$OMP THREADPRIVATE(mth_pre) |
---|
49 | |
---|
50 | REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE :: tau_aer_strat |
---|
51 | REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE :: piz_aer_strat |
---|
52 | REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE :: cg_aer_strat |
---|
53 | REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE :: taulw_aer_strat |
---|
54 | !$OMP THREADPRIVATE(tau_aer_strat,piz_aer_strat,cg_aer_strat,taulw_aer_strat) |
---|
55 | |
---|
56 | ! Champs reconstitues |
---|
57 | REAL, ALLOCATABLE:: tauaerstrat(:, :, :, :) |
---|
58 | REAL, ALLOCATABLE:: pizaerstrat(:, :, :, :) |
---|
59 | REAL, ALLOCATABLE:: cgaerstrat(:, :, :, :) |
---|
60 | REAL, ALLOCATABLE:: taulwaerstrat(:, :, :, :) |
---|
61 | |
---|
62 | REAL, ALLOCATABLE:: tauaerstrat_mois(:, :, :, :) |
---|
63 | REAL, ALLOCATABLE:: pizaerstrat_mois(:, :, :, :) |
---|
64 | REAL, ALLOCATABLE:: cgaerstrat_mois(:, :, :, :) |
---|
65 | REAL, ALLOCATABLE:: taulwaerstrat_mois(:, :, :, :) |
---|
66 | |
---|
67 | REAL, ALLOCATABLE:: tauaerstrat_mois_glo(:, :, :) |
---|
68 | REAL, ALLOCATABLE:: pizaerstrat_mois_glo(:, :, :) |
---|
69 | REAL, ALLOCATABLE:: cgaerstrat_mois_glo(:, :, :) |
---|
70 | REAL, ALLOCATABLE:: taulwaerstrat_mois_glo(:, :, :) |
---|
71 | REAL, ALLOCATABLE:: tauaerstrat_mpi(:, :, :) |
---|
72 | REAL, ALLOCATABLE:: pizaerstrat_mpi(:, :, :) |
---|
73 | REAL, ALLOCATABLE:: cgaerstrat_mpi(:, :, :) |
---|
74 | REAL, ALLOCATABLE:: taulwaerstrat_mpi(:, :, :) |
---|
75 | |
---|
76 | ! For NetCDF: |
---|
77 | INTEGER ncid_in ! IDs for input files |
---|
78 | INTEGER varid, ncerr |
---|
79 | |
---|
80 | !-------------------------------------------------------- |
---|
81 | |
---|
82 | IF (.not.ALLOCATED(tau_aer_strat)) ALLOCATE(tau_aer_strat(klon,klev,NSW)) |
---|
83 | IF (.not.ALLOCATED(piz_aer_strat)) ALLOCATE(piz_aer_strat(klon,klev,NSW)) |
---|
84 | IF (.not.ALLOCATED(cg_aer_strat)) ALLOCATE(cg_aer_strat(klon,klev,NSW)) |
---|
85 | |
---|
86 | IF (.not.ALLOCATED(taulw_aer_strat)) ALLOCATE(taulw_aer_strat(klon,klev,NLW)) |
---|
87 | |
---|
88 | !--we only read monthly strat aerosol data |
---|
89 | IF (debut.OR.mth_cur.NE.mth_pre) THEN |
---|
90 | |
---|
91 | !--only root reads the data |
---|
92 | IF (is_mpi_root.AND.is_omp_root) THEN |
---|
93 | |
---|
94 | !--check mth_cur |
---|
95 | IF (mth_cur.LT.1.OR.mth_cur.GT.12) THEN |
---|
96 | print *,'probleme avec le mois dans readaerosolstrat =', mth_cur |
---|
97 | ENDIF |
---|
98 | |
---|
99 | !--initialize n_lon as input data is 2D (lat-alt) only |
---|
100 | n_lon = nbp_lon |
---|
101 | |
---|
102 | !--Starts with SW optical properties |
---|
103 | |
---|
104 | CALL nf95_open("tauswstrat.2D.nc", nf90_nowrite, ncid_in) |
---|
105 | |
---|
106 | CALL nf95_inq_varid(ncid_in, "LEV", varid) |
---|
107 | CALL nf95_gw_var(ncid_in, varid, lev) |
---|
108 | n_lev = size(lev) |
---|
109 | IF (n_lev.NE.klev) THEN |
---|
110 | abort_message='Le nombre de niveaux n est pas egal a klev' |
---|
111 | CALL abort_physic(modname,abort_message,1) |
---|
112 | ENDIF |
---|
113 | |
---|
114 | CALL nf95_inq_varid(ncid_in, "LAT", varid) |
---|
115 | CALL nf95_gw_var(ncid_in, varid, latitude) |
---|
116 | n_lat = size(latitude) |
---|
117 | |
---|
118 | IF (grid_type/=unstructured) THEN |
---|
119 | IF (n_lat.NE.nbp_lat) THEN |
---|
120 | print *, 'latitude=', n_lat, nbp_lat |
---|
121 | abort_message='Le nombre de lat n est pas egal a nbp_lat' |
---|
122 | CALL abort_physic(modname,abort_message,1) |
---|
123 | ENDIF |
---|
124 | ENDIF |
---|
125 | |
---|
126 | CALL nf95_inq_varid(ncid_in, "TIME", varid) |
---|
127 | CALL nf95_gw_var(ncid_in, varid, time) |
---|
128 | n_month = size(time) |
---|
129 | IF (n_month.NE.12) THEN |
---|
130 | abort_message='Le nombre de month n est pas egal a 12' |
---|
131 | CALL abort_physic(modname,abort_message,1) |
---|
132 | ENDIF |
---|
133 | |
---|
134 | CALL nf95_inq_varid(ncid_in, "WAV", varid) |
---|
135 | CALL nf95_gw_var(ncid_in, varid, wav) |
---|
136 | n_wav = size(wav) |
---|
137 | print *, 'WAV aerosol strato=', n_wav, wav |
---|
138 | IF (n_wav.NE.NSW) THEN |
---|
139 | abort_message='Le nombre de wav n est pas egal a NSW' |
---|
140 | CALL abort_physic(modname,abort_message,1) |
---|
141 | ENDIF |
---|
142 | |
---|
143 | ALLOCATE(tauaerstrat(n_lat, n_lev, n_wav, n_month)) |
---|
144 | ALLOCATE(pizaerstrat(n_lat, n_lev, n_wav, n_month)) |
---|
145 | ALLOCATE(cgaerstrat(n_lat, n_lev, n_wav, n_month)) |
---|
146 | |
---|
147 | !--reading stratospheric aerosol tau per layer |
---|
148 | CALL nf95_inq_varid(ncid_in, "TAU_SUN", varid) |
---|
149 | ncerr = nf90_get_var(ncid_in, varid, tauaerstrat) |
---|
150 | print *,'code erreur readaerosolstrato=', ncerr, varid |
---|
151 | |
---|
152 | !--reading stratospheric aerosol omega per layer |
---|
153 | CALL nf95_inq_varid(ncid_in, "OME_SUN", varid) |
---|
154 | ncerr = nf90_get_var(ncid_in, varid, pizaerstrat) |
---|
155 | print *,'code erreur readaerosolstrato=', ncerr, varid |
---|
156 | |
---|
157 | !--reading stratospheric aerosol g per layer |
---|
158 | CALL nf95_inq_varid(ncid_in, "GGG_SUN", varid) |
---|
159 | ncerr = nf90_get_var(ncid_in, varid, cgaerstrat) |
---|
160 | print *,'code erreur readaerosolstrato sw=', ncerr, varid |
---|
161 | |
---|
162 | CALL nf95_close(ncid_in) |
---|
163 | |
---|
164 | |
---|
165 | IF (grid_type/=unstructured) THEN |
---|
166 | ALLOCATE(tauaerstrat_mois(n_lon, n_lat, n_lev, n_wav)) |
---|
167 | ALLOCATE(pizaerstrat_mois(n_lon, n_lat, n_lev, n_wav)) |
---|
168 | ALLOCATE(cgaerstrat_mois(n_lon, n_lat, n_lev, n_wav)) |
---|
169 | |
---|
170 | ALLOCATE(tauaerstrat_mois_glo(klon_glo, n_lev, n_wav)) |
---|
171 | ALLOCATE(pizaerstrat_mois_glo(klon_glo, n_lev, n_wav)) |
---|
172 | ALLOCATE(cgaerstrat_mois_glo(klon_glo, n_lev, n_wav)) |
---|
173 | !--select the correct month |
---|
174 | !--and copy into 1st longitude |
---|
175 | tauaerstrat_mois(1,:,:,:) = tauaerstrat(:,:,:,mth_cur) |
---|
176 | pizaerstrat_mois(1,:,:,:) = pizaerstrat(:,:,:,mth_cur) |
---|
177 | cgaerstrat_mois(1,:,:,:) = cgaerstrat(:,:,:,mth_cur) |
---|
178 | |
---|
179 | !--copy longitudes |
---|
180 | DO i=2, n_lon |
---|
181 | tauaerstrat_mois(i,:,:,:) = tauaerstrat_mois(1,:,:,:) |
---|
182 | pizaerstrat_mois(i,:,:,:) = pizaerstrat_mois(1,:,:,:) |
---|
183 | cgaerstrat_mois(i,:,:,:) = cgaerstrat_mois(1,:,:,:) |
---|
184 | ENDDO |
---|
185 | |
---|
186 | !---reduce to a klon_glo grid |
---|
187 | DO band=1, NSW |
---|
188 | CALL grid2dTo1d_glo(tauaerstrat_mois(:,:,:,band),tauaerstrat_mois_glo(:,:,band)) |
---|
189 | CALL grid2dTo1d_glo(pizaerstrat_mois(:,:,:,band),pizaerstrat_mois_glo(:,:,band)) |
---|
190 | CALL grid2dTo1d_glo(cgaerstrat_mois(:,:,:,band),cgaerstrat_mois_glo(:,:,band)) |
---|
191 | ENDDO |
---|
192 | ENDIF |
---|
193 | !--Now LW optical properties |
---|
194 | ! |
---|
195 | |
---|
196 | CALL nf95_open("taulwstrat.2D.nc", nf90_nowrite, ncid_in) |
---|
197 | |
---|
198 | CALL nf95_inq_varid(ncid_in, "LEV", varid) |
---|
199 | CALL nf95_gw_var(ncid_in, varid, lev) |
---|
200 | n_lev = size(lev) |
---|
201 | IF (n_lev.NE.klev) THEN |
---|
202 | abort_message='Le nombre de niveaux n est pas egal a klev' |
---|
203 | CALL abort_physic(modname,abort_message,1) |
---|
204 | ENDIF |
---|
205 | |
---|
206 | CALL nf95_inq_varid(ncid_in, "LAT", varid) |
---|
207 | CALL nf95_gw_var(ncid_in, varid, latitude) |
---|
208 | n_lat = size(latitude) |
---|
209 | |
---|
210 | IF (grid_type/=unstructured) THEN |
---|
211 | IF (n_lat.NE.nbp_lat) THEN |
---|
212 | abort_message='Le nombre de lat n est pas egal a nbp_lat' |
---|
213 | CALL abort_physic(modname,abort_message,1) |
---|
214 | ENDIF |
---|
215 | ENDIF |
---|
216 | |
---|
217 | CALL nf95_inq_varid(ncid_in, "TIME", varid) |
---|
218 | CALL nf95_gw_var(ncid_in, varid, time) |
---|
219 | n_month = size(time) |
---|
220 | IF (n_month.NE.12) THEN |
---|
221 | abort_message='Le nombre de month n est pas egal a 12' |
---|
222 | CALL abort_physic(modname,abort_message,1) |
---|
223 | ENDIF |
---|
224 | |
---|
225 | CALL nf95_inq_varid(ncid_in, "WAV", varid) |
---|
226 | CALL nf95_gw_var(ncid_in, varid, wav) |
---|
227 | n_wav = size(wav) |
---|
228 | print *, 'WAV aerosol strato=', n_wav, wav |
---|
229 | IF (n_wav.NE.NLW) THEN |
---|
230 | abort_message='Le nombre de wav n est pas egal a NLW' |
---|
231 | CALL abort_physic(modname,abort_message,1) |
---|
232 | ENDIF |
---|
233 | |
---|
234 | ALLOCATE(taulwaerstrat(n_lat, n_lev, n_wav, n_month)) |
---|
235 | |
---|
236 | !--reading stratospheric aerosol lw tau per layer |
---|
237 | CALL nf95_inq_varid(ncid_in, "TAU_EAR", varid) |
---|
238 | ncerr = nf90_get_var(ncid_in, varid, taulwaerstrat) |
---|
239 | print *,'code erreur readaerosolstrato lw=', ncerr, varid |
---|
240 | |
---|
241 | CALL nf95_close(ncid_in) |
---|
242 | |
---|
243 | IF (grid_type/=unstructured) THEN |
---|
244 | |
---|
245 | ALLOCATE(taulwaerstrat_mois(n_lon, n_lat, n_lev, n_wav)) |
---|
246 | ALLOCATE(taulwaerstrat_mois_glo(klon_glo, n_lev, n_wav)) |
---|
247 | |
---|
248 | !--select the correct month |
---|
249 | !--and copy into 1st longitude |
---|
250 | taulwaerstrat_mois(1,:,:,:) = taulwaerstrat(:,:,:,mth_cur) |
---|
251 | !--copy longitudes |
---|
252 | DO i=2, n_lon |
---|
253 | taulwaerstrat_mois(i,:,:,:) = taulwaerstrat_mois(1,:,:,:) |
---|
254 | ENDDO |
---|
255 | |
---|
256 | !---reduce to a klon_glo grid |
---|
257 | DO band=1, NLW |
---|
258 | CALL grid2dTo1d_glo(taulwaerstrat_mois(:,:,:,band),taulwaerstrat_mois_glo(:,:,band)) |
---|
259 | ENDDO |
---|
260 | ENDIF |
---|
261 | |
---|
262 | ELSE !--proc other than mpi_root and omp_root |
---|
263 | !--dummy allocation needed for debug mode |
---|
264 | |
---|
265 | ALLOCATE(tauaerstrat_mois_glo(1,1,1)) |
---|
266 | ALLOCATE(pizaerstrat_mois_glo(1,1,1)) |
---|
267 | ALLOCATE(cgaerstrat_mois_glo(1,1,1)) |
---|
268 | ALLOCATE(taulwaerstrat_mois_glo(1,1,1)) |
---|
269 | |
---|
270 | ALLOCATE(tauaerstrat(0,0,0,12)) |
---|
271 | ALLOCATE(pizaerstrat(0,0,0,12)) |
---|
272 | ALLOCATE(cgaerstrat(0,0,0,12)) |
---|
273 | ALLOCATE(taulwaerstrat(0,0,0,12)) |
---|
274 | |
---|
275 | |
---|
276 | ENDIF !--is_mpi_root and is_omp_root |
---|
277 | |
---|
278 | !$OMP BARRIER |
---|
279 | |
---|
280 | !--keep memory of previous month |
---|
281 | mth_pre=mth_cur |
---|
282 | |
---|
283 | IF (grid_type==unstructured) THEN |
---|
284 | |
---|
285 | IF (is_omp_master) THEN |
---|
286 | ALLOCATE(tauaerstrat_mpi(klon_mpi, klev, NSW)) |
---|
287 | ALLOCATE(pizaerstrat_mpi(klon_mpi, klev, NSW)) |
---|
288 | ALLOCATE(cgaerstrat_mpi(klon_mpi, klev, NSW)) |
---|
289 | ALLOCATE(taulwaerstrat_mpi(klon_mpi, klev, NLW)) |
---|
290 | |
---|
291 | CALL xios_send_field("tauaerstrat_in",SPREAD(tauaerstrat(:,:,:,mth_cur),1,8)) |
---|
292 | CALL xios_recv_field("tauaerstrat_out",tauaerstrat_mpi) |
---|
293 | CALL xios_send_field("pizaerstrat_in",SPREAD(pizaerstrat(:,:,:,mth_cur),1,8)) |
---|
294 | CALL xios_recv_field("pizaerstrat_out",pizaerstrat_mpi) |
---|
295 | CALL xios_send_field("cgaerstrat_in",SPREAD(cgaerstrat(:,:,:,mth_cur),1,8)) |
---|
296 | CALL xios_recv_field("cgaerstrat_out",cgaerstrat_mpi) |
---|
297 | CALL xios_send_field("taulwaerstrat_in",SPREAD(taulwaerstrat(:,:,:,mth_cur),1,8)) |
---|
298 | CALL xios_recv_field("taulwaerstrat_out",taulwaerstrat_mpi) |
---|
299 | ELSE |
---|
300 | ALLOCATE(tauaerstrat_mpi(0, 0, 0)) |
---|
301 | ALLOCATE(pizaerstrat_mpi(0, 0, 0)) |
---|
302 | ALLOCATE(cgaerstrat_mpi(0, 0, 0)) |
---|
303 | ALLOCATE(taulwaerstrat_mpi(0, 0, 0)) |
---|
304 | ENDIF |
---|
305 | |
---|
306 | CALL scatter_omp(tauaerstrat_mpi,tau_aer_strat) |
---|
307 | CALL scatter_omp(pizaerstrat_mpi,piz_aer_strat) |
---|
308 | CALL scatter_omp(cgaerstrat_mpi,cg_aer_strat) |
---|
309 | CALL scatter_omp(taulwaerstrat_mpi,taulw_aer_strat) |
---|
310 | ELSE |
---|
311 | |
---|
312 | !--scatter on all proc |
---|
313 | CALL scatter(tauaerstrat_mois_glo,tau_aer_strat) |
---|
314 | CALL scatter(pizaerstrat_mois_glo,piz_aer_strat) |
---|
315 | CALL scatter(cgaerstrat_mois_glo,cg_aer_strat) |
---|
316 | CALL scatter(taulwaerstrat_mois_glo,taulw_aer_strat) |
---|
317 | IF (is_mpi_root.AND.is_omp_root) DEALLOCATE(tauaerstrat_mois, pizaerstrat_mois, cgaerstrat_mois, taulwaerstrat_mois) |
---|
318 | |
---|
319 | ENDIF |
---|
320 | |
---|
321 | IF (is_mpi_root.AND.is_omp_root) THEN |
---|
322 | DEALLOCATE(tauaerstrat, pizaerstrat, cgaerstrat,taulwaerstrat) |
---|
323 | ENDIF |
---|
324 | |
---|
325 | |
---|
326 | !$OMP BARRIER |
---|
327 | |
---|
328 | ENDIF !--debut ou nouveau mois |
---|
329 | |
---|
330 | !--total vertical aod at the 5 SW wavelengths |
---|
331 | !--for now use band 3 AOD into all 5 wavelengths |
---|
332 | !--it is only a reasonable approximation for 550 nm (wave=2) |
---|
333 | band=3 |
---|
334 | DO i=1, klon |
---|
335 | DO k=1, klev |
---|
336 | IF (stratomask(i,k).GT.0.999999) THEN |
---|
337 | DO wave=1, nwave_sw |
---|
338 | tausum_aero(i,wave,id_STRAT_phy)=tausum_aero(i,wave,id_STRAT_phy)+tau_aer_strat(i,k,band) |
---|
339 | ENDDO |
---|
340 | ENDIF |
---|
341 | ENDDO |
---|
342 | ENDDO |
---|
343 | |
---|
344 | IF (.NOT. ok_volcan) THEN |
---|
345 | ! |
---|
346 | !--this is the default case |
---|
347 | !--stratospheric aerosols are added to both index 2 and 1 for double radiation calls |
---|
348 | !--weighted average for cg, piz and tau, adding strat aerosols on top of tropospheric ones |
---|
349 | DO band=1, NSW |
---|
350 | WHERE (stratomask.GT.0.999999) |
---|
351 | !--strat aerosols are added to index 2 : natural and anthropogenic aerosols for bands 1 to NSW |
---|
352 | cg_aero_sw_rrtm(:,:,2,band) = ( cg_aero_sw_rrtm(:,:,2,band)*piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) + & |
---|
353 | cg_aer_strat(:,:,band)*piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band) ) / & |
---|
354 | MAX( piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) + & |
---|
355 | piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band), 1.e-15 ) |
---|
356 | piz_aero_sw_rrtm(:,:,2,band) = ( piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) + & |
---|
357 | piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band) ) / & |
---|
358 | MAX( tau_aero_sw_rrtm(:,:,2,band) + tau_aer_strat(:,:,band), 1.e-15 ) |
---|
359 | tau_aero_sw_rrtm(:,:,2,band) = tau_aero_sw_rrtm(:,:,2,band) + tau_aer_strat(:,:,band) |
---|
360 | !--strat aerosols are added to index 1 : natural aerosols only for bands 1 to NSW |
---|
361 | cg_aero_sw_rrtm(:,:,1,band) = ( cg_aero_sw_rrtm(:,:,1,band)*piz_aero_sw_rrtm(:,:,1,band)*tau_aero_sw_rrtm(:,:,1,band) + & |
---|
362 | cg_aer_strat(:,:,band)*piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band) ) / & |
---|
363 | MAX( piz_aero_sw_rrtm(:,:,1,band)*tau_aero_sw_rrtm(:,:,1,band) + & |
---|
364 | piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band), 1.e-15 ) |
---|
365 | piz_aero_sw_rrtm(:,:,1,band) = ( piz_aero_sw_rrtm(:,:,1,band)*tau_aero_sw_rrtm(:,:,1,band) + & |
---|
366 | piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band) ) / & |
---|
367 | MAX( tau_aero_sw_rrtm(:,:,1,band) + tau_aer_strat(:,:,band), 1.e-15 ) |
---|
368 | tau_aero_sw_rrtm(:,:,1,band) = tau_aero_sw_rrtm(:,:,1,band) + tau_aer_strat(:,:,band) |
---|
369 | ENDWHERE |
---|
370 | ENDDO |
---|
371 | ! |
---|
372 | ELSE |
---|
373 | ! |
---|
374 | !--this is the VOLMIP case |
---|
375 | !--stratospheric aerosols are only added to index 2 in this case |
---|
376 | !--weighted average for cg, piz and tau, adding strat aerosols on top of tropospheric ones |
---|
377 | DO band=1, NSW |
---|
378 | WHERE (stratomask.GT.0.999999) |
---|
379 | !--strat aerosols are added to index 2 : natural and anthropogenic aerosols for bands 1 to NSW |
---|
380 | cg_aero_sw_rrtm(:,:,2,band) = ( cg_aero_sw_rrtm(:,:,2,band)*piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) + & |
---|
381 | cg_aer_strat(:,:,band)*piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band) ) / & |
---|
382 | MAX( piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) + & |
---|
383 | piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band), 1.e-15 ) |
---|
384 | piz_aero_sw_rrtm(:,:,2,band) = ( piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) + & |
---|
385 | piz_aer_strat(:,:,band)*tau_aer_strat(:,:,band) ) / & |
---|
386 | MAX( tau_aero_sw_rrtm(:,:,2,band) + tau_aer_strat(:,:,band), 1.e-15 ) |
---|
387 | tau_aero_sw_rrtm(:,:,2,band) = tau_aero_sw_rrtm(:,:,2,band) + tau_aer_strat(:,:,band) |
---|
388 | ENDWHERE |
---|
389 | ENDDO |
---|
390 | ENDIF |
---|
391 | |
---|
392 | !--total vertical aod at 10 um |
---|
393 | !--this is approximated from band 7 of RRTM |
---|
394 | band=7 |
---|
395 | DO i=1, klon |
---|
396 | DO k=1, klev |
---|
397 | IF (stratomask(i,k).GT.0.999999) THEN |
---|
398 | DO wave=1, nwave_lw |
---|
399 | tausum_aero(i,nwave_sw+wave,id_STRAT_phy)=tausum_aero(i,nwave_sw+wave,id_STRAT_phy)+taulw_aer_strat(i,k,band) |
---|
400 | ENDDO |
---|
401 | ENDIF |
---|
402 | ENDDO |
---|
403 | ENDDO |
---|
404 | |
---|
405 | IF (.NOT. ok_volcan) THEN |
---|
406 | !--this is the default case |
---|
407 | !--stratospheric aerosols are added to both index 2 and 1 |
---|
408 | DO band=1, NLW |
---|
409 | WHERE (stratomask.GT.0.999999) |
---|
410 | tau_aero_lw_rrtm(:,:,2,band) = tau_aero_lw_rrtm(:,:,2,band) + taulw_aer_strat(:,:,band) |
---|
411 | tau_aero_lw_rrtm(:,:,1,band) = tau_aero_lw_rrtm(:,:,1,band) + taulw_aer_strat(:,:,band) |
---|
412 | ENDWHERE |
---|
413 | ENDDO |
---|
414 | ! |
---|
415 | ELSE |
---|
416 | ! |
---|
417 | !--this is the VOLMIP case |
---|
418 | DO band=1, NLW |
---|
419 | !--stratospheric aerosols are not added to index 1 |
---|
420 | !--and we copy index 2 in index 1 because we want the same dust aerosol LW properties as above |
---|
421 | tau_aero_lw_rrtm(:,:,1,band) = tau_aero_lw_rrtm(:,:,2,band) |
---|
422 | ! |
---|
423 | WHERE (stratomask.GT.0.999999) |
---|
424 | !--stratospheric aerosols are only added to index 2 |
---|
425 | tau_aero_lw_rrtm(:,:,2,band) = tau_aero_lw_rrtm(:,:,2,band) + taulw_aer_strat(:,:,band) |
---|
426 | ENDWHERE |
---|
427 | ENDDO |
---|
428 | ENDIF |
---|
429 | |
---|
430 | !--default SSA value if there is no aerosol |
---|
431 | !--to avoid 0 values that seems to cause some problem to RRTM |
---|
432 | WHERE (tau_aero_sw_rrtm.LT.1.e-14) |
---|
433 | piz_aero_sw_rrtm = 1.0 |
---|
434 | ENDWHERE |
---|
435 | |
---|
436 | !--in principle this should not be necessary |
---|
437 | !--as these variables have min values already but just in case |
---|
438 | !--put 1e-15 min value to both SW and LW AOD |
---|
439 | tau_aero_sw_rrtm = MAX(tau_aero_sw_rrtm,1.e-15) |
---|
440 | tau_aero_lw_rrtm = MAX(tau_aero_lw_rrtm,1.e-15) |
---|
441 | |
---|
442 | END SUBROUTINE readaerosolstrato2_rrtm |
---|