Changeset 1127
- Timestamp:
- Mar 19, 2009, 11:38:04 AM (16 years ago)
- Location:
- LMDZ4/branches/LMDZ4-dev/libf/phylmd
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ4/branches/LMDZ4-dev/libf/phylmd/cv3_cine.F
r879 r1127 33 33 integer ifst(nloc),isublcl(nloc) 34 34 logical lswitch(nloc),lswitch1(nloc),lswitch2(nloc) 35 logical exist_lfc(nloc) 36 real plfc(nloc) 35 37 real dpmax 36 38 real deltap,dcin 37 39 real buoylcl(nloc),tvplcl(nloc),tvlcl(nloc) 38 real p lfc(nloc),p0(nloc)40 real p0(nloc) 39 41 real buoyz(nloc), buoy(nloc,nd) 40 42 c … … 50 52 c Recompute buoyancies 51 53 c-------------------------------------------------------------- 52 DO k = 1,n l54 DO k = 1,nd 53 55 DO il = 1,ncum 56 ! print*,'tvp tv=',tvp(il,k),tv(il,k) 54 57 buoy(il,k) = tvp(il,k) - tv(il,k) 55 58 ENDDO 56 59 ENDDO 57 c58 c---------------------------------------------------------------59 c premiere couche contenant un niveau de flotabilite positive60 c et premiere couche contenant un niveau de flotabilite negative61 c au dessus du niveau de condensation62 c---------------------------------------------------------------63 do il = 1,ncum64 itop(il) =nl-165 ineg(il) = nl-166 enddo67 do 100 k=nl,1,-168 do 110 il=1,ncum69 if (k .ge. icb(il)) then70 if (buoy(il,k) .gt. 0.) then71 itop(il)=k72 else73 ineg(il)=k74 endif75 endif76 110 continue77 100 continue78 c print *,' itop, ineg, icb ',itop(1),ineg(1), icb(1)79 c80 60 c--------------------------------------------------------------- 81 61 c … … 109 89 c 110 90 c--------------------------------------------------------------- 91 c premiere couche contenant un niveau de flotabilite positive 92 c et premiere couche contenant un niveau de flotabilite negative 93 c au dessus du niveau de condensation 94 c--------------------------------------------------------------- 95 do il = 1,ncum 96 itop(il) =nl-1 97 ineg(il) = nl-1 98 exist_lfc(il) = .FALSE. 99 enddo 100 do 100 k=nl-1,1,-1 101 do 110 il=1,ncum 102 if (k .ge. ifst(il)) then 103 if (buoy(il,k) .gt. 0.) then 104 itop(il)=k 105 exist_lfc(il) = .TRUE. 106 else 107 ineg(il)=k 108 endif 109 endif 110 110 continue 111 100 continue 112 c 113 c--------------------------------------------------------------- 114 c When there is no positive buoyancy level, set Plfc, Cina and Cinb 115 c to arbitrary extreme values. 116 c--------------------------------------------------------------- 117 DO il = 1,ncum 118 IF (.NOT.exist_lfc(il)) THEN 119 Plfc(il) = 1.111 120 Cinb(il) = -1111. 121 Cina(il) = -1112. 122 ENDIF 123 ENDDO 124 c 125 c 126 c--------------------------------------------------------------- 111 127 c -- Two cases : BUOYlcl >= 0 and BUOYlcl < 0. 112 128 c--------------------------------------------------------------- … … 118 134 DPMAX = 50. 119 135 DO il = 1,ncum 120 lswitch1(il)=BUOYlcl(il) .GE. 0. 136 lswitch1(il)=BUOYlcl(il) .GE. 0. .AND. exist_lfc(il) 121 137 lswitch(il) = lswitch1(il) 122 138 ENDDO … … 233 249 C 234 250 DO il = 1,ncum 235 lswitch1(il)=BUOYlcl(il) .LT. 0. 251 lswitch1(il)=BUOYlcl(il) .LT. 0. .AND. exist_lfc(il) 236 252 lswitch(il) = lswitch1(il) 237 253 ENDDO … … 239 255 c 2.0.1 Premiere couche ou la flotabilite est negative au dessus du sol 240 256 c ---------------------------------------------------- 241 c au cas ou ilexiste sinon ilow=1 (nk apres)257 c au cas ou elle existe sinon ilow=1 (nk apres) 242 258 c on suppose que la parcelle part de la premiere couche 243 259 c … … 248 264 ENDDO 249 265 c 250 do 200 i=nl,1,-1266 do 200 k=nl,1,-1 251 267 DO il = 1,ncum 252 268 IF (lswitch(il) .AND. k .LE.icb(il)-1) THEN … … 292 308 dcin = RD*(BUOYz(il)+BUOYlcl(il))*deltap/(P0(il)+Plcl(il)) 293 309 CINB(il) = min(0.,dcin) 294 cc print *,'buoyz(il),buoylcl(il),deltap,p0(il),plcl(il),dcin ', 295 cc $ buoyz(il),buoylcl(il),deltap,p0(il),plcl(il),dcin 296 ENDIF 297 ENDDO 298 c print*, 'CINB ',CINB(1),'DCIN ',DCIN,I,BUOYz(1),BUOYlcl(1) 310 ENDIF 311 ENDDO 299 312 c 300 313 DO il = 1,ncum … … 316 329 ENDDO 317 330 c 318 IF (lswitch(1)) THEN319 c print*,'ilow= ',ilow(1),'DCIN0 ',DCIN,P0(1),P(1,ilow(1))320 c print*,'buoy',(BUOY(1,k),k=1,itop(1))321 ENDIF322 331 c 323 332 C Middle part of CINB : integral from P(ilow) to P(isublcl) … … 332 341 ENDIF 333 342 ENDDO 334 c print*, 'CINB ', CINB(1), 'DCIN',DCIN,k,BUOY(1,k),BUOY(1,k+1)335 343 ENDDO 336 344 c … … 345 353 ENDDO 346 354 C 347 c print*, ' CINB ', CINB(1), 'Dcin ',dcin348 355 c 349 356 cc ENDIF … … 439 446 ENDDO 440 447 cc ENDIF 441 c Print *,' Plcl,P(itop-1),P(itop),PLFC,BUOYlcl'442 c $ ,Plcl(1),P(1,itop(1)-1),P(1,itop(1)),PLFC(1),BUOYlcl(1)443 C444 c print*, 'CIN above', CINA(1), 'CIN below',CINB(1)445 448 c 446 449 -
LMDZ4/branches/LMDZ4-dev/libf/phylmd/cv3_routines.F
r1044 r1127 1 1 ! 2 ! $Header $2 ! $Header: /home/cvsroot/LMDZ4/libf/phylmd/cv3_routines.F,v 1.16 2008-11-06 16:29:35 lmdzadmin Exp $ 3 3 ! 4 4 c … … 120 120 121 121 c ori do 110 k=1,nlp 122 do 110 k=1,nl ! convect3 122 ! abderr do 110 k=1,nl ! convect3 123 do 110 k=1,nlp 124 123 125 do 100 i=1,len 124 126 cdebug lv(i,k)= lv0-clmcpv*(t(i,k)-t0) … … 2256 2258 SUBROUTINE cv3_yield(nloc,ncum,nd,na,ntra 2257 2259 : ,icb,inb,delt 2258 : ,t,rr,t_wake,rr_wake, u,v,tra2260 : ,t,rr,t_wake,rr_wake,s_wake,u,v,tra 2259 2261 : ,gz,p,ph,h,hp,lv,cpn,th,th_wake 2260 2262 : ,ep,clw,m,tp,mp,rp,up,vp,trap … … 2283 2285 real t(nloc,nd), rr(nloc,nd), u(nloc,nd), v(nloc,nd) 2284 2286 real t_wake(nloc,nd), rr_wake(nloc,nd) 2287 real s_wake(nloc) 2285 2288 real tra(nloc,nd,ntra), sig(nloc,nd) 2286 2289 real gz(nloc,na), ph(nloc,nd+1), h(nloc,na), hp(nloc,na) … … 2327 2330 real esum(nloc), fsum(nloc), gsum(nloc), hsum(nloc) 2328 2331 real th_wake(nloc,nd) 2332 real alpha_qpos(nloc) 2329 2333 real qcond(nloc,nd), nqcond(nloc,nd), wa(nloc,nd) ! cld 2330 2334 real siga(nloc,nd), sax(nloc,nd), mac(nloc,nd) ! cld … … 2961 2965 c *** integrated enthalpy and water tendencies *** 2962 2966 c 2967 c Correction bug le 18-03-09 2963 2968 do 503 il=1,ncum 2964 2969 IF (iflag(il) .le. 1) THEN 2965 ax=0.1*ment(il,inb(il),inb(il))*(hp(il,inb(il))-h(il,inb(il))2966 : +t(il,inb(il))*(cpv-cpd)2970 ax=0.1*ment(il,inb(il),inb(il))*(hp(il,inb(il)) 2971 : -h(il,inb(il))+t(il,inb(il))*(cpv-cpd) 2967 2972 : *(rr(il,inb(il))-qent(il,inb(il),inb(il)))) 2968 2973 : /(cpn(il,inb(il))*(ph(il,inb(il))-ph(il,inb(il)+1))) … … 3065 3070 enddo 3066 3071 enddo 3072 3073 c 3074 c *** Check that moisture stays positive. If not, scale tendencies 3075 c in order to ensure moisture positivity 3076 DO il = 1,ncum 3077 IF (iflag(il) .le. 1) THEN 3078 alpha_qpos(il) = max(1. , -delt*fr(il,1)/ 3079 : (s_wake(il)*rr_wake(il,1)+(1.-s_wake(il))*rr(il,1))) 3080 ENDIF 3081 ENDDO 3082 DO i = 2,nl 3083 DO il = 1,ncum 3084 IF (iflag(il) .le. 1) THEN 3085 alpha_qpos(il) = max(alpha_qpos(il) , -delt*fr(il,i)/ 3086 : (s_wake(il)*rr_wake(il,i)+(1.-s_wake(il))*rr(il,i))) 3087 ENDIF 3088 ENDDO 3089 ENDDO 3090 DO il = 1,ncum 3091 IF (iflag(il) .le. 1 .and. alpha_qpos(il) .gt. 1.001) THEN 3092 alpha_qpos(il) = alpha_qpos(il)*1.1 3093 ENDIF 3094 ENDDO 3095 DO il = 1,ncum 3096 IF (iflag(il) .le. 1) THEN 3097 sigd(il) = sigd(il)/alpha_qpos(il) 3098 precip(il) = precip(il)/alpha_qpos(il) 3099 ENDIF 3100 ENDDO 3101 DO i = 1,nl 3102 DO il = 1,ncum 3103 IF (iflag(il) .le. 1) THEN 3104 fr(il,i) = fr(il,i)/alpha_qpos(il) 3105 ft(il,i) = ft(il,i)/alpha_qpos(il) 3106 fqd(il,i) = fqd(il,i)/alpha_qpos(il) 3107 ftd(il,i) = ftd(il,i)/alpha_qpos(il) 3108 fu(il,i) = fu(il,i)/alpha_qpos(il) 3109 fv(il,i) = fv(il,i)/alpha_qpos(il) 3110 m(il,i) = m(il,i)/alpha_qpos(il) 3111 mp(il,i) = mp(il,i)/alpha_qpos(il) 3112 Vprecip(il,i) = Vprecip(il,i)/alpha_qpos(il) 3113 ENDIF 3114 ENDDO 3115 ENDDO 3116 DO i = 1,nl 3117 DO j = 1,nl 3118 DO il = 1,ncum 3119 IF (iflag(il) .le. 1) THEN 3120 ment(il,i,j) = ment(il,i,j)/alpha_qpos(il) 3121 ENDIF 3122 ENDDO 3123 ENDDO 3124 ENDDO 3125 DO j = 1,ntra 3126 DO i = 1,nl 3127 DO il = 1,ncum 3128 IF (iflag(il) .le. 1) THEN 3129 ftra(il,i,j) = ftra(il,i,j)/alpha_qpos(il) 3130 ENDIF 3131 ENDDO 3132 ENDDO 3133 ENDDO 3134 3067 3135 c 3068 3136 c *** reset counter and return *** -
LMDZ4/branches/LMDZ4-dev/libf/phylmd/cv3a_compress.F
r972 r1127 3 3 : ,plcl1,tnk1,qnk1,gznk1,hnk1,unk1,vnk1 4 4 : ,wghti1,pbase1,buoybase1 5 : ,t1,q1,qs1,t1_wake,q1_wake,qs1_wake,u1,v1,gz1,th1,th1_wake 5 : ,t1,q1,qs1,t1_wake,q1_wake,qs1_wake,s1_wake 6 : ,u1,v1,gz1,th1,th1_wake 6 7 : ,tra1 7 8 : ,h1 ,lv1 ,cpn1 ,p1,ph1,tv1 ,tp1,tvp1,clw1 … … 12 13 o ,plcl,tnk,qnk,gznk,hnk,unk,vnk 13 14 o ,wghti,pbase,buoybase 14 o ,t,q,qs,t_wake,q_wake,qs_wake,u,v,gz,th,th_wake 15 o ,t,q,qs,t_wake,q_wake,qs_wake,s_wake 16 o ,u,v,gz,th,th_wake 15 17 o ,tra 16 18 o ,h ,lv ,cpn ,p,ph,tv ,tp,tvp,clw … … 39 41 real t1(len,nd),q1(len,nd),qs1(len,nd) 40 42 real t1_wake(len,nd),q1_wake(len,nd),qs1_wake(len,nd) 43 real s1_wake(len) 41 44 real u1(len,nd),v1(len,nd) 42 45 real gz1(len,nd),th1(len,nd),th1_wake(len,nd) … … 58 61 real t(len,nd),q(len,nd),qs(len,nd) 59 62 real t_wake(len,nd),q_wake(len,nd),qs_wake(len,nd) 63 real s_wake(len) 60 64 real u(len,nd),v(len,nd) 61 65 real gz(len,nd),th(len,nd),th_wake(len,nd) … … 131 135 if(iflag1(i).eq.0)then 132 136 nn=nn+1 137 s_wake(nn)=s1_wake(i) 133 138 iflag(nn)=iflag1(i) 134 139 nk(nn)=nk1(i) -
LMDZ4/branches/LMDZ4-dev/libf/phylmd/cva_driver.F
r1062 r1127 2 2 & iflag_con,iflag_mix, 3 3 & iflag_clos,delt, 4 & t1,q1,qs1,t1_wake,q1_wake,qs1_wake, 4 & t1,q1,qs1,t1_wake,q1_wake,qs1_wake,s1_wake, 5 5 & u1,v1,tra1, 6 6 & p1,ph1, … … 50 50 C q1_wake Real Input specific hum(unsat draught envt) 51 51 C qs1_wake Real Input sat specific hum(unsat draughts envt) 52 C s1_wake Real Input fractionnal area covered by wakes 52 53 C u1 Real Input u-wind 53 54 C v1 Real Input v-wind … … 121 122 real q1_wake(len,nd) 122 123 real qs1_wake(len,nd) 124 real s1_wake(len) 123 125 real u1(len,nd) 124 126 real v1(len,nd) … … 198 200 ! Must be defined at same grid levels as T. 199 201 ! 202 !s_wake: Array of fractionnal area occupied by the wakes. 203 ! 200 204 ! u: Array of zonal wind velocity (m/s) of dimension ND, witth first 201 205 ! index corresponding with the lowest model level. Defined at … … 358 362 real t(nloc,klev),q(nloc,klev),qs(nloc,klev) 359 363 real t_wake(nloc,klev),q_wake(nloc,klev),qs_wake(nloc,klev) 364 real s_wake(nloc) 360 365 real u(nloc,klev),v(nloc,klev) 361 366 real gz(nloc,klev),h(nloc,klev) ,hm(nloc,klev) … … 531 536 print*,'Emanuel version 3 nouvelle' 532 537 endif 533 538 ! print*,'t1, q1 ',t1,q1 534 539 CALL cv3_prelim(len,nd,ndp1,t1,q1,p1,ph1 ! nd->na 535 540 o ,lv1,cpn1,tv1,gz1,h1,hm1,th1) … … 668 673 669 674 if (iflag_con.eq.3) then 670 675 ! print*,'ncum tv1 ',ncum,tv1 676 ! print*,'tvp1 ',tvp1 671 677 CALL cv3a_compress( len,nloc,ncum,nd,ntra 672 678 : ,iflag1,nk1,icb1,icbs1 673 679 : ,plcl1,tnk1,qnk1,gznk1,hnk1,unk1,vnk1 674 680 : ,wghti1,pbase1,buoybase1 675 : ,t1,q1,qs1,t1_wake,q1_wake,qs1_wake,u1,v1,gz1,th1,th1_wake 681 : ,t1,q1,qs1,t1_wake,q1_wake,qs1_wake,s1_wake 682 : ,u1,v1,gz1,th1,th1_wake 676 683 : ,tra1 677 684 : ,h1 ,lv1 ,cpn1 ,p1,ph1,tv1 ,tp1,tvp1,clw1 … … 682 689 o ,plcl,tnk,qnk,gznk,hnk,unk,vnk 683 690 o ,wghti,pbase,buoybase 684 o ,t,q,qs,t_wake,q_wake,qs_wake,u,v,gz,th,th_wake 691 o ,t,q,qs,t_wake,q_wake,qs_wake,s_wake 692 o ,u,v,gz,th,th_wake 685 693 o ,tra 686 694 o ,h ,lv ,cpn ,p,ph,tv ,tp,tvp,clw … … 688 696 o ,sig,w0,ptop2 689 697 o ,Ale,Alp ) 698 699 ! print*,'tv ',tv 700 ! print*,'tvp ',tvp 690 701 691 702 endif … … 856 867 CALL cv3_yield(nloc,ncum,nd,nd,ntra ! na->nd 857 868 : ,icb,inb,delt 858 : ,t,q,t_wake,q_wake, u,v,tra869 : ,t,q,t_wake,q_wake,s_wake,u,v,tra 859 870 : ,gz,p,ph,h,hp,lv,cpn,th,th_wake 860 871 : ,ep,clw,m,tp,mp,qp,up,vp,trap -
LMDZ4/branches/LMDZ4-dev/libf/phylmd/wake.F
r1059 r1127 12 12 o ,Cstar,d_deltat_gw 13 13 o ,d_deltatw2,d_deltaqw2) 14 14 15 15 16 *************************************************************** … … 157 158 REAL alpk 158 159 REAL delta_t_min 159 REAL Pupper160 160 INTEGER nsub 161 161 REAL dtimesub 162 162 REAL sigmad, hwmin 163 REAL :: sigmaw_max 163 164 cIM 080208 164 165 LOGICAL, dimension(klon) :: gwake … … 183 184 INTEGER, DIMENSION(klon) :: ktop, kupper 184 185 186 c Sub-timestep tendencies and related variables 187 REAL d_deltatw(klon,klev),d_deltaqw(klon,klev) 188 REAL d_te(klon,klev),d_qe(klon,klev) 189 REAL d_sigmaw(klon),alpha(klon) 190 REAL q0_min(klon),q1_min(klon) 191 LOGICAL wk_adv(klon), OK_qx_qw(klon) 192 REAL epsilon 193 DATA epsilon/1.e-9/ 194 185 195 c Autres variables internes 186 196 INTEGER isubstep, k, i … … 202 212 REAL, DIMENSION(klon,klev) :: the, thu 203 213 204 REAL, DIMENSION(klon,klev) :: d_deltatw, d_deltaqw214 ! REAL, DIMENSION(klon,klev) :: d_deltatw, d_deltaqw 205 215 206 216 REAL, DIMENSION(klon,klev+1) :: omgbw 217 REAL, DIMENSION(klon) :: pupper 207 218 REAL, DIMENSION(klon) :: omgtop 208 219 REAL, DIMENSION(klon,klev) :: dp_omgbw … … 279 290 dqls(i,k) = 0. 280 291 d_deltat_gw(i,k)=0. 292 d_te(i,k) = 0. 293 d_qe(i,k) = 0. 294 d_deltatw(i,k) = 0. 295 d_deltaqw(i,k) = 0. 281 296 !IM 060508 beg 282 297 d_deltatw2(i,k)=0. … … 294 309 sigmaw(i) = amin1(sigmaw(i),0.99) 295 310 sigmaw0(i) = sigmaw(i) 311 wape(i) = 0. 312 wape2(i) = 0. 313 d_sigmaw(i) = 0. 314 ktopw(i) = 0 296 315 ENDDO 297 316 C … … 406 425 c 407 426 C Pupper = 50000. ! melting level 408 Pupper = 60000.427 c Pupper = 60000. 409 428 c Pupper = 80000. ! essais pour case_e 429 DO i = 1,klon 430 ccc Pupper(i) = 0.6*ph(i,1) 431 Pupper(i) = 60000. 432 ENDDO 433 410 434 C 411 435 C Determine Wake top pressure (Ptop) from buoyancy integral … … 481 505 DO i=1,klon 482 506 IF (ph(i,k+1) .lt. ptop(i)) ktop(i)=k 483 IF (ph(i,k+1) .lt. pupper ) kupper(i)=k507 IF (ph(i,k+1) .lt. pupper(i)) kupper(i)=k 484 508 ENDDO 485 509 ENDDO … … 622 646 ENDIF 623 647 ENDDO 624 c 625 C 648 649 c 650 c Check qx and qw positivity 651 c -------------------------- 652 DO i = 1,klon 653 q0_min(i)=min( (qe(i,1)-sigmaw(i)*deltaqw(i,1)), 654 $ (qe(i,1)+(1.-sigmaw(i))*deltaqw(i,1)) ) 655 ENDDO 656 DO k = 2,klev 657 DO i = 1,klon 658 q1_min(i)=min( (qe(i,k)-sigmaw(i)*deltaqw(i,k)), 659 $ (qe(i,k)+(1.-sigmaw(i))*deltaqw(i,k)) ) 660 IF (q1_min(i).le.q0_min(i)) THEN 661 q0_min(i)=q1_min(i) 662 ENDIF 663 ENDDO 664 ENDDO 665 c 666 DO i = 1,klon 667 OK_qx_qw(i) = q0_min(i) .GE. 0. 668 alpha(i) = 1. 669 ENDDO 670 c 626 671 CC ----------------------------------------------------------------- 627 672 C Sub-time-stepping … … 634 679 DO isubstep = 1,nsub 635 680 c------------------------------------------------------------ 636 DO i=1,klon 681 c 682 c wk_adv is the logical flag enabling wake evolution in the time advance loop 683 DO i = 1,klon 684 wk_adv(i) = OK_qx_qw(i) .AND. alpha(i) .GE. 1. 685 ENDDO 686 c 687 DO i=1,klon 688 IF (wk_adv(i)) THEN 637 689 gfl(i) = 2.*sqrt(3.14*wdens*sigmaw(i)) 638 ENDDO 639 DO i=1,klon 640 sigmaw(i) =sigmaw(i) + gfl(i)*Cstar(i)*dtimesub 641 sigmaw(i) =amin1(sigmaw(i),0.99) !!!!!!!! 690 ENDIF 691 ENDDO 692 DO i=1,klon 693 IF (wk_adv(i)) THEN 694 d_sigmaw(i) = gfl(i)*Cstar(i)*dtimesub 695 c sigmaw(i) =sigmaw(i) + gfl(i)*Cstar(i)*dtimesub 696 c sigmaw(i) =min(sigmaw(i),0.99) !!!!!!!! 642 697 c wdens = wdens0/(10.*sigmaw) 643 698 c sigmaw =max(sigmaw,sigd_con) 644 699 c sigmaw =max(sigmaw,sigmad) 700 ENDIF 645 701 ENDDO 646 702 C … … 650 706 cIM 060208 et omg sur les niveaux de 1 a klev+1, alors que avant l'on definit 651 707 cIM 060208 au niveau k=1..? 652 dp_deltomg(1:klon,1:klev)=0. 708 DO k= 1,klev 709 DO i = 1,klon 710 dp_deltomg(i,k)=0. 711 ENDDO 712 ENDDO 653 713 DO k= 1,klev+1 654 714 DO i = 1,klon … … 658 718 c 659 719 DO i=1,klon 720 IF (wk_adv(i)) THEN 660 721 z(i)= 0. 661 722 omg(i,1) = 0. 662 723 dp_deltomg(i,1) = -(gfl(i)*Cstar(i))/(sigmaw(i) * (1-sigmaw(i))) 724 ENDIF 663 725 ENDDO 664 726 c 665 727 DO k= 2,klev 666 728 DO i = 1,klon 667 IF( k .LE. ktop(i)) THEN729 IF( wk_adv(i) .AND. k .LE. ktop(i)) THEN 668 730 dz(i) = -(ph(i,k)-ph(i,k-1))/(rho(i,k-1)*rg) 669 731 z(i) = z(i)+dz(i) … … 675 737 c 676 738 DO i = 1,klon 739 IF (wk_adv(i)) THEN 677 740 dztop(i)=-(ptop(i)-ph(i,ktop(i)))/(rho(i,ktop(i))*rg) 678 741 ztop(i) = z(i)+dztop(i) 679 742 omgtop(i)=dp_deltomg(i,1)*ztop(i) 743 ENDIF 680 744 ENDDO 681 745 c … … 685 749 c 686 750 DO i=1,klon 751 IF (wk_adv(i)) THEN 687 752 omgtop(i) = -rho(i,ktop(i))*rg*omgtop(i) 688 753 dp_deltomg(i,1) = omgtop(i)/(ptop(i)-ph(i,1)) 754 ENDIF 689 755 ENDDO 690 756 c 691 757 DO k= 1,klev 692 758 DO i = 1,klon 693 IF( k .LE. ktop(i)) THEN759 IF( wk_adv(i) .AND. k .LE. ktop(i)) THEN 694 760 omg(i,k) = - rho(i,k)*rg*omg(i,k) 695 761 dp_deltomg(i,k) = dp_deltomg(i,1) … … 701 767 702 768 DO i=1,klon 703 IF ( kupper(i) .GT. ktop(i)) THEN769 IF ( wk_adv(i) .AND. kupper(i) .GT. ktop(i)) THEN 704 770 omg(i,kupper(i)+1) = - Rg*amdwn(i,kupper(i)+1)/sigmaw(i) 705 771 $ + Rg*amup(i,kupper(i)+1)/(1.-sigmaw(i)) 706 772 dp_deltomg(i,kupper(i)) = (omgtop(i)-omg(i,kupper(i)+1))/ 707 $ (ptop(i)-pupper )773 $ (ptop(i)-pupper(i)) 708 774 ENDIF 709 775 ENDDO … … 711 777 DO k= 1,klev 712 778 DO i = 1,klon 713 IF( k .GT. ktop(i) .AND. k .LE. kupper(i)) THEN779 IF( wk_adv(i) .AND. k .GT. ktop(i) .AND. k .LE. kupper(i)) THEN 714 780 dp_deltomg(i,k) = dp_deltomg(i,kupper(i)) 715 781 omg(i,k) = omgtop(i)+(ph(i,k)-ptop(i))*dp_deltomg(i,kupper(i)) … … 718 784 ENDDO 719 785 c 786 c 720 787 c-- Compute wake average vertical velocity omgbw 721 788 c … … 723 790 DO k = 1,klev+1 724 791 DO i=1,klon 792 IF ( wk_adv(i)) THEN 725 793 omgbw(i,k) = omgb(i,k)+(1.-sigmaw(i))*omg(i,k) 794 ENDIF 726 795 ENDDO 727 796 ENDDO … … 730 799 DO k = 1,klev 731 800 DO i=1,klon 801 IF ( wk_adv(i)) THEN 732 802 dp_omgbw(i,k) = (omgbw(i,k+1)-omgbw(i,k))/(ph(i,k+1)-ph(i,k)) 803 ENDIF 733 804 ENDDO 734 805 ENDDO … … 739 810 DO k = 1,klev 740 811 DO i=1,klon 741 alpha_up(i,k) = 0. 742 IF (omgb(i,k) .GT. 0.) alpha_up(i,k) = 1. 812 IF ( wk_adv(i)) THEN 813 alpha_up(i,k) = 0. 814 IF (omgb(i,k) .GT. 0.) alpha_up(i,k) = 1. 815 ENDIF 743 816 ENDDO 744 817 ENDDO … … 747 820 748 821 DO i=1,klon 749 RRe1(i) = 1.-sigmaw(i) 750 RRe2(i) = sigmaw(i) 822 IF ( wk_adv(i)) THEN 823 RRe1(i) = 1.-sigmaw(i) 824 RRe2(i) = sigmaw(i) 825 ENDIF 751 826 ENDDO 752 827 RRd1 = -1. … … 757 832 DO k= 1,klev 758 833 DO i = 1,klon 759 IF( k .LE. kupper(i)+1) THEN834 IF( wk_adv(i) .AND. k .LE. kupper(i)+1) THEN 760 835 dth(i,k) = deltatw(i,k)/ppi(i,k) 761 836 Th1(i,k) = the(i,k) - sigmaw(i) *dth(i,k) ! undisturbed area … … 778 853 DO k= 2,klev 779 854 DO i = 1,klon 780 IF( k .LE. kupper(i)+1) THEN855 IF( wk_adv(i) .AND. k .LE. kupper(i)+1) THEN 781 856 D_Th1(i,k) = Th1(i,k-1)-Th1(i,k) 782 857 D_Th2(i,k) = Th2(i,k-1)-Th2(i,k) … … 790 865 791 866 DO i=1,klon 792 omgbdth(i,1) = 0. 793 omgbdq(i,1) = 0. 867 IF( wk_adv(i)) THEN 868 omgbdth(i,1) = 0. 869 omgbdq(i,1) = 0. 870 ENDIF 794 871 ENDDO 795 872 796 873 DO k= 2,klev 797 874 DO i = 1,klon 798 IF( k .LE. kupper(i)+1) THEN ! loop on interfaces875 IF( wk_adv(i) .AND. k .LE. kupper(i)+1) THEN ! loop on interfaces 799 876 omgbdth(i,k) = omgb(i,k)*( dth(i,k-1) - dth(i,k)) 800 877 omgbdq(i,k) = omgb(i,k)*(deltaqw(i,k-1) - deltaqw(i,k)) … … 806 883 DO k= 1,klev 807 884 DO i = 1,klon 808 IF( k .LE. kupper(i)-1) THEN885 IF( wk_adv(i) .AND. k .LE. kupper(i)-1) THEN 809 886 c----------------------------------------------------------------- 810 887 c … … 829 906 c and increment large scale tendencies 830 907 c 831 dtls(i,k) = dtls(i,k) + 832 $ dtimesub*( 908 909 c 910 C 911 CC ----------------------------------------------------------------- 912 d_te(i,k) = dtimesub*( 833 913 $ ( RRe1(i)*omg(i,k )*sigmaw(i) *D_Th1(i,k) 834 914 $ -RRe2(i)*omg(i,k+1)*(1.-sigmaw(i))*D_Th2(i,k+1) ) … … 836 916 $ -sigmaw(i)*(1.-sigmaw(i))*dth(i,k)*dp_deltomg(i,k) 837 917 $ )*ppi(i,k) 838 c print*,'dtls=',dtls(i,k) 839 c 840 dqls(i,k) = dqls(i,k) + 841 $ dtimesub*( 918 c 919 d_qe(i,k) = dtimesub*( 842 920 $ ( RRe1(i)*omg(i,k )*sigmaw(i) *D_q1(i,k) 843 921 $ -RRe2(i)*omg(i,k+1)*(1.-sigmaw(i))*D_q2(i,k+1) ) … … 845 923 $ -sigmaw(i)*(1.-sigmaw(i))*deltaqw(i,k)*dp_deltomg(i,k) 846 924 $ ) 847 c print*,'dqls=',dqls(k) 848 ENDIF 925 ENDIF 926 849 927 c------------------------------------------------------------------- 850 928 ENDDO … … 856 934 DO k= 1,klev 857 935 DO i = 1,klon 858 IF( k .LE. kupper(i)-1) THEN936 IF( wk_adv(i) .AND. k .LE. kupper(i)-1) THEN 859 937 c 860 938 c Coefficient de répartition … … 912 990 913 991 IF (dtimesub*Tgw(i,k).lt.1.e-10) THEN 914 d eltatw(i,k) = deltatw(i,k)+dtimesub*915 $ (ff(i)+dtKE(i,k)+dtPBL(i,k) 992 d_deltatw(i,k) = dtimesub* 993 $ (ff(i)+dtKE(i,k)+dtPBL(i,k) 916 994 $ - spread(i,k)*deltatw(i,k)-Tgw(i,k)*deltatw(i,k)) 917 995 ELSE 918 d eltatw(i,k) = deltatw(i,k)+1/Tgw(i,k)*(1-exp(-dtimesub*996 d_deltatw(i,k) = 1/Tgw(i,k)*(1-exp(-dtimesub* 919 997 $ Tgw(i,k)))* 920 998 $ (ff(i)+dtKE(i,k)+dtPBL(i,k) 921 999 $ - spread(i,k)*deltatw(i,k)-Tgw(i,k)*deltatw(i,k)) 922 1000 ENDIF 923 1001 924 1002 dth(i,k) = deltatw(i,k)/ppi(i,k) 925 1003 926 1004 gg(i)=d_deltaqw(i,k)/dtimesub 927 1005 928 deltaqw(i,k) = deltaqw(i,k) + 929 $ dtimesub*(gg(i)+ dqKE(i,k)+dqPBL(i,k) - spread(i,k)* 930 $ deltaqw(i,k)) 1006 d_deltaqw(i,k) = dtimesub*(gg(i)+ dqKE(i,k)+dqPBL(i,k) 1007 $ - spread(i,k)*deltaqw(i,k)) 931 1008 932 1009 d_deltatw2(i,k)=d_deltatw2(i,k)+d_deltatw(i,k) … … 936 1013 ENDDO 937 1014 938 C And update large scale variables 1015 C 1016 C Scale tendencies so that water vapour remains positive in w and x. 1017 C 1018 call wake_vec_modulation(klon,klev,wk_adv,epsilon,qe,d_qe,deltaqw, 1019 $ d_deltaqw,sigmaw,d_sigmaw,alpha) 1020 c 1021 DO k = 1,klev 1022 DO i = 1,klon 1023 IF( wk_adv(i) .AND. k .LE. kupper(i)) THEN 1024 d_te(i,k)=alpha(i)*d_te(i,k) 1025 d_qe(i,k)=alpha(i)*d_qe(i,k) 1026 d_deltatw(i,k)=alpha(i)*d_deltatw(i,k) 1027 d_deltaqw(i,k)=alpha(i)*d_deltaqw(i,k) 1028 d_deltat_gw(i,k)=alpha(i)*d_deltat_gw(i,k) 1029 ENDIF 1030 ENDDO 1031 ENDDO 1032 DO i = 1,klon 1033 IF( wk_adv(i)) THEN 1034 d_sigmaw(i)=alpha(i)*d_sigmaw(i) 1035 ENDIF 1036 ENDDO 1037 1038 C Update large scale variables and wake variables 939 1039 cIM 060208 manque DO i + remplace DO k=1,kupper(i) 940 1040 cIM 060208 DO k = 1,kupper(i) 941 1041 DO k= 1,klev 942 1042 DO i = 1,klon 943 IF(k .LE. kupper(i)) THEN 1043 IF( wk_adv(i) .AND. k .LE. kupper(i)) THEN 1044 dtls(i,k)=dtls(i,k)+d_te(i,k) 1045 dqls(i,k)=dqls(i,k)+d_qe(i,k) 1046 ENDIF 1047 ENDDO 1048 ENDDO 1049 DO k= 1,klev 1050 DO i = 1,klon 1051 IF( wk_adv(i) .AND. k .LE. kupper(i)) THEN 944 1052 te(i,k) = te0(i,k) + dtls(i,k) 945 1053 qe(i,k) = qe0(i,k) + dqls(i,k) 946 1054 the(i,k) = te(i,k)/ppi(i,k) 947 ENDIF 948 ENDDO 1055 deltatw(i,k) = deltatw(i,k)+d_deltatw(i,k) 1056 deltaqw(i,k) = deltaqw(i,k)+d_deltaqw(i,k) 1057 dth(i,k) = deltatw(i,k)/ppi(i,k) 1058 ENDIF 1059 ENDDO 1060 ENDDO 1061 DO i = 1,klon 1062 IF( wk_adv(i)) THEN 1063 sigmaw(i) = sigmaw(i)+d_sigmaw(i) 1064 ENDIF 949 1065 ENDDO 950 1066 c … … 956 1072 c 957 1073 DO i=1,klon 958 Ptop_provis(i)=ph(i,1) 1074 IF ( wk_adv(i)) THEN 1075 Ptop_provis(i)=ph(i,1) 1076 ENDIF 959 1077 ENDDO 960 1078 c 961 1079 DO k= 2,klev 962 1080 DO i=1,klon 963 IF (Ptop_provis(i) .EQ. ph(i,1) .AND. 1081 IF ( wk_adv(i) .AND. 1082 $ Ptop_provis(i) .EQ. ph(i,1) .AND. 964 1083 $ dth(i,k) .GT. -delta_t_min .and. 965 1084 $ dth(i,k-1).LT. -delta_t_min) THEN … … 981 1100 DO k = 1,klev 982 1101 DO i=1,klon 1102 IF ( wk_adv(i)) THEN 983 1103 dz(i) = -(amax1(ph(i,k+1),Ptop_provis(i))-Ph(i,k))/(rho(i,k)*rg) 984 1104 IF (dz(i) .gt. 0) THEN … … 987 1107 dthmin(i) = amin1(dthmin(i),dth(i,k)) 988 1108 ENDIF 1109 ENDIF 989 1110 ENDDO 990 1111 ENDDO … … 993 1114 994 1115 DO i=1,klon 995 hw(i) = 2.*sum_dth(i)/amin1(dthmin(i),-0.5) 996 hw(i) = amax1(hwmin,hw(i)) 1116 IF ( wk_adv(i)) THEN 1117 hw(i) = 2.*sum_dth(i)/amin1(dthmin(i),-0.5) 1118 hw(i) = amax1(hwmin,hw(i)) 1119 ENDIF 997 1120 ENDDO 998 1121 c … … 1006 1129 DO k = 1,klev 1007 1130 DO i=1,klon 1131 IF ( wk_adv(i)) THEN 1008 1132 dz(i) = amin1(-(ph(i,k+1)-Ph(i,k))/(rho(i,k)*rg),hw(i)-z(i)) 1009 1133 IF (dz(i) .gt. 0) THEN … … 1012 1136 ktop(i) = k 1013 1137 ENDIF 1138 ENDIF 1014 1139 ENDDO 1015 1140 ENDDO … … 1018 1143 c 1019 1144 DO i=1,klon 1145 IF ( wk_adv(i)) THEN 1020 1146 Ptop_new(i)=ptop(i) 1147 ENDIF 1021 1148 ENDDO 1022 1149 c … … 1024 1151 DO i=1,klon 1025 1152 cIM v3JYG; IF (k .GE. ktop(i) 1026 IF (k .LE. ktop(i) .AND. 1153 IF ( wk_adv(i) .AND. 1154 $ k .LE. ktop(i) .AND. 1027 1155 $ ptop_new(i) .EQ. ptop(i) .AND. 1028 1156 $ dth(i,k) .GT. -delta_t_min .and. … … 1037 1165 c 1038 1166 DO i=1,klon 1039 ptop(i) = ptop_new(i) 1167 IF ( wk_adv(i)) THEN 1168 ptop(i) = ptop_new(i) 1169 ENDIF 1040 1170 ENDDO 1041 1171 … … 1050 1180 DO k = 1,klev 1051 1181 DO i=1,klon 1052 IF ( k .GE. kupper(i)) THEN1182 IF ( wk_adv(i) .AND. k .GE. kupper(i)) THEN 1053 1183 deltatw(i,k) = 0. 1054 1184 deltaqw(i,k) = 0. … … 1058 1188 c 1059 1189 C 1190 c-------------Cstar computation--------------------------------- 1191 DO i=1, klon 1192 sum_thu(i) = 0. 1193 sum_tu(i) = 0. 1194 sum_qu(i) = 0. 1195 sum_thvu(i) = 0. 1196 sum_dth(i) = 0. 1197 sum_dq(i) = 0. 1198 sum_rho(i) = 0. 1199 sum_dtdwn(i) = 0. 1200 sum_dqdwn(i) = 0. 1201 1202 av_thu(i) = 0. 1203 av_tu(i) =0. 1204 av_qu(i) =0. 1205 av_thvu(i) = 0. 1206 av_dth(i) = 0. 1207 av_dq(i) = 0. 1208 av_rho(i) =0. 1209 av_dtdwn(i) =0. 1210 av_dqdwn(i) = 0. 1211 ENDDO 1212 C 1213 C Integrals (and wake top level number) 1214 C -------------------------------------- 1215 C 1216 C Initialize sum_thvu to 1st level virt. pot. temp. 1217 1218 DO i=1,klon 1219 z(i) = 1. 1220 dz(i) = 1. 1221 sum_thvu(i) = thu(i,1)*(1.+eps*qu(i,1))*dz(i) 1222 sum_dth(i) = 0. 1223 ENDDO 1224 1225 DO k = 1,klev 1226 DO i=1,klon 1227 dz(i) = -(max(ph(i,k+1),ptop(i))-ph(i,k))/(rho(i,k)*rg) 1228 IF (dz(i) .GT. 0) THEN 1229 z(i) = z(i)+dz(i) 1230 sum_thu(i) = sum_thu(i) + thu(i,k)*dz(i) 1231 sum_tu(i) = sum_tu(i) + tu(i,k)*dz(i) 1232 sum_qu(i) = sum_qu(i) + qu(i,k)*dz(i) 1233 sum_thvu(i) = sum_thvu(i) + thu(i,k)*(1.+eps*qu(i,k))*dz(i) 1234 sum_dth(i) = sum_dth(i) + dth(i,k)*dz(i) 1235 sum_dq(i) = sum_dq(i) + deltaqw(i,k)*dz(i) 1236 sum_rho(i) = sum_rho(i) + rhow(i,k)*dz(i) 1237 sum_dtdwn(i) = sum_dtdwn(i) + dtdwn(i,k)*dz(i) 1238 sum_dqdwn(i) = sum_dqdwn(i) + dqdwn(i,k)*dz(i) 1239 ENDIF 1240 ENDDO 1241 ENDDO 1242 c 1243 DO i=1,klon 1244 hw0(i) = z(i) 1245 ENDDO 1246 c 1247 C 1248 C - WAPE and mean forcing computation 1249 C --------------------------------------- 1250 C 1251 C --------------------------------------- 1252 C 1253 C Means 1254 1255 DO i=1,klon 1256 av_thu(i) = sum_thu(i)/hw0(i) 1257 av_tu(i) = sum_tu(i)/hw0(i) 1258 av_qu(i) = sum_qu(i)/hw0(i) 1259 av_thvu(i) = sum_thvu(i)/hw0(i) 1260 av_dth(i) = sum_dth(i)/hw0(i) 1261 av_dq(i) = sum_dq(i)/hw0(i) 1262 av_rho(i) = sum_rho(i)/hw0(i) 1263 av_dtdwn(i) = sum_dtdwn(i)/hw0(i) 1264 av_dqdwn(i) = sum_dqdwn(i)/hw0(i) 1265 c 1266 wape(i) = - rg*hw0(i)*(av_dth(i) 1267 $ + eps*(av_thu(i)*av_dq(i)+av_dth(i)*av_qu(i)+av_dth(i)* 1268 $ av_dq(i) ))/av_thvu(i) 1269 ENDDO 1270 C 1271 C Filter out bad wakes 1272 1273 DO k = 1,klev 1274 DO i=1,klon 1275 IF ( wape(i) .LT. 0.) THEN 1276 deltatw(i,k) = 0. 1277 deltaqw(i,k) = 0. 1278 dth(i,k) = 0. 1279 ENDIF 1280 ENDDO 1281 ENDDO 1282 c 1283 DO i=1,klon 1284 IF ( wape(i) .LT. 0.) THEN 1285 wape(i) = 0. 1286 Cstar(i) = 0. 1287 hw(i) = hwmin 1288 sigmaw(i) = max(sigmad,sigd_con(i)) 1289 fip(i) = 0. 1290 gwake(i) = .FALSE. 1291 ELSE 1292 Cstar(i) = stark*sqrt(2.*wape(i)) 1293 gwake(i) = .TRUE. 1294 ENDIF 1295 ENDDO 1296 1060 1297 ENDDO ! end sub-timestep loop 1061 1298 C … … 1065 1302 DO k = 1,klev 1066 1303 DO i=1,klon 1067 IF ( k .LE. kupper(i)-1) THEN1304 IF ( wk_adv(i) .AND. k .LE. kupper(i)-1) THEN 1068 1305 dtls(i,k) = dtls(i,k)/dtime 1069 1306 dqls(i,k) = dqls(i,k)/dtime … … 1111 1348 DO k =1,klev 1112 1349 DO i=1,klon 1350 IF ( wk_adv(i)) THEN 1113 1351 rho(i,k) = p(i,k)/(rd*te(i,k)) 1114 1352 IF(k .eq. 1) THEN … … 1125 1363 rhow(i,k) = p(i,k)/(rd*(te(i,k)+deltatw(i,k))) 1126 1364 dth(i,k) = deltatw(i,k)/ppi(i,k) 1365 ENDIF 1127 1366 ENDDO 1128 1367 ENDDO … … 1134 1373 1135 1374 DO i=1,klon 1375 IF ( wk_adv(i)) THEN 1136 1376 z(i) = 1. 1137 1377 dz(i) = 1. 1138 1378 sum_thvu(i) = thu(i,1)*(1.+eps*qu(i,1))*dz(i) 1139 1379 sum_dth(i) = 0. 1380 ENDIF 1140 1381 ENDDO 1141 1382 1142 1383 DO k = 1,klev 1143 1384 DO i=1,klon 1385 IF ( wk_adv(i)) THEN 1144 1386 dz(i) = -(amax1(ph(i,k+1),ptop(i))-ph(i,k))/(rho(i,k)*rg) 1145 1387 IF (dz(i) .GT. 0) THEN … … 1155 1397 sum_dqdwn(i) = sum_dqdwn(i) + dqdwn(i,k)*dz(i) 1156 1398 ENDIF 1157 ENDDO 1158 ENDDO 1159 c 1160 DO i=1,klon 1399 ENDIF 1400 ENDDO 1401 ENDDO 1402 c 1403 DO i=1,klon 1404 IF ( wk_adv(i)) THEN 1161 1405 hw0(i) = z(i) 1162 ENDDO 1163 c 1164 C 2.1 - WAPE and mean forcing computation 1406 ENDIF 1407 ENDDO 1408 c 1409 C - WAPE and mean forcing computation 1165 1410 C------------------------------------------------------------- 1166 1411 … … 1168 1413 1169 1414 DO i=1, klon 1415 IF ( wk_adv(i)) THEN 1170 1416 av_thu(i) = sum_thu(i)/hw0(i) 1171 1417 av_tu(i) = sum_tu(i)/hw0(i) … … 1181 1427 $ + eps*(av_thu(i)*av_dq(i)+av_dth(i)*av_qu(i)+ 1182 1428 $ av_dth(i)*av_dq(i) ))/av_thvu(i) 1183 ENDDO 1184 1185 C 2.2 Prognostic variable update 1429 ENDIF 1430 ENDDO 1431 1432 C Prognostic variable update 1186 1433 C ------------------------------------------------------------ 1187 1434 … … 1190 1437 DO k = 1,klev 1191 1438 DO i=1,klon 1192 IF ( w ape2(i) .LT. 0.) THEN1439 IF ( wk_adv(i) .AND. wape2(i) .LT. 0.) THEN 1193 1440 deltatw(i,k) = 0. 1194 1441 deltaqw(i,k) = 0. … … 1200 1447 1201 1448 DO i=1, klon 1202 IF ( wape2(i) .LT. 0.) THEN 1449 IF ( wk_adv(i)) THEN 1450 IF ( wape2(i) .LT. 0.) THEN 1203 1451 wape2(i) = 0. 1204 1452 Cstar2(i) = 0. … … 1212 1460 gwake(i) = .TRUE. 1213 1461 ENDIF 1462 ENDIF 1214 1463 ENDDO 1215 1464 c 1216 1465 DO i=1, klon 1466 IF ( wk_adv(i)) THEN 1217 1467 ktopw(i) = ktop(i) 1468 ENDIF 1218 1469 ENDDO 1219 1470 c 1220 1471 DO i=1, klon 1221 IF (ktopw(i) .gt. 0 .and. gwake(i)) then 1472 IF ( wk_adv(i)) THEN 1473 IF (ktopw(i) .gt. 0 .and. gwake(i)) then 1222 1474 1223 1475 Cjyg1 Utilisation d'un h_efficace constant ( ~ feeding layer) … … 1234 1486 FIP(i) = 0. 1235 1487 ENDIF 1488 ENDIF 1236 1489 ENDDO 1237 1490 c … … 1241 1494 C alors il disparait en se mélangeant à la partie undisturbed 1242 1495 c 1496 sigmaw_max = 0.9 1243 1497 DO k = 1,klev 1244 1498 DO i=1, klon 1245 IF ((sigmaw(i).GT.0.9).or. 1499 c correction NICOLAS $ ((wape(i).ge.wape2(i)).and.(wape2(i).le.1.0))) THEN 1500 ! print*,'wape wape2 ktopw OK_qx_qw =', 1501 ! $ wape(i),wape2(i),ktopw(i),OK_qx_qw(i) 1502 IF ((sigmaw(i).GT.sigmaw_max).or. 1246 1503 $ ((wape(i).ge.wape2(i)).and.(wape2(i).le.1.0)).or. 1247 $ (ktopw(i).le.2)) THEN 1504 $ (ktopw(i).le.2) .OR. 1505 $ .not. OK_qx_qw(i)) THEN 1248 1506 cIM cf NR/JYG 251108 $ ((wape(i).ge.wape2(i)).and.(wape2(i).le.1.0))) THEN 1249 1507 ccc IF (sigmaw(i).GT.0.9) THEN … … 1257 1515 c 1258 1516 DO i=1, klon 1259 IF ((sigmaw(i).GT.0.9).or. 1260 $ ((wape(i).ge.wape2(i)).and.(wape2(i).le.1.0))) THEN 1517 IF ( (sigmaw(i).GT.sigmaw_max).or. 1518 $ ((wape(i).ge.wape2(i)).and.(wape2(i).le.1.0)).or. 1519 $ (ktopw(i).le.2) .OR. 1520 $ .not. OK_qx_qw(i)) THEN 1521 ! correction NICOLAS $ ((wape(i).ge.wape2(i)).and.(wape2(i).le.1.0))) THEN 1261 1522 ccc IF (sigmaw(i).GT.0.9) THEN 1262 1523 wape(i) = 0. … … 1272 1533 RETURN 1273 1534 END 1535 1536 SUBROUTINE wake_vec_modulation(nlon,nl,wk_adv,epsilon,qe,d_qe, 1537 $ deltaqw,d_deltaqw,sigmaw,d_sigmaw,alpha) 1538 c------------------------------------------------------ 1539 cDtermination du coefficient alpha tel que les tendances 1540 c corriges alpha*d_G, pour toutes les grandeurs G, correspondent 1541 c a une humidite positive dans la zone (x) et dans la zone (w). 1542 c------------------------------------------------------ 1543 c 1544 1545 c Input 1546 REAL qe(nlon,nl),d_qe(nlon,nl) 1547 REAL deltaqw(nlon,nl),d_deltaqw(nlon,nl) 1548 REAL sigmaw(nlon),d_sigmaw(nlon) 1549 LOGICAL wk_adv(nlon) 1550 INTEGER nl,nlon 1551 c Output 1552 REAL alpha(nlon) 1553 c Internal variables 1554 REAL alpha1(nlon) 1555 REAL x,a,b,c,discrim,zeta(nlon) 1556 REAL epsilon 1557 ! DATA epsilon/1.e-9/ 1558 c 1559 DO k=1,nl 1560 DO i = 1,nlon 1561 IF (wk_adv(i)) THEN 1562 IF ((deltaqw(i,k)+d_deltaqw(i,k)).ge.0.) then 1563 zeta(i)=0. 1564 ELSE 1565 zeta(i)=1. 1566 END IF 1567 ENDIF 1568 ENDDO 1569 DO i = 1,nlon 1570 IF (wk_adv(i)) THEN 1571 x = qe(i,k)+(zeta(i)-sigmaw(i))*deltaqw(i,k) 1572 $ +d_qe(i,k)+(zeta(i)-sigmaw(i))*d_deltaqw(i,k) 1573 $ -d_sigmaw(i)*(deltaqw(i,k)+d_deltaqw(i,k)) 1574 a=-d_sigmaw(i)*d_deltaqw(i,k) 1575 b=d_qe(i,k)+(zeta(i)-sigmaw(i))*d_deltaqw(i,k) 1576 $ -deltaqw(i,k)*d_sigmaw(i) 1577 ! c=qe(i,k)+(zeta(i)-sigmaw(i))*deltaqw(i,k)-epsilon 1578 c=qe(i,k)+(zeta(i)-sigmaw(i))*deltaqw(i,k) 1579 1580 discrim=b*b-4.*a*c 1581 ! print*,'ZETA *********************' 1582 ! print*,'zeta sigmaw ',zeta(:) 1583 ! print*,'SIGMA *********************' 1584 ! print*,'sigmaw ',sigmaw(:) 1585 1586 ! print*,' x ************************' 1587 ! print*,'x ',x 1588 ! print*,' a+b ************************' 1589 ! print*,'a+b ',a+b 1590 1591 ! print*,'a b c delta zeta ',a,b,c,discrim 1592 IF (a+b .GE. 0.) THEN 1593 alpha1(i)=1. 1594 ELSE 1595 IF (x .GE. 0.) THEN 1596 alpha1(i)=1. 1597 ELSE 1598 ! IF (a .GE. 0.) THEN 1599 IF (a .GT. 0.) THEN 1600 ! print*,'a b c delta zeta ',a,b,c,discrim,zeta(i) 1601 ! print*,'-b+sqrt(discrim) ',-b+sqrt(discrim) 1602 alpha1(i)=0.9*min( (2.*c)/(-b+sqrt(discrim)), 1603 $ (-b+sqrt(discrim))/(2.*a) ) 1604 ELSE IF (a.eq.0.) THEN 1605 alpha1(i)=0.9*(-c/b) 1606 ELSE 1607 ! print*,'a b c delta zeta ',a,b,c,discrim,zeta(i) 1608 ! print*,'-b+sqrt(discrim) ',-b+sqrt(discrim) 1609 alpha1(i)=0.9*max( (2.*c)/(-b+sqrt(discrim)), 1610 $ (-b+sqrt(discrim))/(2.*a) ) 1611 ENDIF 1612 ENDIF 1613 ENDIF 1614 ENDIF 1615 ENDDO 1616 ENDDO 1617 c 1618 DO i = 1,nlon 1619 IF (wk_adv(i)) THEN 1620 alpha(i) = min(alpha(i),alpha1(i)) 1621 ENDIF 1622 ENDDO 1623 c 1624 return 1625 end 1626 1274 1627 Subroutine WAKE_scal (p,ph,ppi,dtime,sigd_con 1275 1628 : ,te0,qe0,omgb … … 2315 2668 C alors il disparait en se mélangeant à la partie undisturbed 2316 2669 2670 ! correction NICOLAS . ((wape.ge.wape2).and.(wape2.le.1.0))) THEN 2317 2671 IF ((sigmaw.GT.0.9).or. 2318 2672 . ((wape.ge.wape2).and.(wape2.le.1.0)).or.(ktopw.le.2)) THEN
Note: See TracChangeset
for help on using the changeset viewer.