[1452] | 1 | SUBROUTINE concentrations2(pplay,t_seri,pdt,tr_seri, nqmx) |
---|
[1310] | 2 | |
---|
| 3 | use dimphy |
---|
[1452] | 4 | use conc, only: mmean, rho, Akknew, rnew, cpnew |
---|
[1621] | 5 | use cpdet_phy_mod, only: cpdet |
---|
[1442] | 6 | USE chemparam_mod |
---|
| 7 | |
---|
[1310] | 8 | implicit none |
---|
| 9 | |
---|
| 10 | !======================================================================= |
---|
| 11 | ! CALCULATION OF MEAN MOLECULAR MASS, Cp, Akk and R |
---|
| 12 | ! |
---|
| 13 | ! mmean(klon,klev) amu |
---|
| 14 | ! cpnew(klon,klev) J/kg/K |
---|
| 15 | ! rnew(klon,klev) J/kg/K |
---|
| 16 | ! akknew(klon,klev) coefficient of thermal conduction |
---|
| 17 | ! |
---|
| 18 | ! version: April 2012 - Franck Lefevre |
---|
| 19 | !======================================================================= |
---|
| 20 | |
---|
| 21 | ! declarations |
---|
| 22 | |
---|
| 23 | #include "YOMCST.h" |
---|
| 24 | #include "clesphys.h" |
---|
| 25 | c#include "comdiurn.h" |
---|
| 26 | c#include "chimiedata.h" |
---|
| 27 | c#include "tracer.h" |
---|
[1442] | 28 | c#include "mmol.h" |
---|
[1310] | 29 | |
---|
| 30 | ! input/output |
---|
| 31 | |
---|
| 32 | real pplay(klon,klev) |
---|
| 33 | c real pt(klon,klev) |
---|
[1442] | 34 | integer,intent(in) :: nqmx ! number of tracers |
---|
[1310] | 35 | real t_seri(klon, klev) |
---|
| 36 | real pdt(klon,klev) |
---|
[1442] | 37 | real n2vmr_gcm(klon,klev),nvmr_gcm(klon,klev) |
---|
| 38 | real tr_seri(klon,klev,nqmx) |
---|
[1310] | 39 | c real pdq(klon,klev,nqmx) |
---|
| 40 | real ptimestep |
---|
| 41 | |
---|
| 42 | ! local variables |
---|
| 43 | |
---|
| 44 | integer :: i, l, ig, iq |
---|
[1442] | 45 | integer, save :: nbq |
---|
| 46 | integer,allocatable,save :: niq(:) |
---|
| 47 | real :: ni(nqmx), ntot |
---|
[1310] | 48 | real :: zt(klon, klev) |
---|
[1442] | 49 | real :: zq(klon, klev, nqmx) |
---|
| 50 | real,allocatable,save :: aki(:) |
---|
| 51 | real,allocatable,save :: cpi(:) |
---|
| 52 | real, save :: akin,akin2 |
---|
[1310] | 53 | |
---|
| 54 | logical, save :: firstcall = .true. |
---|
| 55 | |
---|
| 56 | if (firstcall) then |
---|
| 57 | |
---|
| 58 | ! initialize thermal conductivity and specific heat coefficients |
---|
| 59 | ! values are taken from the literature [J/kg K] |
---|
| 60 | |
---|
[1442] | 61 | ! allocate local saved arrays: |
---|
| 62 | allocate(aki(nqmx)) |
---|
| 63 | allocate(cpi(nqmx)) |
---|
| 64 | allocate(niq(nqmx)) |
---|
[1310] | 65 | |
---|
[1442] | 66 | ! find index of chemical tracers to use |
---|
| 67 | ! initialize thermal conductivity and specific heat coefficients |
---|
| 68 | ! !? values are estimated |
---|
[1310] | 69 | |
---|
[1442] | 70 | nbq = 0 ! to count number of tracers used in this subroutine |
---|
[1310] | 71 | |
---|
[1442] | 72 | if (i_co2 /= 0) then |
---|
| 73 | nbq = nbq + 1 |
---|
| 74 | niq(nbq) = i_co2 |
---|
| 75 | aki(nbq) = 3.072e-4 |
---|
| 76 | cpi(nbq) = 0.834e3 |
---|
| 77 | end if |
---|
| 78 | if (i_co /= 0) then |
---|
| 79 | nbq = nbq + 1 |
---|
| 80 | niq(nbq) = i_co |
---|
| 81 | aki(nbq) = 4.87e-4 |
---|
| 82 | cpi(nbq) = 1.034e3 |
---|
| 83 | end if |
---|
| 84 | if (i_o /= 0) then |
---|
| 85 | nbq = nbq + 1 |
---|
| 86 | niq(nbq) = i_o |
---|
| 87 | aki(nbq) = 7.59e-4 |
---|
| 88 | cpi(nbq) = 1.3e3 |
---|
| 89 | end if |
---|
| 90 | if (i_o1d /= 0) then |
---|
| 91 | nbq = nbq + 1 |
---|
| 92 | niq(nbq) = i_o1d |
---|
| 93 | aki(nbq) = 7.59e-4 !? |
---|
| 94 | cpi(nbq) = 1.3e3 !? |
---|
| 95 | end if |
---|
| 96 | if (i_o2 /= 0) then |
---|
| 97 | nbq = nbq + 1 |
---|
| 98 | niq(nbq) = i_o2 |
---|
| 99 | aki(nbq) = 5.68e-4 |
---|
| 100 | cpi(nbq) = 0.9194e3 |
---|
| 101 | end if |
---|
| 102 | if (i_o3 /= 0) then |
---|
| 103 | nbq = nbq + 1 |
---|
| 104 | niq(nbq) = i_o3 |
---|
| 105 | aki(nbq) = 3.00e-4 !? |
---|
| 106 | cpi(nbq) = 0.800e3 !? |
---|
| 107 | end if |
---|
| 108 | if (i_h /= 0) then |
---|
| 109 | nbq = nbq + 1 |
---|
| 110 | niq(nbq) = i_h |
---|
| 111 | aki(nbq) = 0.0 |
---|
| 112 | cpi(nbq) = 20.780e3 |
---|
| 113 | end if |
---|
| 114 | if (i_h2 /= 0) then |
---|
| 115 | nbq = nbq + 1 |
---|
| 116 | niq(nbq) = i_h2 |
---|
| 117 | aki(nbq) = 36.314e-4 |
---|
| 118 | cpi(nbq) = 14.266e3 |
---|
| 119 | end if |
---|
| 120 | if (i_oh /= 0) then |
---|
| 121 | nbq = nbq + 1 |
---|
| 122 | niq(nbq) = i_oh |
---|
| 123 | aki(nbq) = 7.00e-4 !? |
---|
| 124 | cpi(nbq) = 1.045e3 |
---|
| 125 | end if |
---|
| 126 | if (i_ho2 /= 0) then |
---|
| 127 | nbq = nbq + 1 |
---|
| 128 | niq(nbq) = i_ho2 |
---|
| 129 | aki(nbq) = 0.0 |
---|
| 130 | cpi(nbq) = 1.065e3 !? |
---|
| 131 | end if |
---|
| 132 | if (i_n2 /= 0) then |
---|
| 133 | nbq = nbq + 1 |
---|
| 134 | niq(nbq) = i_n2 |
---|
| 135 | aki(nbq) = 5.6e-4 |
---|
| 136 | cpi(nbq) = 1.034e3 |
---|
| 137 | end if |
---|
| 138 | c if (i_ar /= 0) then |
---|
| 139 | c nbq = nbq + 1 |
---|
| 140 | c niq(nbq) = i_ar |
---|
| 141 | c aki(nbq) = 0.0 !? |
---|
| 142 | c cpi(nbq) = 1.000e3 !? |
---|
| 143 | c end if |
---|
| 144 | if (i_h2o /= 0) then |
---|
| 145 | nbq = nbq + 1 |
---|
| 146 | niq(nbq) = i_h2o |
---|
| 147 | aki(nbq) = 0.0 |
---|
| 148 | cpi(nbq) = 1.870e3 |
---|
| 149 | end if |
---|
| 150 | c if (i_n /= 0) then |
---|
| 151 | c nbq = nbq + 1 |
---|
| 152 | c niq(nbq) = i_n |
---|
| 153 | c aki(nbq) = 0.0 |
---|
| 154 | c cpi(nbq) = 0.0 |
---|
| 155 | c endif |
---|
| 156 | c if(i_no /= 0) then |
---|
| 157 | c nbq = nbq + 1 |
---|
| 158 | c niq(nbq) = i_no |
---|
| 159 | c aki(nbq) = 0.0 |
---|
| 160 | c cpi(nbq) = 0.0 |
---|
| 161 | c endif |
---|
| 162 | c if(i_no2 /= 0) then |
---|
| 163 | c nbq = nbq + 1 |
---|
| 164 | c niq(nbq) = i_no2 |
---|
| 165 | c aki(nbq) = 0.0 |
---|
| 166 | c cpi(nbq) = 0.0 |
---|
| 167 | c endif |
---|
| 168 | c if(i_n2d /= 0) then |
---|
| 169 | c nbq = nbq + 1 |
---|
| 170 | c niq(nbq) = i_n2d |
---|
| 171 | c aki(nbq) = 0.0 |
---|
| 172 | c cpi(nbq) = 0.0 |
---|
| 173 | c endif |
---|
[1310] | 174 | |
---|
[1442] | 175 | ! tell the world about it: |
---|
| 176 | write(*,*) "concentrations: firstcall, nbq=",nbq |
---|
| 177 | ! write(*,*) " niq(1:nbq)=",niq(1:nbq) |
---|
| 178 | ! write(*,*) " aki(1:nbq)=",aki(1:nbq) |
---|
| 179 | ! write(*,*) " cpi(1:nbq)=",cpi(1:nbq) |
---|
| 180 | |
---|
| 181 | |
---|
[1310] | 182 | firstcall = .false. |
---|
| 183 | end if ! if (firstcall) |
---|
| 184 | |
---|
| 185 | ! update temperature |
---|
| 186 | |
---|
| 187 | do l = 1,klev |
---|
| 188 | do ig = 1,klon |
---|
| 189 | zt(ig,l) = t_seri(ig,l) |
---|
[1442] | 190 | end do |
---|
| 191 | end do |
---|
[1310] | 192 | |
---|
[1442] | 193 | |
---|
| 194 | ! update mass mixing ratio tracers |
---|
| 195 | |
---|
| 196 | do l = 1,klev |
---|
| 197 | do ig = 1,klon |
---|
| 198 | do i = 1,nqmx |
---|
| 199 | ! iq = niq(i) |
---|
| 200 | zq(ig,l,i) = max(1.e-30, tr_seri(ig,l,i)) |
---|
| 201 | end do |
---|
[1310] | 202 | end do |
---|
| 203 | end do |
---|
| 204 | |
---|
| 205 | ! mmean : mean molecular mass |
---|
[1452] | 206 | ! rho : mass density [kg/m3] |
---|
[1310] | 207 | ! rnew : specific gas constant |
---|
[1452] | 208 | |
---|
[1310] | 209 | mmean(:,:) = 0. |
---|
[1452] | 210 | rho(:,:) = 0. |
---|
[1310] | 211 | |
---|
| 212 | do l = 1,klev |
---|
| 213 | do ig = 1,klon |
---|
[1442] | 214 | do i = 1,nqmx |
---|
[1452] | 215 | c iq = niq(i) |
---|
[1442] | 216 | mmean(ig,l) = mmean(ig,l) + zq(ig,l,i)/M_tr(i) |
---|
| 217 | end do |
---|
| 218 | mmean(ig,l) = 1./mmean(ig,l) |
---|
[1591] | 219 | rnew(ig,l) = 8.314/mmean(ig,l)*1.e3 ! J/kg K |
---|
| 220 | c write(*,*),'Mmean in concentration2: ',ig, l, mmean(ig,l) |
---|
[1310] | 221 | end do |
---|
| 222 | end do |
---|
| 223 | |
---|
| 224 | ! cpnew : specific heat |
---|
| 225 | ! akknew : thermal conductivity cofficient |
---|
| 226 | |
---|
[1442] | 227 | cpnew(:,:) = 0. |
---|
| 228 | akknew(:,:) = 0. |
---|
[1310] | 229 | |
---|
| 230 | do l = 1,klev |
---|
| 231 | do ig = 1,klon |
---|
| 232 | |
---|
| 233 | ntot = pplay(ig,l)/(RKBOL*zt(ig,l))*1.e-6 ! in #/cm3 |
---|
[1452] | 234 | rho(ig,l) = (ntot * mmean(ig,l))/RNAVO*1.e3 ! in kg/m3 |
---|
[1310] | 235 | |
---|
[1452] | 236 | c write(*,*),'Air density: ',ig, l, rho(0,l) |
---|
| 237 | |
---|
[1442] | 238 | !! WARNING -> Cp here below doesn't depend on T (cpdet) |
---|
[1310] | 239 | |
---|
[1442] | 240 | do i = 1,nbq |
---|
| 241 | c iq = niq(i) |
---|
| 242 | ni(i) = ntot*zq(ig,l,i)*mmean(ig,l)/M_tr(i) |
---|
| 243 | cpnew(ig,l) = cpnew(ig,l) + ni(i)*cpi(i) |
---|
| 244 | akknew(ig,l) = akknew(ig,l) + ni(i)*aki(i) |
---|
| 245 | end do |
---|
| 246 | |
---|
[1310] | 247 | |
---|
| 248 | cpnew(ig,l) = cpnew(ig,l)/ntot |
---|
| 249 | akknew(ig,l)= akknew(ig,l)/ntot |
---|
| 250 | |
---|
[1442] | 251 | |
---|
[1310] | 252 | end do |
---|
| 253 | end do |
---|
| 254 | |
---|
| 255 | return |
---|
| 256 | end |
---|