source: LMDZ5/trunk/libf/phylmd/rrtm/readaerosolstrato_rrtm.F90 @ 2152

Last change on this file since 2152 was 2152, checked in by fhourdin, 10 years ago

Corrections cosmétiques pour RRTM
Bug fixing for RRTM

  • 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: 8.8 KB
Line 
1!
2! $Id: readaerosolstrato_rrtm.F90 2152 2014-11-19 16:52:35Z fhourdin $
3!
4subroutine readaerosolstrato_rrtm(debut)
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
12    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
13    USE mod_phys_lmdz_para
14    USE phys_state_var_mod
15    USE phys_local_var_mod
16    USE aero_mod
17    USE dimphy
18    USE YOERAD   , ONLY : NLW
19
20    implicit none
21
22    include "YOMCST.h"
23    include "dimensions.h"
24
25! Variable input
26    logical debut
27
28! Variables locales
29    integer n_lat   ! number of latitudes in the input data
30    integer n_lon   ! number of longitudes in the input data
31    integer n_lev   ! number of levels in the input data
32    integer n_month ! number of months in the input data
33    real, pointer:: latitude(:)
34    real, pointer:: longitude(:)
35    real, pointer:: time(:)
36    real, pointer:: lev(:)
37    integer k, band, wave, i
38    integer, save :: mth_pre
39
40    real, allocatable, dimension(:,:), save :: tau_aer_strat
41!$OMP THREADPRIVATE(tau_aer_strat)
42
43! Champs reconstitues
44    real, allocatable:: tauaerstrat(:, :, :, :)
45    real, allocatable:: tauaerstrat_mois(:, :, :)
46    real, allocatable:: tauaerstrat_mois_glo(:, :)
47    real, allocatable:: tauaerstrat_mois_glo_bands(:,:,:)
48
49    real, allocatable:: sum_tau_aer_strat(:)
50
51! For NetCDF:
52    integer ncid_in  ! IDs for input files
53    integer varid, ncerr
54
55! Stratospheric aerosols optical properties
56! alpha_sw_strat over the 6 bands is normalised by the 550 nm extinction coefficient
57    real, dimension(nbands_sw_rrtm) :: alpha_sw_strat, piz_sw_strat, cg_sw_strat
58    data alpha_sw_strat/0.8545564, 0.8451642, 0.9821724, 0.8145110, 0.3073565, 7.7966176E-02/
59    data cg_sw_strat   /0.6997170, 0.6810035, 0.7403592, 0.7562674, 0.6676504, 0.3478689/
60    data piz_sw_strat  /0.9999998, 0.9999998, 1.000000000, 0.9999958, 0.9977155, 0.4510679/
61!
62!--diagnostics AOD in the SW
63! alpha_sw_strat_wave is *not* normalised by the 550 nm extinction coefficient
64    real, dimension(nwave) :: alpha_sw_strat_wave
65    data alpha_sw_strat_wave/3.708007,4.125824,4.136584,3.887478,3.507738/
66!
67!--diagnostics AOD in the LW at 10 um
68    real :: alpha_lw_strat_wave
69    data alpha_lw_strat_wave/0.2746812/
70!
71    real, dimension(nbands_lw_rrtm) :: alpha_lw_abs_rrtm
72    data alpha_lw_abs_rrtm/   8.8340312E-02, 6.9856711E-02, 6.2652975E-02, 5.7188231E-02, &
73                              6.3157059E-02, 5.5072524E-02, 5.0571125E-02, 0.1349073, &   
74                              0.1381676, 9.6506312E-02, 5.1312990E-02, 2.4256418E-02, &
75                              2.7191756E-02, 3.3862915E-02, 1.6132960E-02, 1.4275438E-02/ ! calculated with Mie_SW_LW_RRTM_V2.4 (bimodal, corrected)
76                                                                                          ! for r_0=/0.13E-6, 0.41E-6/ m, sigma_g=/1.26, 1.30/
77                                                                                          ! order: increasing wavelength!
78!--------------------------------------------------------
79
80    IF (.not.ALLOCATED(tau_aer_strat)) ALLOCATE(tau_aer_strat(klon,klev))
81    IF (.not.ALLOCATED(sum_tau_aer_strat)) ALLOCATE(sum_tau_aer_strat(klon))
82
83    IF (is_mpi_root) THEN
84
85    IF (debut.OR.mth_cur.NE.mth_pre) THEN
86
87    IF (nbands_sw_rrtm.NE.6) THEN
88        print *,'nbands_sw_rrtm doit etre egal a 6 dans readaerosolstrat_rrtm'
89        STOP
90    ENDIF
91
92    CALL nf95_open("taustrat.nc", nf90_nowrite, ncid_in)
93
94    CALL nf95_inq_varid(ncid_in, "LEV", varid)
95    CALL nf95_gw_var(ncid_in, varid, lev)
96    n_lev = size(lev)
97    IF (n_lev.NE.klev) THEN
98       print *,'Le nombre de niveaux n est pas egal a klev'
99       STOP
100    ENDIF
101
102    CALL nf95_inq_varid(ncid_in, "LAT", varid)
103    CALL nf95_gw_var(ncid_in, varid, latitude)
104    n_lat = size(latitude)
105    print *, 'LAT aerosol strato=', n_lat, latitude
106    IF (n_lat.NE.jjm+1) THEN
107       print *,'Le nombre de lat n est pas egal a jjm+1'
108       STOP
109    ENDIF
110
111    CALL nf95_inq_varid(ncid_in, "LON", varid)
112    CALL nf95_gw_var(ncid_in, varid, longitude)
113    n_lon = size(longitude)
114    print *, 'LON aerosol strato=', n_lon, longitude
115    IF (n_lon.NE.iim) THEN
116       print *,'Le nombre de lon n est pas egal a iim'
117       STOP
118    ENDIF
119
120    CALL nf95_inq_varid(ncid_in, "TIME", varid)
121    CALL nf95_gw_var(ncid_in, varid, time)
122    n_month = size(time)
123    print *, 'TIME aerosol strato=', n_month, time
124    IF (n_month.NE.12) THEN
125       print *,'Le nombre de month n est pas egal a 12'
126       STOP
127    ENDIF
128
129    ALLOCATE(tauaerstrat(n_lon, n_lat, n_lev, n_month))
130    ALLOCATE(tauaerstrat_mois(n_lon, n_lat, n_lev))
131    ALLOCATE(tauaerstrat_mois_glo(klon_glo, n_lev))
132    ALLOCATE(tauaerstrat_mois_glo_bands(klon_glo, n_lev,nbands_sw_rrtm))
133
134!--reading stratospheric AOD at 550 nm
135    CALL nf95_inq_varid(ncid_in, "TAUSTRAT", varid)
136    ncerr = nf90_get_var(ncid_in, varid, tauaerstrat)
137    print *,'code erreur readaerosolstrato=', ncerr, varid
138
139    CALL nf95_close(ncid_in)
140
141!---select the correct month
142    IF (mth_cur.LT.1.OR.mth_cur.GT.12) THEN
143      print *,'probleme avec le mois dans readaerosolstrat =', mth_cur
144    ENDIF
145    tauaerstrat_mois(:,:,:) = tauaerstrat(:,:,:,mth_cur)
146
147!---reduce to a klon_glo grid
148    CALL grid2dTo1d_glo(tauaerstrat_mois,tauaerstrat_mois_glo)
149
150    ENDIF !--is_mpi_root
151
152!--keep memory of previous month
153    mth_pre=mth_cur
154
155!--scatter on all proc
156    CALL scatter(tauaerstrat_mois_glo,tau_aer_strat)
157
158    IF (is_mpi_root) THEN
159!
160    DEALLOCATE(tauaerstrat)
161    DEALLOCATE(tauaerstrat_mois)
162    DEALLOCATE(tauaerstrat_mois_glo)
163!
164    ENDIF !--is_mpi_root
165
166    ENDIF !--debut ou nouveau mois
167
168!--total vertical aod at the 5 SW wavelengths
169    DO wave=1, nwave
170    DO k=1, klev
171    tausum_aero(:,wave,id_STRAT_phy)=tausum_aero(:,wave,id_STRAT_phy)+ &
172    tau_aer_strat(:,k)*alpha_sw_strat_wave(wave)/alpha_sw_strat_wave(2)
173    ENDDO
174    ENDDO
175
176!--weighted average for cg, piz and tau, adding strat aerosols on top of tropospheric ones
177    DO band=1, nbands_sw_rrtm
178!--anthropogenic aerosols bands 1 to nbands_sw_rrtm
179    cg_aero_sw_rrtm(:,:,2,band)  = ( cg_aero_sw_rrtm(:,:,2,band)*piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) + &
180                                  cg_sw_strat(band)*piz_sw_strat(band)*alpha_sw_strat(band)*tau_aer_strat(:,:) ) /           &
181                             MAX( piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) +                                &
182                                  piz_sw_strat(band)*alpha_sw_strat(band)*tau_aer_strat(:,:), 1.e-15 )
183    piz_aero_sw_rrtm(:,:,2,band)  = ( piz_aero_sw_rrtm(:,:,2,band)*tau_aero_sw_rrtm(:,:,2,band) +                            &
184                              piz_sw_strat(band)*alpha_sw_strat(band)*tau_aer_strat(:,:) ) /                                 &
185                              MAX( tau_aero_sw_rrtm(:,:,2,band) + alpha_sw_strat(band)*tau_aer_strat(:,:), 1.e-15 )
186    tau_aero_sw_rrtm(:,:,2,band)  = tau_aero_sw_rrtm(:,:,2,band) + alpha_sw_strat(band)*tau_aer_strat(:,:)
187!--natural aerosols bands 1 to nbands_sw_rrtm
188    cg_aero_sw_rrtm(:,:,1,band)  = ( cg_aero_sw_rrtm(:,:,1,band)*piz_aero_sw_rrtm(:,:,1,band)*tau_aero_sw_rrtm(:,:,1,band) + &
189                             cg_sw_strat(band)*piz_sw_strat(band)*alpha_sw_strat(band)*tau_aer_strat(:,:) ) /                &
190                             MAX( piz_aero_sw_rrtm(:,:,1,band)*tau_aero_sw_rrtm(:,:,1,band) +                                &
191                                  piz_sw_strat(band)*alpha_sw_strat(band)*tau_aer_strat(:,:), 1.e-15 )
192    piz_aero_sw_rrtm(:,:,1,band)  = ( piz_aero_sw_rrtm(:,:,1,band)*tau_aero_sw_rrtm(:,:,1,band) +                            &
193                              piz_sw_strat(band)*alpha_sw_strat(band)*tau_aer_strat(:,:) ) /                                 &
194                              MAX( tau_aero_sw_rrtm(:,:,1,band) + alpha_sw_strat(band)*tau_aer_strat(:,:),1.e-15 )
195    tau_aero_sw_rrtm(:,:,1,band)  = tau_aero_sw_rrtm(:,:,1,band) + alpha_sw_strat(band)*tau_aer_strat(:,:)
196!--no stratospheric aerosol in index 1 for these tests
197!    cg_aero_sw_rrtm(:,:,1,band)  =  cg_aero_sw_rrtm(:,:,1,band)
198!    piz_aero_sw_rrtm(:,:,1,band)  = piz_aero_sw_rrtm(:,:,1,band)
199!    tau_aero_sw_rrtm(:,:,1,band)  = tau_aero_sw_rrtm(:,:,1,band)
200    ENDDO
201
202!--stratospheric AOD in LW
203    IF (nbands_lw_rrtm .NE. NLW) then
204      print*, 'different values for NLW (=',NLW,') and nbands_lw_rrtm (=', nbands_lw_rrtm, ')'
205      STOP
206    ENDIF
207
208    DO band=1, nbands_lw_rrtm
209    tau_aero_lw_rrtm(:,:,2,band)  = tau_aero_lw_rrtm(:,:,2,band) + alpha_lw_abs_rrtm(band)*tau_aer_strat(:,:)
210    tau_aero_lw_rrtm(:,:,1,band)  = tau_aero_lw_rrtm(:,:,1,band) + alpha_lw_abs_rrtm(band)*tau_aer_strat(:,:)
211!--no stratospheric aerosols in index 1 for these tests
212!    tau_aero_lw_rrtm(:,:,1,band)  = tau_aero_lw_rrtm(:,:,1,band)
213    ENDDO
214
215end subroutine readaerosolstrato_rrtm
Note: See TracBrowser for help on using the repository browser.