c $Header SUBROUTINE CONVECT * (DTIME, T1, R1, RS, U, V, TRA, P, PH, * ND, NDP1, NL, NTRA, DELT, IFLAG, * FT, FR, FU, FV, FTRA, PRECIP, * icb,inb, upwd,dnwd,dnwd0,SIG, W0,Mike,Mke, * Ma,MENTS,QENTS,TPS,TLS,SIGIJ,CAPE,TVP,PBASE,BUOYBASE, * DTVPDT1,DTVPDQ1,DPLCLDT,DPLCLDR) C C *** THE PARAMETER NA SHOULD IN GENERAL EQUAL ND *** C c################################################################# cFleur Introduction des traceurs dans convect3 le 6 juin 200 c################################################################# #include "dimensions.h" #include "dimphy.h" PARAMETER (NA=60) integer NTRAC PARAMETER (NTRAC=nqmx-2) INTEGER NENT(NA) REAL T1(ND),R1(ND),RS(ND),U(ND),V(ND),TRA(ND,NTRA) REAL P(ND),PH(NDP1) REAL FT(ND),FR(ND),FU(ND),FV(ND),FTRA(ND,NTRA) REAL SIG(ND),W0(ND) REAL UENT(NA,NA),VENT(NA,NA),TRAENT(NA,NA,NTRAC),TRATM(NA) REAL UP(NA),VP(NA),TRAP(NA,NTRAC) REAL M(NA),MP(NA),MENT(NA,NA),QENT(NA,NA),ELIJ(NA,NA) REAL SIJ(NA,NA),TVP(NA),TV(NA),WATER(NA) REAL RP(NA),EP(NA),TH(NA),WT(NA),EVAP(NA),CLW(NA) REAL SIGP(NA),B(NA),TP(NA),CPN(NA) REAL LV(NA),LVCP(NA),H(NA),HP(NA),GZ(NA) REAL T(NA),RR(NA) C REAL BUOY(NA) ! Lifted parcel buoyancy REAL DTVPDT1(ND),DTVPDQ1(ND) ! Derivatives of parcel virtual C temperature wrt T1 and Q1 REAL CLW_NEW(NA),QI(NA) C LOGICAL ICE_CONV PARAMETER (ICE_CONV=.TRUE.) cccccccccccccccccccccccccccccccccccccccccccccc c declaration des variables a sortir ccccccccccccccccccccccccccccccccccccccccccccc real Mke(nd) real Mike(nd) real Ma(nd) real TPS(ND) !temperature dans les ascendances non diluees real TLS(ND) !temperature potentielle real MENTS(nd,nd) real QENTS(nd,nd) REAL SIGIJ(KLEV,KLEV) REAL PBASE ! pressure at the cloud base level REAL BUOYBASE ! buoyancy at the cloud base level cccccccccccccccccccccccccccccccccccccccccccccc c real dnwd0(nd) ! precipitation driven unsaturated downdraft flux real dnwd(nd), dn1 ! in-cloud saturated downdraft mass flux real upwd(nd), up1 ! in-cloud saturated updraft mass flux C C *** ASSIGN VALUES OF THERMODYNAMIC CONSTANTS *** C *** THESE SHOULD BE CONSISTENT WITH *** C *** THOSE USED IN CALLING PROGRAM *** C *** NOTE: THESE ARE ALSO SPECIFIED IN SUBROUTINE TLIFT *** C c sb CPD=1005.7 c sb CPV=1870.0 c sb CL=4190.0 c sb CPVMCL=CL-CPV c sb RV=461.5 c sb RD=287.04 c sb EPS=RD/RV c sb ALV0=2.501E6 ccccccccccccccccccccccc c constantes coherentes avec le modele du Centre Europeen c sb RD = 1000.0 * 1.380658E-23 * 6.0221367E+23 / 28.9644 c sb RV = 1000.0 * 1.380658E-23 * 6.0221367E+23 / 18.0153 c sb CPD = 3.5 * RD c sb CPV = 4.0 * RV c sb CL = 4218.0 c sb CPVMCL=CL-CPV c sb EPS=RD/RV c sb ALV0=2.5008E+06 cccccccccccccccccccccc c on utilise les constantes thermo du Centre Europeen: (SB) c #include "YOMCST.h" c CPD = RCPD CPV = RCPV CL = RCW CPVMCL = CL-CPV EPS = RD/RV ALV0 = RLVTT c NK = 1 ! origin level of the lifted parcel c cccccccccccccccccccccc C C *** INITIALIZE OUTPUT ARRAYS AND PARAMETERS *** C DO 5 I=1,ND FT(I)=0.0 FR(I)=0.0 FU(I)=0.0 FV(I)=0.0 DO 4 J=1,NTRA FTRA(I,J)=0.0 4 CONTINUE T(I)=T1(I) RR(I)=R1(I) 5 CONTINUE DO 7 I=1,NL RDCP=(RD*(1.-RR(I))+RR(I)*RV)/ (CPD*(1.-RR(I))+RR(I)*CPV) TH(I)=T(I)*(1000.0/P(I))**RDCP 7 CONTINUE C ************************************************************* ** CALCUL DES TEMPERATURES POTENTIELLES A SORTIR ************************************************************* do i=1,ND RDCP=(RD*(1.-RR(I))+RR(I)*RV)/ (CPD*(1.-RR(I))+RR(I)*CPV) TLS(i)=T(I)*(1000.0/P(I))**RDCP enddo ************************************************************ PRECIP=0.0 IFLAG=1 C C *** SPECIFY PARAMETERS *** C *** PBCRIT IS THE CRITICAL CLOUD DEPTH (MB) BENEATH WHICH THE *** C *** PRECIPITATION EFFICIENCY IS ASSUMED TO BE ZERO *** C *** PTCRIT IS THE CLOUD DEPTH (MB) ABOVE WHICH THE PRECIP. *** C *** EFFICIENCY IS ASSUMED TO BE UNITY *** C *** SIGD IS THE FRACTIONAL AREA COVERED BY UNSATURATED DNDRAFT *** C *** SPFAC IS THE FRACTION OF PRECIPITATION FALLING OUTSIDE *** C *** OF CLOUD *** C *** ALPHA AND BETA ARE PARAMETERS THAT CONTROL THE RATE OF *** C *** APPROACH TO QUASI-EQUILIBRIUM *** C *** (THEIR STANDARD VALUES ARE 1.0 AND 0.96, RESPECTIVELY) *** C *** (BETA MUST BE LESS THAN OR EQUAL TO 1) *** C *** DTCRIT IS THE CRITICAL BUOYANCY (K) USED TO ADJUST THE *** C *** APPROACH TO QUASI-EQUILIBRIUM *** C *** IT MUST BE LESS THAN 0 *** C PBCRIT=150.0 PTCRIT=500.0 SIGD=0.01 SPFAC=0.15 c sb: EPMAX=0.993 ! precip efficiency less than unity c EPMAX=1. ! precip efficiency less than unity C Cjyg CCC BETA=0.96 C Beta is now expressed as a function of the characteristic time C of the convective process. CCC Old value : TAU = 15000. !(for dtime = 600.s) CCC Other value (inducing little change) :TAU = 8000. TAU = 8000. BETA = 1.-DTIME/TAU Cjyg CCC ALPHA=1.0 ALPHA=1.5E-3*DTIME/TAU C Increase alpha in order to compensate W decrease ALPHA = ALPHA*1.5 C Cjyg (voir CONVECT 3) CCC DTCRIT=-0.2 DTCRIT=-2. Cgf&jyg CCC DT pour l'overshoot. DTOVSH = -0.2 C C *** INCREMENT THE COUNTER *** C SIG(ND)=SIG(ND)+1.0 SIG(ND)=AMIN1(SIG(ND),12.1) C C *** IF NOPT IS AN INTEGER OTHER THAN 0, CONVECT *** C *** RETURNS ARRAYS T AND R THAT MAY HAVE BEEN *** C *** ALTERED BY DRY ADIABATIC ADJUSTMENT; OTHERWISE *** C *** THE RETURNED ARRAYS ARE UNALTERED. *** C NOPT=0 C C *** PERFORM DRY ADIABATIC ADJUSTMENT *** C C *** DO NOT BYPASS THIS EVEN IF THE CALLING PROGRAM HAS A *** C *** BOUNDARY LAYER SCHEME !!! *** C c test sb DO 30 I=NL-1,1,-1 c test sb JN=0 c test sb DO 10 J=I+1,NL c test sb 10 IF(TH(J).LT.TH(I))JN=J c test sb IF(JN.EQ.0)GOTO 30 c test sb AHM=0.0 c test sb RM=0.0 c test sb UM=0.0 c test sb VM=0.0 c test sb DO K=1,NTRA c test sb TRATM(K)=0.0 c test sb END DO c test sb DO 15 J=I,JN c test sb AHM=AHM+(CPD*(1.-RR(J))+RR(J)*CPV)*T(J)*(PH(J)-PH(J+1)) c test sb RM=RM+RR(J)*(PH(J)-PH(J+1)) c test sb UM=UM+U(J)*(PH(J)-PH(J+1)) c test sb VM=VM+V(J)*(PH(J)-PH(J+1)) c test sb DO K=1,NTRA c test sb TRATM(K)=TRATM(K)+TRA(J,K)*(PH(J)-PH(J+1)) c test sb END DO c test sb 15 CONTINUE c test sb DPHINV=1./(PH(I)-PH(JN+1)) c test sb RM=RM*DPHINV c test sb UM=UM*DPHINV c test sb VM=VM*DPHINV c test sb DO K=1,NTRA c test sb TRATM(K)=TRATM(K)*DPHINV c test sb END DO c test sb A2=0.0 c test sb DO 20 J=I,JN c test sb RR(J)=RM c test sb U(J)=UM c test sb V(J)=VM c test sb DO K=1,NTRA c test sb TRA(J,K)=TRATM(K) c test sb END DO c test sb RDCP=(RD*(1.-RR(J))+RR(J)*RV)/ (CPD*(1.-RR(J))+RR(J)*CPV) c test sb X=(0.001*P(J))**RDCP c test sb T(J)=X c test sb A2=A2+(CPD*(1.-RR(J))+RR(J)*CPV)*X*(PH(J)-PH(J+1)) c test sb 20 CONTINUE c test sb DO 25 J=I,JN c test sb TH(J)=AHM/A2 c test sb T(J)=T(J)*TH(J) c test sb 25 CONTINUE c test sb 30 CONTINUE C C *** RESET INPUT ARRAYS IF NOPT .NE. 0 *** C IF (NOPT.NE.0)THEN DO 35 I=1,ND T1(I)=T(I) R1(I)=RR(I) 35 CONTINUE END IF C C *** CALCULATE ARRAYS OF GEOPOTENTIAL, HEAT CAPACITY AND STATIC ENERGY C GZ(1)=0.0 CPN(1)=CPD*(1.-RR(1))+RR(1)*CPV H(1)=T(1)*CPN(1) DO 40 I=2,NL TVX=T(I)*(1.+RR(I)/EPS-RR(I)) TVY=T(I-1)*(1.+RR(I-1)/EPS-RR(I-1)) GZ(I)=GZ(I-1)+0.5*RD*(TVX+TVY)*(P(I-1)-P(I))/PH(I) CPN(I)=CPD*(1.-RR(I))+CPV*RR(I) H(I)=T(I)*CPN(I)+GZ(I) 40 CONTINUE C C *** CALCULATE LIFTED CONDENSATION LEVEL OF AIR AT LOWEST MODEL LEVEL *** C *** (WITHIN 0.2% OF FORMULA OF BOLTON, MON. WEA. REV.,1980) *** C IF (T(1).LT.250.0.OR.RR(1).LE.0.0)THEN IFLAG=0 c sb3d print*,'je suis passe par 366' RETURN END IF cjyg1 Utilisation de la subroutine CLIFT CC RH=RR(1)/RS(1) CC CHI=T(1)/(1669.0-122.0*RH-T(1)) CC PLCL=P(1)*(RH**CHI) CALL CLIFT(P(1),T(1),RR(1),RS(1),PLCL,DPLCLDT,DPLCLDR) cjyg2 c sb3d PRINT *,' em_plcl,p1,t1,r1,rs1,rh ' c sb3d $ ,PLCL,P(1),T(1),RR(1),RS(1),RH c IF (PLCL.LT.200.0.OR.PLCL.GE.2000.0)THEN IFLAG=2 RETURN END IF Cjyg1 C Essais de modification de ICB C C *** CALCULATE FIRST LEVEL ABOVE LCL (=ICB) *** C CC ICB=NL-1 CC DO 50 I=2,NL-1 CC IF(P(I).LT.PLCL)THEN CC ICB=MIN(ICB,I) ! ICB sup ou egal a 2 CC END IF CC 50 CONTINUE CC IF(ICB.EQ.(NL-1))THEN CC IFLAG=3 CC RETURN CC END IF C C *** CALCULATE LAYER CONTAINING LCL (=ICB) *** C ICB=NL-1 c sb DO 50 I=2,NL-1 DO 50 I=3,NL-1 ! modif sb pour que ICB soit sup/egal a 2 C la modification consiste a comparer PLCL a PH et non a P: C ICB est defini par : PH(ICB) adiabatic CAPE) C ccc TVP(I)=TVP(I)-TP(I)*(RR(1)-EP(I)*CLW(I)) c!!! sb TVP(I)=TVP(I)-TP(I)*RR(1) ! calcule dans tlift Ccd2 C C *** Calculate first estimate of buoyancy C BUOY(I) = TVP(I) - TV(I) 55 CONTINUE C C *** Set Cloud Base Buoyancy at (Plcl+DPbase) level buoyancy C DPBASE = -40. !That is 400m above LCL PBASE = PLCL + DPBASE TVPBASE = TVP(ICB )*(PBASE -P(ICB+1))/(P(ICB)-P(ICB+1)) $ +TVP(ICB+1)*(P(ICB)-PBASE )/(P(ICB)-P(ICB+1)) TVBASE = TV(ICB )*(PBASE -P(ICB+1))/(P(ICB)-P(ICB+1)) $ +TV(ICB+1)*(P(ICB)-PBASE )/(P(ICB)-P(ICB+1)) C BUOYBASE = TVPBASE - TVBASE C CC Set buoyancy = BUOYBASE for all levels below BASE. CC For safety, set : BUOY(ICB) = BUOYBASE DO I = ICB,NL IF (P(I) .GE. PBASE) THEN BUOY(I) = BUOYBASE ENDIF ENDDO BUOY(ICB) = BUOYBASE C c sb3d print *,'buoybase,tvp_tv,tvpbase,tvbase,pbase,plcl' c sb3d $, buoybase,tvp(icb)-tv(icb),tvpbase,tvbase,pbase,plcl c sb3d print *,'TVP ',(tvp(i),i=1,nl) c sb3d print *,'TV ',(tv(i),i=1,nl) c sb3d print *, 'P ',(p(i),i=1,nl) c sb3d print *,'ICB ',icb C C *** MAKE SURE THAT COLUMN IS DRY ADIABATIC BETWEEN THE SURFACE *** C *** AND CLOUD BASE, AND THAT LIFTED AIR IS POSITIVELY BUOYANT *** C *** AT CLOUD BASE *** C *** IF NOT, RETURN TO CALLING PROGRAM AFTER RESETTING *** C *** SIG(I) AND W0(I) *** C Cjyg CCC TDIF=TVP(ICB)-TV(ICB) TDIF = BUOY(ICB) ATH1=TH(1) Cjyg CCC ATH=TH(ICB-1)-1.0 ATH=TH(ICB-1)-5.0 c ATH=0. ! ajout sb c IF (ICB.GT.1) ATH=TH(ICB-1)-5.0 ! modif sb IF(TDIF.LT.DTCRIT.OR.ATH.GT.ATH1)THEN DO 60 I=1,NL SIG(I)=BETA*SIG(I)-2.*ALPHA*TDIF*TDIF SIG(I)=AMAX1(SIG(I),0.0) W0(I)=BETA*W0(I) 60 CONTINUE IFLAG=0 RETURN END IF C C *** IF THIS POINT IS REACHED, MOIST CONVECTIVE ADJUSTMENT IS NECESSARY *** C *** NOW INITIALIZE VARIOUS ARRAYS USED IN THE COMPUTATIONS *** C DO 70 I=1,NL HP(I)=H(I) WT(I)=0.001 RP(I)=RR(I) UP(I)=U(I) VP(I)=V(I) DO 71 J=1,NTRA TRAP(I,J)=TRA(I,J) 71 CONTINUE NENT(I)=0 WATER(I)=0.0 EVAP(I)=0.0 B(I)=0.0 MP(I)=0.0 M(I)=0.0 LV(I)=ALV0-CPVMCL*(T(I)-273.15) LVCP(I)=LV(I)/CPN(I) DO 70 J=1,NL QENT(I,J)=RR(J) ELIJ(I,J)=0.0 MENT(I,J)=0.0 SIJ(I,J)=0.0 UENT(I,J)=U(J) VENT(I,J)=V(J) DO 70 K=1,NTRA TRAENT(I,J,K)=TRA(J,K) 70 CONTINUE DELTI=1.0/DELT C C *** FIND THE FIRST MODEL LEVEL (INB) ABOVE THE PARCEL'S *** C *** LEVEL OF NEUTRAL BUOYANCY *** C INB=NL-1 DO 80 I=ICB,NL-1 Cjyg CCC IF((TVP(I)-TV(I)).LT.DTCRIT)THEN IF(BUOY(I).LT.DTOVSH)THEN INB=MIN(INB,I) END IF 80 CONTINUE C C *** RESET SIG(I) AND W0(I) FOR I>INB AND IPH(I), PR1=1 & PR2=0 C Pour PH(I+1)