source: LMDZ6/trunk/libf/phylmd/StratAer/strataer_emiss_mod.F90 @ 4666

Last change on this file since 4666 was 4625, checked in by dcugnet, 16 months ago

StratAer? commit, N. Lebas

File size: 10.7 KB
Line 
1MODULE strataer_emiss_mod
2! This module contains information about strato microphysic model emission parameters
3 
4CONTAINS
5   
6  SUBROUTINE strataer_emiss_init()
7   
8    USE strataer_local_var_mod
9    USE ioipsl_getin_p_mod, ONLY : getin_p
10    USE print_control_mod, ONLY : lunout
11    USE mod_phys_lmdz_para, ONLY : is_master
12   
13    ! Local variables
14    INTEGER                  :: ispec
15   
16    WRITE(lunout,*) 'IN STRATAER_EMISS INIT WELCOME!'
17   
18    IF (flag_emit.EQ.1 .OR. flag_emit.EQ.4) THEN ! Volcano
19       CALL getin_p('nErupt',nErupt) !eruption nb
20       CALL getin_p('injdur',injdur) !injection duration
21       
22       IF (flag_emit==1) THEN
23          CALL getin_p('nAerErupt', nAerErupt) !sulfur aer nb
24       ELSEIF (flag_emit==4) THEN
25          CALL getin_p('nSpeciesErupt', nSpeciesErupt) !chimical species nb
26       ENDIF
27       
28       IF (nErupt.GT.0) THEN
29          ALLOCATE(year_emit_vol(nErupt),mth_emit_vol(nErupt),day_emit_vol(nErupt))
30          ALLOCATE(altemiss_vol(nErupt),sigma_alt_vol(nErupt))
31          ALLOCATE(xlat_min_vol(nErupt),xlon_min_vol(nErupt))
32          ALLOCATE(xlat_max_vol(nErupt),xlon_max_vol(nErupt))
33          IF (flag_emit==1) THEN
34             ALLOCATE(m_sulf_emiss_vol(nErupt))
35             ALLOCATE(m_aer_emiss_vol(nErupt,nAerErupt))
36             IF (ok_qemiss) then
37                ALLOCATE(m_H2O_emiss_vol(nErupt))
38                ALLOCATE(m_H2O_emiss_vol_daily(nErupt))
39!                ALLOCATE(d_q_emiss(klon,klev))
40                ALLOCATE(budg_emi(klon,nAerErupt+1))
41                m_H2O_emiss_vol(:)=0.
42                m_H2O_emiss_vol_daily(:)=0.
43!                d_q_emiss(:,:)=0.
44             ELSE
45                ALLOCATE(budg_emi(klon,nAerErupt))
46             ENDIF
47             budg_emi(:,:)=0.
48          ELSEIF (flag_emit==4) THEN
49             ALLOCATE(m_Chlore_emiss_vol(nErupt))
50             ALLOCATE(id_HCl)
51             ALLOCATE(m_Brome_emiss_vol(nErupt))
52             ALLOCATE(id_HBr)
53             ALLOCATE(id_species(nSpeciesErupt))
54             ALLOCATE(m_species_emiss_vol(nErupt,nSpeciesErupt))
55             ALLOCATE(m_NOx_emiss_vol(nErupt))
56             ALLOCATE(m_H2O_emiss_vol(nErupt))
57             ALLOCATE(id_NOx)
58             ALLOCATE(id_H2O)
59             ALLOCATE(budg_emi(klon,nSpeciesErupt))
60             budg_emi(:,:)=0.
61          ENDIF
62       ELSE
63          WRITE(lunout,*) 'ERROR : Using flag_emit=1 or 4 (ie Volcanic eruption) but nErupt (',nErupt,') <=0 !'
64          CALL abort_physic('strataer_emiss_mod', &
65               'No eruption define in physiq_def (nErupt=0). Add at one eruption or use background condition.',1)
66       ENDIF ! fin if nerupt
67       
68       ! injection params (dates, loc, injections params)
69       CALL getin_p('year_emit_vol',year_emit_vol)
70       CALL getin_p('mth_emit_vol',mth_emit_vol)
71       CALL getin_p('day_emit_vol',day_emit_vol)
72       CALL getin_p('altemiss_vol',altemiss_vol)
73       CALL getin_p('sigma_alt_vol',sigma_alt_vol)
74       CALL getin_p('xlon_min_vol',xlon_min_vol)
75       CALL getin_p('xlon_max_vol',xlon_max_vol)
76       CALL getin_p('xlat_min_vol',xlat_min_vol)
77       CALL getin_p('xlat_max_vol',xlat_max_vol)
78       IF (flag_emit==1) THEN
79          CALL getin_p('m_sulf_emiss_vol',m_sulf_emiss_vol)
80        if (ok_qemiss) then
81         CALL getin_p('m_H2O_emiss_vol',m_H2O_emiss_vol)
82        endif
83       ELSEIF (flag_emit==4) THEN
84          CALL getin_p('id_species',id_species)
85          CALL getin_p('m_Chlore_emiss_vol',m_Chlore_emiss_vol) 
86          CALL getin_p('id_HCl',id_HCl)
87          CALL getin_p('m_Brome_emiss_vol',m_Brome_emiss_vol)
88          CALL getin_p('id_HBr',id_HBr)
89          CALL getin_p('m_NOx_emiss_vol',m_NOx_emiss_vol)
90          CALL getin_p('id_NOx',id_NOx)
91          CALL getin_p('m_H2O_emiss_vol',m_H2O_emiss_vol)
92          CALL getin_p('id_H2O',id_H2O)
93       ENDIF
94       
95    ELSEIF (flag_emit == 2) THEN ! SAI
96       CALL getin_p('m_aer_emiss_sai',m_aer_emiss_sai)
97       CALL getin_p('altemiss_sai',altemiss_sai)
98       CALL getin_p('sigma_alt_sai',sigma_alt_sai)
99       CALL getin_p('xlat_sai',xlat_sai)
100       CALL getin_p('xlon_sai',xlon_sai)
101       CALL getin_p('year_emit_sai_start',year_emit_sai_start)
102       CALL getin_p('year_emit_sai_end',year_emit_sai_end)
103       CALL getin_p('mth_emit_sai_start',mth_emit_sai_start)
104       CALL getin_p('mth_emit_sai_end',mth_emit_sai_end)
105       CALL getin_p('day_emit_sai_start',day_emit_sai_start)
106       CALL getin_p('day_emit_sai_end',day_emit_sai_end)
107       
108    ELSEIF (flag_emit == 3) THEN ! SAI between latitudes
109       CALL getin_p('m_aer_emiss_sai',m_aer_emiss_sai)
110       CALL getin_p('altemiss_sai',altemiss_sai)
111       CALL getin_p('sigma_alt_sai',sigma_alt_sai)
112       CALL getin_p('xlon_sai',xlon_sai)
113       CALL getin_p('xlat_max_sai',xlat_max_sai)
114       CALL getin_p('xlat_min_sai',xlat_min_sai)
115    ENDIF
116   
117    IF (flag_emit == 1) THEN
118       DO ispec=1,nAerErupt
119          m_aer_emiss_vol(:,ispec) = m_sulf_emiss_vol(:)
120       ENDDO
121    ELSEIF (flag_emit== 4) THEN
122       DO ispec=1,nSpeciesErupt
123          IF(id_species(ispec) == id_HCl) THEN
124             m_species_emiss_vol(:,ispec) = m_Chlore_emiss_vol(:)
125          ENDIF
126          IF (id_species(ispec) == id_HBr) THEN
127             m_species_emiss_vol(:,ispec) = m_Brome_emiss_vol(:)
128          ENDIF
129          IF (id_species(ispec) == id_NOx) THEN
130             m_species_emiss_vol(:,ispec) = m_NOx_emiss_vol(:)
131          ENDIF
132          IF (id_species(ispec) == id_H2O) THEN
133             m_species_emiss_vol(:,ispec) = m_H2O_emiss_vol(:)
134          ENDIF
135       ENDDO
136    ENDIF
137   
138    !============= Injection ponderation =============
139    IF (flag_emit > 0) THEN
140       CALL strataer_ponde_init
141       WRITE(lunout,*) 'IN STRATAER INIT : ponde_lonlat_vol',ponde_lonlat_vol
142    ENDIF
143   
144    !============= Print params =============
145    IF (is_master) THEN
146       IF (flag_emit == 1 .OR. flag_emit == 4) THEN
147          WRITE(lunout,*) 'IN STRATAER nErupt: ',nErupt
148          WRITE(lunout,*) 'IN STRATAER injdur: ',injdur
149          WRITE(lunout,*) 'IN STRATAER nAerErupt: ',nAerErupt
150         
151          WRITE(lunout,*) 'IN STRATAER : year_emit_vol',year_emit_vol
152          WRITE(lunout,*) 'IN STRATAER : mth_emit_vol',mth_emit_vol
153          WRITE(lunout,*) 'IN STRATAER : day_emit_vol',day_emit_vol
154          WRITE(lunout,*) 'IN STRATAER : altemiss_vol',altemiss_vol
155          WRITE(lunout,*) 'IN STRATAER : sigma_alt_vol',sigma_alt_vol
156          WRITE(lunout,*) 'IN STRATAER : xlat_min_vol',xlat_min_vol
157          WRITE(lunout,*) 'IN STRATAER : xlat_max_vol',xlat_max_vol
158          WRITE(lunout,*) 'IN STRATAER : xlon_min_vol',xlon_min_vol
159          WRITE(lunout,*) 'IN STRATAER : xlon_max_vol',xlon_max_vol
160          IF (flag_emit==1) THEN
161             WRITE(lunout,*) 'IN STRATAEREMISS : m_sulf_emiss_vol',m_sulf_emiss_vol
162             WRITE(lunout,*) 'IN STRATAER : m_aer_emiss_vol',m_aer_emiss_vol
163             IF (ok_qemiss) then
164                WRITE(lunout,*) 'IN STRATAEREMISS : m_H2O_emiss_vol',m_H2O_emiss_vol
165             ENDIF
166          ENDIF
167       ELSEIF (flag_emit == 2) THEN
168          WRITE(lunout,*) 'IN STRATAER : m_aer_emiss_sai',m_aer_emiss_sai
169          WRITE(lunout,*) 'IN STRATAER : altemiss_sai',altemiss_sai
170          WRITE(lunout,*) 'IN STRATAER : sigma_alt_sai',sigma_alt_sai
171          WRITE(lunout,*) 'IN STRATAER : xlat_sai',xlat_sai
172          WRITE(lunout,*) 'IN STRATAER : xlon_sai',xlon_sai
173       ELSEIF (flag_emit == 3) THEN
174          WRITE(lunout,*) 'IN STRATAER : m_aer_emiss_sai',m_aer_emiss_sai
175          WRITE(lunout,*) 'IN STRATAER : altemiss_sai',altemiss_sai
176          WRITE(lunout,*) 'IN STRATAER : sigma_alt_sai',sigma_alt_sai
177          WRITE(lunout,*) 'IN STRATAER : year_emit_sai start/end',year_emit_sai_start,year_emit_sai_end
178          WRITE(lunout,*) 'IN STRATAER : mth_emit_sai start/end',mth_emit_sai_start,mth_emit_sai_end
179          WRITE(lunout,*) 'IN STRATAER : day_emit_sai start/end',day_emit_sai_start,day_emit_sai_end
180          WRITE(lunout,*) 'IN STRATAER : xlat_min_sai',xlat_min_sai
181          WRITE(lunout,*) 'IN STRATAER : xlat_max_sai',xlat_max_sai
182          WRITE(lunout,*) 'IN STRATAER : xlon_sai',xlon_sai
183       ENDIF
184       IF(flag_emit == 4) THEN
185          WRITE(lunout,*) 'IN STRATAER : nSpeciesErupt: ',nSpeciesErupt
186          WRITE(lunout,*) 'IN STRATAER : id_species = ',id_species
187          WRITE(lunout,*) 'IN STRATAER : id_HCl = ',id_HCl
188          WRITE(lunout,*) 'IN STRATAER : id_HBr = ',id_HBr
189          WRITE(lunout,*) 'IN STRATAER : id_NOx = ',id_NOx
190          WRITE(lunout,*) 'IN STRATAER : id_H2O = ',id_H2O
191          WRITE(lunout,*) 'IN STRATAER : m_Chlore_emiss_vol = ',m_Chlore_emiss_vol
192          WRITE(lunout,*) 'IN STRATAER : m_Brome_emiss_vol = ',m_Brome_emiss_vol
193          WRITE(lunout,*) 'IN STRATAER : m_NOx_emiss_vol = ',m_NOx_emiss_vol
194          WRITE(lunout,*) 'IN STRATAER : m_H2O_emiss_vol = ',m_H2O_emiss_vol
195       ENDIF
196    ENDIF ! if master
197   
198    WRITE(lunout,*) 'IN STRATAER_EMISS END'
199  END SUBROUTINE strataer_emiss_init
200 
201  ! Compute the ponderation to applicate in each grid point for all eruptions and init
202  ! dlat & dlon variables
203  SUBROUTINE strataer_ponde_init()
204   
205    USE regular_lonlat_mod, ONLY: lon_reg, lat_reg
206    USE dimphy, ONLY: klon
207    USE mod_grid_phy_lmdz, ONLY: nbp_lat, nbp_lon
208    USE print_control_mod, ONLY : lunout
209    USE strataer_local_var_mod
210   
211    INCLUDE "YOMCST.h"  !--RPI
212   
213    ! local var
214    REAL                :: lat_reg_deg,lon_reg_deg ! lat and lon of grid points in degree
215    INTEGER             :: ieru, i, j
216   
217    ALLOCATE(ponde_lonlat_vol(nErupt))
218   
219    !Compute lon/lat ponderation for injection
220    dlat=180./2./FLOAT(nbp_lat)   ! d latitude in degree
221    dlon=360./2./FLOAT(nbp_lon)   ! d longitude in degree
222    WRITE(lunout,*) 'IN STRATAER_INIT dlat=',dlat,'dlon=',dlon
223    WRITE(lunout,*) 'IN STRATAER_INIT nErupt=',nErupt
224    WRITE(lunout,*) 'IN STRATAER_INIT xlat_min=',xlat_min_vol,'xlat_max=',xlat_max_vol
225    WRITE(lunout,*) 'IN STRATAER_INIT xlon_min=',xlon_min_vol,'xlon_max=',xlon_max_vol
226   
227    DO ieru=1, nErupt
228       ponde_lonlat_vol(ieru) = 0
229       DO i=1,nbp_lon
230          lon_reg_deg = lon_reg(i)*180./RPI
231          DO j=1,nbp_lat
232             lat_reg_deg = lat_reg(j)*180./RPI
233             IF  ( lat_reg_deg.GE.xlat_min_vol(ieru)-dlat .AND. lat_reg_deg.LT.xlat_max_vol(ieru)+dlat .AND. &
234                  lon_reg_deg.GE.xlon_min_vol(ieru)-dlon .AND. lon_reg_deg.LT.xlon_max_vol(ieru)+dlon ) THEN
235                ponde_lonlat_vol(ieru) = ponde_lonlat_vol(ieru) + 1
236             ENDIF
237          ENDDO
238       ENDDO
239       IF(ponde_lonlat_vol(ieru) == 0) THEN
240          WRITE(lunout,*) 'STRATAER_INIT ERROR: no grid point found for eruption ieru=',ieru
241       ENDIF
242    ENDDO !ieru
243   
244    WRITE(lunout,*) 'IN STRATAER_PONDE_INIT ponde_lonlat: ', ponde_lonlat_vol
245   
246  END SUBROUTINE strataer_ponde_init
247 
248END MODULE strataer_emiss_mod
Note: See TracBrowser for help on using the repository browser.