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

Last change on this file since 2514 was 2461, checked in by emillour, 4 years ago

Mars GCM:

  • Adding the deuterium chemistry now that the HDO cycle is included.
  • Chemistry still works as before if deuterium tracers are not present.
  • Added handling of hdo in molecular diffusion (moldiff_red).

FGG+JYC+EM

File size: 7.1 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*30,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      integer,save :: igcm_stormdust_mass   !  storm dust mass mixing ratio
45      integer,save :: igcm_stormdust_number !  storm dust number mixing ratio
46      integer,save :: igcm_topdust_mass   !  topdust mass mixing ratio
47      integer,save :: igcm_topdust_number !  topdust number mixing ratio
48
49      integer,save :: igcm_ccnco2_mass   ! CCN (dust and/or water ice) for CO2 mass mixing ratio
50      integer,save :: igcm_ccnco2_number ! CCN (dust and/or water ice) for CO2 number mixing ratio
51
52      ! water
53      integer,save :: igcm_h2o_vap ! water vapour
54      integer,save :: igcm_h2o_ice ! water ice
55      integer,save :: igcm_hdo_vap ! hdo vapour
56      integer,save :: igcm_hdo_ice ! hdo ice
57      integer,save :: igcm_co2_ice ! co2 ice
58
59      ! chemistry:
60      integer,save :: igcm_co2
61      integer,save :: igcm_co
62      integer,save :: igcm_o
63      integer,save :: igcm_o1d
64      integer,save :: igcm_o2
65      integer,save :: igcm_o3
66      integer,save :: igcm_h
67      integer,save :: igcm_h2
68      integer,save :: igcm_oh
69      integer,save :: igcm_ho2
70      integer,save :: igcm_h2o2
71      integer,save :: igcm_n2
72      integer,save :: igcm_ar
73      integer,save :: igcm_n
74      integer,save :: igcm_no
75      integer,save :: igcm_no2
76      integer,save :: igcm_n2d
77      integer,save :: igcm_he
78      integer,save :: igcm_ch4
79      !Deuterated species derived from HDO
80      integer,save :: igcm_od
81      integer,save :: igcm_d
82      integer,save :: igcm_hd
83      integer,save :: igcm_do2
84      integer,save :: igcm_hdo2
85      ! Ions
86      integer,save :: igcm_co2plus
87      integer,save :: igcm_oplus
88      integer,save :: igcm_o2plus
89      integer,save :: igcm_coplus
90      integer,save :: igcm_cplus
91      integer,save :: igcm_nplus
92      integer,save :: igcm_noplus
93      integer,save :: igcm_n2plus
94      integer,save :: igcm_hplus
95      integer,save :: igcm_hco2plus
96      integer,save :: igcm_hcoplus
97      integer,save :: igcm_h2oplus
98      integer,save :: igcm_h3oplus
99      integer,save :: igcm_ohplus
100      integer,save :: igcm_elec
101      ! other tracers
102      integer,save :: igcm_ar_n2 ! for simulations using co2 +neutral gas
103      ! MVals: isotopes
104      integer, save                 :: nqperes ! numbers of tracers defined as "peres"
105      integer, allocatable, save    :: nqfils(:) ! numbers of sons ("fils") of the considered tracer
106      real, parameter               :: qperemin=1.e-16 ! threschold for the "pere" mixing ratio qpere to calculate Ratio=qfils/qpere
107      real, parameter               :: masseqmin=1.e-16 ! threschold for the "pere" transporting masse martian case as there are no gran-sons
108
109!-----------------------------------------------------------------------
110
111  contains
112 
113    subroutine ini_tracer_mod(nq,tname,dyn_nqperes,dyn_nqfils)! MVals: variables isotopes
114      implicit none
115     
116      integer,intent(in) :: nq ! number of tracers
117      character(len=*),intent(in) :: tname(nq) ! tracer names
118      !MVals: variables isotopes
119      integer,intent(in) :: dyn_nqperes
120      integer,intent(in) :: dyn_nqfils(nq)
121     
122      integer :: iq, count
123      character(len=20) :: txt ! to store some text
124     
125      ! set dimension and tracer names
126      nqmx=nq
127      allocate(noms(nq))
128      do iq=1,nq
129        noms(iq)=tname(iq)
130        write(*,*) "tracer_mod names : ", trim(noms(iq))
131      enddo
132
133      !MVals: isotopes variables initialisation
134      allocate(nqfils(nq))
135      nqperes=dyn_nqperes   
136      nqfils(:)=dyn_nqfils(:)
137     
138#ifndef MESOSCALE
139      ! check if tracers have 'old' names
140      count=0
141      do iq=1,nq
142        txt=" "
143        write(txt,'(a1,i2.2)') 'q',iq
144        if (txt.eq.tname(iq)) then
145          count=count+1
146        endif
147      enddo ! of do iq=1,nq
148     
149      if ((count.eq.nq).and.(nq.ne.0)) then
150        write(*,*) "ini_tracer_mod: tracers seem to follow old naming ", &
151                   "convention (q01,q02,...)"
152        write(*,*) "you should run newstart to rename them"
153        call abort_physic("ini_tracer_mod","tracer name issue",1)
154      endif
155#endif
156           
157      ! allocate module arrays:
158      ! -- not domain-dependent
159      allocate(mmol(nq))
160      allocate(radius(nq))
161      allocate(rho_q(nq))
162      allocate(alpha_lift(nq))
163      allocate(alpha_devil(nq))
164      allocate(igcm_dustbin(nq))
165      allocate(nqdust(nq))
166     
167    end subroutine ini_tracer_mod
168
169    subroutine end_tracer_mod
170
171    implicit none
172
173      if (allocated(noms)) deallocate(noms)
174      if (allocated(mmol)) deallocate(mmol)
175      if (allocated(radius)) deallocate(radius)
176      if (allocated(rho_q)) deallocate(rho_q)
177      if (allocated(alpha_lift)) deallocate(alpha_lift)
178      if (allocated(alpha_devil)) deallocate(alpha_devil)
179      if (allocated(igcm_dustbin)) deallocate(igcm_dustbin)
180      if (allocated(nqdust)) deallocate(nqdust)
181
182    end subroutine end_tracer_mod
183
184end module tracer_mod
Note: See TracBrowser for help on using the repository browser.