Changeset 1494 for LMDZ5/trunk
- Timestamp:
- Mar 9, 2011, 11:05:02 AM (14 years ago)
- Location:
- LMDZ5/trunk/libf/phylmd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phylmd/cv3_routines.F
r1479 r1494 38 38 CHARACTER (LEN=20) :: modname='cv3_param' 39 39 CHARACTER (LEN=80) :: abort_message 40 LOGICAL, SAVE :: FIRST=.TRUE.41 !$OMP THREADPRIVATE(FIRST)42 43 40 44 41 c noff: integer limit for convection (nd-noff) … … 103 100 CLOSE(99) 104 101 9999 Continue 105 if (first) then 106 WRITE(*,*)'dpbase=',dpbase 107 WRITE(*,*)'pbcrit=',pbcrit 108 WRITE(*,*)'ptcrit=',ptcrit 109 WRITE(*,*)'sigdz=',sigdz 110 WRITE(*,*)'spfac=',spfac 111 endif 102 WRITE(*,*)'dpbase=',dpbase 103 WRITE(*,*)'pbcrit=',pbcrit 104 WRITE(*,*)'ptcrit=',ptcrit 105 WRITE(*,*)'sigdz=',sigdz 106 WRITE(*,*)'spfac=',spfac 112 107 113 108 return … … 1055 1050 pden=ptcrit-pbcrit 1056 1051 ep(i,k)=(plcl(i)-p(i,k)-pbcrit)/pden*epmax 1057 ep(i,k)= amax1(ep(i,k),0.0)1052 ep(i,k)=max(ep(i,k),0.0) 1058 1053 ep(i,k)=amin1(ep(i,k),epmax) 1059 1054 sigp(i,k)=spfac … … 1157 1152 enddo 1158 1153 1159 do 53 0 i=1,ncum1160 do 53 5 k=1,nl-11154 do 535 k=1,nl-1 1155 do 530 i=1,ncum 1161 1156 if ((k.ge.iposit(i)).and.(buoy(i,k).lt.dtovsh)) then 1162 1157 inb(i)=MIN(inb(i),k) 1163 1158 endif 1164 53 5continue1165 53 0continue1166 1159 530 continue 1160 535 continue 1161 c 1167 1162 c-- end convect3 1168 1163 … … 1354 1349 if (k.le.icb(i))then 1355 1350 sig(i,k)=beta*sig(i,k)-2.*alpha*buoy(i,icb(i))*buoy(i,icb(i)) 1356 sig(i,k)= amax1(sig(i,k),0.0)1351 sig(i,k)=max(sig(i,k),0.0) 1357 1352 w0(i,k)=beta*w0(i,k) 1358 1353 endif … … 1364 1359 c! sig(i)=beta*sig(i)+2.*alpha*buoy(inb)* 1365 1360 c! 1 abs(buoy(inb)) 1366 c! sig(i)= amax1(sig(i),0.0)1361 c! sig(i)=max(sig(i),0.0) 1367 1362 c! w0(i)=beta*w0(i) 1368 1363 c! 85 continue … … 1371 1366 c! do 87 i=1,icb 1372 1367 c! sig(i)=beta*sig(i)-2.*alpha*buoy(icb)*buoy(icb) 1373 c! sig(i)= amax1(sig(i),0.0)1368 c! sig(i)=max(sig(i),0.0) 1374 1369 c! w0(i)=beta*w0(i) 1375 1370 c! 87 continue … … 1436 1431 1437 1432 sig(i,k)=beta*sig(i,k)+alpha*dtmin(i,k)*ABS(dtmin(i,k)) 1438 sig(i,k)= amax1(sig(i,k),0.0)1433 sig(i,k)=max(sig(i,k),0.0) 1439 1434 sig(i,k)=amin1(sig(i,k),0.01) 1440 1435 fac=AMIN1(((dtcrit-dtmin(i,k))/dtcrit),1.0) … … 1496 1491 c! dcape=rrd*buoy(i-1)*deltap/p(i-1) 1497 1492 c! dlnp=deltap/p(i-1) 1498 c! cape= amax1(0.0,cape)1493 c! cape=max(0.0,cape) 1499 1494 c! sigold=sig(i) 1500 1495 … … 1505 1500 1506 1501 c! sig(i)=beta*sig(i)+alpha*dtmin*abs(dtmin) 1507 c! sig(i)= amax1(sig(i),0.0)1502 c! sig(i)=max(sig(i),0.0) 1508 1503 c! sig(i)=amin1(sig(i),0.01) 1509 1504 c! fac=amin1(((dtcrit-dtmin)/dtcrit),1.0) … … 1654 1649 c!!! end do 1655 1650 elij(il,i,j)=altem 1656 elij(il,i,j)= amax1(0.0,elij(il,i,j))1651 elij(il,i,j)=max(0.0,elij(il,i,j)) 1657 1652 ment(il,i,j)=m(il,i)/(1.-sij(il,i,j)) 1658 1653 nent(il,i)=nent(il,i)+1 1659 1654 end if 1660 sij(il,i,j)= amax1(0.0,sij(il,i,j))1655 sij(il,i,j)=max(0.0,sij(il,i,j)) 1661 1656 sij(il,i,j)=amin1(1.0,sij(il,i,j)) 1662 1657 endif ! new … … 1778 1773 wgh=1.0 1779 1774 if(j.gt.i)then 1780 sjmax= amax1(sij(il,i,j+1),smax(il))1775 sjmax=max(sij(il,i,j+1),smax(il)) 1781 1776 sjmax=amin1(sjmax,scrit(il)) 1782 smax(il)= amax1(sij(il,i,j),smax(il))1783 sjmin= amax1(sij(il,i,j-1),smax(il))1777 smax(il)=max(sij(il,i,j),smax(il)) 1778 sjmin=max(sij(il,i,j-1),smax(il)) 1784 1779 sjmin=amin1(sjmin,scrit(il)) 1785 1780 if(sij(il,i,j).lt.(smax(il)-1.0e-16))wgh=0.0 1786 1781 smid=amin1(sij(il,i,j),scrit(il)) 1787 1782 else 1788 sjmax= amax1(sij(il,i,j+1),scrit(il))1789 smid= amax1(sij(il,i,j),scrit(il))1783 sjmax=max(sij(il,i,j+1),scrit(il)) 1784 smid=max(sij(il,i,j),scrit(il)) 1790 1785 sjmin=0.0 1791 1786 if(j.gt.1)sjmin=sij(il,i,j-1) 1792 sjmin= amax1(sjmin,scrit(il))1787 sjmin=max(sjmin,scrit(il)) 1793 1788 endif 1794 1789 delp=abs(sjmax-smid) … … 1804 1799 do il=1,ncum 1805 1800 if (i.ge.icb(il).and.i.le.inb(il).and.lwork(il)) then 1806 asij(il)= amax1(1.0e-16,asij(il))1801 asij(il)=max(1.0e-16,asij(il)) 1807 1802 asij(il)=1.0/asij(il) 1808 1803 asum(il,i)=0.0 … … 1834 1829 do il=1,ncum 1835 1830 if (i.ge.icb(il).and.i.le.inb(il).and.lwork(il)) then 1836 bsum(il,i)= amax1(bsum(il,i),1.0e-16)1831 bsum(il,i)=max(bsum(il,i),1.0e-16) 1837 1832 bsum(il,i)=1.0/bsum(il,i) 1838 1833 endif … … 1951 1946 real tinv, delti 1952 1947 real awat, afac, afac1, afac2, bfac 1953 real pr1, pr2, sigt, b6, c6, revap, tevap,delth1948 real pr1, pr2, sigt, b6, c6, revap, delth 1954 1949 real amfac, amp2, xf, tf, fac2, ur, sru, fac, d, af, bf 1955 1950 real ampmax 1951 real tevap(nloc) 1956 1952 real lvcp(nloc,na) 1957 1953 real h(nloc,na),hm(nloc,na) 1958 1954 real wdtrain(nloc) 1959 logical lwork(nloc) 1955 logical lwork(nloc),mplus(nloc) 1960 1956 1961 1957 … … 1993 1989 1994 1990 do il=1,ncum 1995 lwork(il)=.TRUE. 1996 if(ep(il,inb(il)).lt.0.0001)lwork(il)=.FALSE. 1991 !! lwork(il)=.TRUE. 1992 !! if(ep(il,inb(il)).lt.0.0001)lwork(il)=.FALSE. 1993 lwork(il)= ep(il,inb(il)) .ge. 0.0001 1997 1994 enddo 1998 1999 call zilch(wdtrain,ncum)2000 1995 2001 1996 c *** Set the fractionnal area sigd of precipitating downdraughts … … 2004 1999 enddo 2005 2000 2001 2002 c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2003 c 2004 c *** begin downdraft loop *** 2005 c 2006 c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2007 c 2006 2008 DO 400 i=nl+1,1,-1 2007 2009 … … 2012 2014 if (num1.le.0) goto 400 2013 2015 2016 call zilch(wdtrain,ncum) 2017 2014 2018 c 2015 2019 c *** integrate liquid water equation to find condensed water *** 2016 2020 c *** and condensed water flux *** 2017 2021 c 2018 2019 c2020 c *** begin downdraft loop ***2021 c2022 2023 2022 c 2024 2023 c *** calculate detrained precipitation *** … … 2039 2038 if (i.le.inb(il) .and. lwork(il)) then 2040 2039 awat=elij(il,j,i)-(1.-ep(il,i))*clw(il,i) 2041 awat= amax1(awat,0.0)2040 awat=max(awat,0.0) 2042 2041 if (cvflag_grav) then 2043 2042 wdtrain(il)=wdtrain(il)+grav*awat*ment(il,j,i) … … 2055 2054 c 2056 2055 2057 do 999 il=1,ncum 2058 2056 do 995 il=1,ncum 2059 2057 if (i.le.inb(il) .and. lwork(il)) then 2060 2058 … … 2066 2064 rp(il,i)=0.5*(rp(il,i)+rr(il,i)) 2067 2065 endif 2068 rp(il,i)= amax1(rp(il,i),0.0)2066 rp(il,i)=max(rp(il,i),0.0) 2069 2067 rp(il,i)=amin1(rp(il,i),rs(il,i)) 2070 2068 rp(il,inb(il))=rr(il,inb(il)) … … 2077 2075 rp(il,i-1)=0.5*(rp(il,i-1)+rr(il,i-1)) 2078 2076 rp(il,i-1)=amin1(rp(il,i-1),rs(il,i-1)) 2079 rp(il,i-1)= amax1(rp(il,i-1),0.0)2077 rp(il,i-1)=max(rp(il,i-1),0.0) 2080 2078 afac1=p(il,i)*(rs(il,i)-rp(il,i))/(1.0e4+2000.0*p(il,i)*rs(il,i)) 2081 2079 afac2=p(il,i-1)*(rs(il,i-1)-rp(il,i-1)) … … 2084 2082 endif 2085 2083 if(i.eq.inb(il))afac=0.0 2086 afac= amax1(afac,0.0)2084 afac=max(afac,0.0) 2087 2085 bfac=1./(sigd(il)*wt(il,i)) 2088 2086 c … … 2148 2146 : /(sigd(il)*(ph(il,i)-ph(il,i+1))*100.) 2149 2147 c 2148 endif !(i.le.inb(il) .and. lwork(il)) 2149 995 Continue 2150 c---------------------------------------------------------------- 2151 c 2150 2152 ccc 2151 2153 c *** calculate precipitating downdraft mass flux under *** 2152 2154 c *** hydrostatic approximation *** 2153 2155 c 2154 if (i.ne.1) then 2155 2156 tevap=amax1(0.0,evap(il,i)) 2157 delth=amax1(0.001,(th(il,i)-th(il,i-1))) 2156 Do 996 il = 1,ncum 2157 if (i.le.inb(il) .and. lwork(il) .and. i.ne.1) then 2158 c 2159 tevap(il)=max(0.0,evap(il,i)) 2160 delth=max(0.001,(th(il,i)-th(il,i-1))) 2158 2161 if (cvflag_grav) then 2159 mp(il,i)=100.*ginv*lvcp(il,i)*sigd(il)*tevap 2162 mp(il,i)=100.*ginv*lvcp(il,i)*sigd(il)*tevap(il) 2160 2163 : *(p(il,i-1)-p(il,i))/delth 2161 2164 else 2162 mp(il,i)=10.*lvcp(il,i)*sigd(il)*tevap 2165 mp(il,i)=10.*lvcp(il,i)*sigd(il)*tevap(il) 2163 2166 : *(p(il,i-1)-p(il,i))/delth 2164 2167 endif 2168 c 2169 endif !(i.le.inb(il) .and. lwork(il) .and. i.ne.1) 2170 996 Continue 2171 c---------------------------------------------------------------- 2165 2172 c 2166 2173 c *** if hydrostatic assumption fails, *** … … 2168 2175 c *** and mass flux from two simultaneous differential eqns *** 2169 2176 c 2177 Do 997 il = 1,ncum 2178 if (i.le.inb(il) .and. lwork(il) .and. i.ne.1) then 2179 c 2170 2180 amfac=sigd(il)*sigd(il)*70.0*ph(il,i)*(p(il,i-1)-p(il,i)) 2171 2181 : *(th(il,i)-th(il,i-1))/(tv(il,i)*th(il,i)) 2172 2182 amp2=abs(mp(il,i+1)*mp(il,i+1)-mp(il,i)*mp(il,i)) 2183 c 2173 2184 if(amp2.gt.(0.1*amfac))then 2174 2185 xf=100.0*sigd(il)*sigd(il)*sigd(il)*(ph(il,i)-ph(il,i+1)) … … 2177 2188 af=xf*tf+mp(il,i+1)*mp(il,i+1)*tinv 2178 2189 bf=2.*(tinv*mp(il,i+1))**3+tinv*mp(il,i+1)*xf*tf 2179 : +50.*(p(il,i-1)-p(il,i))*xf*tevap 2190 : +50.*(p(il,i-1)-p(il,i))*xf*tevap(il) 2180 2191 fac2=1.0 2181 2192 if(bf.lt.0.0)fac2=-1.0 … … 2193 2204 mp(il,i)=mp(il,i+1)*tinv+2.*sqrt(af*tinv)*cos(d*tinv) 2194 2205 endif 2195 mp(il,i)= amax1(0.0,mp(il,i))2206 mp(il,i)=max(0.0,mp(il,i)) 2196 2207 2197 2208 if (cvflag_grav) then … … 2199 2210 C il faut diviser par (mp(il,i)*sigd(il)*grav) et non par (mp(il,i)+sigd(il)*0.1). 2200 2211 C Et il faut bien revoir les facteurs 100. 2201 b(il,i-1)=b(il,i)+100.0*(p(il,i-1)-p(il,i))*tevap 2212 b(il,i-1)=b(il,i)+100.0*(p(il,i-1)-p(il,i))*tevap(il) 2202 2213 2 /(mp(il,i)+sigd(il)*0.1) 2203 2214 3 -10.0*(th(il,i)-th(il,i-1))*t(il,i)/(lvcp(il,i) 2204 2215 : *sigd(il)*th(il,i)) 2205 2216 else 2206 b(il,i-1)=b(il,i)+100.0*(p(il,i-1)-p(il,i))*tevap 2217 b(il,i-1)=b(il,i)+100.0*(p(il,i-1)-p(il,i))*tevap(il) 2207 2218 2 /(mp(il,i)+sigd(il)*0.1) 2208 2219 3 -10.0*(th(il,i)-th(il,i-1))*t(il,i)/(lvcp(il,i) 2209 2220 : *sigd(il)*th(il,i)) 2210 2221 endif 2211 b(il,i-1)=amax1(b(il,i-1),0.0) 2212 endif 2222 b(il,i-1)=max(b(il,i-1),0.0) 2223 c 2224 endif !(amp2.gt.(0.1*amfac)) 2213 2225 c 2214 2226 c *** limit magnitude of mp(i) to meet cfl condition *** … … 2216 2228 ampmax=2.0*(ph(il,i)-ph(il,i+1))*delti 2217 2229 amp2=2.0*(ph(il,i-1)-ph(il,i))*delti 2218 ampmax= amin1(ampmax,amp2)2219 mp(il,i)= amin1(mp(il,i),ampmax)2230 ampmax=min(ampmax,amp2) 2231 mp(il,i)=min(mp(il,i),ampmax) 2220 2232 c 2221 2233 c *** force mp to decrease linearly to zero *** … … 2231 2243 endif 2232 2244 2233 360 continue 2234 endif ! i.eq.1 2245 endif ! (i.le.inb(il) .and. lwork(il) .and. i.ne.1) 2246 997 Continue 2247 c---------------------------------------------------------------- 2235 2248 c 2236 2249 c *** find mixing ratio of precipitating downdraft *** 2237 2250 c 2238 2239 if (i.ne.inb(il)) then 2240 2251 Do il = 1,ncum 2252 if (i.lt.inb(il) .and. lwork(il)) then 2253 mplus(il) = mp(il,i).gt.mp(il,i+1) 2254 endif ! (i.lt.inb(il) .and. lwork(il)) 2255 enddo 2256 c 2257 Do 999 il = 1,ncum 2258 if (i.lt.inb(il) .and. lwork(il)) then 2259 c 2241 2260 rp(il,i)=rr(il,i) 2242 2261 2243 if(mp (il,i).gt.mp(il,i+1))then2262 if(mplus(il))then 2244 2263 2245 2264 if (cvflag_grav) then … … 2258 2277 vp(il,i)=vp(il,i)/mp(il,i) 2259 2278 2260 do j=1,ntra 2261 trap(il,i,j)=trap(il,i+1,j)*mp(il,i+1) 2262 : +trap(il,i,j)*(mp(il,i)-mp(il,i+1)) 2263 trap(il,i,j)=trap(il,i,j)/mp(il,i) 2264 end do 2265 2266 else 2279 else ! if (mplus(il)) 2267 2280 2268 2281 if(mp(il,i+1).gt.1.0e-16)then … … 2278 2291 up(il,i)=up(il,i+1) 2279 2292 vp(il,i)=vp(il,i+1) 2280 2281 do j=1,ntra 2282 trap(il,i,j)=trap(il,i+1,j) 2283 end do 2284 2285 endif 2286 endif 2293 endif ! (mp(il,i+1).gt.1.0e-16) 2294 endif ! (mplus(il)) else if (.not.mplus(il)) 2295 c 2287 2296 rp(il,i)=amin1(rp(il,i),rs(il,i)) 2288 rp(il,i)=amax1(rp(il,i),0.0) 2289 2290 endif 2291 endif 2297 rp(il,i)=max(rp(il,i),0.0) 2298 2299 endif ! (i.lt.inb(il) .and. lwork(il)) 2292 2300 999 continue 2301 c---------------------------------------------------------------- 2302 c 2303 c *** find tracer concentrations in precipitating downdraft *** 2304 c 2305 do j=1,ntra 2306 do il = 1,ncum 2307 if (i.lt.inb(il) .and. lwork(il)) then 2308 c 2309 if(mplus(il))then 2310 trap(il,i,j)=trap(il,i+1,j)*mp(il,i+1) 2311 : +trap(il,i,j)*(mp(il,i)-mp(il,i+1)) 2312 trap(il,i,j)=trap(il,i,j)/mp(il,i) 2313 else ! if (mplus(il)) 2314 if(mp(il,i+1).gt.1.0e-16)then 2315 trap(il,i,j)=trap(il,i+1,j) 2316 endif 2317 endif ! (mplus(il)) else if (.not.mplus(il)) 2318 c 2319 endif ! (i.lt.inb(il) .and. lwork(il)) 2320 enddo 2321 end do 2293 2322 2294 2323 400 continue 2324 c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2325 c 2326 c *** end of downdraft loop *** 2327 c 2328 c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2329 c 2295 2330 2296 2331 return … … 2814 2849 do il = 1,ncum 2815 2850 awat(il)=elij(il,k,i)-(1.-ep(il,i))*clw(il,i) 2816 awat(il)= amax1(awat(il),0.0)2851 awat(il)=max(awat(il),0.0) 2817 2852 enddo 2818 2853 c -
LMDZ5/trunk/libf/phylmd/cv3p_mixing.F
r1050 r1494 53 53 real Qmixmin(nloc), Rmixmin(nloc), SQmRmin(nloc) 54 54 real signhpmh(nloc) 55 real Sx, Scrit2 56 integer Jx 55 real Sx(nloc), Scrit2 57 56 real smid(nloc), sjmin(nloc), sjmax(nloc) 58 57 real Sbef(nloc), Sup(nloc), Smin(nloc) … … 240 239 enddo 241 240 242 DO 789 i=minorig+1,nl 241 c--------------------------------------------------------------- 242 DO 789 i=minorig+1,nl !Loop on origin level "i" 243 c--------------------------------------------------------------- 243 244 244 245 num1=0 … … 248 249 if (num1.le.0) goto 789 249 250 251 c 252 cjyg1 Find maximum of SIJ for J>I, if any. 253 c 254 Sx(:) = 0. 255 c 256 DO il = 1,ncum 257 IF ( i.ge.icb(il) .and. i.le.inb(il) ) THEN 258 Signhpmh(il) = sign(1.,hp(il,i)-h(il,i)) 259 Sbef(il) = max(0.,signhpmh(il)) 260 ENDIF 261 ENDDO 262 263 DO j = i+1,nl 264 DO il = 1,ncum 265 IF ( i.ge.icb(il) .and. i.le.inb(il) 266 : .and. j.le.inb(il) ) THEN 267 IF (Sbef(il) .LT. Sij(il,i,j)) THEN 268 Sx(il) = max(Sij(il,i,j),Sx(il)) 269 ENDIF 270 Sbef(il) = Sij(il,i,j) 271 ENDIF 272 ENDDO 273 ENDDO 274 c 250 275 251 276 do 781 il=1,ncum 252 277 if ( i.ge.icb(il) .and. i.le.inb(il) ) then 253 278 lwork(il)=(nent(il,i).ne.0) 254 Signhpmh(il) = sign(1.,hp(il,i)-h(il,i))255 279 qp=qnk(il)-ep(il,i)*clw(il,i) 256 280 anum=h(il,i)-hp(il,i)-lv(il,i)*(qp-rs(il,i)) … … 262 286 alt=qp-rs(il,i)+scrit(il)*(rr(il,i)-qp) 263 287 c 264 cjyg1 Find maximum of SIJ for J>I, if any, andnew critical value Scrit2288 cjyg1 Find new critical value Scrit2 265 289 c such that : Sij > Scrit2 => mixed draught will detrain at J<I 266 290 c Sij < Scrit2 => mixed draught will detrain at J>I 267 291 c 268 Sx = 0. 269 Jx = 0. 270 Sbef(il) = max(0.,signhpmh(il)) 271 DO j = i+1,inb(il) 272 IF (Sbef(il) .LT. Sij(il,i,j)) THEN 273 Sx = max(Sij(il,i,j),Sx) 274 Jx = J 275 ENDIF 276 Sbef(il) = Sij(il,i,j) 277 ENDDO 278 c 279 Scrit2 = min(Scrit(il),Sx)*max(0.,-signhpmh(il)) 292 Scrit2 = min(Scrit(il),Sx(il))*max(0.,-signhpmh(il)) 280 293 : +Scrit(il)*max(0.,signhpmh(il)) 281 294 c … … 293 306 781 continue 294 307 295 do 175 j=minorig,nl 308 c--------------------------------------------------------------- 309 do 175 j=minorig,nl !Loop on destination level "j" 310 c--------------------------------------------------------------- 296 311 297 312 num2=0 -
LMDZ5/trunk/libf/phylmd/thermcell_main.F90
r1403 r1494 80 80 !$OMP THREADPRIVATE(lev_out) 81 81 82 INTEGER ig,k,l,ll 82 INTEGER ig,k,l,ll,ierr 83 83 real zsortie1d(klon) 84 84 INTEGER lmax(klon),lmin(klon),lalim(klon) … … 233 233 ! write(lunout,*)'WARNING thermcell_main f0=max(f0,1.e-2)' 234 234 do ig=1,klon 235 if (prt_level.ge.20) then236 print*,'th_main ig f0',ig,f0(ig)237 endif238 235 f0(ig)=max(f0(ig),1.e-2) 239 236 zmax0(ig)=max(zmax0(ig),40.) … … 241 238 enddo 242 239 240 if (prt_level.ge.20) then 241 do ig=1,ngrid 242 print*,'th_main ig f0',ig,f0(ig) 243 enddo 244 endif 243 245 !----------------------------------------------------------------------- 244 246 ! Calcul de T,q,ql a partir de Tl et qT dans l environnement … … 290 292 !----------------------------------------------------------------------- 291 293 292 do l=1,nlay 293 rho(:,l)=pplay(:,l)/(zpspsk(:,l)*RD*ztv(:,l)) 294 enddo 295 296 !IM 294 rho(:,:)=pplay(:,:)/(zpspsk(:,:)*RD*ztv(:,:)) 295 297 296 if (prt_level.ge.10)write(lunout,*) & 298 297 & 'WARNING thermcell_main rhobarz(:,1)=rho(:,1)' … … 619 618 enddo 620 619 !IM 620 ierr=0 621 621 do ig=1,ngrid 622 622 if (pcon(ig).le.pplay(ig,nlay)) then 623 623 zcon2(ig)=zlay(ig,nlay)-(pcon(ig)-pplay(ig,nlay))/(RG*rho(ig,nlay))/100. 624 ierr=1 625 endif 626 enddo 627 if (ierr==1) then 624 628 abort_message = 'thermcellV0_main: les thermiques vont trop haut ' 625 629 CALL abort_gcm (modname,abort_message,1) 626 627 enddo 630 endif 631 628 632 if (prt_level.ge.1) print*,'14b OK convect8' 629 633 do k=nlay,1,-1 … … 655 659 zf2=zf/(1.-zf) 656 660 ! 657 if (prt_level.ge.10) print*,'14e OK convect8 ig,l,zf,zf2',ig,l,zf,zf2658 !659 if (prt_level.ge.10) print*,'14f OK convect8 ig,l,zha zh zpspsk ',ig,l,zha(ig,l),zh(ig,l),zpspsk(ig,l)660 661 thetath2(ig,l)=zf2*(ztla(ig,l)-zthl(ig,l))**2 661 662 if(zw2(ig,l).gt.1.e-10) then … … 664 665 wth2(ig,l)=0. 665 666 endif 666 ! print*,'wth2=',wth2(ig,l)667 667 wth3(ig,l)=zf2*(1-2.*fraca(ig,l))/(1-fraca(ig,l)) & 668 668 & *zw2(ig,l)*zw2(ig,l)*zw2(ig,l) 669 if (prt_level.ge.10) print*,'14g OK convect8 ig,l,po',ig,l,po(ig,l)670 669 q2(ig,l)=zf2*(zqta(ig,l)*1000.-po(ig,l)*1000.)**2 671 670 !test: on calcul q2/po=ratqsc … … 682 681 enddo 683 682 ! 683 if (prt_level.ge.10) then 684 ig=igout 685 do l=1,nlay 686 print*,'14f OK convect8 ig,l,zha zh zpspsk ',ig,l,zha(ig,l),zh(ig,l),zpspsk(ig,l) 687 print*,'14g OK convect8 ig,l,po',ig,l,po(ig,l) 688 enddo 689 endif 690 684 691 ! print*,'avant calcul ale et alp' 685 692 !calcul de ALE et ALP pour la convection … … 705 712 !initialisations 706 713 ! print*,'ponderation' 707 do ig=1,ngrid 708 fm_tot(ig)=0. 709 enddo 710 do ig=1,ngrid 711 do k=1,klev 712 wght_th(ig,k)=1. 713 enddo 714 enddo 715 do ig=1,ngrid 716 ! lalim_conv(ig)=lmix_bis(ig) 717 !la hauteur de la couche alim_conv = hauteur couche alim_therm 718 lalim_conv(ig)=lalim(ig) 719 ! zentr(ig)=zlev(ig,lalim(ig)) 720 enddo 721 do ig=1,ngrid 722 do k=1,lalim_conv(ig) 723 fm_tot(ig)=fm_tot(ig)+fm(ig,k) 724 enddo 725 enddo 726 do ig=1,ngrid 727 do k=1,lalim_conv(ig) 728 if (fm_tot(ig).gt.1.e-10) then 729 ! wght_th(ig,k)=fm(ig,k)/fm_tot(ig) 730 endif 731 !on pondere chaque couche par a* 732 if (alim_star(ig,k).gt.1.e-10) then 733 wght_th(ig,k)=alim_star(ig,k) 734 else 735 wght_th(ig,k)=1. 736 endif 737 enddo 738 enddo 714 715 fm_tot(:)=0. 716 wght_th(:,:)=1. 717 lalim_conv(:)=lalim(:) 718 719 do k=1,klev 720 do ig=1,ngrid 721 if (k<=lalim_conv(ig)) fm_tot(ig)=fm_tot(ig)+fm(ig,k) 722 enddo 723 enddo 724 725 ! assez bizarre car, si on est dans la couche d'alim et que alim_star et 726 ! plus petit que 1.e-10, on prend wght_th=1. 727 do k=1,klev 728 do ig=1,ngrid 729 if (k<=lalim_conv(ig).and.alim_star(ig,k)>1.e-10) then 730 wght_th(ig,k)=alim_star(ig,k) 731 endif 732 enddo 733 enddo 734 739 735 ! print*,'apres wght_th' 740 736 !test pour prolonger la convection … … 748 744 enddo 749 745 746 750 747 !calcul du ratqscdiff 751 748 if (prt_level.ge.1) print*,'14e OK convect8' … … 753 750 vardiff=0. 754 751 ratqsdiff(:,:)=0. 755 do ig=1,ngrid 756 do l=1,lalim(ig) 752 753 do l=1,klev 754 do ig=1,ngrid 755 if (l<=lalim(ig)) then 757 756 var=var+alim_star(ig,l)*zqta(ig,l)*1000. 758 enddo 759 enddo 757 endif 758 enddo 759 enddo 760 760 761 if (prt_level.ge.1) print*,'14f OK convect8' 761 do ig=1,ngrid 762 do l=1,lalim(ig) 763 zf=fraca(ig,l) 764 zf2=zf/(1.-zf) 765 vardiff=vardiff+alim_star(ig,l) & 766 & *(zqta(ig,l)*1000.-var)**2 767 ! ratqsdiff=ratqsdiff+alim_star(ig,l)* 768 ! s (zqta(ig,l)*1000.-po(ig,l)*1000.)**2 769 enddo 770 enddo 762 763 do l=1,klev 764 do ig=1,ngrid 765 if (l<=lalim(ig)) then 766 zf=fraca(ig,l) 767 zf2=zf/(1.-zf) 768 vardiff=vardiff+alim_star(ig,l)*(zqta(ig,l)*1000.-var)**2 769 endif 770 enddo 771 enddo 772 771 773 if (prt_level.ge.1) print*,'14g OK convect8' 772 774 do l=1,nlay … … 779 781 ! 780 782 !ecriture des fichiers sortie 781 ! print*,'15 OK convect8 '783 ! print*,'15 OK convect8 CCCCCCCCCCCCCCCCCCc' 782 784 783 785 #ifdef wrgrads_thermcell
Note: See TracChangeset
for help on using the changeset viewer.