source: trunk/LMDZ.TITAN/libf/phytitan/initracer.F @ 1789

Last change on this file since 1789 was 1788, checked in by jvatant, 8 years ago

Get rid of all the old-generic dummy aerosol scheme ( just left scatterers_h for compilation )
as the new microphysics for Titan will be plugged in
-> even removed sedimentation ( will be done in the microphysical model )
--JVO

File size: 9.2 KB
Line 
1      SUBROUTINE initracer(ngrid,nq,nametrac)
2
3      use surfdat_h
4      USE tracer_h
5      IMPLICIT NONE
6c=======================================================================
7c   subject:
8c   --------
9c   Initialization related to tracer
10c   (chemical species, ice...)
11c
12c   Name of the tracer
13c
14c   Test of dimension :
15c   Initialize COMMON tracer in tracer.h, using tracer names provided
16c   by the argument nametrac
17c
18c   author: F.Forget
19c   ------
20c            Ehouarn Millour (oct. 2008) identify tracers by their names
21c            Jan Vatant d'Ollone (fev. 2017) chemical species for Titan
22c=======================================================================
23
24      integer :: ngrid,nq
25
26!      real qsurf(ngrid,nq)       ! tracer on surface (e.g.  kg.m-2)
27      character(len=20) :: txt ! to store some text
28      integer iq,ig,count
29!      logical :: oldnames ! =.true. if old tracer naming convention (q01,...)
30
31      character*20 nametrac(nq)   ! name of the tracer from dynamics
32
33
34c------------------------------------------------
35c  rho_q(nq)       ! tracer densities (kg.m-3)
36c------------------------------------------------
37       nqtot=nq
38       !! we allocate once for all arrays in common in tracer_h.F90
39       !! (supposedly those are not used before call to initracer)
40       IF (.NOT.ALLOCATED(noms)) ALLOCATE(noms(nq))
41       ALLOCATE(mmol(nq))
42       ALLOCATE(rho_q(nq))
43
44! Initialization: get tracer names from the dynamics and check if we are
45!                 using 'old' tracer convention ('q01',q02',...)
46!                 or new convention (full tracer names)
47      ! check if tracers have 'old' names
48
49! copy tracer names from dynamics
50        do iq=1,nq
51          noms(iq)=nametrac(iq)
52        enddo
53
54! Identify tracers by their names: (and set corresponding values of mmol)
55      ! 0. initialize tracer indexes to zero:
56      ! NB: igcm_* indexes are commons in 'tracer.h'
57     
58      igcm_h       =0
59      igcm_h2      =0
60      igcm_ch      =0
61      igcm_ch2s    =0
62      igcm_ch2     =0
63      igcm_ch3     =0
64      igcm_ch4     =0
65      igcm_c2      =0
66      igcm_c2h     =0
67      igcm_c2h2    =0
68      igcm_c2h3    =0
69      igcm_c2h4    =0
70      igcm_c2h5    =0
71      igcm_c2h6    =0
72      igcm_c3h3    =0
73      igcm_c3h5    =0
74      igcm_c3h6    =0
75      igcm_c3h7    =0
76      igcm_c4h     =0
77      igcm_c4h3    =0
78      igcm_c4h4    =0
79      igcm_c4h2s   =0
80      igcm_ch2cch2 =0
81      igcm_ch3cch  =0
82      igcm_c3h8    =0
83      igcm_c4h2    =0
84      igcm_c4h6    =0
85      igcm_c4h10   =0
86      igcm_ac6h6   =0
87      igcm_c3h2    =0
88      igcm_c4h5    =0
89      igcm_ac6h5   =0
90      igcm_n2      =0
91      igcm_n4s     =0
92      igcm_cn      =0
93      igcm_hcn     =0
94      igcm_h2cn    =0
95      igcm_chcn    =0
96      igcm_ch2cn   =0
97      igcm_ch3cn   =0
98      igcm_c3n     =0
99      igcm_hc3n    =0
100      igcm_nccn    =0
101      igcm_c4n2    =0     
102     
103      write(*,*) 'initracer: noms() ', noms
104
105
106      ! 1. find chemistry tracers
107      count = 0.
108     
109      do iq=1,nq
110     
111        if (noms(iq).eq."h") then
112          igcm_h=iq
113          mmol(igcm_h)=1.01
114          count=count+1
115        endif
116        if (noms(iq).eq."h2") then
117          igcm_h2=iq
118          mmol(igcm_h2)=2.0158
119          count=count+1
120        endif
121        if (noms(iq).eq."ch") then
122          igcm_ch=iq
123          mmol(igcm_ch)=13.02
124          count=count+1
125        endif
126        if (noms(iq).eq."ch2s") then
127          igcm_ch2s=iq
128          mmol(igcm_ch2s)=14.03
129          count=count+1
130        endif
131        if (noms(iq).eq."ch2") then
132          igcm_ch2=iq
133          mmol(igcm_ch2)=14.03
134          count=count+1
135        endif
136        if (noms(iq).eq."ch3") then
137          igcm_ch3=iq
138          mmol(igcm_ch3)=15.03
139          count=count+1
140        endif
141        if (noms(iq).eq."ch4") then
142          igcm_ch4=iq
143          mmol(igcm_ch4)=16.04
144          count=count+1
145        endif
146        if (noms(iq).eq."c2") then
147          igcm_c2=iq
148          mmol(igcm_c2)=24.02
149          count=count+1
150        endif
151        if (noms(iq).eq."c2h") then
152          igcm_c2h=iq
153          mmol(igcm_c2h)=25.03
154          count=count+1
155        endif
156        if (noms(iq).eq."c2h2") then
157          igcm_c2h2=iq
158          mmol(igcm_c2h2)=26.04
159          count=count+1
160        endif
161        if (noms(iq).eq."c2h3") then
162          igcm_c2h3=iq
163          mmol(igcm_c2h3)=27.05
164          count=count+1
165        endif
166        if (noms(iq).eq."c2h4") then
167          igcm_c2h4=iq
168          mmol(igcm_c2h4)=28.05
169          count=count+1
170        endif
171        if (noms(iq).eq."c2h5") then
172          igcm_c2h5=iq
173          mmol(igcm_c2h5)=29.06
174          count=count+1
175        endif
176        if (noms(iq).eq."c2h6") then
177          igcm_c2h6=iq
178          mmol(igcm_c2h6)=30.07
179          count=count+1
180        endif
181        if (noms(iq).eq."c3h3") then
182          igcm_c3h3=iq
183          mmol(igcm_c3h3)=39.06
184          count=count+1
185        endif
186        if (noms(iq).eq."c3h5") then
187          igcm_c3h5=iq
188          mmol(igcm_c3h5)=41.07
189          count=count+1
190        endif
191        if (noms(iq).eq."c3h6") then
192          igcm_c3h6=iq
193          mmol(igcm_c3h6)=42.08
194          count=count+1
195        endif
196        if (noms(iq).eq."c3h7") then
197          igcm_c3h7=iq
198          mmol(igcm_c3h7)=43.09
199          count=count+1
200        endif
201        if (noms(iq).eq."c4h") then
202          igcm_c4h=iq
203          mmol(igcm_c4h)=49.05
204          count=count+1
205        endif
206        if (noms(iq).eq."c4h3") then
207          igcm_c4h3=iq
208          mmol(igcm_c4h3)=51.07
209          count=count+1
210        endif
211        if (noms(iq).eq."c4h4") then
212          igcm_c4h4=iq
213          mmol(igcm_c4h4)=52.08
214          count=count+1
215        endif
216        if (noms(iq).eq."c4h2s") then
217          igcm_c4h2s=iq
218          mmol(igcm_c4h2s)=50.06
219          count=count+1
220        endif
221        if (noms(iq).eq."ch2cch2") then
222          igcm_ch2cch2=iq
223          mmol(igcm_ch2cch2)=40.07
224          count=count+1
225        endif
226        if (noms(iq).eq."ch3cch") then
227          igcm_ch3cch=iq
228          mmol(igcm_ch3cch)=40.07
229          count=count+1
230        endif
231        if (noms(iq).eq."c3h8") then
232          igcm_c3h8=iq
233          mmol(igcm_c3h8)=44.11
234          count=count+1
235        endif
236        if (noms(iq).eq."c4h2") then
237          igcm_c4h2=iq
238          mmol(igcm_c4h2)=50.06
239          count=count+1
240        endif
241        if (noms(iq).eq."c4h6") then
242          igcm_c4h6=iq
243          mmol(igcm_c4h6)=54.09
244          count=count+1
245        endif
246        if (noms(iq).eq."c4h10") then
247          igcm_c4h10=iq
248          mmol(igcm_c4h10)=58.13
249          count=count+1
250        endif
251        if (noms(iq).eq."ac6h6") then
252          igcm_ac6h6=iq
253          mmol(igcm_ac6h6)=78.1136
254          count=count+1
255        endif
256        if (noms(iq).eq."c3h2") then
257          igcm_c3h2=iq
258          mmol(igcm_c3h2)=38.05
259          count=count+1
260        endif
261        if (noms(iq).eq."c4h5") then
262          igcm_c4h5=iq
263          mmol(igcm_c4h5)=53.07
264          count=count+1
265        endif
266        if (noms(iq).eq."ac6h5") then
267          igcm_ac6h5=iq
268          mmol(igcm_ac6h5)=77.1136
269          count=count+1
270        endif
271        if (noms(iq).eq."n2") then
272          igcm_n2=iq
273          mmol(igcm_n2)=28.0134
274          count=count+1
275        endif
276        if (noms(iq).eq."n4s") then
277          igcm_n4s=iq
278          mmol(igcm_n4s)=14.01
279          count=count+1
280        endif
281        if (noms(iq).eq."cn") then
282          igcm_cn=iq
283          mmol(igcm_cn)=26.02
284          count=count+1
285        endif
286        if (noms(iq).eq."hcn") then
287          igcm_hcn=iq
288          mmol(igcm_hcn)=27.04
289          count=count+1
290        endif
291        if (noms(iq).eq."h2cn") then
292          igcm_h2cn=iq
293          mmol(igcm_h2cn)=28.05
294          count=count+1
295        endif
296        if (noms(iq).eq."chcn") then
297          igcm_chcn=iq
298          mmol(igcm_chcn)=39.05
299          count=count+1
300        endif
301        if (noms(iq).eq."ch2cn") then
302          igcm_ch2cn=iq
303          mmol(igcm_cn)=40.04
304          count=count+1
305        endif
306        if (noms(iq).eq."ch3cn") then
307          igcm_ch3cn=iq
308          mmol(igcm_ch3cn)=41.05
309          count=count+1
310        endif
311        if (noms(iq).eq."c3n") then
312          igcm_c3n=iq
313          mmol(igcm_c3n)=50.04
314          count=count+1
315        endif
316        if (noms(iq).eq."hc3n") then
317          igcm_hc3n=iq
318          mmol(igcm_hc3n)=51.05
319          count=count+1
320        endif
321        if (noms(iq).eq."nccn") then
322          igcm_nccn=iq
323          mmol(igcm_nccn)=52.04
324          count=count+1
325        endif
326        if (noms(iq).eq."c4n2") then
327          igcm_c4n2=iq
328          mmol(igcm_c4n2)=76.1
329          count=count+1
330        endif
331       
332
333      enddo ! of do iq=1,nq
334 
335      ! check that we identified all tracers:
336      if (count.ne.nq) then
337        write(*,*) "initracer: found only ",count," tracers"
338        write(*,*) "               expected ",nq
339        do iq=1,count
340          write(*,*)'      ',iq,' ',trim(noms(iq))
341        enddo
342!        stop
343      else
344        write(*,*) "initracer: found all expected tracers, namely:"
345        do iq=1,nq
346          write(*,*)'      ',iq,' ',trim(noms(iq))
347        enddo
348      endif
349
350
351c------------------------------------------------------------
352c     Initialisation tracers ....
353c------------------------------------------------------------
354      call zerophys(nq,rho_q)
355
356
357      end
Note: See TracBrowser for help on using the repository browser.