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

Last change on this file since 2302 was 2302, checked in by emillour, 5 years ago

Mars GCM:

  • Add H2O+ ion chemistry

FGG

File size: 6.0 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_co2_ice ! co2 ice
56
57      ! chemistry:
58      integer,save :: igcm_co2
59      integer,save :: igcm_co
60      integer,save :: igcm_o
61      integer,save :: igcm_o1d
62      integer,save :: igcm_o2
63      integer,save :: igcm_o3
64      integer,save :: igcm_h
65      integer,save :: igcm_h2
66      integer,save :: igcm_oh
67      integer,save :: igcm_ho2
68      integer,save :: igcm_h2o2
69      integer,save :: igcm_n2
70      integer,save :: igcm_ar
71      integer,save :: igcm_n
72      integer,save :: igcm_no
73      integer,save :: igcm_no2
74      integer,save :: igcm_n2d
75      integer,save :: igcm_he
76      integer,save :: igcm_ch4
77      ! Ions
78      integer,save :: igcm_co2plus
79      integer,save :: igcm_oplus
80      integer,save :: igcm_o2plus
81      integer,save :: igcm_coplus
82      integer,save :: igcm_cplus
83      integer,save :: igcm_nplus
84      integer,save :: igcm_noplus
85      integer,save :: igcm_n2plus
86      integer,save :: igcm_hplus
87      integer,save :: igcm_hco2plus
88      integer,save :: igcm_hcoplus
89      integer,save :: igcm_h2oplus
90      integer,save :: igcm_elec
91      ! other tracers
92      integer,save :: igcm_ar_n2 ! for simulations using co2 +neutral gas
93
94
95!-----------------------------------------------------------------------
96
97  contains
98 
99    subroutine ini_tracer_mod(nq,tname)
100      implicit none
101     
102      integer,intent(in) :: nq ! number of tracers
103      character(len=*),intent(in) :: tname(nq) ! tracer names
104     
105      integer :: iq, count
106      character(len=20) :: txt ! to store some text
107     
108      ! set dimension and tracer names
109      nqmx=nq
110      allocate(noms(nq))
111      do iq=1,nq
112        noms(iq)=tname(iq)
113        write(*,*) "tracer_mod names : ", trim(noms(iq))
114      enddo
115     
116#ifndef MESOSCALE
117      ! check if tracers have 'old' names
118      count=0
119      do iq=1,nq
120        txt=" "
121        write(txt,'(a1,i2.2)') 'q',iq
122        if (txt.eq.tname(iq)) then
123          count=count+1
124        endif
125      enddo ! of do iq=1,nq
126     
127      if ((count.eq.nq).and.(nq.ne.0)) then
128        write(*,*) "ini_tracer_mod: tracers seem to follow old naming ", &
129                   "convention (q01,q02,...)"
130        write(*,*) "you should run newstart to rename them"
131        call abort_physic("ini_tracer_mod","tracer name issue",1)
132      endif
133#endif
134           
135      ! allocate module arrays:
136      ! -- not domain-dependent
137      allocate(mmol(nq))
138      allocate(radius(nq))
139      allocate(rho_q(nq))
140      allocate(alpha_lift(nq))
141      allocate(alpha_devil(nq))
142      allocate(igcm_dustbin(nq))
143      allocate(nqdust(nq))
144     
145    end subroutine ini_tracer_mod
146
147    subroutine end_tracer_mod
148
149    implicit none
150
151      if (allocated(noms)) deallocate(noms)
152      if (allocated(mmol)) deallocate(mmol)
153      if (allocated(radius)) deallocate(radius)
154      if (allocated(rho_q)) deallocate(rho_q)
155      if (allocated(alpha_lift)) deallocate(alpha_lift)
156      if (allocated(alpha_devil)) deallocate(alpha_devil)
157      if (allocated(igcm_dustbin)) deallocate(igcm_dustbin)
158      if (allocated(nqdust)) deallocate(nqdust)
159
160    end subroutine end_tracer_mod
161
162end module tracer_mod
Note: See TracBrowser for help on using the repository browser.