[1036] | 1 | module tracer_mod |
---|
| 2 | |
---|
| 3 | implicit none |
---|
| 4 | |
---|
| 5 | ! number of tracers: |
---|
[1224] | 6 | integer,save :: nqmx ! initialized in conf_phys |
---|
[2578] | 7 | |
---|
| 8 | !$OMP THREADPRIVATE(nqmx) |
---|
[1617] | 9 | |
---|
[1974] | 10 | character*30,allocatable,save :: noms(:) ! name of the tracer |
---|
[1036] | 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 | |
---|
[2578] | 17 | !$OMP THREADPRIVATE(noms,mmol,radius,rho_q,alpha_lift, & |
---|
| 18 | !$OMP alpha_devil) |
---|
| 19 | |
---|
[1036] | 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) |
---|
[1617] | 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. |
---|
[2578] | 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) |
---|
[1974] | 33 | |
---|
[1036] | 34 | real,save :: ccn_factor ! ratio of nuclei for water ice particles |
---|
| 35 | |
---|
[2578] | 36 | !$OMP THREADPRIVATE(ccn_factor) |
---|
| 37 | |
---|
[1224] | 38 | INTEGER,ALLOCATABLE,SAVE :: nqdust(:) ! to store the indexes of dust tracers (cf aeropacity) |
---|
[1617] | 39 | real,allocatable,save :: dryness(:)!"Dryness coefficient" for grnd water ice sublimation |
---|
[1224] | 40 | |
---|
[2578] | 41 | !$OMP THREADPRIVATE(nqdust,dryness) |
---|
[1617] | 42 | |
---|
[2578] | 43 | |
---|
[1036] | 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 |
---|
[1974] | 56 | integer,save :: igcm_stormdust_mass ! storm dust mass mixing ratio |
---|
| 57 | integer,save :: igcm_stormdust_number ! storm dust number mixing ratio |
---|
[2199] | 58 | integer,save :: igcm_topdust_mass ! topdust mass mixing ratio |
---|
| 59 | integer,save :: igcm_topdust_number ! topdust number mixing ratio |
---|
| 60 | |
---|
[2578] | 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 | |
---|
[1617] | 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 |
---|
[2589] | 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 |
---|
[2562] | 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 |
---|
[1617] | 72 | |
---|
[2578] | 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 | |
---|
[1036] | 77 | ! water |
---|
| 78 | integer,save :: igcm_h2o_vap ! water vapour |
---|
| 79 | integer,save :: igcm_h2o_ice ! water ice |
---|
[2312] | 80 | integer,save :: igcm_hdo_vap ! hdo vapour |
---|
| 81 | integer,save :: igcm_hdo_ice ! hdo ice |
---|
[1617] | 82 | integer,save :: igcm_co2_ice ! co2 ice |
---|
| 83 | |
---|
[2578] | 84 | !$OMP THREADPRIVATE(igcm_h2o_vap, igcm_h2o_ice, igcm_hdo_vap, igcm_hdo_ice, & |
---|
| 85 | !$OMP igcm_co2_ice) |
---|
| 86 | |
---|
[1036] | 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 |
---|
[1660] | 105 | integer,save :: igcm_he |
---|
[1036] | 106 | integer,save :: igcm_ch4 |
---|
[2578] | 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 | |
---|
[2461] | 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 |
---|
[2578] | 118 | |
---|
| 119 | !$OMP THREADPRIVATE(igcm_od,igcm_d,igcm_hd, igcm_do2,igcm_hdo2) |
---|
| 120 | |
---|
[1036] | 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 |
---|
[2284] | 132 | integer,save :: igcm_hcoplus |
---|
[2302] | 133 | integer,save :: igcm_h2oplus |
---|
[2321] | 134 | integer,save :: igcm_h3oplus |
---|
| 135 | integer,save :: igcm_ohplus |
---|
[1036] | 136 | integer,save :: igcm_elec |
---|
[2578] | 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 | |
---|
[1036] | 142 | ! other tracers |
---|
| 143 | integer,save :: igcm_ar_n2 ! for simulations using co2 +neutral gas |
---|
[2322] | 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 |
---|
[2578] | 147 | |
---|
| 148 | !$OMP THREADPRIVATE(igcm_ar_n2,nqperes,nqfils) |
---|
| 149 | |
---|
[2322] | 150 | real, parameter :: qperemin=1.e-16 ! threschold for the "pere" mixing ratio qpere to calculate Ratio=qfils/qpere |
---|
[2332] | 151 | real, parameter :: masseqmin=1.e-16 ! threschold for the "pere" transporting masse martian case as there are no gran-sons |
---|
[1036] | 152 | |
---|
| 153 | !----------------------------------------------------------------------- |
---|
| 154 | |
---|
[1621] | 155 | contains |
---|
| 156 | |
---|
[2332] | 157 | subroutine ini_tracer_mod(nq,tname,dyn_nqperes,dyn_nqfils)! MVals: variables isotopes |
---|
[1621] | 158 | implicit none |
---|
| 159 | |
---|
| 160 | integer,intent(in) :: nq ! number of tracers |
---|
| 161 | character(len=*),intent(in) :: tname(nq) ! tracer names |
---|
[2322] | 162 | !MVals: variables isotopes |
---|
| 163 | integer,intent(in) :: dyn_nqperes |
---|
| 164 | integer,intent(in) :: dyn_nqfils(nq) |
---|
[1621] | 165 | |
---|
| 166 | integer :: iq, count |
---|
| 167 | character(len=20) :: txt ! to store some text |
---|
| 168 | |
---|
| 169 | ! set dimension and tracer names |
---|
| 170 | nqmx=nq |
---|
| 171 | allocate(noms(nq)) |
---|
| 172 | do iq=1,nq |
---|
| 173 | noms(iq)=tname(iq) |
---|
| 174 | write(*,*) "tracer_mod names : ", trim(noms(iq)) |
---|
| 175 | enddo |
---|
[2322] | 176 | |
---|
| 177 | !MVals: isotopes variables initialisation |
---|
[2332] | 178 | allocate(nqfils(nq)) |
---|
[2322] | 179 | nqperes=dyn_nqperes |
---|
| 180 | nqfils(:)=dyn_nqfils(:) |
---|
[1633] | 181 | |
---|
| 182 | #ifndef MESOSCALE |
---|
[1621] | 183 | ! check if tracers have 'old' names |
---|
| 184 | count=0 |
---|
| 185 | do iq=1,nq |
---|
| 186 | txt=" " |
---|
| 187 | write(txt,'(a1,i2.2)') 'q',iq |
---|
| 188 | if (txt.eq.tname(iq)) then |
---|
| 189 | count=count+1 |
---|
| 190 | endif |
---|
| 191 | enddo ! of do iq=1,nq |
---|
| 192 | |
---|
[1941] | 193 | if ((count.eq.nq).and.(nq.ne.0)) then |
---|
[1621] | 194 | write(*,*) "ini_tracer_mod: tracers seem to follow old naming ", & |
---|
| 195 | "convention (q01,q02,...)" |
---|
| 196 | write(*,*) "you should run newstart to rename them" |
---|
[1941] | 197 | call abort_physic("ini_tracer_mod","tracer name issue",1) |
---|
[1621] | 198 | endif |
---|
| 199 | #endif |
---|
| 200 | |
---|
| 201 | ! allocate module arrays: |
---|
[1770] | 202 | ! -- not domain-dependent |
---|
[1621] | 203 | allocate(mmol(nq)) |
---|
| 204 | allocate(radius(nq)) |
---|
| 205 | allocate(rho_q(nq)) |
---|
| 206 | allocate(alpha_lift(nq)) |
---|
| 207 | allocate(alpha_devil(nq)) |
---|
| 208 | allocate(igcm_dustbin(nq)) |
---|
| 209 | allocate(nqdust(nq)) |
---|
| 210 | |
---|
| 211 | end subroutine ini_tracer_mod |
---|
| 212 | |
---|
[1770] | 213 | subroutine end_tracer_mod |
---|
| 214 | |
---|
| 215 | implicit none |
---|
| 216 | |
---|
| 217 | if (allocated(noms)) deallocate(noms) |
---|
| 218 | if (allocated(mmol)) deallocate(mmol) |
---|
| 219 | if (allocated(radius)) deallocate(radius) |
---|
| 220 | if (allocated(rho_q)) deallocate(rho_q) |
---|
| 221 | if (allocated(alpha_lift)) deallocate(alpha_lift) |
---|
| 222 | if (allocated(alpha_devil)) deallocate(alpha_devil) |
---|
| 223 | if (allocated(igcm_dustbin)) deallocate(igcm_dustbin) |
---|
| 224 | if (allocated(nqdust)) deallocate(nqdust) |
---|
| 225 | |
---|
| 226 | end subroutine end_tracer_mod |
---|
| 227 | |
---|
[1036] | 228 | end module tracer_mod |
---|