source: trunk/LMDZ.GENERIC/libf/phystd/initracer.F @ 1576

Last change on this file since 1576 was 1542, checked in by emillour, 10 years ago

Generic GCM:

  • fix for 1D in writediagfi to enable writing at "ecritphy" rate.
  • move iniprint.h to "misc"
  • Some code cleanup in anticipation of future updates:
    • changed variable names in comgeomphy.F90: give them more explicit names: rlond => longitude , rlatd => latitude, airephy => cell_area, cuphy => dx , cvphy => dy
    • removed long(), lati() and area() from comgeomfi_h.F90, use longitude(), latitude() and cell_are() from comgeomphy.F90 instead

EM

File size: 10.8 KB
Line 
1      SUBROUTINE initracer(ngrid,nq,nametrac)
2
3      use surfdat_h
4      USE tracer_h
5      USE callkeys_mod, only: water
6      IMPLICIT NONE
7c=======================================================================
8c   subject:
9c   --------
10c   Initialization related to tracer
11c   (transported dust, water, chemical species, ice...)
12c
13c   Name of the tracer
14c
15c   Test of dimension :
16c   Initialize COMMON tracer in tracer.h, using tracer names provided
17c   by the argument nametrac
18c
19c   author: F.Forget
20c   ------
21c            Ehouarn Millour (oct. 2008) identify tracers by their names
22c=======================================================================
23
24      integer :: ngrid,nq
25
26!      real qsurf(ngrid,nq)       ! tracer on surface (e.g.  kg.m-2)
27!      real co2ice(ngrid)           ! co2 ice mass on surface (e.g.  kg.m-2)
28      character(len=20) :: txt ! to store some text
29      integer iq,ig,count
30      real r0_lift , reff_lift
31!      logical :: oldnames ! =.true. if old tracer naming convention (q01,...)
32
33      character*20 nametrac(nq)   ! name of the tracer from dynamics
34
35
36c-----------------------------------------------------------------------
37c  radius(nq)      ! aerosol particle radius (m)
38c  rho_q(nq)       ! tracer densities (kg.m-3)
39c  qext(nq)        ! Single Scat. Extinction coeff at 0.67 um
40c  alpha_lift(nq)  ! saltation vertical flux/horiz flux ratio (m-1)
41c  alpha_devil(nq) ! lifting coeeficient by dust devil
42c  rho_dust          ! Mars dust density
43c  rho_ice           ! Water ice density
44c  doubleq           ! if method with mass (iq=1) and number(iq=2) mixing ratio
45c  varian            ! Characteristic variance of log-normal distribution
46c-----------------------------------------------------------------------
47
48       !! we allocate once for all arrays in common in tracer_h.F90
49       !! (supposedly those are not used before call to initracer)
50       IF (.NOT.ALLOCATED(noms)) ALLOCATE(noms(nq))
51       ALLOCATE(mmol(nq))
52       ALLOCATE(radius(nq))
53       ALLOCATE(rho_q(nq))
54       ALLOCATE(qext(nq))
55       ALLOCATE(alpha_lift(nq))
56       ALLOCATE(alpha_devil(nq))
57       ALLOCATE(qextrhor(nq))
58       ALLOCATE(igcm_dustbin(nq))
59       !! initialization
60       alpha_lift(:)=0.
61       alpha_devil(:)=0.
62
63! Initialization: get tracer names from the dynamics and check if we are
64!                 using 'old' tracer convention ('q01',q02',...)
65!                 or new convention (full tracer names)
66      ! check if tracers have 'old' names
67
68! copy tracer names from dynamics
69        do iq=1,nq
70          noms(iq)=nametrac(iq)
71        enddo
72
73
74! Identify tracers by their names: (and set corresponding values of mmol)
75      ! 0. initialize tracer indexes to zero:
76      ! NB: igcm_* indexes are commons in 'tracer.h'
77      do iq=1,nq
78        igcm_dustbin(iq)=0
79      enddo
80      igcm_dust_mass=0
81      igcm_dust_number=0
82      igcm_h2o_vap=0
83      igcm_h2o_ice=0
84      igcm_co2=0
85      igcm_co=0
86      igcm_o=0
87      igcm_o1d=0
88      igcm_o2=0
89      igcm_o3=0
90      igcm_h=0
91      igcm_h2=0
92      igcm_oh=0
93      igcm_ho2=0
94      igcm_h2o2=0
95      igcm_n2=0
96      igcm_ar=0
97      igcm_ar_n2=0
98      igcm_co2_ice=0
99
100      write(*,*) 'initracer: noms() ', noms
101
102
103      !print*,'Setting dustbin = 0 in initracer.F'
104      !dustbin=0
105
106      ! 1. find dust tracers
107      count=0
108!      if (dustbin.gt.0) then
109!        do iq=1,nq
110!          txt=" "
111!          write(txt,'(a4,i2.2)')'dust',count+1   
112!          if (noms(iq).eq.txt) then
113!            count=count+1
114!            igcm_dustbin(count)=iq
115!            mmol(iq)=100.
116!          endif
117!        enddo !do iq=1,nq
118!      endif ! of if (dustbin.gt.0)
119
120
121!      if (doubleq) then
122!        do iq=1,nq
123!          if (noms(iq).eq."dust_mass") then
124!            igcm_dust_mass=iq
125!            count=count+1
126!          endif
127!          if (noms(iq).eq."dust_number") then
128!            igcm_dust_number=iq
129!            count=count+1
130!          endif
131!        enddo
132!      endif ! of if (doubleq)
133      ! 2. find chemistry and water tracers
134      do iq=1,nq
135        if (noms(iq).eq."co2") then
136          igcm_co2=iq
137          mmol(igcm_co2)=44.
138          count=count+1
139!          write(*,*) 'co2: count=',count
140        endif
141        if (noms(iq).eq."co2_ice") then
142          igcm_co2_ice=iq
143          mmol(igcm_co2_ice)=44.
144          count=count+1
145!          write(*,*) 'co2_ice: count=',count
146        endif
147        if (noms(iq).eq."h2o_vap") then
148          igcm_h2o_vap=iq
149          mmol(igcm_h2o_vap)=18.
150          count=count+1
151!          write(*,*) 'h2o_vap: count=',count
152        endif
153        if (noms(iq).eq."h2o_ice") then
154          igcm_h2o_ice=iq
155          mmol(igcm_h2o_ice)=18.
156          count=count+1
157!          write(*,*) 'h2o_ice: count=',count
158        endif
159      enddo ! of do iq=1,nq
160     
161      ! check that we identified all tracers:
162      if (count.ne.nq) then
163        write(*,*) "initracer: found only ",count," tracers"
164        write(*,*) "               expected ",nq
165        do iq=1,count
166          write(*,*)'      ',iq,' ',trim(noms(iq))
167        enddo
168!        stop
169      else
170        write(*,*) "initracer: found all expected tracers, namely:"
171        do iq=1,nq
172          write(*,*)'      ',iq,' ',trim(noms(iq))
173        enddo
174      endif
175
176
177c------------------------------------------------------------
178c     Initialisation tracers ....
179c------------------------------------------------------------
180      call zerophys(nq,rho_q)
181
182      rho_dust=2500.  ! Mars dust density (kg.m-3)
183      rho_ice=920.    ! Water ice density (kg.m-3)
184      rho_co2=1620.   ! CO2 ice density (kg.m-3)
185
186
187
188c$$$      if (doubleq) then
189c$$$c       "doubleq" technique
190c$$$c       -------------------
191c$$$c      (transport of mass and number mixing ratio)
192c$$$c       iq=1: Q mass mixing ratio, iq=2: N number mixing ratio
193c$$$
194c$$$        if( (nq.lt.2).or.(water.and.(nq.lt.3)) ) then
195c$$$          write(*,*)'initracer: nq is too low : nq=', nq
196c$$$          write(*,*)'water= ',water,' doubleq= ',doubleq   
197c$$$        end if
198c$$$
199c$$$        varian=0.637    ! Characteristic variance   
200c$$$        qext(igcm_dust_mass)=3.04   ! reference extinction at 0.67 um for ref dust
201c$$$        qext(igcm_dust_number)=3.04 ! reference extinction at 0.67 um for ref dust
202c$$$        rho_q(igcm_dust_mass)=rho_dust
203c$$$        rho_q(igcm_dust_number)=rho_dust
204c$$$
205c$$$c       Intermediate calcul for computing geometric mean radius r0
206c$$$c       as a function of mass and number mixing ratio Q and N
207c$$$c       (r0 = (r3n_q * Q/ N)
208c$$$        r3n_q = exp(-4.5*varian**2)*(3./4.)/(pi*rho_dust)
209c$$$
210c$$$c       Intermediate calcul for computing effective radius reff
211c$$$c       from geometric mean radius r0
212c$$$c       (reff = ref_r0 * r0)
213c$$$        ref_r0 = exp(2.5*varian**2)
214c$$$       
215c$$$c       lifted dust :
216c$$$c       '''''''''''
217c$$$        reff_lift = 3.e-6      !  Effective radius of lifted dust (m)
218c$$$        alpha_devil(igcm_dust_mass)=9.e-9   !  dust devil lift mass coeff
219c$$$        alpha_lift(igcm_dust_mass)=3.0e-15  !  Lifted mass coeff
220c$$$
221c$$$        r0_lift = reff_lift/ref_r0
222c$$$        alpha_devil(igcm_dust_number)=r3n_q*
223c$$$     &                        alpha_devil(igcm_dust_mass)/r0_lift**3
224c$$$        alpha_lift(igcm_dust_number)=r3n_q*
225c$$$     &                        alpha_lift(igcm_dust_mass)/r0_lift**3
226c$$$
227c$$$c       Not used:
228c$$$        radius(igcm_dust_mass) = 0.
229c$$$        radius(igcm_dust_number) = 0.
230c$$$
231c$$$      else
232
233
234c$$$       if (dustbin.gt.1) then
235c$$$        print*,'ATTENTION:',
236c$$$     $   ' properties of dust need input in initracer !!!'
237c$$$        stop
238c$$$
239c$$$       else if (dustbin.eq.1) then
240c$$$
241c$$$c       This will be used for 1 dust particle size:
242c$$$c       ------------------------------------------
243c$$$        radius(igcm_dustbin(1))=3.e-6
244c$$$        Qext(igcm_dustbin(1))=3.04
245c$$$        alpha_lift(igcm_dustbin(1))=0.0e-6
246c$$$        alpha_devil(igcm_dustbin(1))=7.65e-9
247c$$$        qextrhor(igcm_dustbin(1))=(3./4.)*Qext(igcm_dustbin(1))
248c$$$     &                         /(rho_dust*radius(igcm_dustbin(1)))
249c$$$        rho_q(igcm_dustbin(1))=rho_dust
250c$$$
251c$$$       endif
252c$$$!      end if    ! (doubleq)
253
254c     Initialization for water vapor
255c     ------------------------------
256      if(water) then
257         radius(igcm_h2o_vap)=0.
258         Qext(igcm_h2o_vap)=0.
259         alpha_lift(igcm_h2o_vap) =0.
260         alpha_devil(igcm_h2o_vap)=0.
261         qextrhor(igcm_h2o_vap)= 0.
262
263c       "Dryness coefficient" controlling the evaporation and
264c        sublimation from the ground water ice (close to 1)
265c        HERE, the goal is to correct for the fact
266c        that the simulated permanent water ice polar caps
267c        is larger than the actual cap and the atmospheric
268c        opacity not always realistic.
269
270
271!         if(ngrid.eq.1)
272
273
274!     to be modified for BC+ version?
275
276         !! this is defined in surfdat_h.F90
277         IF (.not.ALLOCATED(dryness)) ALLOCATE(dryness(ngrid))
278         IF (.not.ALLOCATED(watercaptag)) ALLOCATE(watercaptag(ngrid))
279
280         do ig=1,ngrid
281           if (ngrid.ne.1) watercaptag(ig)=.false.
282           dryness(ig) = 1.
283         enddo
284
285
286
287
288!         IF (caps) THEN
289c Perennial H20 north cap defined by watercaptag=true (allows surface to be
290c hollowed by sublimation in vdifc).
291!         do ig=1,ngrid
292!           if (lati(ig)*180./pi.gt.84) then
293!             if (ngrid.ne.1) watercaptag(ig)=.true.
294!             dryness(ig) = 1.
295c Use the following cap definition for high spatial resolution (latitudinal bin <= 5 deg)
296c             if (lati(ig)*180./pi.lt.85.and.long(ig).ge.0) then
297c               if (ngrid.ne.1) watercaptag(ig)=.true.
298c               dryness(ig) = 1.
299c             endif
300c             if (lati(ig)*180./pi.ge.85) then
301c               if (ngrid.ne.1) watercaptag(ig)=.true.
302c               dryness(ig) = 1.
303c             endif
304!           endif  ! (lati>80 deg)
305!         end do ! (ngrid)
306!        ENDIF ! (caps)
307
308!         if(iceparty.and.(nq.ge.2)) then
309
310           radius(igcm_h2o_ice)=3.e-6
311           rho_q(igcm_h2o_ice)=rho_ice
312           Qext(igcm_h2o_ice)=0.
313!           alpha_lift(igcm_h2o_ice) =0.
314!           alpha_devil(igcm_h2o_ice)=0.
315           qextrhor(igcm_h2o_ice)= (3./4.)*Qext(igcm_h2o_ice)
316     $       / (rho_ice*radius(igcm_h2o_ice))
317
318
319
320!         elseif(iceparty.and.(nq.lt.2)) then
321!            write(*,*) 'nq is too low : nq=', nq
322!            write(*,*) 'water= ',water,' iceparty= ',iceparty
323!         endif
324
325      end if  ! (water)
326
327c     Output for records:
328c     ~~~~~~~~~~~~~~~~~~
329      write(*,*)
330      Write(*,*) '******** initracer : dust transport parameters :'
331      write(*,*) 'alpha_lift = ', alpha_lift
332      write(*,*) 'alpha_devil = ', alpha_devil
333      write(*,*) 'radius  = ', radius
334!      if(doubleq) then
335!        write(*,*) 'reff_lift (um) =  ', reff_lift
336!        write(*,*) 'size distribution variance  = ', varian
337!        write(*,*) 'r3n_q , ref_r0 : ', r3n_q , ref_r0
338!      end if
339      write(*,*) 'Qext  = ', qext
340      write(*,*)
341
342      end
Note: See TracBrowser for help on using the repository browser.