| 1 | module 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_meteor_mass ! CCN (dust and/or water ice) for CO2 mass mixing ratio |
|---|
| 68 | integer,save :: igcm_ccnco2_meteor_number ! CCN (dust and/or water ice) for CO2 number mixing ratio |
|---|
| 69 | integer,save :: igcm_ccnco2_h2o_mass_ice ! CCN (dust and/or water ice) for CO2 mass mixing ratio |
|---|
| 70 | integer,save :: igcm_ccnco2_h2o_mass_ccn ! CCN (dust and/or water ice) for CO2 mass mixing ratio |
|---|
| 71 | integer,save :: igcm_ccnco2_h2o_number ! CCN (dust and/or water ice) for CO2 number mixing ratio |
|---|
| 72 | |
|---|
| 73 | !$OMP THREADPRIVATE(igcm_ccnco2_mass,igcm_ccnco2_number, & |
|---|
| 74 | !$OMP igcm_ccnco2_h2o_mass_ice,igcm_ccnco2_h2o_mass_ccn, & |
|---|
| 75 | !$OMP igcm_ccnco2_h2o_number) |
|---|
| 76 | |
|---|
| 77 | ! water |
|---|
| 78 | integer,save :: igcm_h2o_vap ! water vapour |
|---|
| 79 | integer,save :: igcm_h2o_ice ! water ice |
|---|
| 80 | integer,save :: igcm_hdo_vap ! hdo vapour |
|---|
| 81 | integer,save :: igcm_hdo_ice ! hdo ice |
|---|
| 82 | integer,save :: igcm_co2_ice ! co2 ice |
|---|
| 83 | |
|---|
| 84 | !$OMP THREADPRIVATE(igcm_h2o_vap, igcm_h2o_ice, igcm_hdo_vap, igcm_hdo_ice, & |
|---|
| 85 | !$OMP igcm_co2_ice) |
|---|
| 86 | |
|---|
| 87 | ! chemistry: |
|---|
| 88 | integer,save :: igcm_co2 |
|---|
| 89 | integer,save :: igcm_co |
|---|
| 90 | integer,save :: igcm_o |
|---|
| 91 | integer,save :: igcm_o1d |
|---|
| 92 | integer,save :: igcm_o2 |
|---|
| 93 | integer,save :: igcm_o3 |
|---|
| 94 | integer,save :: igcm_h |
|---|
| 95 | integer,save :: igcm_h2 |
|---|
| 96 | integer,save :: igcm_oh |
|---|
| 97 | integer,save :: igcm_ho2 |
|---|
| 98 | integer,save :: igcm_h2o2 |
|---|
| 99 | integer,save :: igcm_n2 |
|---|
| 100 | integer,save :: igcm_ar |
|---|
| 101 | integer,save :: igcm_n |
|---|
| 102 | integer,save :: igcm_no |
|---|
| 103 | integer,save :: igcm_no2 |
|---|
| 104 | integer,save :: igcm_n2d |
|---|
| 105 | integer,save :: igcm_he |
|---|
| 106 | integer,save :: igcm_ch4 |
|---|
| 107 | |
|---|
| 108 | !$OMP THREADPRIVATE(igcm_co2,igcm_co,igcm_o,igcm_o1d,igcm_o2,igcm_o3,igcm_h, & |
|---|
| 109 | !$OMP igcm_h2,igcm_oh,igcm_ho2,igcm_h2o2,igcm_n2,igcm_ar,igcm_n,& |
|---|
| 110 | !$OMP igcm_no,igcm_no2,igcm_n2d,igcm_he,igcm_ch4) |
|---|
| 111 | |
|---|
| 112 | !Deuterated species derived from HDO |
|---|
| 113 | integer,save :: igcm_od |
|---|
| 114 | integer,save :: igcm_d |
|---|
| 115 | integer,save :: igcm_hd |
|---|
| 116 | integer,save :: igcm_do2 |
|---|
| 117 | integer,save :: igcm_hdo2 |
|---|
| 118 | |
|---|
| 119 | !$OMP THREADPRIVATE(igcm_od,igcm_d,igcm_hd, igcm_do2,igcm_hdo2) |
|---|
| 120 | |
|---|
| 121 | ! Ions |
|---|
| 122 | integer,save :: igcm_co2plus |
|---|
| 123 | integer,save :: igcm_oplus |
|---|
| 124 | integer,save :: igcm_o2plus |
|---|
| 125 | integer,save :: igcm_coplus |
|---|
| 126 | integer,save :: igcm_cplus |
|---|
| 127 | integer,save :: igcm_nplus |
|---|
| 128 | integer,save :: igcm_noplus |
|---|
| 129 | integer,save :: igcm_n2plus |
|---|
| 130 | integer,save :: igcm_hplus |
|---|
| 131 | integer,save :: igcm_hco2plus |
|---|
| 132 | integer,save :: igcm_hcoplus |
|---|
| 133 | integer,save :: igcm_h2oplus |
|---|
| 134 | integer,save :: igcm_h3oplus |
|---|
| 135 | integer,save :: igcm_ohplus |
|---|
| 136 | integer,save :: igcm_elec |
|---|
| 137 | |
|---|
| 138 | !$OMP THREADPRIVATE(igcm_co2plus,igcm_oplus,igcm_o2plus,igcm_coplus,igcm_cplus, & |
|---|
| 139 | !$OMP igcm_nplus,igcm_noplus,igcm_n2plus,igcm_hplus,igcm_hco2plus,& |
|---|
| 140 | !$OMP igcm_hcoplus,igcm_h2oplus,igcm_h3oplus,igcm_ohplus,igcm_elec) |
|---|
| 141 | |
|---|
| 142 | ! other tracers |
|---|
| 143 | integer,save :: igcm_ar_n2 ! for simulations using co2 +neutral gas |
|---|
| 144 | ! MVals: isotopes |
|---|
| 145 | integer, save :: nqperes ! numbers of tracers defined as "peres" |
|---|
| 146 | integer, allocatable, save :: nqfils(:) ! numbers of sons ("fils") of the considered tracer |
|---|
| 147 | |
|---|
| 148 | !$OMP THREADPRIVATE(igcm_ar_n2,nqperes,nqfils) |
|---|
| 149 | |
|---|
| 150 | real, parameter :: qperemin=1.e-16 ! threschold for the "pere" mixing ratio qpere to calculate Ratio=qfils/qpere |
|---|
| 151 | real, parameter :: masseqmin=1.e-16 ! threschold for the "pere" transporting masse martian case as there are no gran-sons |
|---|
| 152 | |
|---|
| 153 | !----------------------------------------------------------------------- |
|---|
| 154 | |
|---|
| 155 | contains |
|---|
| 156 | |
|---|
| 157 | subroutine ini_tracer_mod(nq,tname,dyn_nqperes,dyn_nqfils)! MVals: variables isotopes |
|---|
| 158 | implicit none |
|---|
| 159 | |
|---|
| 160 | integer,intent(in) :: nq ! number of tracers |
|---|
| 161 | character(len=*),intent(in) :: tname(nq) ! tracer names |
|---|
| 162 | !MVals: variables isotopes |
|---|
| 163 | integer,intent(in) :: dyn_nqperes |
|---|
| 164 | integer,intent(in) :: dyn_nqfils(nq) |
|---|
| 165 | |
|---|
| 166 | integer :: iq, count |
|---|
| 167 | character(len=20) :: txt ! to store some text |
|---|
| 168 | |
|---|
| 169 | logical :: co2_tracer_found=.false. |
|---|
| 170 | |
|---|
| 171 | ! set dimension and tracer names |
|---|
| 172 | nqmx=nq |
|---|
| 173 | allocate(noms(nq)) |
|---|
| 174 | do iq=1,nq |
|---|
| 175 | noms(iq)=tname(iq) |
|---|
| 176 | write(*,*) "tracer_mod names : ", trim(noms(iq)) |
|---|
| 177 | if(noms(iq).eq."co2") then |
|---|
| 178 | co2_tracer_found=.true. |
|---|
| 179 | endif |
|---|
| 180 | enddo |
|---|
| 181 | |
|---|
| 182 | if(.not.co2_tracer_found) then |
|---|
| 183 | call abort_physic("ini_tracer_mod","co2 tracer is now mandatory",1) |
|---|
| 184 | endif |
|---|
| 185 | |
|---|
| 186 | !MVals: isotopes variables initialisation |
|---|
| 187 | allocate(nqfils(nq)) |
|---|
| 188 | nqperes=dyn_nqperes |
|---|
| 189 | nqfils(:)=dyn_nqfils(:) |
|---|
| 190 | |
|---|
| 191 | #ifndef MESOSCALE |
|---|
| 192 | ! check if tracers have 'old' names |
|---|
| 193 | count=0 |
|---|
| 194 | do iq=1,nq |
|---|
| 195 | txt=" " |
|---|
| 196 | write(txt,'(a1,i2.2)') 'q',iq |
|---|
| 197 | if (txt.eq.tname(iq)) then |
|---|
| 198 | count=count+1 |
|---|
| 199 | endif |
|---|
| 200 | enddo ! of do iq=1,nq |
|---|
| 201 | |
|---|
| 202 | if ((count.eq.nq).and.(nq.ne.0)) then |
|---|
| 203 | write(*,*) "ini_tracer_mod: tracers seem to follow old naming ", & |
|---|
| 204 | "convention (q01,q02,...)" |
|---|
| 205 | write(*,*) "you should run newstart to rename them" |
|---|
| 206 | call abort_physic("ini_tracer_mod","tracer name issue",1) |
|---|
| 207 | endif |
|---|
| 208 | #endif |
|---|
| 209 | |
|---|
| 210 | ! allocate module arrays: |
|---|
| 211 | ! -- not domain-dependent |
|---|
| 212 | allocate(mmol(nq)) |
|---|
| 213 | allocate(radius(nq)) |
|---|
| 214 | allocate(rho_q(nq)) |
|---|
| 215 | allocate(alpha_lift(nq)) |
|---|
| 216 | allocate(alpha_devil(nq)) |
|---|
| 217 | allocate(igcm_dustbin(nq)) |
|---|
| 218 | allocate(nqdust(nq)) |
|---|
| 219 | |
|---|
| 220 | end subroutine ini_tracer_mod |
|---|
| 221 | |
|---|
| 222 | subroutine end_tracer_mod |
|---|
| 223 | |
|---|
| 224 | implicit none |
|---|
| 225 | |
|---|
| 226 | if (allocated(noms)) deallocate(noms) |
|---|
| 227 | if (allocated(mmol)) deallocate(mmol) |
|---|
| 228 | if (allocated(radius)) deallocate(radius) |
|---|
| 229 | if (allocated(rho_q)) deallocate(rho_q) |
|---|
| 230 | if (allocated(alpha_lift)) deallocate(alpha_lift) |
|---|
| 231 | if (allocated(alpha_devil)) deallocate(alpha_devil) |
|---|
| 232 | if (allocated(igcm_dustbin)) deallocate(igcm_dustbin) |
|---|
| 233 | if (allocated(nqdust)) deallocate(nqdust) |
|---|
| 234 | |
|---|
| 235 | end subroutine end_tracer_mod |
|---|
| 236 | |
|---|
| 237 | end module tracer_mod |
|---|