source: trunk/LMDZ.MARS/libf/phymars/tracer_mod.F90 @ 1972

Last change on this file since 1972 was 1941, checked in by emillour, 6 years ago

Mars GCM: Very minor correction for when running without any tracers.
EM

File size: 5.6 KB
Line 
1module tracer_mod
2
3 implicit none
4 
5      ! number of tracers:
6      integer,save :: nqmx ! initialized in conf_phys
7   
8      character*20,allocatable,save ::  noms(:)  ! name of the tracer
9      real,allocatable,save :: mmol(:)           ! mole mass of tracer (g/mol-1)
10      real,allocatable,save :: radius(:)   ! dust and ice particle radius (m)
11      real,allocatable,save :: rho_q(:)    ! tracer densities (kg.m-3)
12      real,allocatable,save :: alpha_lift(:) ! saltation vertical flux/horiz flux ratio (m-1)
13      real,allocatable,save :: alpha_devil(:) ! lifting coeeficient by dust devil
14
15      real,save :: varian      ! Characteristic variance of log-normal distribution
16      real,save :: r3n_q     ! used to compute r0 from number and mass mixing ratio
17      real,save :: rho_dust     ! Mars dust density (kg.m-3)
18      real,save :: rho_ice     ! Water ice density (kg.m-3)
19      real,save :: nuice_ref   ! Effective variance of the water ice dist.
20      real,save :: nuice_sed   ! Sedimentation effective variance of the water ice dist.
21      real,save :: ref_r0        ! for computing reff=ref_r0*r0 (in log.n. distribution)
22      real,save :: rho_ice_co2     ! co2 ice density (kg.m-3)
23      real,save :: nuiceco2_sed   ! Sedimentation effective variance of the co2 ice dist.
24      real,save :: nuiceco2_ref   ! Effective variance of the co2 ice dist.
25
26      real,save :: ccn_factor  ! ratio of nuclei for water ice particles
27
28      INTEGER,ALLOCATABLE,SAVE :: nqdust(:) ! to store the indexes of dust tracers (cf aeropacity)
29      real,allocatable,save :: dryness(:)!"Dryness coefficient" for grnd water ice sublimation
30
31
32! tracer indexes: these are initialized in initracer and should be 0 if the
33!                 corresponding tracer does not exist
34      ! dust
35      integer,allocatable,save :: igcm_dustbin(:) ! for dustbin 'dust' tracers
36      ! dust, special doubleq case
37      integer,save :: igcm_dust_mass   ! dust mass mixing ratio
38                                  !   (for transported dust)
39      integer,save :: igcm_dust_number ! dust number mixing ratio
40                                  !   (transported dust)
41      integer,save :: igcm_ccn_mass   ! CCN mass mixing ratio
42      integer,save :: igcm_ccn_number ! CCN number mixing ratio
43      integer,save :: igcm_dust_submicron ! submicron dust mixing ratio
44   
45      integer,save :: igcm_ccnco2_mass   ! CCN (dust and/or water ice) for CO2 mass mixing ratio
46      integer,save :: igcm_ccnco2_number ! CCN (dust and/or water ice) for CO2 number mixing ratio
47
48      ! water
49      integer,save :: igcm_h2o_vap ! water vapour
50      integer,save :: igcm_h2o_ice ! water ice
51      integer,save :: igcm_co2_ice ! co2 ice
52
53      ! chemistry:
54      integer,save :: igcm_co2
55      integer,save :: igcm_co
56      integer,save :: igcm_o
57      integer,save :: igcm_o1d
58      integer,save :: igcm_o2
59      integer,save :: igcm_o3
60      integer,save :: igcm_h
61      integer,save :: igcm_h2
62      integer,save :: igcm_oh
63      integer,save :: igcm_ho2
64      integer,save :: igcm_h2o2
65      integer,save :: igcm_n2
66      integer,save :: igcm_ar
67      integer,save :: igcm_n
68      integer,save :: igcm_no
69      integer,save :: igcm_no2
70      integer,save :: igcm_n2d
71      integer,save :: igcm_he
72      integer,save :: igcm_ch4
73      ! Ions
74      integer,save :: igcm_co2plus
75      integer,save :: igcm_oplus
76      integer,save :: igcm_o2plus
77      integer,save :: igcm_coplus
78      integer,save :: igcm_cplus
79      integer,save :: igcm_nplus
80      integer,save :: igcm_noplus
81      integer,save :: igcm_n2plus
82      integer,save :: igcm_hplus
83      integer,save :: igcm_hco2plus
84      integer,save :: igcm_elec
85      ! other tracers
86      integer,save :: igcm_ar_n2 ! for simulations using co2 +neutral gas
87
88
89!-----------------------------------------------------------------------
90
91  contains
92 
93    subroutine ini_tracer_mod(nq,tname)
94      implicit none
95     
96      integer,intent(in) :: nq ! number of tracers
97      character(len=*),intent(in) :: tname(nq) ! tracer names
98     
99      integer :: iq, count
100      character(len=20) :: txt ! to store some text
101     
102      ! set dimension and tracer names
103      nqmx=nq
104      allocate(noms(nq))
105      do iq=1,nq
106        noms(iq)=tname(iq)
107        write(*,*) "tracer_mod names : ", trim(noms(iq))
108      enddo
109     
110#ifndef MESOSCALE
111      ! check if tracers have 'old' names
112      count=0
113      do iq=1,nq
114        txt=" "
115        write(txt,'(a1,i2.2)') 'q',iq
116        if (txt.eq.tname(iq)) then
117          count=count+1
118        endif
119      enddo ! of do iq=1,nq
120     
121      if ((count.eq.nq).and.(nq.ne.0)) then
122        write(*,*) "ini_tracer_mod: tracers seem to follow old naming ", &
123                   "convention (q01,q02,...)"
124        write(*,*) "you should run newstart to rename them"
125        call abort_physic("ini_tracer_mod","tracer name issue",1)
126      endif
127#endif
128           
129      ! allocate module arrays:
130      ! -- not domain-dependent
131      allocate(mmol(nq))
132      allocate(radius(nq))
133      allocate(rho_q(nq))
134      allocate(alpha_lift(nq))
135      allocate(alpha_devil(nq))
136      allocate(igcm_dustbin(nq))
137      allocate(nqdust(nq))
138     
139    end subroutine ini_tracer_mod
140
141    subroutine end_tracer_mod
142
143    implicit none
144
145      if (allocated(noms)) deallocate(noms)
146      if (allocated(mmol)) deallocate(mmol)
147      if (allocated(radius)) deallocate(radius)
148      if (allocated(rho_q)) deallocate(rho_q)
149      if (allocated(alpha_lift)) deallocate(alpha_lift)
150      if (allocated(alpha_devil)) deallocate(alpha_devil)
151      if (allocated(igcm_dustbin)) deallocate(igcm_dustbin)
152      if (allocated(nqdust)) deallocate(nqdust)
153
154    end subroutine end_tracer_mod
155
156end module tracer_mod
Note: See TracBrowser for help on using the repository browser.