1 | subroutine inichim_newstart(pq,ps,sig,nq,latfi,lonfi,airefi, |
---|
2 | $ thermo) |
---|
3 | |
---|
4 | implicit none |
---|
5 | |
---|
6 | c======================================================================= |
---|
7 | c |
---|
8 | c subject: |
---|
9 | c -------- |
---|
10 | c |
---|
11 | c Initialization of the composition for use in the building of a new start file |
---|
12 | c using newstart.F |
---|
13 | c |
---|
14 | c Author: Sebastien Lebonnois (08/11/2002) |
---|
15 | c ------- |
---|
16 | c Revised 07/2003 by Monica Angelats-i-Coll to use input files |
---|
17 | c |
---|
18 | c Arguments: |
---|
19 | c ---------- |
---|
20 | c |
---|
21 | c pq(iip1,jjp1,llm,nqmx) Advected fields, ie chemical species here |
---|
22 | c sig = sigma vertical coordinate (interface of layers) |
---|
23 | c nq: permet de ne pas modifier l'eau (et la glace d'eau si iceparty) |
---|
24 | c |
---|
25 | c======================================================================= |
---|
26 | |
---|
27 | c Declarations : |
---|
28 | c -------------- |
---|
29 | |
---|
30 | #include "dimensions.h" |
---|
31 | #include "dimphys.h" |
---|
32 | #include "paramet.h" |
---|
33 | #include "chimiedata.h" |
---|
34 | #include "tracer.h" |
---|
35 | #include "comcstfi.h" |
---|
36 | #include "comdiurn.h" |
---|
37 | #include "callkeys.h" |
---|
38 | #include "temps.h" |
---|
39 | #include "datafile.h" |
---|
40 | |
---|
41 | c Arguments : |
---|
42 | c ----------- |
---|
43 | |
---|
44 | real ps(iip1,jjp1) |
---|
45 | real pq(iip1,jjp1,llm,nqmx) ! Advected fields, ie chemical species |
---|
46 | real sig(llm+1) ! vertical coordinate (interface of layers) |
---|
47 | integer nq ! =nqmx |
---|
48 | ! or =nqmx-1 if H2O kept |
---|
49 | ! or =nqmx-2 if H2O and ice kept |
---|
50 | REAL latfi(ngridmx),lonfi(ngridmx),airefi(ngridmx) |
---|
51 | integer thermo ! flag for thermosphere initialisation only |
---|
52 | |
---|
53 | c Local variables : |
---|
54 | c ----------------- |
---|
55 | |
---|
56 | integer iq,i,j,l,n, nspecini,inil,iqmax |
---|
57 | INTEGER aa(nqmx) |
---|
58 | REAL qtot(iip1,jjp1,llm) |
---|
59 | real densconc,zgcm,zfile(252),vmrint,nt, mmean |
---|
60 | real nxf(252),zfilemin(252),sigfile(252) |
---|
61 | real vmrf(252,14),nf(252,14) |
---|
62 | real tfile(252),zzfile(252) |
---|
63 | real ni(14),niold(14) |
---|
64 | real mmolf(14) ! molecular mass in amu (species in files) |
---|
65 | data mmolf/44.,40.,28.,32.,28.,16.,2., ! majors |
---|
66 | & 1.,17.,33.,18.,34.,16.,48./ ! minors |
---|
67 | character*3 tmp ! temporary variable |
---|
68 | integer ierr,lnblnk |
---|
69 | external lnblnk |
---|
70 | |
---|
71 | |
---|
72 | c----------------------------------------------------------------------- |
---|
73 | c Input/Output |
---|
74 | c ------------ |
---|
75 | |
---|
76 | call inichim_readcallphys() |
---|
77 | |
---|
78 | c Dimension test: |
---|
79 | c --------------- |
---|
80 | |
---|
81 | if (iceparty) then |
---|
82 | if ((nqchem_min+ncomp+1).ne.nqmx) then |
---|
83 | print*,'********* Dimension problem! ********' |
---|
84 | print*,"nqchem_min+ncomp+1).ne.nqmx" |
---|
85 | print*,"ncomp: ",ncomp |
---|
86 | print*,"nqchem_min: ",nqchem_min |
---|
87 | print*,"nqmx: ",nqmx |
---|
88 | print*,'Change ncomp in chimiedata.h' |
---|
89 | STOP |
---|
90 | endif |
---|
91 | else |
---|
92 | if ((nqchem_min+ncomp).ne.nqmx) then |
---|
93 | print*,'********* Dimension problem! ********' |
---|
94 | print*,"nqchem_min+ncomp).ne.nqmx" |
---|
95 | print*,"ncomp: ",ncomp |
---|
96 | print*,"nqchem_min: ",nqchem_min |
---|
97 | print*,"nqmx: ",nqmx |
---|
98 | print*,'Change ncomp in chimiedata.h' |
---|
99 | STOP |
---|
100 | endif |
---|
101 | endif |
---|
102 | |
---|
103 | c noms and mmol vectors: |
---|
104 | c ---------------------- |
---|
105 | |
---|
106 | if (iceparty) then |
---|
107 | do iq=nqchem_min,nqmx-2 |
---|
108 | noms(iq) = nomchem(iq-nqchem_min+1) |
---|
109 | mmol(iq) = mmolchem(iq-nqchem_min+1) |
---|
110 | enddo |
---|
111 | noms(nqmx-1) = 'ice' |
---|
112 | mmol(nqmx-1) = 18. |
---|
113 | noms(nqmx) = 'h2o' |
---|
114 | mmol(nqmx) = 18. |
---|
115 | else |
---|
116 | do iq=nqchem_min,nqmx-1 |
---|
117 | noms(iq) = nomchem(iq-nqchem_min+1) |
---|
118 | mmol(iq) = mmolchem(iq-nqchem_min+1) |
---|
119 | enddo |
---|
120 | noms(nqmx) = 'h2o' |
---|
121 | mmol(nqmx) = 18. |
---|
122 | endif |
---|
123 | if (nqchem_min.gt.1) then |
---|
124 | do iq=1,nqchem_min-1 |
---|
125 | noms(iq) = 'dust' |
---|
126 | mmol(iq) = 100. |
---|
127 | enddo |
---|
128 | endif |
---|
129 | |
---|
130 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
131 | c tracers numbering in the gcm |
---|
132 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
133 | c |
---|
134 | c co2 = nqchem_min |
---|
135 | c co = nqchem_min + 1 |
---|
136 | c o = nqchem_min + 2 |
---|
137 | c o(1d) = nqchem_min + 3 |
---|
138 | c o2 = nqchem_min + 4 |
---|
139 | c o3 = nqchem_min + 5 |
---|
140 | c h = nqchem_min + 6 |
---|
141 | c h2 = nqchem_min + 7 |
---|
142 | c oh = nqchem_min + 8 |
---|
143 | c ho2 = nqchem_min + 9 |
---|
144 | c h2o2 = nqchem_min + 10 |
---|
145 | c n2 = nqchem_min + 11 |
---|
146 | c ar = nqchem_min + 12 |
---|
147 | c h2o = nqmx |
---|
148 | c |
---|
149 | c---------------------------------------------------------------------- |
---|
150 | c Major species in files: |
---|
151 | c |
---|
152 | c 1=CO2 |
---|
153 | c 2=AR |
---|
154 | c 3=N2 |
---|
155 | c 4=O2 |
---|
156 | c 5=CO |
---|
157 | c 6=O |
---|
158 | c 7=H2 |
---|
159 | c |
---|
160 | c Minor species in files: |
---|
161 | c |
---|
162 | c 1=H |
---|
163 | c 2=OH |
---|
164 | c 3=HO2 |
---|
165 | c 4=H2O |
---|
166 | c 5=H2O2 |
---|
167 | c 6=O1D |
---|
168 | c 7=O3 |
---|
169 | c |
---|
170 | c---------------------------------------------------------------------- |
---|
171 | c Major species: |
---|
172 | aa(nqchem_min) = 1 |
---|
173 | aa(nqchem_min + 12) = 2 |
---|
174 | aa(nqchem_min + 11) = 3 |
---|
175 | aa(nqchem_min + 4) = 4 |
---|
176 | aa(nqchem_min + 1) = 5 |
---|
177 | aa(nqchem_min + 2) = 6 |
---|
178 | aa(nqchem_min + 7) = 7 |
---|
179 | c Minor species: |
---|
180 | aa(nqchem_min + 6) = 8 |
---|
181 | aa(nqchem_min + 8) = 9 |
---|
182 | aa(nqchem_min + 9) = 10 |
---|
183 | aa(nqmx) = 11 |
---|
184 | aa(nqchem_min + 10) = 12 |
---|
185 | aa(nqchem_min + 3) = 13 |
---|
186 | aa(nqchem_min + 5) = 14 |
---|
187 | c---------------------------------------------------------------------- |
---|
188 | open(210, iostat=ierr,file= |
---|
189 | & datafile(1:lnblnk(datafile))//'/atmosfera_LMD_may.dat') |
---|
190 | if (ierr.ne.0) then |
---|
191 | write(*,*)'Error : cannot open file atmosfera_LMD_may.dat ' |
---|
192 | write(*,*)'(in aeronomars/inichim.F)' |
---|
193 | write(*,*)'It should be in :', datafile(1:lnblnk(datafile)),'/' |
---|
194 | write(*,*)'1) You can change this directory address in ' |
---|
195 | write(*,*)' file phymars/datafile.h' |
---|
196 | write(*,*)'2) If necessary atmosfera_LMD_may.dat (and others)' |
---|
197 | write(*,*)' can be obtained online on:' |
---|
198 | write(*,*)' http://www.lmd.jussieu.fr/~forget/datagcm/datafile' |
---|
199 | STOP |
---|
200 | endif |
---|
201 | open(220, iostat=ierr,file= |
---|
202 | & datafile(1:lnblnk(datafile))//'/atmosfera_LMD_min.dat') |
---|
203 | if (ierr.ne.0) then |
---|
204 | write(*,*)'Error : cannot open file atmosfera_LMD_min.dat ' |
---|
205 | write(*,*)'(in aeronomars/inichim.F)' |
---|
206 | write(*,*)'It should be in :', datafile(1:lnblnk(datafile)),'/' |
---|
207 | write(*,*)'1) You can change this directory address in ' |
---|
208 | write(*,*)' file phymars/datafile.h' |
---|
209 | write(*,*)'2) If necessary atmosfera_LMD_min.dat (and others)' |
---|
210 | write(*,*)' can be obtained online on:' |
---|
211 | write(*,*)' http://www.lmd.jussieu.fr/~forget/datagcm/datafile' |
---|
212 | STOP |
---|
213 | endif |
---|
214 | |
---|
215 | read(210,*) tmp |
---|
216 | read(220,*) tmp |
---|
217 | do l=1,252 |
---|
218 | read(210,112) tfile(l),zfile(l),nxf(l),(vmrf(l,n),n=1,7) |
---|
219 | zfile(l)=zfile(l)*100. !pressure (Pa) |
---|
220 | sigfile(l)=zfile(l)/zfile(1) |
---|
221 | enddo |
---|
222 | do l=1,252 |
---|
223 | read(220,113)zfilemin(l),(vmrf(l,n),n=8,14) |
---|
224 | zfilemin(l)=zfilemin(l)*1000. !height (m) |
---|
225 | do n=1,14 |
---|
226 | nf(l,n)=vmrf(l,n)*nxf(l) |
---|
227 | enddo |
---|
228 | enddo |
---|
229 | close(210) |
---|
230 | close(220) |
---|
231 | c flag thermo set to 1 or 0 in newstart |
---|
232 | c inil=33 for initialisation of thermosphere only |
---|
233 | c inil=1 for initialisation of all layers |
---|
234 | if (thermo.eq.1) then |
---|
235 | inil=33 |
---|
236 | else |
---|
237 | inil=1 |
---|
238 | endif |
---|
239 | |
---|
240 | do i=1,iip1 |
---|
241 | do j=1,jjp1 |
---|
242 | do l=inil,llm |
---|
243 | |
---|
244 | c zgcm=sig(l) |
---|
245 | zgcm=sig(l)*ps(i,j) |
---|
246 | densconc=0. |
---|
247 | nt=0. |
---|
248 | |
---|
249 | do n=1,14 |
---|
250 | call intrplf(zgcm,vmrint,zfile,nf(1,n),252) |
---|
251 | c call intrplf(zgcm,vmrint,sigfile,nf(1,n),252) |
---|
252 | ni(n)=vmrint |
---|
253 | |
---|
254 | densconc=densconc+ni(n)*mmolf(n) |
---|
255 | nt=nt+ni(n) |
---|
256 | enddo |
---|
257 | |
---|
258 | mmean=densconc/nt ! in amu |
---|
259 | |
---|
260 | if (nq.ne.nqmx) then |
---|
261 | do n=nqchem_min,nq-1 |
---|
262 | pq(i,j,l,n)=ni(aa(n))/nt*mmol(n)/mmean |
---|
263 | if(i.eq.iip1) pq(i,j,l,n)=pq(1,j,l,n) |
---|
264 | enddo |
---|
265 | if (iceparty .and. nq.gt.nqmx-2) then |
---|
266 | pq(i,j,l,nq) = 0. |
---|
267 | if(i.eq.iip1) pq(i,j,l,nq)=pq(1,j,l,nq) |
---|
268 | else |
---|
269 | pq(i,j,l,nq)=ni(aa(nq))/nt*mmol(nq)/mmean |
---|
270 | if(i.eq.iip1) pq(i,j,l,nq)=pq(1,j,l,nq) |
---|
271 | endif |
---|
272 | endif |
---|
273 | if (nq.eq.nqmx) then |
---|
274 | do n=nqchem_min,nq-2 |
---|
275 | pq(i,j,l,n)=ni(aa(n))/nt*mmol(n)/mmean |
---|
276 | if(i.eq.iip1) pq(i,j,l,n)=pq(1,j,l,n) |
---|
277 | enddo |
---|
278 | if (iceparty) then |
---|
279 | pq(i,j,l,nq-1) = 0. |
---|
280 | if(i.eq.iip1) pq(i,j,l,nq-1)=pq(1,j,l,nq-1) |
---|
281 | pq(i,j,l,nq)=ni(aa(nq))/nt*mmol(nq)/mmean |
---|
282 | if(i.eq.iip1) pq(i,j,l,nq)=pq(1,j,l,nq) |
---|
283 | else |
---|
284 | do n=nq-1,nq |
---|
285 | pq(i,j,l,n)=ni(aa(n))/nt*mmol(n)/mmean |
---|
286 | if(i.eq.iip1) pq(i,j,l,n)=pq(1,j,l,n) |
---|
287 | enddo |
---|
288 | endif |
---|
289 | endif |
---|
290 | enddo !nlayer |
---|
291 | enddo !ngrid_j |
---|
292 | enddo !ngrid_i |
---|
293 | |
---|
294 | cccccccccccccccccccccccccccccc |
---|
295 | c make sure that sum of q = 1 |
---|
296 | c dominent species is = 1 - sum(all other species) |
---|
297 | cccccccccccccccccccccccccccccc |
---|
298 | iqmax=nqchem_min |
---|
299 | |
---|
300 | if ((nqmx-nqchem_min).gt.10) then |
---|
301 | do l=1,llm |
---|
302 | do j=1,jjp1 |
---|
303 | do i=1,iip1 |
---|
304 | do iq=nqchem_min,nqmx |
---|
305 | if ( (pq(i,j,l,iq).gt.pq(i,j,l,iqmax)).and. |
---|
306 | . (noms(iq).ne."ice") ) then |
---|
307 | iqmax=iq |
---|
308 | endif |
---|
309 | enddo |
---|
310 | pq(i,j,l,iqmax)=1. |
---|
311 | qtot(i,j,l)=0 |
---|
312 | do iq=nqchem_min,nqmx |
---|
313 | if ( (iq.ne.iqmax).and. |
---|
314 | . (noms(iq).ne."ice") ) then |
---|
315 | pq(i,j,l,iqmax)=pq(i,j,l,iqmax)-pq(i,j,l,iq) |
---|
316 | endif |
---|
317 | enddo !iq |
---|
318 | do iq=nqchem_min,nqmx |
---|
319 | if (noms(iq).ne."ice") then |
---|
320 | qtot(i,j,l)=qtot(i,j,l)+pq(i,j,l,iq) |
---|
321 | endif |
---|
322 | c if (i.eq.1.and.j.eq.1.and.l.eq.1) write(*,*) 'qtot(i,j,l)', |
---|
323 | c $ qtot(i,j,l) |
---|
324 | enddo !iq |
---|
325 | if (i.eq.1.and.j.eq.1) write(*,*) 'qtot(i,j,l)', |
---|
326 | $ qtot(i,j,l) |
---|
327 | enddo !i |
---|
328 | enddo !j |
---|
329 | enddo !l |
---|
330 | endif |
---|
331 | ccccccccccccccccccccccccccccccc |
---|
332 | |
---|
333 | 66 format(i2,6(1x,e11.5)) |
---|
334 | 112 format(7x,f7.3,3x,e12.6,3x,e12.6,7(3x,e12.6)) |
---|
335 | 113 format(1x,f6.2,7(3x,e12.6)) |
---|
336 | |
---|
337 | end |
---|