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