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

Last change on this file since 2578 was 2578, checked in by romain.vande, 3 years ago

First stage of implementing Open_MP in the physic.
So far it can initialyse physic and run with all routines at .FALSE.

File size: 8.9 KB
Line 
1module tracer_mod
2
3 implicit none
4 
5      ! number of tracers:
6      integer,save :: nqmx ! initialized in conf_phys
7
8!$OMP THREADPRIVATE(nqmx) 
9   
10      character*30,allocatable,save ::  noms(:)  ! name of the tracer
11      real,allocatable,save :: mmol(:)           ! mole mass of tracer (g/mol-1)
12      real,allocatable,save :: radius(:)   ! dust and ice particle radius (m)
13      real,allocatable,save :: rho_q(:)    ! tracer densities (kg.m-3)
14      real,allocatable,save :: alpha_lift(:) ! saltation vertical flux/horiz flux ratio (m-1)
15      real,allocatable,save :: alpha_devil(:) ! lifting coeeficient by dust devil
16
17!$OMP THREADPRIVATE(noms,mmol,radius,rho_q,alpha_lift,                           &
18!$OMP                alpha_devil) 
19
20      real,save :: varian      ! Characteristic variance of log-normal distribution
21      real,save :: r3n_q     ! used to compute r0 from number and mass mixing ratio
22      real,save :: rho_dust     ! Mars dust density (kg.m-3)
23      real,save :: rho_ice     ! Water ice density (kg.m-3)
24      real,save :: nuice_ref   ! Effective variance of the water ice dist.
25      real,save :: nuice_sed   ! Sedimentation effective variance of the water ice dist.
26      real,save :: ref_r0        ! for computing reff=ref_r0*r0 (in log.n. distribution)
27      real,save :: rho_ice_co2     ! co2 ice density (kg.m-3)
28      real,save :: nuiceco2_sed   ! Sedimentation effective variance of the co2 ice dist.
29      real,save :: nuiceco2_ref   ! Effective variance of the co2 ice dist.
30
31!$OMP THREADPRIVATE(varian,r3n_q,rho_dust,rho_ice,nuice_ref,                     &
32!$OMP                nuice_sed,ref_r0,rho_ice_co2,nuiceco2_sed,nuiceco2_ref) 
33     
34      real,save :: ccn_factor  ! ratio of nuclei for water ice particles
35
36!$OMP THREADPRIVATE(ccn_factor) 
37
38      INTEGER,ALLOCATABLE,SAVE :: nqdust(:) ! to store the indexes of dust tracers (cf aeropacity)
39      real,allocatable,save :: dryness(:)!"Dryness coefficient" for grnd water ice sublimation
40
41!$OMP THREADPRIVATE(nqdust,dryness) 
42
43
44! tracer indexes: these are initialized in initracer and should be 0 if the
45!                 corresponding tracer does not exist
46      ! dust
47      integer,allocatable,save :: igcm_dustbin(:) ! for dustbin 'dust' tracers
48      ! dust, special doubleq case
49      integer,save :: igcm_dust_mass   ! dust mass mixing ratio
50                                  !   (for transported dust)
51      integer,save :: igcm_dust_number ! dust number mixing ratio
52                                  !   (transported dust)
53      integer,save :: igcm_ccn_mass   ! CCN mass mixing ratio
54      integer,save :: igcm_ccn_number ! CCN number mixing ratio
55      integer,save :: igcm_dust_submicron ! submicron dust mixing ratio
56      integer,save :: igcm_stormdust_mass   !  storm dust mass mixing ratio
57      integer,save :: igcm_stormdust_number !  storm dust number mixing ratio
58      integer,save :: igcm_topdust_mass   !  topdust mass mixing ratio
59      integer,save :: igcm_topdust_number !  topdust number mixing ratio
60
61!$OMP THREADPRIVATE(igcm_dustbin,igcm_dust_mass,igcm_dust_number,igcm_ccn_mass,  &
62!$OMP                igcm_ccn_number,igcm_dust_submicron,igcm_stormdust_mass,    &
63!$OMP                igcm_stormdust_number,igcm_topdust_mass,igcm_topdust_number) 
64
65      integer,save :: igcm_ccnco2_mass   ! CCN (dust and/or water ice) for CO2 mass mixing ratio
66      integer,save :: igcm_ccnco2_number ! CCN (dust and/or water ice) for CO2 number mixing ratio
67      integer,save :: igcm_ccnco2_h2o_mass_ice   ! CCN (dust and/or water ice) for CO2 mass mixing ratio
68      integer,save :: igcm_ccnco2_h2o_mass_ccn   ! CCN (dust and/or water ice) for CO2 mass mixing ratio
69      integer,save :: igcm_ccnco2_h2o_number ! CCN (dust and/or water ice) for CO2 number mixing ratio
70
71!$OMP THREADPRIVATE(igcm_ccnco2_mass,igcm_ccnco2_number,                         &
72!$OMP                igcm_ccnco2_h2o_mass_ice,igcm_ccnco2_h2o_mass_ccn,          &
73!$OMP                igcm_ccnco2_h2o_number) 
74
75      ! water
76      integer,save :: igcm_h2o_vap ! water vapour
77      integer,save :: igcm_h2o_ice ! water ice
78      integer,save :: igcm_hdo_vap ! hdo vapour
79      integer,save :: igcm_hdo_ice ! hdo ice
80      integer,save :: igcm_co2_ice ! co2 ice
81
82!$OMP THREADPRIVATE(igcm_h2o_vap, igcm_h2o_ice, igcm_hdo_vap, igcm_hdo_ice,      &
83!$OMP                igcm_co2_ice) 
84
85      ! chemistry:
86      integer,save :: igcm_co2
87      integer,save :: igcm_co
88      integer,save :: igcm_o
89      integer,save :: igcm_o1d
90      integer,save :: igcm_o2
91      integer,save :: igcm_o3
92      integer,save :: igcm_h
93      integer,save :: igcm_h2
94      integer,save :: igcm_oh
95      integer,save :: igcm_ho2
96      integer,save :: igcm_h2o2
97      integer,save :: igcm_n2
98      integer,save :: igcm_ar
99      integer,save :: igcm_n
100      integer,save :: igcm_no
101      integer,save :: igcm_no2
102      integer,save :: igcm_n2d
103      integer,save :: igcm_he
104      integer,save :: igcm_ch4
105
106!$OMP THREADPRIVATE(igcm_co2,igcm_co,igcm_o,igcm_o1d,igcm_o2,igcm_o3,igcm_h,   &
107!$OMP                igcm_h2,igcm_oh,igcm_ho2,igcm_h2o2,igcm_n2,igcm_ar,igcm_n,&
108!$OMP               igcm_no,igcm_no2,igcm_n2d,igcm_he,igcm_ch4)
109
110      !Deuterated species derived from HDO
111      integer,save :: igcm_od
112      integer,save :: igcm_d
113      integer,save :: igcm_hd
114      integer,save :: igcm_do2
115      integer,save :: igcm_hdo2
116
117!$OMP THREADPRIVATE(igcm_od,igcm_d,igcm_hd, igcm_do2,igcm_hdo2)
118
119      ! Ions
120      integer,save :: igcm_co2plus
121      integer,save :: igcm_oplus
122      integer,save :: igcm_o2plus
123      integer,save :: igcm_coplus
124      integer,save :: igcm_cplus
125      integer,save :: igcm_nplus
126      integer,save :: igcm_noplus
127      integer,save :: igcm_n2plus
128      integer,save :: igcm_hplus
129      integer,save :: igcm_hco2plus
130      integer,save :: igcm_hcoplus
131      integer,save :: igcm_h2oplus
132      integer,save :: igcm_h3oplus
133      integer,save :: igcm_ohplus
134      integer,save :: igcm_elec
135
136!$OMP THREADPRIVATE(igcm_co2plus,igcm_oplus,igcm_o2plus,igcm_coplus,igcm_cplus,   &
137!$OMP                igcm_nplus,igcm_noplus,igcm_n2plus,igcm_hplus,igcm_hco2plus,&
138!$OMP                igcm_hcoplus,igcm_h2oplus,igcm_h3oplus,igcm_ohplus,igcm_elec)
139
140      ! other tracers
141      integer,save :: igcm_ar_n2 ! for simulations using co2 +neutral gas
142      ! MVals: isotopes
143      integer, save                 :: nqperes ! numbers of tracers defined as "peres"
144      integer, allocatable, save    :: nqfils(:) ! numbers of sons ("fils") of the considered tracer
145
146!$OMP THREADPRIVATE(igcm_ar_n2,nqperes,nqfils) 
147
148      real, parameter               :: qperemin=1.e-16 ! threschold for the "pere" mixing ratio qpere to calculate Ratio=qfils/qpere
149      real, parameter               :: masseqmin=1.e-16 ! threschold for the "pere" transporting masse martian case as there are no gran-sons
150
151!-----------------------------------------------------------------------
152
153  contains
154 
155    subroutine ini_tracer_mod(nq,tname,dyn_nqperes,dyn_nqfils)! MVals: variables isotopes
156      implicit none
157     
158      integer,intent(in) :: nq ! number of tracers
159      character(len=*),intent(in) :: tname(nq) ! tracer names
160      !MVals: variables isotopes
161      integer,intent(in) :: dyn_nqperes
162      integer,intent(in) :: dyn_nqfils(nq)
163     
164      integer :: iq, count
165      character(len=20) :: txt ! to store some text
166     
167      ! set dimension and tracer names
168      nqmx=nq
169      allocate(noms(nq))
170      do iq=1,nq
171        noms(iq)=tname(iq)
172        write(*,*) "tracer_mod names : ", trim(noms(iq))
173      enddo
174
175      !MVals: isotopes variables initialisation
176      allocate(nqfils(nq))
177      nqperes=dyn_nqperes   
178      nqfils(:)=dyn_nqfils(:)
179     
180#ifndef MESOSCALE
181      ! check if tracers have 'old' names
182      count=0
183      do iq=1,nq
184        txt=" "
185        write(txt,'(a1,i2.2)') 'q',iq
186        if (txt.eq.tname(iq)) then
187          count=count+1
188        endif
189      enddo ! of do iq=1,nq
190     
191      if ((count.eq.nq).and.(nq.ne.0)) then
192        write(*,*) "ini_tracer_mod: tracers seem to follow old naming ", &
193                   "convention (q01,q02,...)"
194        write(*,*) "you should run newstart to rename them"
195        call abort_physic("ini_tracer_mod","tracer name issue",1)
196      endif
197#endif
198           
199      ! allocate module arrays:
200      ! -- not domain-dependent
201      allocate(mmol(nq))
202      allocate(radius(nq))
203      allocate(rho_q(nq))
204      allocate(alpha_lift(nq))
205      allocate(alpha_devil(nq))
206      allocate(igcm_dustbin(nq))
207      allocate(nqdust(nq))
208     
209    end subroutine ini_tracer_mod
210
211    subroutine end_tracer_mod
212
213    implicit none
214
215      if (allocated(noms)) deallocate(noms)
216      if (allocated(mmol)) deallocate(mmol)
217      if (allocated(radius)) deallocate(radius)
218      if (allocated(rho_q)) deallocate(rho_q)
219      if (allocated(alpha_lift)) deallocate(alpha_lift)
220      if (allocated(alpha_devil)) deallocate(alpha_devil)
221      if (allocated(igcm_dustbin)) deallocate(igcm_dustbin)
222      if (allocated(nqdust)) deallocate(nqdust)
223
224    end subroutine end_tracer_mod
225
226end module tracer_mod
Note: See TracBrowser for help on using the repository browser.