diff --git a/docs/TODO b/docs/TODO index cab8a3f7e39e98f24ae924493f8a5aa80a286745..c9f936aa706ab8ae252da5d08ea182403a10b458 100644 --- a/docs/TODO +++ b/docs/TODO @@ -51,6 +51,7 @@ Pb identifiés à corriger plus tard: - si possible, modifier ice4_sedimentation_split* dans le même esprit que stat - il faudrait nettoyer les interfaces pour supprimer les clés passées directement alors qu'elles sont également disponibles dans les structures (ex: HMF_UPDRAFT) + - il faudrait harmoniser l'utilisation des variables D% (cad faire IKT=D%NKT en haut ou utiliser directement D%NKT) - La taille du buffer utilisé pour th_r_from_thl_rt doit être mise en module et utilisée pour déclarer le buffer dans les routines appelantes et dans th_r_from_thl_rt - shallow_mf_pack devrait être récrit pour appeler directement shallow_mf sans recopier les tableaux pour les changer de forme @@ -71,4 +72,3 @@ Reprendre les différents outils en deux scripts principaux: - outil pour reprendre toutes les fonctionnalités sur le code: filepp, MNH_Expand_Array, correct_indent.py, verify_mnh_expand.py et renommage - outil prep_code débarrassé du renommage pour ne faire que la gestion des commit et lancer la manipulation sur le code Il restera, à part, les scripts de comparaison des résultats (à moins qu'ils puissent être inlinés dans les check_commit correspondant) ->>>>>>> GPU diff --git a/src/common/micro/condensation.F90 b/src/common/micro/condensation.F90 index e9c526f5472bbea3d25faf314ec6fd9eb0c05231..8748c8ef9fd0c1c444d5ad338dd8d49c090a30e3 100644 --- a/src/common/micro/condensation.F90 +++ b/src/common/micro/condensation.F90 @@ -109,26 +109,25 @@ TYPE(TURB_t), INTENT(IN) :: TURBN CHARACTER(LEN=1), INTENT(IN) :: HFRAC_ICE CHARACTER(LEN=4), INTENT(IN) :: HCONDENS CHARACTER(LEN=*), INTENT(IN) :: HLAMBDA3 ! formulation for lambda3 coeff -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PPABS ! pressure (Pa) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PZZ ! height of model levels (m) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRHODREF -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PT ! grid scale T (K) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRV_IN ! grid scale water vapor mixing ratio (kg/kg) in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRV_OUT! grid scale water vapor mixing ratio (kg/kg) in output -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRC_IN ! grid scale r_c mixing ratio (kg/kg) in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRC_OUT! grid scale r_c mixing ratio (kg/kg) in output -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRI_IN ! grid scale r_i (kg/kg) in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRI_OUT! grid scale r_i (kg/kg) in output -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRR ! grid scale mixing ration of rain (kg/kg) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRS ! grid scale mixing ration of snow (kg/kg) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRG ! grid scale mixing ration of graupel (kg/kg) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSIGS ! Sigma_s from turbulence scheme +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PPABS ! pressure (Pa) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PZZ ! height of model levels (m) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODREF +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PT ! grid scale T (K) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRV_IN ! grid scale water vapor mixing ratio (kg/kg) in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRV_OUT! grid scale water vapor mixing ratio (kg/kg) in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRC_IN ! grid scale r_c mixing ratio (kg/kg) in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRC_OUT! grid scale r_c mixing ratio (kg/kg) in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRI_IN ! grid scale r_i (kg/kg) in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRI_OUT! grid scale r_i (kg/kg) in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRR ! grid scale mixing ration of rain (kg/kg) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRS ! grid scale mixing ration of snow (kg/kg) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRG ! grid scale mixing ration of graupel (kg/kg) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PSIGS ! Sigma_s from turbulence scheme LOGICAL, INTENT(IN) :: LMFCONV ! =SIZE(PMFCONV)!=0 -REAL, DIMENSION(MERGE(D%NIT,0,LMFCONV),& - MERGE(D%NJT,0,LMFCONV),& +REAL, DIMENSION(MERGE(D%NIJT,0,LMFCONV),& MERGE(D%NKT,0,LMFCONV)), INTENT(IN) :: PMFCONV! convective mass flux (kg /s m^2) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PCLDFR ! cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSIGRC ! s r_c / sig_s^2 +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PCLDFR ! cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSIGRC ! s r_c / sig_s^2 LOGICAL, INTENT(IN) :: OUSERI ! logical switch to compute both ! liquid and solid condensate (OUSERI=.TRUE.) @@ -138,51 +137,51 @@ LOGICAL, INTENT(IN) :: OSIGMAS! use present global Sigma LOGICAL, INTENT(IN) :: OCND2 ! logical switch to sparate liquid and ice ! more rigid (DEFALT value : .FALSE.) LOGICAL, INTENT(IN) :: LHGT_QS! logical switch for height dependent VQSIGSAT -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PICLDFR ! ice cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PWCLDFR ! water or mixed-phase cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSSIO ! Super-saturation with respect to ice in the +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PICLDFR ! ice cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PWCLDFR ! water or mixed-phase cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSSIO ! Super-saturation with respect to ice in the ! supersaturated fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSSIU ! Sub-saturation with respect to ice in the +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSSIU ! Sub-saturation with respect to ice in the ! subsaturated fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PIFR ! Ratio cloud ice moist part -REAL, DIMENSION(D%NIT,D%NJT), INTENT(IN) :: PSIGQSAT ! use an extra "qsat" variance contribution (OSIGMAS case) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PIFR ! Ratio cloud ice moist part +REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSIGQSAT ! use an extra "qsat" variance contribution (OSIGMAS case) ! multiplied by PSIGQSAT -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PLV ! Latent heat L_v -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PLS ! Latent heat L_s -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PCPH ! Specific heat C_ph -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HRC -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HCF ! cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HRI -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HCF -REAL, DIMENSION(D%NIT,D%NJT), OPTIONAL, INTENT(IN) :: PICE_CLD_WGT +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PLV ! Latent heat L_v +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PLS ! Latent heat L_s +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PCPH ! Specific heat C_ph +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HRC +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HCF ! cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HRI +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HCF +REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PICE_CLD_WGT ! ! !* 0.2 Declarations of local variables : ! -INTEGER :: JI, JJ, JK, JKP, JKM ! loop index -REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZTLK, ZRT ! work arrays for T_l and total water mixing ratio -REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZL ! length scale -INTEGER, DIMENSION(D%NIT,D%NJT) :: ITPL ! top levels of troposphere -REAL, DIMENSION(D%NIT,D%NJT) :: ZTMIN ! minimum Temp. related to ITPL +INTEGER :: JIJ, JK, JKP, JKM ! loop index +REAL, DIMENSION(D%NIJT,D%NKT) :: ZTLK, ZRT ! work arrays for T_l and total water mixing ratio +REAL, DIMENSION(D%NIJT,D%NKT) :: ZL ! length scale +INTEGER, DIMENSION(D%NIJT) :: ITPL ! top levels of troposphere +REAL, DIMENSION(D%NIJT) :: ZTMIN ! minimum Temp. related to ITPL ! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZLV, ZLS, ZCPD +REAL, DIMENSION(D%NIJT,D%NKT) :: ZLV, ZLS, ZCPD REAL :: ZGCOND, ZAUTC, ZAUTI, ZGAUV, ZGAUC, ZGAUI, ZGAUTC, ZGAUTI, ZCRIAUTI ! Used for Gaussian PDF integration REAL :: ZLVS ! thermodynamics -REAL, DIMENSION(D%NIT) :: ZPV, ZPIV, ZQSL, ZQSI ! thermodynamics +REAL, DIMENSION(D%NIJT) :: ZPV, ZPIV, ZQSL, ZQSI ! thermodynamics REAL :: ZLL, DZZ, ZZZ ! used for length scales REAL :: ZAH, ZDRW, ZDTL, ZSIG_CONV ! related to computation of Sig_s -REAL, DIMENSION(D%NIT) :: ZA, ZB, ZSBAR, ZSIGMA, ZQ1 ! related to computation of Sig_s -REAL, DIMENSION(D%NIT) :: ZCOND -REAL, DIMENSION(D%NIT) :: ZFRAC ! Ice fraction +REAL, DIMENSION(D%NIJT) :: ZA, ZB, ZSBAR, ZSIGMA, ZQ1 ! related to computation of Sig_s +REAL, DIMENSION(D%NIJT) :: ZCOND +REAL, DIMENSION(D%NIJT) :: ZFRAC ! Ice fraction INTEGER :: INQ1 REAL :: ZINC ! related to OCND2 noise check : REAL :: ZRSP, ZRSW, ZRFRAC, ZRSDIF, ZRCOLD ! related to OCND2 ice cloud calulation : -REAL, DIMENSION(D%NIT) :: ESATW_T +REAL, DIMENSION(D%NIJT) :: ESATW_T REAL :: ZDUM1,ZDUM2,ZDUM3,ZDUM4,ZPRIFACT,ZLWINC -REAL, DIMENSION(D%NIT) :: ZDZ, ZARDUM, ZARDUM2, ZCLDINI +REAL, DIMENSION(D%NIJT) :: ZDZ, ZARDUM, ZARDUM2, ZCLDINI ! end OCND2 ! LHGT_QS: @@ -218,8 +217,8 @@ REAL, DIMENSION(-22:11),PARAMETER :: ZSRC_1D =(/ & ! IF (LHOOK) CALL DR_HOOK('CONDENSATION',0,ZHOOK_HANDLE) ! -PCLDFR(:,:,:) = 0. ! Initialize values -PSIGRC(:,:,:) = 0. ! Initialize values +PCLDFR(:,:) = 0. ! Initialize values +PSIGRC(:,:) = 0. ! Initialize values ZPRIFACT = 1. ! Initialize value ZARDUM2 = 0. ! Initialize values ZCLDINI = -1. ! Dummy Initialized cloud input to icecloud routine @@ -242,91 +241,79 @@ IF(OCND2)ZPRIFACT = 0. !------------------------------------------------------------------------------- ! store total water mixing ratio DO JK=D%NKTB,D%NKTE - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - ZRT(JI,JJ,JK) = PRV_IN(JI,JJ,JK) + PRC_IN(JI,JJ,JK) + PRI_IN(JI,JJ,JK)*ZPRIFACT - END DO + DO JIJ=D%NIJB,D%NIJE + ZRT(JIJ,JK) = PRV_IN(JIJ,JK) + PRC_IN(JIJ,JK) + PRI_IN(JIJ,JK)*ZPRIFACT END DO END DO !------------------------------------------------------------------------------- ! Preliminary calculations ! latent heat of vaporisation/sublimation IF(PRESENT(PLV) .AND. PRESENT(PLS)) THEN - ZLV(:,:,:)=PLV(:,:,:) - ZLS(:,:,:)=PLS(:,:,:) + ZLV(:,:)=PLV(:,:) + ZLS(:,:)=PLS(:,:) ELSE DO JK=D%NKTB,D%NKTE - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - ! latent heat of vaporisation/sublimation - ZLV(JI,JJ,JK) = CST%XLVTT + ( CST%XCPV - CST%XCL ) * ( PT(JI,JJ,JK) - CST%XTT ) - ZLS(JI,JJ,JK) = CST%XLSTT + ( CST%XCPV - CST%XCI ) * ( PT(JI,JJ,JK) - CST%XTT ) - ENDDO + DO JIJ=D%NIJB,D%NIJE + ! latent heat of vaporisation/sublimation + ZLV(JIJ,JK) = CST%XLVTT + ( CST%XCPV - CST%XCL ) * ( PT(JIJ,JK) - CST%XTT ) + ZLS(JIJ,JK) = CST%XLSTT + ( CST%XCPV - CST%XCI ) * ( PT(JIJ,JK) - CST%XTT ) ENDDO ENDDO ENDIF IF(PRESENT(PCPH)) THEN - ZCPD(:,:,:)=PCPH(:,:,:) + ZCPD(:,:)=PCPH(:,:) ELSE DO JK=D%NKTB,D%NKTE - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - ZCPD(JI,JJ,JK) = CST%XCPD + CST%XCPV*PRV_IN(JI,JJ,JK) + CST%XCL*PRC_IN(JI,JJ,JK) + CST%XCI*PRI_IN(JI,JJ,JK) + & + DO JIJ=D%NIJB,D%NIJE + ZCPD(JIJ,JK) = CST%XCPD + CST%XCPV*PRV_IN(JIJ,JK) + CST%XCL*PRC_IN(JIJ,JK) + CST%XCI*PRI_IN(JIJ,JK) + & #if defined(REPRO48) || defined(REPRO55) #else - CST%XCL*PRR(JI,JJ,JK) + & + CST%XCL*PRR(JIJ,JK) + & #endif - CST%XCI*(PRS(JI,JJ,JK) + PRG(JI,JJ,JK) ) - ENDDO + CST%XCI*(PRS(JIJ,JK) + PRG(JIJ,JK) ) ENDDO ENDDO ENDIF ! Preliminary calculations needed for computing the "turbulent part" of Sigma_s IF ( .NOT. OSIGMAS ) THEN DO JK=D%NKTB,D%NKTE - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - ! store temperature at saturation - ZTLK(JI,JJ,JK) = PT(JI,JJ,JK) - ZLV(JI,JJ,JK)*PRC_IN(JI,JJ,JK)/ZCPD(JI,JJ,JK) & - - ZLS(JI,JJ,JK)*PRI_IN(JI,JJ,JK)/ZCPD(JI,JJ,JK)*ZPRIFACT - END DO + DO JIJ=D%NIJB,D%NIJE + ! store temperature at saturation + ZTLK(JIJ,JK) = PT(JIJ,JK) - ZLV(JIJ,JK)*PRC_IN(JIJ,JK)/ZCPD(JIJ,JK) & + - ZLS(JIJ,JK)*PRI_IN(JIJ,JK)/ZCPD(JIJ,JK)*ZPRIFACT END DO END DO ! Determine tropopause/inversion height from minimum temperature #ifdef REPRO48 - ITPL(:,:) = D%NIB+1 + ITPL(:) = D%NIJB+1 !I (Sébastien Riette) don't understand why tropopause level is set !with the index of the second physical point on the horizontal (i.e. 2+JPHEXT)!!! !I assume it is a bug... #else - ITPL(:,:) = D%NKB+D%NKL + ITPL(:) = D%NKB+D%NKL #endif - ZTMIN(:,:) = 400. + ZTMIN(:) = 400. DO JK = D%NKTB+1,D%NKTE-1 - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - IF ( PT(JI,JJ,JK) < ZTMIN(JI,JJ) ) THEN - ZTMIN(JI,JJ) = PT(JI,JJ,JK) - ITPL(JI,JJ) = JK - ENDIF - END DO + DO JIJ=D%NIJB,D%NIJE + IF ( PT(JIJ,JK) < ZTMIN(JIJ) ) THEN + ZTMIN(JIJ) = PT(JIJ,JK) + ITPL(JIJ) = JK + ENDIF END DO END DO ! Set the mixing length scale - ZL(:,:,D%NKB) = 20. + ZL(:,D%NKB) = 20. DO JK = D%NKB+D%NKL,D%NKE,D%NKL - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - ! free troposphere - ZL(JI,JJ,JK) = ZL0 - ZZZ = PZZ(JI,JJ,JK) - PZZ(JI,JJ,D%NKB) - JKP = ITPL(JI,JJ) - ! approximate length for boundary-layer - IF ( ZL0 > ZZZ ) ZL(JI,JJ,JK) = ZZZ - ! gradual decrease of length-scale near and above tropopause - IF ( ZZZ > 0.9*(PZZ(JI,JJ,JKP)-PZZ(JI,JJ,D%NKB)) ) & - ZL(JI,JJ,JK) = .6 * ZL(JI,JJ,JK-D%NKL) - END DO + DO JIJ=D%NIJB,D%NIJE + ! free troposphere + ZL(JIJ,JK) = ZL0 + ZZZ = PZZ(JIJ,JK) - PZZ(JIJ,D%NKB) + JKP = ITPL(JIJ) + ! approximate length for boundary-layer + IF ( ZL0 > ZZZ ) ZL(JIJ,JK) = ZZZ + ! gradual decrease of length-scale near and above tropopause + IF ( ZZZ > 0.9*(PZZ(JIJ,JKP)-PZZ(JIJ,D%NKB)) ) & + ZL(JIJ,JK) = .6 * ZL(JIJ,JK-D%NKL) END DO END DO END IF @@ -335,271 +322,269 @@ END IF DO JK=D%NKTB,D%NKTE JKP=MAX(MIN(JK+D%NKL,D%NKTE),D%NKTB) JKM=MAX(MIN(JK-D%NKL,D%NKTE),D%NKTB) - DO JJ=D%NJB,D%NJE - IF (OCND2) THEN - DO JI = D%NIB, D%NIE - ZDZ(JI) = PZZ(JI,JJ,JKP) - PZZ(JI,JJ,JKP-D%NKL) - ENDDO - CALL ICECLOUD(D%NIE-D%NIB+1,PPABS(D%NIB,JJ,JK),PZZ(D%NIB,JJ,JK),ZDZ(D%NIB), & - & PT(D%NIB,JJ,JK),PRV_IN(D%NIB,JJ,JK),1.,-1., & - & ZCLDINI(D%NIB:D%NIE),PIFR(D%NIB,JJ,JK),PICLDFR(D%NIB,JJ,JK), & - & PSSIO(D%NIB,JJ,JK),PSSIU(D%NIB,JJ,JK),ZARDUM2(D%NIB:D%NIE),ZARDUM(D%NIB:D%NIE)) - ! latent heats - ! saturated water vapor mixing ratio over liquid water and ice - DO JI=D%NIB,D%NIE - ESATW_T(JI)=ESATW(PT(JI,JJ,JK)) - ZPV(JI) = MIN(ESATW_T(JI), .99*PPABS(JI,JJ,JK)) - ZPIV(JI) = MIN(ESATI(PT(JI,JJ,JK)), .99*PPABS(JI,JJ,JK)) - END DO - ELSE - ! latent heats - ! saturated water vapor mixing ratio over liquid water and ice - DO JI=D%NIB,D%NIE - ZPV(JI) = MIN(EXP( CST%XALPW - CST%XBETAW / PT(JI,JJ,JK) - CST%XGAMW * LOG( PT(JI,JJ,JK) ) ), .99*PPABS(JI,JJ,JK)) - ZPIV(JI) = MIN(EXP( CST%XALPI - CST%XBETAI / PT(JI,JJ,JK) - CST%XGAMI * LOG( PT(JI,JJ,JK) ) ), .99*PPABS(JI,JJ,JK)) - END DO - ENDIF - !Ice fraction - ZFRAC(:) = 0. - IF (OUSERI .AND. .NOT.OCND2) THEN - DO JI=D%NIB,D%NIE - IF (PRC_IN(JI,JJ,JK)+PRI_IN(JI,JJ,JK) > 1.E-20) THEN - ZFRAC(JI) = PRI_IN(JI,JJ,JK) / (PRC_IN(JI,JJ,JK)+PRI_IN(JI,JJ,JK)) - ENDIF - END DO - DO JI=D%NIB,D%NIE - CALL COMPUTE_FRAC_ICE(HFRAC_ICE, NEB, ZFRAC(JI), PT(JI,JJ,JK), IERR) !error code IERR cannot be checked here to not break vectorization - ENDDO - ENDIF - DO JI=D%NIB,D%NIE - ZQSL(JI) = CST%XRD / CST%XRV * ZPV(JI) / ( PPABS(JI,JJ,JK) - ZPV(JI) ) - ZQSI(JI) = CST%XRD / CST%XRV * ZPIV(JI) / ( PPABS(JI,JJ,JK) - ZPIV(JI) ) + IF (OCND2) THEN + DO JIJ = D%NIJB, D%NIJE + ZDZ(JIJ) = PZZ(JIJ,JKP) - PZZ(JIJ,JKP-D%NKL) + ENDDO + CALL ICECLOUD(D,PPABS(:,JK),PZZ(:,JK),ZDZ(:), & + & PT(:,JK),PRV_IN(:,JK),1.,-1., & + & ZCLDINI(:),PIFR(D%NIJB,JK),PICLDFR(:,JK), & + & PSSIO(:,JK),PSSIU(:,JK),ZARDUM2(:),ZARDUM(:)) + ! latent heats + ! saturated water vapor mixing ratio over liquid water and ice + DO JIJ=D%NIJB,D%NIJE + ESATW_T(JIJ)=ESATW(PT(JIJ,JK)) + ZPV(JIJ) = MIN(ESATW_T(JIJ), .99*PPABS(JIJ,JK)) + ZPIV(JIJ) = MIN(ESATI(PT(JIJ,JK)), .99*PPABS(JIJ,JK)) + END DO + ELSE + ! latent heats + ! saturated water vapor mixing ratio over liquid water and ice + DO JIJ=D%NIJB,D%NIJE + ZPV(JIJ) = MIN(EXP( CST%XALPW - CST%XBETAW / PT(JIJ,JK) - CST%XGAMW * LOG( PT(JIJ,JK) ) ), .99*PPABS(JIJ,JK)) + ZPIV(JIJ) = MIN(EXP( CST%XALPI - CST%XBETAI / PT(JIJ,JK) - CST%XGAMI * LOG( PT(JIJ,JK) ) ), .99*PPABS(JIJ,JK)) + END DO + ENDIF + !Ice fraction + ZFRAC(:) = 0. + IF (OUSERI .AND. .NOT.OCND2) THEN + DO JIJ=D%NIJB,D%NIJE + IF (PRC_IN(JIJ,JK)+PRI_IN(JIJ,JK) > 1.E-20) THEN + ZFRAC(JIJ) = PRI_IN(JIJ,JK) / (PRC_IN(JIJ,JK)+PRI_IN(JIJ,JK)) + ENDIF + END DO + DO JIJ=D%NIJB,D%NIJE + CALL COMPUTE_FRAC_ICE(HFRAC_ICE, NEB, ZFRAC(JIJ), PT(JIJ,JK), IERR) !error code IERR cannot be checked here to not break vectorization + ENDDO + ENDIF + DO JIJ=D%NIJB,D%NIJE + ZQSL(JIJ) = CST%XRD / CST%XRV * ZPV(JIJ) / ( PPABS(JIJ,JK) - ZPV(JIJ) ) + ZQSI(JIJ) = CST%XRD / CST%XRV * ZPIV(JIJ) / ( PPABS(JIJ,JK) - ZPIV(JIJ) ) - ! interpolate between liquid and solid as function of temperature - ZQSL(JI) = (1. - ZFRAC(JI)) * ZQSL(JI) + ZFRAC(JI) * ZQSI(JI) - ZLVS = (1. - ZFRAC(JI)) * ZLV(JI,JJ,JK) + & - & ZFRAC(JI) * ZLS(JI,JJ,JK) + ! interpolate between liquid and solid as function of temperature + ZQSL(JIJ) = (1. - ZFRAC(JIJ)) * ZQSL(JIJ) + ZFRAC(JIJ) * ZQSI(JIJ) + ZLVS = (1. - ZFRAC(JIJ)) * ZLV(JIJ,JK) + & + & ZFRAC(JIJ) * ZLS(JIJ,JK) - ! coefficients a and b - ZAH = ZLVS * ZQSL(JI) / ( CST%XRV * PT(JI,JJ,JK)**2 ) * (CST%XRV * ZQSL(JI) / CST%XRD + 1.) - ZA(JI) = 1. / ( 1. + ZLVS/ZCPD(JI,JJ,JK) * ZAH ) - ZB(JI) = ZAH * ZA(JI) - ZSBAR(JI) = ZA(JI) * ( ZRT(JI,JJ,JK) - ZQSL(JI) + & - & ZAH * ZLVS * (PRC_IN(JI,JJ,JK)+PRI_IN(JI,JJ,JK)*ZPRIFACT) / ZCPD(JI,JJ,JK)) - END DO - ! switch to take either present computed value of SIGMAS - ! or that of Meso-NH turbulence scheme - IF ( OSIGMAS ) THEN - DO JI=D%NIB,D%NIE - IF (PSIGQSAT(JI,JJ)/=0.) THEN - ZDZFACT = 1. - IF(LHGT_QS .AND. JK+1 <= D%NKTE)THEN - ZDZFACT= MAX(ICEP%XFRMIN(23),MIN(ICEP%XFRMIN(24),(PZZ(JI,JJ,JK) - PZZ(JI,JJ,JK+1))/ZDZREF)) - ELSEIF(LHGT_QS)THEN - ZDZFACT= MAX(ICEP%XFRMIN(23),MIN(ICEP%XFRMIN(24),((PZZ(JI,JJ,JK-1) - PZZ(JI,JJ,JK)))*0.8/ZDZREF)) - ENDIF - IF (TURBN%LSTATNW) THEN - ZSIGMA(JI) = SQRT((PSIGS(JI,JJ,JK))**2 + (PSIGQSAT(JI,JJ)*ZDZFACT*ZQSL(JI)*ZA(JI))**2) - ELSE - ZSIGMA(JI) = SQRT((2*PSIGS(JI,JJ,JK))**2 + (PSIGQSAT(JI,JJ)*ZQSL(JI)*ZA(JI))**2) - ENDIF + ! coefficients a and b + ZAH = ZLVS * ZQSL(JIJ) / ( CST%XRV * PT(JIJ,JK)**2 ) * (CST%XRV * ZQSL(JIJ) / CST%XRD + 1.) + ZA(JIJ) = 1. / ( 1. + ZLVS/ZCPD(JIJ,JK) * ZAH ) + ZB(JIJ) = ZAH * ZA(JIJ) + ZSBAR(JIJ) = ZA(JIJ) * ( ZRT(JIJ,JK) - ZQSL(JIJ) + & + & ZAH * ZLVS * (PRC_IN(JIJ,JK)+PRI_IN(JIJ,JK)*ZPRIFACT) / ZCPD(JIJ,JK)) + END DO + ! switch to take either present computed value of SIGMAS + ! or that of Meso-NH turbulence scheme + IF ( OSIGMAS ) THEN + DO JIJ=D%NIJB,D%NIJE + IF (PSIGQSAT(JIJ)/=0.) THEN + ZDZFACT = 1. + IF(LHGT_QS .AND. JK+1 <= D%NKTE)THEN + ZDZFACT= MAX(ICEP%XFRMIN(23),MIN(ICEP%XFRMIN(24),(PZZ(JIJ,JK) - PZZ(JIJ,JK+1))/ZDZREF)) + ELSEIF(LHGT_QS)THEN + ZDZFACT= MAX(ICEP%XFRMIN(23),MIN(ICEP%XFRMIN(24),((PZZ(JIJ,JK-1) - PZZ(JIJ,JK)))*0.8/ZDZREF)) + ENDIF + IF (TURBN%LSTATNW) THEN + ZSIGMA(JIJ) = SQRT((PSIGS(JIJ,JK))**2 + (PSIGQSAT(JIJ)*ZDZFACT*ZQSL(JIJ)*ZA(JIJ))**2) ELSE - IF (TURBN%LSTATNW) THEN - ZSIGMA(JI) = PSIGS(JI,JJ,JK) - ELSE - ZSIGMA(JI) = 2*PSIGS(JI,JJ,JK) - ENDIF - END IF - END DO - ELSE - DO JI=D%NIB,D%NIE - ! parameterize Sigma_s with first_order closure - DZZ = PZZ(JI,JJ,JKP) - PZZ(JI,JJ,JKM) - ZDRW = ZRT(JI,JJ,JKP) - ZRT(JI,JJ,JKM) - ZDTL = ZTLK(JI,JJ,JKP) - ZTLK(JI,JJ,JKM) + CST%XG/ZCPD(JI,JJ,JK) * DZZ - ZLL = ZL(JI,JJ,JK) - ! standard deviation due to convection - ZSIG_CONV =0. - IF(LMFCONV) ZSIG_CONV = ZCSIG_CONV * PMFCONV(JI,JJ,JK) / ZA(JI) - ! zsigma should be of order 4.e-4 in lowest 5 km of atmosphere - ZSIGMA(JI) = SQRT( MAX( 1.E-25, ZCSIGMA * ZCSIGMA * ZLL*ZLL/(DZZ*DZZ)*(& - ZA(JI)*ZA(JI)*ZDRW*ZDRW - 2.*ZA(JI)*ZB(JI)*ZDRW*ZDTL + ZB(JI)*ZB(JI)*ZDTL*ZDTL) + & - ZSIG_CONV * ZSIG_CONV ) ) - END DO - END IF - DO JI=D%NIB,D%NIE - ZSIGMA(JI)= MAX( 1.E-10, ZSIGMA(JI) ) - - ! normalized saturation deficit - ZQ1(JI) = ZSBAR(JI)/ZSIGMA(JI) + ZSIGMA(JIJ) = SQRT((2*PSIGS(JIJ,JK))**2 + (PSIGQSAT(JIJ)*ZQSL(JIJ)*ZA(JIJ))**2) + ENDIF + ELSE + IF (TURBN%LSTATNW) THEN + ZSIGMA(JIJ) = PSIGS(JIJ,JK) + ELSE + ZSIGMA(JIJ) = 2*PSIGS(JIJ,JK) + ENDIF + END IF END DO - IF(HCONDENS == 'GAUS') THEN - DO JI=D%NIB,D%NIE - ! Gaussian Probability Density Function around ZQ1 - ! Computation of ZG and ZGAM(=erf(ZG)) - ZGCOND = -ZQ1(JI)/SQRT(2.) - - !Approximation of erf function for Gaussian distribution - ZGAUV = 1 - SIGN(1., ZGCOND) * SQRT(1-EXP(-4*ZGCOND**2/CST%XPI)) + ELSE + DO JIJ=D%NIJB,D%NIJE + ! parameterize Sigma_s with first_order closure + DZZ = PZZ(JIJ,JKP) - PZZ(JIJ,JKM) + ZDRW = ZRT(JIJ,JKP) - ZRT(JIJ,JKM) + ZDTL = ZTLK(JIJ,JKP) - ZTLK(JIJ,JKM) + CST%XG/ZCPD(JIJ,JK) * DZZ + ZLL = ZL(JIJ,JK) + ! standard deviation due to convection + ZSIG_CONV =0. + IF(LMFCONV) ZSIG_CONV = ZCSIG_CONV * PMFCONV(JIJ,JK) / ZA(JIJ) + ! zsigma should be of order 4.e-4 in lowest 5 km of atmosphere + ZSIGMA(JIJ) = SQRT( MAX( 1.E-25, ZCSIGMA * ZCSIGMA * ZLL*ZLL/(DZZ*DZZ)*(& + ZA(JIJ)*ZA(JIJ)*ZDRW*ZDRW - 2.*ZA(JIJ)*ZB(JIJ)*ZDRW*ZDTL + ZB(JIJ)*ZB(JIJ)*ZDTL*ZDTL) + & + ZSIG_CONV * ZSIG_CONV ) ) + END DO + END IF + DO JIJ=D%NIJB,D%NIJE + ZSIGMA(JIJ)= MAX( 1.E-10, ZSIGMA(JIJ) ) - !Computation Cloud Fraction - PCLDFR(JI,JJ,JK) = MAX( 0., MIN(1.,0.5*ZGAUV)) + ! normalized saturation deficit + ZQ1(JIJ) = ZSBAR(JIJ)/ZSIGMA(JIJ) + END DO + IF(HCONDENS == 'GAUS') THEN + DO JIJ=D%NIJB,D%NIJE + ! Gaussian Probability Density Function around ZQ1 + ! Computation of ZG and ZGAM(=erf(ZG)) + ZGCOND = -ZQ1(JIJ)/SQRT(2.) - !Computation of condensate - ZCOND(JI) = (EXP(-ZGCOND**2)-ZGCOND*SQRT(CST%XPI)*ZGAUV)*ZSIGMA(JI)/SQRT(2.*CST%XPI) - ZCOND(JI) = MAX(ZCOND(JI), 0.) + !Approximation of erf function for Gaussian distribution + ZGAUV = 1 - SIGN(1., ZGCOND) * SQRT(1-EXP(-4*ZGCOND**2/CST%XPI)) - PSIGRC(JI,JJ,JK) = PCLDFR(JI,JJ,JK) - END DO - !Computation warm/cold Cloud Fraction and content in high water content part - IF(PRESENT(PHLC_HCF) .AND. PRESENT(PHLC_HRC))THEN - DO JI=D%NIB,D%NIE - IF(1-ZFRAC(JI) > 1.E-20)THEN - ZAUTC = (ZSBAR(JI) - ICEP%XCRIAUTC/(PRHODREF(JI,JJ,JK)*(1-ZFRAC(JI))))/ZSIGMA(JI) - ZGAUTC = -ZAUTC/SQRT(2.) - !Approximation of erf function for Gaussian distribution - ZGAUC = 1 - SIGN(1., ZGAUTC) * SQRT(1-EXP(-4*ZGAUTC**2/CST%XPI)) - PHLC_HCF(JI,JJ,JK) = MAX( 0., MIN(1.,0.5*ZGAUC)) - PHLC_HRC(JI,JJ,JK) = (1-ZFRAC(JI))*(EXP(-ZGAUTC**2)-ZGAUTC*SQRT(CST%XPI)*ZGAUC)*ZSIGMA(JI)/SQRT(2.*CST%XPI) - PHLC_HRC(JI,JJ,JK) = PHLC_HRC(JI,JJ,JK) + ICEP%XCRIAUTC/PRHODREF(JI,JJ,JK) * PHLC_HCF(JI,JJ,JK) - PHLC_HRC(JI,JJ,JK) = MAX(PHLC_HRC(JI,JJ,JK), 0.) - ELSE - PHLC_HCF(JI,JJ,JK)=0. - PHLC_HRC(JI,JJ,JK)=0. - ENDIF - END DO - ENDIF + !Computation Cloud Fraction + PCLDFR(JIJ,JK) = MAX( 0., MIN(1.,0.5*ZGAUV)) - IF(PRESENT(PHLI_HCF) .AND. PRESENT(PHLI_HRI))THEN - DO JI=D%NIB,D%NIE - IF(ZFRAC(JI) > 1.E-20)THEN - ZCRIAUTI=MIN(ICEP%XCRIAUTI,10**(ICEP%XACRIAUTI*(PT(JI,JJ,JK)-CST%XTT)+ICEP%XBCRIAUTI)) - ZAUTI = (ZSBAR(JI) - ZCRIAUTI/ZFRAC(JI))/ZSIGMA(JI) - ZGAUTI = -ZAUTI/SQRT(2.) - !Approximation of erf function for Gaussian distribution - ZGAUI = 1 - SIGN(1., ZGAUTI) * SQRT(1-EXP(-4*ZGAUTI**2/CST%XPI)) - PHLI_HCF(JI,JJ,JK) = MAX( 0., MIN(1.,0.5*ZGAUI)) - PHLI_HRI(JI,JJ,JK) = ZFRAC(JI)*(EXP(-ZGAUTI**2)-ZGAUTI*SQRT(CST%XPI)*ZGAUI)*ZSIGMA(JI)/SQRT(2.*CST%XPI) - PHLI_HRI(JI,JJ,JK) = PHLI_HRI(JI,JJ,JK) + ZCRIAUTI*PHLI_HCF(JI,JJ,JK) - PHLI_HRI(JI,JJ,JK) = MAX(PHLI_HRI(JI,JJ,JK), 0.) - ELSE - PHLI_HCF(JI,JJ,JK)=0. - PHLI_HRI(JI,JJ,JK)=0. - ENDIF - END DO - ENDIF + !Computation of condensate + ZCOND(JIJ) = (EXP(-ZGCOND**2)-ZGCOND*SQRT(CST%XPI)*ZGAUV)*ZSIGMA(JIJ)/SQRT(2.*CST%XPI) + ZCOND(JIJ) = MAX(ZCOND(JIJ), 0.) - ELSEIF(HCONDENS == 'CB02')THEN - DO JI=D%NIB,D%NIE - !Total condensate - IF (ZQ1(JI) > 0. .AND. ZQ1(JI) <= 2) THEN - ZCOND(JI) = MIN(EXP(-1.)+.66*ZQ1(JI)+.086*ZQ1(JI)**2, 2.) ! We use the MIN function for continuity - ELSE IF (ZQ1(JI) > 2.) THEN - ZCOND(JI) = ZQ1(JI) + PSIGRC(JIJ,JK) = PCLDFR(JIJ,JK) + END DO + !Computation warm/cold Cloud Fraction and content in high water content part + IF(PRESENT(PHLC_HCF) .AND. PRESENT(PHLC_HRC))THEN + DO JIJ=D%NIJB,D%NIJE + IF(1-ZFRAC(JIJ) > 1.E-20)THEN + ZAUTC = (ZSBAR(JIJ) - ICEP%XCRIAUTC/(PRHODREF(JIJ,JK)*(1-ZFRAC(JIJ))))/ZSIGMA(JIJ) + ZGAUTC = -ZAUTC/SQRT(2.) + !Approximation of erf function for Gaussian distribution + ZGAUC = 1 - SIGN(1., ZGAUTC) * SQRT(1-EXP(-4*ZGAUTC**2/CST%XPI)) + PHLC_HCF(JIJ,JK) = MAX( 0., MIN(1.,0.5*ZGAUC)) + PHLC_HRC(JIJ,JK) = (1-ZFRAC(JIJ))*(EXP(-ZGAUTC**2)-ZGAUTC*SQRT(CST%XPI)*ZGAUC)*ZSIGMA(JIJ)/SQRT(2.*CST%XPI) + PHLC_HRC(JIJ,JK) = PHLC_HRC(JIJ,JK) + ICEP%XCRIAUTC/PRHODREF(JIJ,JK) * PHLC_HCF(JIJ,JK) + PHLC_HRC(JIJ,JK) = MAX(PHLC_HRC(JIJ,JK), 0.) ELSE - ZCOND(JI) = EXP( 1.2*ZQ1(JI)-1. ) + PHLC_HCF(JIJ,JK)=0. + PHLC_HRC(JIJ,JK)=0. ENDIF - ZCOND(JI) = ZCOND(JI) * ZSIGMA(JI) + END DO + ENDIF - !Cloud fraction - IF (ZCOND(JI) < 1.E-12) THEN - PCLDFR(JI,JJ,JK) = 0. + IF(PRESENT(PHLI_HCF) .AND. PRESENT(PHLI_HRI))THEN + DO JIJ=D%NIJB,D%NIJE + IF(ZFRAC(JIJ) > 1.E-20)THEN + ZCRIAUTI=MIN(ICEP%XCRIAUTI,10**(ICEP%XACRIAUTI*(PT(JIJ,JK)-CST%XTT)+ICEP%XBCRIAUTI)) + ZAUTI = (ZSBAR(JIJ) - ZCRIAUTI/ZFRAC(JIJ))/ZSIGMA(JIJ) + ZGAUTI = -ZAUTI/SQRT(2.) + !Approximation of erf function for Gaussian distribution + ZGAUI = 1 - SIGN(1., ZGAUTI) * SQRT(1-EXP(-4*ZGAUTI**2/CST%XPI)) + PHLI_HCF(JIJ,JK) = MAX( 0., MIN(1.,0.5*ZGAUI)) + PHLI_HRI(JIJ,JK) = ZFRAC(JIJ)*(EXP(-ZGAUTI**2)-ZGAUTI*SQRT(CST%XPI)*ZGAUI)*ZSIGMA(JIJ)/SQRT(2.*CST%XPI) + PHLI_HRI(JIJ,JK) = PHLI_HRI(JIJ,JK) + ZCRIAUTI*PHLI_HCF(JIJ,JK) + PHLI_HRI(JIJ,JK) = MAX(PHLI_HRI(JIJ,JK), 0.) ELSE - PCLDFR(JI,JJ,JK) = MAX( 0., MIN(1.,0.5+0.36*ATAN(1.55*ZQ1(JI))) ) - ENDIF - IF (PCLDFR(JI,JJ,JK)==0.) THEN - ZCOND(JI)=0. + PHLI_HCF(JIJ,JK)=0. + PHLI_HRI(JIJ,JK)=0. ENDIF + END DO + ENDIF - INQ1 = MIN( MAX(-22,FLOOR(MIN(100., MAX(-100., 2*ZQ1(JI)))) ), 10) !inner min/max prevents sigfpe when 2*zq1 does not fit into an int - ZINC = 2.*ZQ1(JI) - INQ1 + ELSEIF(HCONDENS == 'CB02')THEN + DO JIJ=D%NIJB,D%NIJE + !Total condensate + IF (ZQ1(JIJ) > 0. .AND. ZQ1(JIJ) <= 2) THEN + ZCOND(JIJ) = MIN(EXP(-1.)+.66*ZQ1(JIJ)+.086*ZQ1(JIJ)**2, 2.) ! We use the MIN function for continuity + ELSE IF (ZQ1(JIJ) > 2.) THEN + ZCOND(JIJ) = ZQ1(JIJ) + ELSE + ZCOND(JIJ) = EXP( 1.2*ZQ1(JIJ)-1. ) + ENDIF + ZCOND(JIJ) = ZCOND(JIJ) * ZSIGMA(JIJ) - PSIGRC(JI,JJ,JK) = MIN(1.,(1.-ZINC)*ZSRC_1D(INQ1)+ZINC*ZSRC_1D(INQ1+1)) - END DO - IF(PRESENT(PHLC_HCF) .AND. PRESENT(PHLC_HRC))THEN - PHLC_HCF(:,JJ,JK)=0. - PHLC_HRC(:,JJ,JK)=0. + !Cloud fraction + IF (ZCOND(JIJ) < 1.E-12) THEN + PCLDFR(JIJ,JK) = 0. + ELSE + PCLDFR(JIJ,JK) = MAX( 0., MIN(1.,0.5+0.36*ATAN(1.55*ZQ1(JIJ))) ) ENDIF - IF(PRESENT(PHLI_HCF) .AND. PRESENT(PHLI_HRI))THEN - PHLI_HCF(:,JJ,JK)=0. - PHLI_HRI(:,JJ,JK)=0. + IF (PCLDFR(JIJ,JK)==0.) THEN + ZCOND(JIJ)=0. ENDIF - END IF !HCONDENS - IF(.NOT. OCND2) THEN - DO JI=D%NIB,D%NIE - PRC_OUT(JI,JJ,JK) = (1.-ZFRAC(JI)) * ZCOND(JI) ! liquid condensate - PRI_OUT(JI,JJ,JK) = ZFRAC(JI) * ZCOND(JI) ! solid condensate - PT(JI,JJ,JK) = PT(JI,JJ,JK) + ((PRC_OUT(JI,JJ,JK)-PRC_IN(JI,JJ,JK))*ZLV(JI,JJ,JK) + & - &(PRI_OUT(JI,JJ,JK)-PRI_IN(JI,JJ,JK))*ZLS(JI,JJ,JK) ) & - & /ZCPD(JI,JJ,JK) - PRV_OUT(JI,JJ,JK) = ZRT(JI,JJ,JK) - PRC_OUT(JI,JJ,JK) - PRI_OUT(JI,JJ,JK)*ZPRIFACT - END DO - ELSE - DO JI=D%NIB,D%NIE - PRC_OUT(JI,JJ,JK) = (1.-ZFRAC(JI)) * ZCOND(JI) ! liquid condensate - ZLWINC = PRC_OUT(JI,JJ,JK) - PRC_IN(JI,JJ,JK) - ! -! This check is mainly for noise reduction : -! ------------------------- - IF(ABS(ZLWINC)>1.0E-12 .AND. ESATW(PT(JI,JJ,JK)) < PPABS(JI,JJ,JK)*0.5 )THEN - ZRCOLD = PRC_OUT(JI,JJ,JK) - ZRFRAC = PRV_IN(JI,JJ,JK) - ZLWINC - IF( PRV_IN(JI,JJ,JK) < ZRSW )THEN ! sub - saturation over water: - ! Avoid drying of cloudwater leading to supersaturation with - ! respect to water - ZRSDIF= MIN(0.,ZRSP-ZRFRAC) - ELSE ! super - saturation over water: - ! Avoid deposition of water leading to sub-saturation with - ! respect to water - ! ZRSDIF= MAX(0.,ZRSP-ZRFRAC) - ZRSDIF= 0. ! t7 - ENDIF - PRC_OUT(JI,JJ,JK) = ZCOND(JI) - ZRSDIF - ELSE - ZRCOLD = PRC_IN(JI,JJ,JK) - ENDIF - ! end check + INQ1 = MIN( MAX(-22,FLOOR(MIN(100., MAX(-100., 2*ZQ1(JIJ)))) ), 10) !inner min/max prevents sigfpe when 2*zq1 does not fit into an int + ZINC = 2.*ZQ1(JIJ) - INQ1 - ! compute separate ice cloud: - PWCLDFR(JI,JJ,JK) = PCLDFR(JI,JJ,JK) - ZDUM1 = MIN(1.0,20.* PRC_OUT(JI,JJ,JK)*SQRT(ZDZ(JI))/ZQSL(JI)) ! cloud liquid water factor - ZDUM3 = MAX(0.,PICLDFR(JI,JJ,JK)-PWCLDFR(JI,JJ,JK)) ! pure ice cloud part - IF (JK==D%NKTB) THEN - ZDUM4 = PRI_IN(JI,JJ,JK) - ELSE - ZDUM4 = PRI_IN(JI,JJ,JK) + PRS(JI,JJ,JK)*0.5 + PRG(JI,JJ,JK)*0.25 - ENDIF + PSIGRC(JIJ,JK) = MIN(1.,(1.-ZINC)*ZSRC_1D(INQ1)+ZINC*ZSRC_1D(INQ1+1)) + END DO + IF(PRESENT(PHLC_HCF) .AND. PRESENT(PHLC_HRC))THEN + PHLC_HCF(:,JK)=0. + PHLC_HRC(:,JK)=0. + ENDIF + IF(PRESENT(PHLI_HCF) .AND. PRESENT(PHLI_HRI))THEN + PHLI_HCF(:,JK)=0. + PHLI_HRI(:,JK)=0. + ENDIF + END IF !HCONDENS + + IF(.NOT. OCND2) THEN + DO JIJ=D%NIJB,D%NIJE + PRC_OUT(JIJ,JK) = (1.-ZFRAC(JIJ)) * ZCOND(JIJ) ! liquid condensate + PRI_OUT(JIJ,JK) = ZFRAC(JIJ) * ZCOND(JIJ) ! solid condensate + PT(JIJ,JK) = PT(JIJ,JK) + ((PRC_OUT(JIJ,JK)-PRC_IN(JIJ,JK))*ZLV(JIJ,JK) + & + &(PRI_OUT(JIJ,JK)-PRI_IN(JIJ,JK))*ZLS(JIJ,JK) ) & + & /ZCPD(JIJ,JK) + PRV_OUT(JIJ,JK) = ZRT(JIJ,JK) - PRC_OUT(JIJ,JK) - PRI_OUT(JIJ,JK)*ZPRIFACT + END DO + ELSE + DO JIJ=D%NIJB,D%NIJE + PRC_OUT(JIJ,JK) = (1.-ZFRAC(JIJ)) * ZCOND(JIJ) ! liquid condensate + ZLWINC = PRC_OUT(JIJ,JK) - PRC_IN(JIJ,JK) + ! +! This check is mainly for noise reduction : +! ------------------------- + IF(ABS(ZLWINC)>1.0E-12 .AND. ESATW(PT(JIJ,JK)) < PPABS(JIJ,JK)*0.5 )THEN + ZRCOLD = PRC_OUT(JIJ,JK) + ZRFRAC = PRV_IN(JIJ,JK) - ZLWINC + IF( PRV_IN(JIJ,JK) < ZRSW )THEN ! sub - saturation over water: + ! Avoid drying of cloudwater leading to supersaturation with + ! respect to water + ZRSDIF= MIN(0.,ZRSP-ZRFRAC) + ELSE ! super - saturation over water: + ! Avoid deposition of water leading to sub-saturation with + ! respect to water + ! ZRSDIF= MAX(0.,ZRSP-ZRFRAC) + ZRSDIF= 0. ! t7 + ENDIF + PRC_OUT(JIJ,JK) = ZCOND(JIJ) - ZRSDIF + ELSE + ZRCOLD = PRC_IN(JIJ,JK) + ENDIF + ! end check - ZDUM4 = MAX(0.,MIN(1.,PICE_CLD_WGT(JI,JJ)*ZDUM4*SQRT(ZDZ(JI))/ZQSI(JI))) ! clould ice+solid - ! precip. water factor + ! compute separate ice cloud: + PWCLDFR(JIJ,JK) = PCLDFR(JIJ,JK) + ZDUM1 = MIN(1.0,20.* PRC_OUT(JIJ,JK)*SQRT(ZDZ(JIJ))/ZQSL(JIJ)) ! cloud liquid water factor + ZDUM3 = MAX(0.,PICLDFR(JIJ,JK)-PWCLDFR(JIJ,JK)) ! pure ice cloud part + IF (JK==D%NKTB) THEN + ZDUM4 = PRI_IN(JIJ,JK) + ELSE + ZDUM4 = PRI_IN(JIJ,JK) + PRS(JIJ,JK)*0.5 + PRG(JIJ,JK)*0.25 + ENDIF - ZDUM2 = (0.8*PCLDFR(JI,JJ,JK)+0.2)*MIN(1.,ZDUM1 + ZDUM4*PCLDFR(JI,JJ,JK)) - ! water cloud, use 'statistical' cloud, but reduce it in case of low liquid content + ZDUM4 = MAX(0.,MIN(1.,PICE_CLD_WGT(JIJ)*ZDUM4*SQRT(ZDZ(JIJ))/ZQSI(JIJ))) ! clould ice+solid + ! precip. water factor - PCLDFR(JI,JJ,JK) = MIN(1., ZDUM2 + (0.5*ZDUM3+0.5)*ZDUM4) ! Rad cloud - ! Reduce ice cloud part in case of low ice water content - PRI_OUT(JI,JJ,JK) = PRI_IN(JI,JJ,JK) - PT(JI,JJ,JK) = PT(JI,JJ,JK) + ((PRC_OUT(JI,JJ,JK)-ZRCOLD)*ZLV(JI,JJ,JK) + & - &(PRI_OUT(JI,JJ,JK)-PRI_IN(JI,JJ,JK))*ZLS(JI,JJ,JK) ) & - & /ZCPD(JI,JJ,JK) - PRV_OUT(JI,JJ,JK) = ZRT(JI,JJ,JK) - PRC_OUT(JI,JJ,JK) - PRI_OUT(JI,JJ,JK)*ZPRIFACT - END DO - END IF ! End OCND2 - IF(HLAMBDA3=='CB')THEN - DO JI=D%NIB,D%NIE - ! s r_c/ sig_s^2 - ! PSIGRC(JI,JJ,JK) = PCLDFR(JI,JJ,JK) ! use simple Gaussian relation - ! - ! multiply PSRCS by the lambda3 coefficient - ! - ! PSIGRC(JI,JJ,JK) = 2.*PCLDFR(JI,JJ,JK) * MIN( 3. , MAX(1.,1.-ZQ1(JI)) ) - ! in the 3D case lambda_3 = 1. + ZDUM2 = (0.8*PCLDFR(JIJ,JK)+0.2)*MIN(1.,ZDUM1 + ZDUM4*PCLDFR(JIJ,JK)) + ! water cloud, use 'statistical' cloud, but reduce it in case of low liquid content - PSIGRC(JI,JJ,JK) = PSIGRC(JI,JJ,JK)* MIN( 3. , MAX(1.,1.-ZQ1(JI)) ) - END DO - END IF - END DO + PCLDFR(JIJ,JK) = MIN(1., ZDUM2 + (0.5*ZDUM3+0.5)*ZDUM4) ! Rad cloud + ! Reduce ice cloud part in case of low ice water content + PRI_OUT(JIJ,JK) = PRI_IN(JIJ,JK) + PT(JIJ,JK) = PT(JIJ,JK) + ((PRC_OUT(JIJ,JK)-ZRCOLD)*ZLV(JIJ,JK) + & + &(PRI_OUT(JIJ,JK)-PRI_IN(JIJ,JK))*ZLS(JIJ,JK) ) & + & /ZCPD(JIJ,JK) + PRV_OUT(JIJ,JK) = ZRT(JIJ,JK) - PRC_OUT(JIJ,JK) - PRI_OUT(JIJ,JK)*ZPRIFACT + END DO + END IF ! End OCND2 + IF(HLAMBDA3=='CB')THEN + DO JIJ=D%NIJB,D%NIJE + ! s r_c/ sig_s^2 + ! PSIGRC(JIJ,JK) = PCLDFR(JIJ,JK) ! use simple Gaussian relation + ! + ! multiply PSRCS by the lambda3 coefficient + ! + ! PSIGRC(JIJ,JK) = 2.*PCLDFR(JIJ,JK) * MIN( 3. , MAX(1.,1.-ZQ1(JIJ)) ) + ! in the 3D case lambda_3 = 1. + + PSIGRC(JIJ,JK) = PSIGRC(JIJ,JK)* MIN( 3. , MAX(1.,1.-ZQ1(JIJ)) ) + END DO + END IF END DO ! IF (LHOOK) CALL DR_HOOK('CONDENSATION',1,ZHOOK_HANDLE) diff --git a/src/common/micro/ice_adjust.F90 b/src/common/micro/ice_adjust.F90 index c6cd2b745ab6b148912964fac112680ec498ae2f..77108bd2cf9d97431ebe5b65c484741067a89f48 100644 --- a/src/common/micro/ice_adjust.F90 +++ b/src/common/micro/ice_adjust.F90 @@ -119,7 +119,7 @@ USE MODD_TURB_n, ONLY: TURB_t USE MODD_BUDGET, ONLY: TBUDGETDATA, TBUDGETCONF_t, NBUDGET_TH, NBUDGET_RV, NBUDGET_RC, NBUDGET_RI USE MODD_RAIN_ICE_PARAM, ONLY : RAIN_ICE_PARAM_t ! -USE MODE_BUDGET, ONLY: BUDGET_STORE_INIT, BUDGET_STORE_END +USE MODE_BUDGET, ONLY: BUDGET_STORE_INIT_PHY, BUDGET_STORE_END_PHY ! USE MODI_CONDENSATION ! @@ -152,72 +152,69 @@ LOGICAL, INTENT(IN) :: LHGT_QS ! logical switch for height CHARACTER(LEN=80), INTENT(IN) :: HSUBG_MF_PDF REAL, INTENT(IN) :: PTSTEP ! Double Time step ! (single if cold start) -REAL, DIMENSION(D%NIT,D%NJT), INTENT(IN) :: PSIGQSAT ! coeff applied to qsat variance contribution +REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSIGQSAT ! coeff applied to qsat variance contribution ! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRHODJ ! Dry density * Jacobian -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEXNREF ! Reference Exner function -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRHODREF +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODJ ! Dry density * Jacobian +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PEXNREF ! Reference Exner function +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODREF ! -REAL, DIMENSION(MERGE(D%NIT,0,OSUBG_COND),& - MERGE(D%NJT,0,OSUBG_COND),& +REAL, DIMENSION(MERGE(D%NIJT,0,OSUBG_COND),& MERGE(D%NKT,0,OSUBG_COND)), INTENT(IN) :: PSIGS ! Sigma_s at time t -LOGICAL, INTENT(IN) :: LMFCONV ! =SIZE(PMFCONV)!=0 -REAL, DIMENSION(MERGE(D%NIT,0,LMFCONV),& - MERGE(D%NJT,0,LMFCONV),& +LOGICAL, INTENT(IN) :: LMFCONV ! =SIZE(PMFCONV)!=0 +REAL, DIMENSION(MERGE(D%NIJT,0,LMFCONV),& MERGE(D%NKT,0,LMFCONV)), INTENT(IN) :: PMFCONV ! convective mass flux -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PPABST ! Absolute Pressure at t -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PZZ ! height of model layer -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEXN ! Exner function -! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PCF_MF ! Convective Mass Flux Cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRC_MF ! Convective Mass Flux liquid mixing ratio -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRI_MF ! Convective Mass Flux ice mixing ratio -! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRV ! Water vapor m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRC ! Cloud water m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PRVS ! Water vapor m.r. source -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PRCS ! Cloud water m.r. source -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTH ! Theta to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PTHS ! Theta source +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PPABST ! Absolute Pressure at t +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PZZ ! height of model layer +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PEXN ! Exner function +! +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PCF_MF ! Convective Mass Flux Cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRC_MF ! Convective Mass Flux liquid mixing ratio +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRI_MF ! Convective Mass Flux ice mixing ratio +! +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRV ! Water vapor m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRC ! Cloud water m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PRVS ! Water vapor m.r. source +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PRCS ! Cloud water m.r. source +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTH ! Theta to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PTHS ! Theta source LOGICAL, INTENT(IN) :: OCOMPUTE_SRC -REAL, DIMENSION(MERGE(D%NIT,0,OCOMPUTE_SRC),& - MERGE(D%NJT,0,OCOMPUTE_SRC),& +REAL, DIMENSION(MERGE(D%NIJT,0,OCOMPUTE_SRC),& MERGE(D%NKT,0,OCOMPUTE_SRC)), INTENT(OUT) :: PSRCS ! Second-order flux ! s'rc'/2Sigma_s2 at time t+1 ! multiplied by Lambda_3 -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PCLDFR ! Cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PICLDFR ! ice cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PWCLDFR ! water or mixed-phase cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSSIO ! Super-saturation with respect to ice in the - ! supersaturated fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSSIU ! Sub-saturation with respect to ice in the - ! subsaturated fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PIFR ! Ratio cloud ice moist part to dry part -! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT):: PRIS ! Cloud ice m.r. at t+1 -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRR ! Rain water m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRI ! Cloud ice m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRS ! Aggregate m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRG ! Graupel m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PCLDFR ! Cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PICLDFR ! ice cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PWCLDFR ! water or mixed-phase cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSSIO ! Super-saturation with respect to ice in the + ! supersaturated fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSSIU ! Sub-saturation with respect to ice in the + ! subsaturated fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PIFR ! Ratio cloud ice moist part to dry part +! +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT):: PRIS ! Cloud ice m.r. at t+1 +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRR ! Rain water m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRI ! Cloud ice m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRS ! Aggregate m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRG ! Graupel m.r. to adjust TYPE(TBUDGETDATA), DIMENSION(KBUDGETS), INTENT(INOUT):: TBUDGETS INTEGER, INTENT(IN) :: KBUDGETS -REAL, DIMENSION(D%NIT,D%NJT), OPTIONAL, INTENT(IN) :: PICE_CLD_WGT -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PRH ! Hail m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RV ! Adjusted value -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RC ! Adjusted value -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RI ! Adjusted value -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_TH ! Adjusted value -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HRC -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HCF -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HRI -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HCF +REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PICE_CLD_WGT +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PRH ! Hail m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RV ! Adjusted value +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RC ! Adjusted value +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RI ! Adjusted value +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_TH ! Adjusted value +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HRC +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HCF +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HRI +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HCF ! ! !* 0.2 Declarations of local variables : ! ! REAL :: ZW1,ZW2 ! intermediate fields -REAL, DIMENSION(D%NIT,D%NJT,D%NKT) & +REAL, DIMENSION(D%NIJT,D%NKT) & :: ZT, & ! adjusted temperature ZRV, ZRC, ZRI, & ! adjusted state ZCPH, & ! guess of the CPh for the mixing @@ -227,10 +224,10 @@ REAL :: ZCRIAUT, & ! Autoconversion thresholds ZHCF, ZHR ! INTEGER :: JITER,ITERMAX ! iterative loop for first order adjustment -INTEGER :: JI, JJ, JK +INTEGER :: JIJ, JK ! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZSIGS, ZSRCS -REAL, DIMENSION(D%NIT,D%NJT) :: ZSIGQSAT +REAL, DIMENSION(D%NIJT,D%NKT) :: ZSIGS, ZSRCS +REAL, DIMENSION(D%NIJT) :: ZSIGQSAT REAL(KIND=JPRB) :: ZHOOK_HANDLE ! !------------------------------------------------------------------------------- @@ -242,10 +239,10 @@ IF (LHOOK) CALL DR_HOOK('ICE_ADJUST',0,ZHOOK_HANDLE) ! ITERMAX=1 ! -IF(BUCONF%LBUDGET_TH) CALL BUDGET_STORE_INIT(TBUDGETS(NBUDGET_TH), TRIM(HBUNAME), PTHS(:, :, :)*PRHODJ(:, :, :)) -IF(BUCONF%LBUDGET_RV) CALL BUDGET_STORE_INIT(TBUDGETS(NBUDGET_RV), TRIM(HBUNAME), PRVS(:, :, :)*PRHODJ(:, :, :)) -IF(BUCONF%LBUDGET_RC) CALL BUDGET_STORE_INIT(TBUDGETS(NBUDGET_RC), TRIM(HBUNAME), PRCS(:, :, :)*PRHODJ(:, :, :)) -IF(BUCONF%LBUDGET_RI) CALL BUDGET_STORE_INIT(TBUDGETS(NBUDGET_RI), TRIM(HBUNAME), PRIS(:, :, :)*PRHODJ(:, :, :)) +IF(BUCONF%LBUDGET_TH) CALL BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_TH), TRIM(HBUNAME), PTHS(:, :)*PRHODJ(:, :)) +IF(BUCONF%LBUDGET_RV) CALL BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RV), TRIM(HBUNAME), PRVS(:, :)*PRHODJ(:, :)) +IF(BUCONF%LBUDGET_RC) CALL BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RC), TRIM(HBUNAME), PRCS(:, :)*PRHODJ(:, :)) +IF(BUCONF%LBUDGET_RI) CALL BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RI), TRIM(HBUNAME), PRIS(:, :)*PRHODJ(:, :)) !------------------------------------------------------------------------------- ! !* 2. COMPUTE QUANTITIES WITH THE GUESS OF THE FUTURE INSTANT @@ -260,12 +257,10 @@ DO JITER =1,ITERMAX ! and the latent heat of sublimation Ls(T*) at t+1 ! DO JK=D%NKTB,D%NKTE - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - IF (JITER==1) ZT(JI,JJ,JK) = PTH(JI,JJ,JK) * PEXN(JI,JJ,JK) - ZLV(JI,JJ,JK) = CST%XLVTT + ( CST%XCPV - CST%XCL ) * ( ZT(JI,JJ,JK) -CST%XTT ) - ZLS(JI,JJ,JK) = CST%XLSTT + ( CST%XCPV - CST%XCI ) * ( ZT(JI,JJ,JK) -CST%XTT ) - ENDDO + DO JIJ=D%NIJB,D%NIJE + IF (JITER==1) ZT(JIJ,JK) = PTH(JIJ,JK) * PEXN(JIJ,JK) + ZLV(JIJ,JK) = CST%XLVTT + ( CST%XCPV - CST%XCL ) * ( ZT(JIJ,JK) -CST%XTT ) + ZLS(JIJ,JK) = CST%XLSTT + ( CST%XCPV - CST%XCI ) * ( ZT(JIJ,JK) -CST%XTT ) ENDDO ENDDO ! @@ -285,156 +280,154 @@ ENDDO ! end of the iterative loop ! ! DO JK=D%NKTB,D%NKTE - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - ! - !* 5.0 compute the variation of mixing ratio - ! - ! Rc - Rc* - ZW1 = (ZRC(JI,JJ,JK) - PRC(JI,JJ,JK)) / PTSTEP ! Pcon = ---------- - ! 2 Delta t - ZW2 = (ZRI(JI,JJ,JK) - PRI(JI,JJ,JK)) / PTSTEP ! idem ZW1 but for Ri - ! - !* 5.1 compute the sources - ! - IF( ZW1 < 0.0 ) THEN - ZW1 = MAX ( ZW1, -PRCS(JI,JJ,JK) ) - ELSE - ZW1 = MIN ( ZW1, PRVS(JI,JJ,JK) ) - ENDIF - PRVS(JI,JJ,JK) = PRVS(JI,JJ,JK) - ZW1 - PRCS(JI,JJ,JK) = PRCS(JI,JJ,JK) + ZW1 - PTHS(JI,JJ,JK) = PTHS(JI,JJ,JK) + & - ZW1 * ZLV(JI,JJ,JK) / (ZCPH(JI,JJ,JK) * PEXNREF(JI,JJ,JK)) - ! - IF( ZW2 < 0.0 ) THEN - ZW2 = MAX ( ZW2, -PRIS(JI,JJ,JK) ) + DO JIJ=D%NIJB,D%NIJE + ! + !* 5.0 compute the variation of mixing ratio + ! + ! Rc - Rc* + ZW1 = (ZRC(JIJ,JK) - PRC(JIJ,JK)) / PTSTEP ! Pcon = ---------- + ! 2 Delta t + ZW2 = (ZRI(JIJ,JK) - PRI(JIJ,JK)) / PTSTEP ! idem ZW1 but for Ri + ! + !* 5.1 compute the sources + ! + IF( ZW1 < 0.0 ) THEN + ZW1 = MAX ( ZW1, -PRCS(JIJ,JK) ) + ELSE + ZW1 = MIN ( ZW1, PRVS(JIJ,JK) ) + ENDIF + PRVS(JIJ,JK) = PRVS(JIJ,JK) - ZW1 + PRCS(JIJ,JK) = PRCS(JIJ,JK) + ZW1 + PTHS(JIJ,JK) = PTHS(JIJ,JK) + & + ZW1 * ZLV(JIJ,JK) / (ZCPH(JIJ,JK) * PEXNREF(JIJ,JK)) + ! + IF( ZW2 < 0.0 ) THEN + ZW2 = MAX ( ZW2, -PRIS(JIJ,JK) ) + ELSE + ZW2 = MIN ( ZW2, PRVS(JIJ,JK) ) + ENDIF + PRVS(JIJ,JK) = PRVS(JIJ,JK) - ZW2 + PRIS(JIJ,JK) = PRIS(JIJ,JK) + ZW2 + PTHS(JIJ,JK) = PTHS(JIJ,JK) + & + ZW2 * ZLS(JIJ,JK) / (ZCPH(JIJ,JK) * PEXNREF(JIJ,JK)) + ENDDO + ! + !* 5.2 compute the cloud fraction PCLDFR + ! + IF ( .NOT. OSUBG_COND ) THEN + DO JIJ=D%NIJB,D%NIJE + IF (PRCS(JIJ,JK) + PRIS(JIJ,JK) > 1.E-12 / PTSTEP) THEN + PCLDFR(JIJ,JK) = 1. ELSE - ZW2 = MIN ( ZW2, PRVS(JI,JJ,JK) ) + PCLDFR(JIJ,JK) = 0. ENDIF - PRVS(JI,JJ,JK) = PRVS(JI,JJ,JK) - ZW2 - PRIS(JI,JJ,JK) = PRIS(JI,JJ,JK) + ZW2 - PTHS(JI,JJ,JK) = PTHS(JI,JJ,JK) + & - ZW2 * ZLS(JI,JJ,JK) / (ZCPH(JI,JJ,JK) * PEXNREF(JI,JJ,JK)) + IF (OCOMPUTE_SRC) THEN + PSRCS(JIJ,JK) = PCLDFR(JIJ,JK) + END IF ENDDO - ! - !* 5.2 compute the cloud fraction PCLDFR - ! - IF ( .NOT. OSUBG_COND ) THEN - DO JI=D%NIB,D%NIE - IF (PRCS(JI,JJ,JK) + PRIS(JI,JJ,JK) > 1.E-12 / PTSTEP) THEN - PCLDFR(JI,JJ,JK) = 1. - ELSE - PCLDFR(JI,JJ,JK) = 0. - ENDIF - IF (OCOMPUTE_SRC) THEN - PSRCS(JI,JJ,JK) = PCLDFR(JI,JJ,JK) - END IF - ENDDO - ELSE !OSUBG_COND case - DO JI=D%NIB,D%NIE - !We limit PRC_MF+PRI_MF to PRVS*PTSTEP to avoid negative humidity - ZW1=PRC_MF(JI,JJ,JK)/PTSTEP - ZW2=PRI_MF(JI,JJ,JK)/PTSTEP - IF(ZW1+ZW2>PRVS(JI,JJ,JK)) THEN - ZW1=ZW1*PRVS(JI,JJ,JK)/(ZW1+ZW2) - ZW2=PRVS(JI,JJ,JK)-ZW1 - ENDIF - PCLDFR(JI,JJ,JK)=MIN(1.,PCLDFR(JI,JJ,JK)+PCF_MF(JI,JJ,JK)) - PRCS(JI,JJ,JK)=PRCS(JI,JJ,JK)+ZW1 - PRIS(JI,JJ,JK)=PRIS(JI,JJ,JK)+ZW2 - PRVS(JI,JJ,JK)=PRVS(JI,JJ,JK)-(ZW1+ZW2) - PTHS(JI,JJ,JK) = PTHS(JI,JJ,JK) + & - (ZW1 * ZLV(JI,JJ,JK) + ZW2 * ZLS(JI,JJ,JK)) / ZCPH(JI,JJ,JK) / PEXNREF(JI,JJ,JK) - ! - IF(PRESENT(PHLC_HRC) .AND. PRESENT(PHLC_HCF)) THEN - ZCRIAUT=ICEP%XCRIAUTC/PRHODREF(JI,JJ,JK) - IF(HSUBG_MF_PDF=='NONE')THEN - IF(ZW1*PTSTEP>PCF_MF(JI,JJ,JK) * ZCRIAUT) THEN - PHLC_HRC(JI,JJ,JK)=PHLC_HRC(JI,JJ,JK)+ZW1*PTSTEP - PHLC_HCF(JI,JJ,JK)=MIN(1.,PHLC_HCF(JI,JJ,JK)+PCF_MF(JI,JJ,JK)) - ENDIF - ELSEIF(HSUBG_MF_PDF=='TRIANGLE')THEN - !ZHCF is the precipitating part of the *cloud* and not of the grid cell - IF(ZW1*PTSTEP>PCF_MF(JI,JJ,JK)*ZCRIAUT) THEN - ZHCF=1.-.5*(ZCRIAUT*PCF_MF(JI,JJ,JK) / MAX(1.E-20, ZW1*PTSTEP))**2 - ZHR=ZW1*PTSTEP-(ZCRIAUT*PCF_MF(JI,JJ,JK))**3 / & - &(3*MAX(1.E-20, ZW1*PTSTEP)**2) - ELSEIF(2.*ZW1*PTSTEP<=PCF_MF(JI,JJ,JK) * ZCRIAUT) THEN - ZHCF=0. - ZHR=0. - ELSE - ZHCF=(2.*ZW1*PTSTEP-ZCRIAUT*PCF_MF(JI,JJ,JK))**2 / & - &(2.*MAX(1.E-20, ZW1*PTSTEP)**2) - ZHR=(4.*(ZW1*PTSTEP)**3-3.*ZW1*PTSTEP*(ZCRIAUT*PCF_MF(JI,JJ,JK))**2+& - (ZCRIAUT*PCF_MF(JI,JJ,JK))**3) / & - &(3*MAX(1.E-20, ZW1*PTSTEP)**2) - ENDIF - ZHCF=ZHCF*PCF_MF(JI,JJ,JK) !to retrieve the part of the grid cell - PHLC_HCF(JI,JJ,JK)=MIN(1.,PHLC_HCF(JI,JJ,JK)+ZHCF) !total part of the grid cell that is precipitating - PHLC_HRC(JI,JJ,JK)=PHLC_HRC(JI,JJ,JK)+ZHR + ELSE !OSUBG_COND case + DO JIJ=D%NIJB,D%NIJE + !We limit PRC_MF+PRI_MF to PRVS*PTSTEP to avoid negative humidity + ZW1=PRC_MF(JIJ,JK)/PTSTEP + ZW2=PRI_MF(JIJ,JK)/PTSTEP + IF(ZW1+ZW2>PRVS(JIJ,JK)) THEN + ZW1=ZW1*PRVS(JIJ,JK)/(ZW1+ZW2) + ZW2=PRVS(JIJ,JK)-ZW1 + ENDIF + PCLDFR(JIJ,JK)=MIN(1.,PCLDFR(JIJ,JK)+PCF_MF(JIJ,JK)) + PRCS(JIJ,JK)=PRCS(JIJ,JK)+ZW1 + PRIS(JIJ,JK)=PRIS(JIJ,JK)+ZW2 + PRVS(JIJ,JK)=PRVS(JIJ,JK)-(ZW1+ZW2) + PTHS(JIJ,JK) = PTHS(JIJ,JK) + & + (ZW1 * ZLV(JIJ,JK) + ZW2 * ZLS(JIJ,JK)) / ZCPH(JIJ,JK) / PEXNREF(JIJ,JK) + ! + IF(PRESENT(PHLC_HRC) .AND. PRESENT(PHLC_HCF)) THEN + ZCRIAUT=ICEP%XCRIAUTC/PRHODREF(JIJ,JK) + IF(HSUBG_MF_PDF=='NONE')THEN + IF(ZW1*PTSTEP>PCF_MF(JIJ,JK) * ZCRIAUT) THEN + PHLC_HRC(JIJ,JK)=PHLC_HRC(JIJ,JK)+ZW1*PTSTEP + PHLC_HCF(JIJ,JK)=MIN(1.,PHLC_HCF(JIJ,JK)+PCF_MF(JIJ,JK)) ENDIF - ENDIF - IF(PRESENT(PHLI_HRI) .AND. PRESENT(PHLI_HCF)) THEN - ZCRIAUT=MIN(ICEP%XCRIAUTI,10**(ICEP%XACRIAUTI*(ZT(JI,JJ,JK)-CST%XTT)+ICEP%XBCRIAUTI)) - IF(HSUBG_MF_PDF=='NONE')THEN - IF(ZW2*PTSTEP>PCF_MF(JI,JJ,JK) * ZCRIAUT) THEN - PHLI_HRI(JI,JJ,JK)=PHLI_HRI(JI,JJ,JK)+ZW2*PTSTEP - PHLI_HCF(JI,JJ,JK)=MIN(1.,PHLI_HCF(JI,JJ,JK)+PCF_MF(JI,JJ,JK)) - ENDIF - ELSEIF(HSUBG_MF_PDF=='TRIANGLE')THEN - !ZHCF is the precipitating part of the *cloud* and not of the grid cell - IF(ZW2*PTSTEP>PCF_MF(JI,JJ,JK)*ZCRIAUT) THEN - ZHCF=1.-.5*(ZCRIAUT*PCF_MF(JI,JJ,JK) / (ZW2*PTSTEP))**2 - ZHR=ZW2*PTSTEP-(ZCRIAUT*PCF_MF(JI,JJ,JK))**3/(3*(ZW2*PTSTEP)**2) - ELSEIF(2.*ZW2*PTSTEP<=PCF_MF(JI,JJ,JK) * ZCRIAUT) THEN - ZHCF=0. - ZHR=0. - ELSE - ZHCF=(2.*ZW2*PTSTEP-ZCRIAUT*PCF_MF(JI,JJ,JK))**2 / (2.*(ZW2*PTSTEP)**2) - ZHR=(4.*(ZW2*PTSTEP)**3-3.*ZW2*PTSTEP*(ZCRIAUT*PCF_MF(JI,JJ,JK))**2+& - (ZCRIAUT*PCF_MF(JI,JJ,JK))**3)/(3*(ZW2*PTSTEP)**2) - ENDIF - ZHCF=ZHCF*PCF_MF(JI,JJ,JK) !to retrieve the part of the grid cell - PHLI_HCF(JI,JJ,JK)=MIN(1.,PHLI_HCF(JI,JJ,JK)+ZHCF) !total part of the grid cell that is precipitating - PHLI_HRI(JI,JJ,JK)=PHLI_HRI(JI,JJ,JK)+ZHR + ELSEIF(HSUBG_MF_PDF=='TRIANGLE')THEN + !ZHCF is the precipitating part of the *cloud* and not of the grid cell + IF(ZW1*PTSTEP>PCF_MF(JIJ,JK)*ZCRIAUT) THEN + ZHCF=1.-.5*(ZCRIAUT*PCF_MF(JIJ,JK) / MAX(1.E-20, ZW1*PTSTEP))**2 + ZHR=ZW1*PTSTEP-(ZCRIAUT*PCF_MF(JIJ,JK))**3 / & + &(3*MAX(1.E-20, ZW1*PTSTEP)**2) + ELSEIF(2.*ZW1*PTSTEP<=PCF_MF(JIJ,JK) * ZCRIAUT) THEN + ZHCF=0. + ZHR=0. + ELSE + ZHCF=(2.*ZW1*PTSTEP-ZCRIAUT*PCF_MF(JIJ,JK))**2 / & + &(2.*MAX(1.E-20, ZW1*PTSTEP)**2) + ZHR=(4.*(ZW1*PTSTEP)**3-3.*ZW1*PTSTEP*(ZCRIAUT*PCF_MF(JIJ,JK))**2+& + (ZCRIAUT*PCF_MF(JIJ,JK))**3) / & + &(3*MAX(1.E-20, ZW1*PTSTEP)**2) ENDIF + ZHCF=ZHCF*PCF_MF(JIJ,JK) !to retrieve the part of the grid cell + PHLC_HCF(JIJ,JK)=MIN(1.,PHLC_HCF(JIJ,JK)+ZHCF) !total part of the grid cell that is precipitating + PHLC_HRC(JIJ,JK)=PHLC_HRC(JIJ,JK)+ZHR ENDIF - ENDDO - ! - IF(PRESENT(POUT_RV) .OR. PRESENT(POUT_RC) .OR. & - &PRESENT(POUT_RI) .OR. PRESENT(POUT_TH)) THEN - DO JI=D%NIB,D%NIE - ZW1=PRC_MF(JI,JJ,JK) - ZW2=PRI_MF(JI,JJ,JK) - IF(ZW1+ZW2>ZRV(JI,JJ,JK)) THEN - ZW1=ZW1*ZRV(JI,JJ,JK)/(ZW1+ZW2) - ZW2=ZRV(JI,JJ,JK)-ZW1 + ENDIF + IF(PRESENT(PHLI_HRI) .AND. PRESENT(PHLI_HCF)) THEN + ZCRIAUT=MIN(ICEP%XCRIAUTI,10**(ICEP%XACRIAUTI*(ZT(JIJ,JK)-CST%XTT)+ICEP%XBCRIAUTI)) + IF(HSUBG_MF_PDF=='NONE')THEN + IF(ZW2*PTSTEP>PCF_MF(JIJ,JK) * ZCRIAUT) THEN + PHLI_HRI(JIJ,JK)=PHLI_HRI(JIJ,JK)+ZW2*PTSTEP + PHLI_HCF(JIJ,JK)=MIN(1.,PHLI_HCF(JIJ,JK)+PCF_MF(JIJ,JK)) ENDIF - ZRC(JI,JJ,JK)=ZRC(JI,JJ,JK)+ZW1 - ZRI(JI,JJ,JK)=ZRI(JI,JJ,JK)+ZW2 - ZRV(JI,JJ,JK)=ZRV(JI,JJ,JK)-(ZW1+ZW2) - ZT(JI,JJ,JK) = ZT(JI,JJ,JK) + & - (ZW1 * ZLV(JI,JJ,JK) + ZW2 * ZLS(JI,JJ,JK)) / ZCPH(JI,JJ,JK) - ENDDO + ELSEIF(HSUBG_MF_PDF=='TRIANGLE')THEN + !ZHCF is the precipitating part of the *cloud* and not of the grid cell + IF(ZW2*PTSTEP>PCF_MF(JIJ,JK)*ZCRIAUT) THEN + ZHCF=1.-.5*(ZCRIAUT*PCF_MF(JIJ,JK) / (ZW2*PTSTEP))**2 + ZHR=ZW2*PTSTEP-(ZCRIAUT*PCF_MF(JIJ,JK))**3/(3*(ZW2*PTSTEP)**2) + ELSEIF(2.*ZW2*PTSTEP<=PCF_MF(JIJ,JK) * ZCRIAUT) THEN + ZHCF=0. + ZHR=0. + ELSE + ZHCF=(2.*ZW2*PTSTEP-ZCRIAUT*PCF_MF(JIJ,JK))**2 / (2.*(ZW2*PTSTEP)**2) + ZHR=(4.*(ZW2*PTSTEP)**3-3.*ZW2*PTSTEP*(ZCRIAUT*PCF_MF(JIJ,JK))**2+& + (ZCRIAUT*PCF_MF(JIJ,JK))**3)/(3*(ZW2*PTSTEP)**2) + ENDIF + ZHCF=ZHCF*PCF_MF(JIJ,JK) !to retrieve the part of the grid cell + PHLI_HCF(JIJ,JK)=MIN(1.,PHLI_HCF(JIJ,JK)+ZHCF) !total part of the grid cell that is precipitating + PHLI_HRI(JIJ,JK)=PHLI_HRI(JIJ,JK)+ZHR + ENDIF ENDIF - ENDIF !OSUBG_COND - ENDDO + ENDDO + ! + IF(PRESENT(POUT_RV) .OR. PRESENT(POUT_RC) .OR. & + &PRESENT(POUT_RI) .OR. PRESENT(POUT_TH)) THEN + DO JIJ=D%NIJB,D%NIJE + ZW1=PRC_MF(JIJ,JK) + ZW2=PRI_MF(JIJ,JK) + IF(ZW1+ZW2>ZRV(JIJ,JK)) THEN + ZW1=ZW1*ZRV(JIJ,JK)/(ZW1+ZW2) + ZW2=ZRV(JIJ,JK)-ZW1 + ENDIF + ZRC(JIJ,JK)=ZRC(JIJ,JK)+ZW1 + ZRI(JIJ,JK)=ZRI(JIJ,JK)+ZW2 + ZRV(JIJ,JK)=ZRV(JIJ,JK)-(ZW1+ZW2) + ZT(JIJ,JK) = ZT(JIJ,JK) + & + (ZW1 * ZLV(JIJ,JK) + ZW2 * ZLS(JIJ,JK)) / ZCPH(JIJ,JK) + ENDDO + ENDIF + ENDIF !OSUBG_COND ENDDO ! IF(PRESENT(POUT_RV)) POUT_RV=ZRV IF(PRESENT(POUT_RC)) POUT_RC=ZRC IF(PRESENT(POUT_RI)) POUT_RI=ZRI -IF(PRESENT(POUT_TH)) POUT_TH=ZT / PEXN(:,:,:) +IF(PRESENT(POUT_TH)) POUT_TH=ZT / PEXN(:,:) ! ! !* 6. STORE THE BUDGET TERMS ! ---------------------- ! -IF(BUCONF%LBUDGET_TH) CALL BUDGET_STORE_END(TBUDGETS(NBUDGET_TH), TRIM(HBUNAME), PTHS(:, :, :)*PRHODJ(:, :, :)) -IF(BUCONF%LBUDGET_RV) CALL BUDGET_STORE_END(TBUDGETS(NBUDGET_RV), TRIM(HBUNAME), PRVS(:, :, :)*PRHODJ(:, :, :)) -IF(BUCONF%LBUDGET_RC) CALL BUDGET_STORE_END(TBUDGETS(NBUDGET_RC), TRIM(HBUNAME), PRCS(:, :, :)*PRHODJ(:, :, :)) -IF(BUCONF%LBUDGET_RI) CALL BUDGET_STORE_END(TBUDGETS(NBUDGET_RI), TRIM(HBUNAME), PRIS(:, :, :)*PRHODJ(:, :, :)) +IF(BUCONF%LBUDGET_TH) CALL BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_TH), TRIM(HBUNAME), PTHS(:, :)*PRHODJ(:, :)) +IF(BUCONF%LBUDGET_RV) CALL BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RV), TRIM(HBUNAME), PRVS(:, :)*PRHODJ(:, :)) +IF(BUCONF%LBUDGET_RC) CALL BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RC), TRIM(HBUNAME), PRCS(:, :)*PRHODJ(:, :)) +IF(BUCONF%LBUDGET_RI) CALL BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RI), TRIM(HBUNAME), PRIS(:, :)*PRHODJ(:, :)) !------------------------------------------------------------------------------ ! ! @@ -443,38 +436,36 @@ IF (LHOOK) CALL DR_HOOK('ICE_ADJUST',1,ZHOOK_HANDLE) CONTAINS SUBROUTINE ITERATION(PRV_IN,PRC_IN,PRI_IN,PRV_OUT,PRC_OUT,PRI_OUT) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRV_IN ! Water vapor m.r. to adjust in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRC_IN ! Cloud water m.r. to adjust in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRI_IN ! Cloud ice m.r. to adjust in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRV_OUT ! Water vapor m.r. to adjust in output -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRC_OUT ! Cloud water m.r. to adjust in output -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRI_OUT ! Cloud ice m.r. to adjust in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRV_IN ! Water vapor m.r. to adjust in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRC_IN ! Cloud water m.r. to adjust in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRI_IN ! Cloud ice m.r. to adjust in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRV_OUT ! Water vapor m.r. to adjust in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRC_OUT ! Cloud water m.r. to adjust in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRI_OUT ! Cloud ice m.r. to adjust in output ! !* 2.4 compute the specific heat for moist air (Cph) at t+1 DO JK=D%NKTB,D%NKTE - DO JJ=D%NJB,D%NJE - DO JI=D%NIB,D%NIE - SELECT CASE(KRR) - CASE(7) - ZCPH(JI,JJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JI,JJ,JK) & - + CST%XCL * (PRC_IN(JI,JJ,JK) + PRR(JI,JJ,JK)) & - + CST%XCI * (PRI_IN(JI,JJ,JK) + PRS(JI,JJ,JK) + PRG(JI,JJ,JK) + PRH(JI,JJ,JK)) - CASE(6) - ZCPH(JI,JJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JI,JJ,JK) & - + CST%XCL * (PRC_IN(JI,JJ,JK) + PRR(JI,JJ,JK)) & - + CST%XCI * (PRI_IN(JI,JJ,JK) + PRS(JI,JJ,JK) + PRG(JI,JJ,JK)) - CASE(5) - ZCPH(JI,JJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JI,JJ,JK) & - + CST%XCL * (PRC_IN(JI,JJ,JK) + PRR(JI,JJ,JK)) & - + CST%XCI * (PRI_IN(JI,JJ,JK) + PRS(JI,JJ,JK)) - CASE(3) - ZCPH(JI,JJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JI,JJ,JK) & - + CST%XCL * (PRC_IN(JI,JJ,JK) + PRR(JI,JJ,JK)) - CASE(2) - ZCPH(JI,JJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JI,JJ,JK) & - + CST%XCL * PRC_IN(JI,JJ,JK) - END SELECT - ENDDO + DO JIJ=D%NIJB,D%NIJE + SELECT CASE(KRR) + CASE(7) + ZCPH(JIJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JIJ,JK) & + + CST%XCL * (PRC_IN(JIJ,JK) + PRR(JIJ,JK)) & + + CST%XCI * (PRI_IN(JIJ,JK) + PRS(JIJ,JK) + PRG(JIJ,JK) + PRH(JIJ,JK)) + CASE(6) + ZCPH(JIJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JIJ,JK) & + + CST%XCL * (PRC_IN(JIJ,JK) + PRR(JIJ,JK)) & + + CST%XCI * (PRI_IN(JIJ,JK) + PRS(JIJ,JK) + PRG(JIJ,JK)) + CASE(5) + ZCPH(JIJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JIJ,JK) & + + CST%XCL * (PRC_IN(JIJ,JK) + PRR(JIJ,JK)) & + + CST%XCI * (PRI_IN(JIJ,JK) + PRS(JIJ,JK)) + CASE(3) + ZCPH(JIJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JIJ,JK) & + + CST%XCL * (PRC_IN(JIJ,JK) + PRR(JIJ,JK)) + CASE(2) + ZCPH(JIJ,JK) = CST%XCPD + CST%XCPV * PRV_IN(JIJ,JK) & + + CST%XCL * PRC_IN(JIJ,JK) + END SELECT ENDDO ENDDO ! @@ -500,8 +491,8 @@ ELSE ! FOR MIXED-PHASE CLOUD ! ----------------------------------------------- ! - ZSIGS(:,:,:)=0. - ZSIGQSAT(:,:)=0. + ZSIGS(:,:)=0. + ZSIGQSAT(:)=0. !We use ZSRCS because in Méso-NH, PSRCS can be a zero-length array in this case !ZT is INOUT CALL CONDENSATION(D, CST, ICEP, NEB, TURBN, & diff --git a/src/common/micro/mode_icecloud.F90 b/src/common/micro/mode_icecloud.F90 index e53841902b6281c4328ade465488ee0ce736e188..edfab2c0d93f535f6f8e5efe07216c2efb76ff5d 100644 --- a/src/common/micro/mode_icecloud.F90 +++ b/src/common/micro/mode_icecloud.F90 @@ -3,12 +3,13 @@ IMPLICIT NONE CONTAINS SUBROUTINE ICECLOUD & ! Input : - & ( NP,PP,PZ,PDZ,PT,PR,PTSTEP,PPBLH,PWCLD,XW2D, & + & ( D,PP,PZ,PDZ,PT,PR,PTSTEP,PPBLH,PWCLD,XW2D, & ! Output : & SIFRC,SSIO,SSIU,W2D,RSI) USE PARKIND1, ONLY : JPRB USE YOMHOOK , ONLY : LHOOK, DR_HOOK + USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t USE MODD_CST,ONLY : XCPD,XCPV,XLVTT,XLSTT,XG,XRD,XEPSILO USE MODE_TIWMX, ONLY: ESATW, ESATI USE MODE_QSATMX_TAB, ONLY: QSATMX_TAB @@ -51,30 +52,30 @@ SUBROUTINE ICECLOUD & ! the gridbox and parts of the gridbox ! RSI : Saturation mixing ratio over ice -INTEGER, INTENT(IN) :: NP -REAL, INTENT(IN) :: PP(NP) -REAL, INTENT(IN) :: PZ(NP) -REAL, INTENT(IN) :: PDZ(NP) -REAL, INTENT(IN) :: PT(NP) -REAL, INTENT(IN) :: PR(NP) +TYPE(DIMPHYEX_t), INTENT(IN) :: D +REAL, INTENT(IN) :: PP(D%NIJT) +REAL, INTENT(IN) :: PZ(D%NIJT) +REAL, INTENT(IN) :: PDZ(D%NIJT) +REAL, INTENT(IN) :: PT(D%NIJT) +REAL, INTENT(IN) :: PR(D%NIJT) REAL, INTENT(IN) :: PTSTEP REAL, INTENT(IN) :: PPBLH -REAL, INTENT(IN) :: PWCLD(NP) +REAL, INTENT(IN) :: PWCLD(D%NIJT) REAL, INTENT(IN) :: XW2D ! OUTPUT arguments (arguments d'sortie) !--------------------------------------------- -REAL, INTENT(OUT) :: SIFRC(NP) -REAL, INTENT(OUT) :: SSIO(NP) -REAL, INTENT(OUT) :: SSIU(NP) -REAL, INTENT(OUT) :: W2D(NP) -REAL, INTENT(OUT) :: RSI(NP) +REAL, INTENT(OUT) :: SIFRC(D%NIJT) +REAL, INTENT(OUT) :: SSIO(D%NIJT) +REAL, INTENT(OUT) :: SSIU(D%NIJT) +REAL, INTENT(OUT) :: W2D(D%NIJT) +REAL, INTENT(OUT) :: RSI(D%NIJT) ! Working variables: REAL :: ZSIGMAX,ZSIGMAY,ZSIGMAZ,ZXDIST,ZYDIST,& & ZRSW,ZRHW,ZRHIN,ZDRHDZ,ZZ,ZRHDIST,ZRHLIM, & & ZRHDIF,ZWCLD,ZI2W,ZRHLIMICE,ZRHLIMINV,ZA,ZRHI,ZR -INTEGER :: JK +INTEGER :: JIJ REAL(KIND=JPRB) :: ZHOOK_HANDLE IF (LHOOK) CALL DR_HOOK('ICECLOUD',0,ZHOOK_HANDLE) @@ -91,31 +92,31 @@ ZXDIST=2500. ! due to stronger vertical velocities. ZYDIST=ZXDIST ! gridsize in y axis (m) -DO JK = 1, NP - ZR = MAX(0.,PR(JK)*PTSTEP) - SIFRC(JK) = 0. - ZA = ZR*PP(JK)/(XEPSILO + ZR) - ZRHW = ZA/ESATW(PT(JK)) - RSI(JK) = QSATMX_TAB(PP(JK),PT(JK),1.) - ZRHI = ZA/ESATI(PT(JK)) - ZI2W = ESATW(PT(JK))/ESATI(PT(JK)) - - SSIU(JK) = MIN(ZI2W,ZRHI) - SSIO(JK) = SSIU(JK) - W2D(JK) = 1. - - IF (PT(JK)>273.1 .OR. ZR<=0. .OR. ESATI(PT(JK)) >= PP(JK)*0.5) THEN - SSIU(JK) = SSIU(JK) - 1. - SSIO(JK) = SSIU(JK) - IF(PWCLD(JK)>=0.) SIFRC(JK) = PWCLD(JK) +DO JIJ = D%NIJB, D%NIJE + ZR = MAX(0.,PR(JIJ)*PTSTEP) + SIFRC(JIJ) = 0. + ZA = ZR*PP(JIJ)/(XEPSILO + ZR) + ZRHW = ZA/ESATW(PT(JIJ)) + RSI(JIJ) = QSATMX_TAB(PP(JIJ),PT(JIJ),1.) + ZRHI = ZA/ESATI(PT(JIJ)) + ZI2W = ESATW(PT(JIJ))/ESATI(PT(JIJ)) + + SSIU(JIJ) = MIN(ZI2W,ZRHI) + SSIO(JIJ) = SSIU(JIJ) + W2D(JIJ) = 1. + + IF (PT(JIJ)>273.1 .OR. ZR<=0. .OR. ESATI(PT(JIJ)) >= PP(JIJ)*0.5) THEN + SSIU(JIJ) = SSIU(JIJ) - 1. + SSIO(JIJ) = SSIU(JIJ) + IF(PWCLD(JIJ)>=0.) SIFRC(JIJ) = PWCLD(JIJ) CYCLE ENDIF ZRHIN = MAX(0.05, MIN(1.,ZRHW)) - ZDRHDZ=ZRHIN*XG /(PT(JK)*XRD)* & - & ( XEPSILO*XLVTT/(XCPD*PT(JK)) - 1.) ! correct + ZDRHDZ=ZRHIN*XG /(PT(JIJ)*XRD)* & + & ( XEPSILO*XLVTT/(XCPD*PT(JIJ)) - 1.) ! correct ! & ( ZEPSILO*XLSTT/(XCPD*PT) -1.) ! incorrect ! more exact ! assumed rh variation in the z axis (rh/m) in the pbl . @@ -124,9 +125,9 @@ DO JK = 1, NP ZZ=0. IF(PPBLH < 0. )THEN ! Assume boundary layer height is not available - ZZ = MIN(1.,MAX(0.,PZ(JK)*0.001)) + ZZ = MIN(1.,MAX(0.,PZ(JIJ)*0.001)) ELSE - IF(PZ(JK) > 35. .AND. PZ(JK) > PPBLH) ZZ = 1. + IF(PZ(JIJ) > 35. .AND. PZ(JIJ) > PPBLH) ZZ = 1. ENDIF ! 1.6e-2 rh/m means variations is of order 0.5 for a 1km dept. @@ -138,7 +139,7 @@ DO JK = 1, NP ! assumed to be fairly constantly increasing with height ZRHDIST = SQRT( ZXDIST*ZSIGMAX**2 + ZYDIST*ZSIGMAY**2 + & - & (1.-ZZ)* (PDZ(JK)*ZDRHDZ)**2 + ZZ*PDZ(JK)*ZSIGMAZ**2) + & (1.-ZZ)* (PDZ(JIJ)*ZDRHDZ)**2 + ZZ*PDZ(JIJ)*ZSIGMAZ**2) ! z-variation of rh in the pbl z-variation of rh outside the pbl ! Safety for very coarse vertical resolution: IF(ZZ > 0.1) ZRHDIST = ZRHDIST/(1.+ZRHDIST) @@ -147,20 +148,20 @@ DO JK = 1, NP ZRHLIM = MAX(0.5,MIN(0.99,1.-0.5*ZRHDIST)) - IF(PWCLD(JK) < 0.)THEN + IF(PWCLD(JIJ) < 0.)THEN ! Assume water/mixed-phase cloud cover from e.g. ! statistical cloud scheme is not available ZRHDIF = (1. - ZRHW)/(1.0-ZRHLIM) ZRHDIF = 1. - SQRT(MAX(0.,ZRHDIF)) ZWCLD = MIN(1.,MAX(ZRHDIF,0.0)) ELSE - ZWCLD = PWCLD(JK) + ZWCLD = PWCLD(JIJ) ! possible to backwards compute a critical relative humity consitent with ! input cloudcover: ! IF(PWCLD < 0.99 .AND. PWCLD > 0.01) ZRHLIM= 1. - (1.-ZRHW)/(1.-PWCLD)**2 ENDIF - SIFRC(JK) = ZWCLD + SIFRC(JIJ) = ZWCLD ! relation rhlim with respect to water to that of ice: !ZRHLIMICE = MAX(ZRHDMIN*ZI2W,1.+ ZI2W*( ZRHLIM - 1.)) @@ -173,30 +174,30 @@ DO JK = 1, NP ZRHDIF = (ZRHI - ZRHLIMICE)*ZRHLIMINV IF(ZWCLD==0.)THEN - SIFRC(JK) = MIN(1.,0.5*MAX(0.,ZRHDIF)) + SIFRC(JIJ) = MIN(1.,0.5*MAX(0.,ZRHDIF)) ELSE ZA = 1. - 1./ZI2W - SIFRC(JK) = MIN(1.,ZA*0.5/ (1. - ZRHLIM)) - SIFRC(JK) = MIN(1.,ZWCLD + SIFRC(JK)) + SIFRC(JIJ) = MIN(1.,ZA*0.5/ (1. - ZRHLIM)) + SIFRC(JIJ) = MIN(1.,ZWCLD + SIFRC(JIJ)) ENDIF ENDIF - IF(SIFRC(JK) > 0.01) THEN - SSIU(JK) = SIFRC(JK) + ZRHLIMICE*(1.-SIFRC(JK)) - SSIO(JK) = (ZRHI - (1.- SIFRC(JK))*SSIU(JK))/SIFRC(JK) + IF(SIFRC(JIJ) > 0.01) THEN + SSIU(JIJ) = SIFRC(JIJ) + ZRHLIMICE*(1.-SIFRC(JIJ)) + SSIO(JIJ) = (ZRHI - (1.- SIFRC(JIJ))*SSIU(JIJ))/SIFRC(JIJ) ELSE - SIFRC(JK) = 0.! to aviod mismatch with output variables + SIFRC(JIJ) = 0.! to aviod mismatch with output variables ZA = MIN(0.,ZRHI-ZRHLIMICE) - SSIU(JK) = MAX(0.,SIFRC(JK) + ZRHLIMICE*(1.-SIFRC(JK)) + 2.*ZA ) + SSIU(JIJ) = MAX(0.,SIFRC(JIJ) + ZRHLIMICE*(1.-SIFRC(JIJ)) + 2.*ZA ) ENDIF - SSIO(JK) = MIN(ZI2W,SSIO(JK)) - SSIU(JK) = MAX(0.,SSIU(JK)) + SSIO(JIJ) = MIN(ZI2W,SSIO(JIJ)) + SSIU(JIJ) = MAX(0.,SSIU(JIJ)) ! Transform from relative humidity to degree of saturation: - SSIU(JK) = SSIU(JK) - 1. - SSIO(JK) = SSIO(JK) - 1. + SSIU(JIJ) = SSIU(JIJ) - 1. + SSIO(JIJ) = SSIO(JIJ) - 1. - IF (XW2D > 1.) W2D(JK) = 1./(1. - SIFRC(JK) + XW2D*SIFRC(JK)) + IF (XW2D > 1.) W2D(JIJ) = 1./(1. - SIFRC(JIJ) + XW2D*SIFRC(JIJ)) ENDDO diff --git a/src/common/micro/modi_condensation.F90 b/src/common/micro/modi_condensation.F90 index f557c480c196636f43284e1c2121bb28ae96e6a3..812dae784eb9a29e7c860111520c12e6fc82a32c 100644 --- a/src/common/micro/modi_condensation.F90 +++ b/src/common/micro/modi_condensation.F90 @@ -28,26 +28,25 @@ TYPE(TURB_t), INTENT(IN) :: TURBN CHARACTER(LEN=1), INTENT(IN) :: HFRAC_ICE CHARACTER(LEN=4), INTENT(IN) :: HCONDENS CHARACTER(LEN=*), INTENT(IN) :: HLAMBDA3 ! formulation for lambda3 coeff -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PPABS ! pressure (Pa) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PZZ ! height of model levels (m) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRHODREF -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PT ! grid scale T (K) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRV_IN ! grid scale water vapor mixing ratio (kg/kg) in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRV_OUT! grid scale water vapor mixing ratio (kg/kg) in output -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRC_IN ! grid scale r_c mixing ratio (kg/kg) in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRC_OUT! grid scale r_c mixing ratio (kg/kg) in output -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRI_IN ! grid scale r_i (kg/kg) in input -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PRI_OUT! grid scale r_i (kg/kg) in output -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRR ! grid scale mixing ration of rain (kg/kg) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRS ! grid scale mixing ration of snow (kg/kg) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRG ! grid scale mixing ration of graupel (kg/kg) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSIGS ! Sigma_s from turbulence scheme +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PPABS ! pressure (Pa) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PZZ ! height of model levels (m) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODREF +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PT ! grid scale T (K) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRV_IN ! grid scale water vapor mixing ratio (kg/kg) in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRV_OUT! grid scale water vapor mixing ratio (kg/kg) in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRC_IN ! grid scale r_c mixing ratio (kg/kg) in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRC_OUT! grid scale r_c mixing ratio (kg/kg) in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRI_IN ! grid scale r_i (kg/kg) in input +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PRI_OUT! grid scale r_i (kg/kg) in output +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRR ! grid scale mixing ration of rain (kg/kg) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRS ! grid scale mixing ration of snow (kg/kg) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRG ! grid scale mixing ration of graupel (kg/kg) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PSIGS ! Sigma_s from turbulence scheme LOGICAL, INTENT(IN) :: LMFCONV ! =SIZE(PMFCONV)!=0 -REAL, DIMENSION(MERGE(D%NIT,0,LMFCONV),& - MERGE(D%NJT,0,LMFCONV),& +REAL, DIMENSION(MERGE(D%NIJT,0,LMFCONV),& MERGE(D%NKT,0,LMFCONV)), INTENT(IN) :: PMFCONV! convective mass flux (kg /s m^2) -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PCLDFR ! cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSIGRC ! s r_c / sig_s^2 +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PCLDFR ! cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSIGRC ! s r_c / sig_s^2 LOGICAL, INTENT(IN) :: OUSERI ! logical switch to compute both ! liquid and solid condensate (OUSERI=.TRUE.) @@ -57,24 +56,24 @@ LOGICAL, INTENT(IN) :: OSIGMAS! use present global Sigma LOGICAL, INTENT(IN) :: OCND2 ! logical switch to sparate liquid and ice ! more rigid (DEFALT value : .FALSE.) LOGICAL, INTENT(IN) :: LHGT_QS! logical switch for height dependent VQSIGSAT -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PICLDFR ! ice cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PWCLDFR ! water or mixed-phase cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSSIO ! Super-saturation with respect to ice in the +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PICLDFR ! ice cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PWCLDFR ! water or mixed-phase cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSSIO ! Super-saturation with respect to ice in the ! supersaturated fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSSIU ! Sub-saturation with respect to ice in the +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSSIU ! Sub-saturation with respect to ice in the ! subsaturated fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PIFR ! Ratio cloud ice moist part -REAL, DIMENSION(D%NIT,D%NJT), INTENT(IN) :: PSIGQSAT ! use an extra "qsat" variance contribution (OSIGMAS case) +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PIFR ! Ratio cloud ice moist part +REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSIGQSAT ! use an extra "qsat" variance contribution (OSIGMAS case) ! multiplied by PSIGQSAT -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PLV ! Latent heat L_v -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PLS ! Latent heat L_s -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PCPH ! Specific heat C_ph -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HRC -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HCF ! cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HRI -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HCF -REAL, DIMENSION(D%NIT,D%NJT), OPTIONAL, INTENT(IN) :: PICE_CLD_WGT +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PLV ! Latent heat L_v +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PLS ! Latent heat L_s +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PCPH ! Specific heat C_ph +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HRC +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HCF ! cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HRI +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HCF +REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PICE_CLD_WGT END SUBROUTINE CONDENSATION ! END INTERFACE diff --git a/src/common/micro/modi_ice_adjust.F90 b/src/common/micro/modi_ice_adjust.F90 index 629f4e146a57e1a7e54be722568dab954e6915ee..d7809b182653d1adf791eab1cd7b927696f592dc 100644 --- a/src/common/micro/modi_ice_adjust.F90 +++ b/src/common/micro/modi_ice_adjust.F90 @@ -54,65 +54,62 @@ LOGICAL, INTENT(IN) :: LHGT_QS ! logical switch for height CHARACTER(LEN=80), INTENT(IN) :: HSUBG_MF_PDF REAL, INTENT(IN) :: PTSTEP ! Double Time step ! (single if cold start) -REAL, DIMENSION(D%NIT,D%NJT), INTENT(IN) :: PSIGQSAT ! coeff applied to qsat variance contribution +REAL, DIMENSION(D%NIJT), INTENT(IN) :: PSIGQSAT ! coeff applied to qsat variance contribution ! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRHODJ ! Dry density * Jacobian -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEXNREF ! Reference Exner function -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRHODREF +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODJ ! Dry density * Jacobian +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PEXNREF ! Reference Exner function +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRHODREF ! -REAL, DIMENSION(MERGE(D%NIT,0,OSUBG_COND),& - MERGE(D%NJT,0,OSUBG_COND),& +REAL, DIMENSION(MERGE(D%NIJT,0,OSUBG_COND),& MERGE(D%NKT,0,OSUBG_COND)), INTENT(IN) :: PSIGS ! Sigma_s at time t -LOGICAL, INTENT(IN) :: LMFCONV ! =SIZE(PMFCONV)!=0 -REAL, DIMENSION(MERGE(D%NIT,0,LMFCONV),& - MERGE(D%NJT,0,LMFCONV),& +LOGICAL, INTENT(IN) :: LMFCONV ! =SIZE(PMFCONV)!=0 +REAL, DIMENSION(MERGE(D%NIJT,0,LMFCONV),& MERGE(D%NKT,0,LMFCONV)), INTENT(IN) :: PMFCONV ! convective mass flux -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PPABST ! Absolute Pressure at t -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PZZ ! height of model layer -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEXN ! Exner function +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PPABST ! Absolute Pressure at t +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PZZ ! height of model layer +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PEXN ! Exner function ! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PCF_MF ! Convective Mass Flux Cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRC_MF ! Convective Mass Flux liquid mixing ratio -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRI_MF ! Convective Mass Flux ice mixing ratio +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PCF_MF ! Convective Mass Flux Cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRC_MF ! Convective Mass Flux liquid mixing ratio +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRI_MF ! Convective Mass Flux ice mixing ratio ! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRV ! Water vapor m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRC ! Cloud water m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PRVS ! Water vapor m.r. source -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PRCS ! Cloud water m.r. source -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTH ! Theta to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT) :: PTHS ! Theta source +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRV ! Water vapor m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRC ! Cloud water m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PRVS ! Water vapor m.r. source +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PRCS ! Cloud water m.r. source +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PTH ! Theta to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT) :: PTHS ! Theta source LOGICAL, INTENT(IN) :: OCOMPUTE_SRC -REAL, DIMENSION(MERGE(D%NIT,0,OCOMPUTE_SRC),& - MERGE(D%NJT,0,OCOMPUTE_SRC),& +REAL, DIMENSION(MERGE(D%NIJT,0,OCOMPUTE_SRC),& MERGE(D%NKT,0,OCOMPUTE_SRC)), INTENT(OUT) :: PSRCS ! Second-order flux ! s'rc'/2Sigma_s2 at time t+1 ! multiplied by Lambda_3 -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PCLDFR ! Cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PICLDFR ! ice cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PWCLDFR ! water or mixed-phase cloud fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSSIO ! Super-saturation with respect to ice in the - ! supersaturated fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PSSIU ! Sub-saturation with respect to ice in the - ! subsaturated fraction -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(OUT) :: PIFR ! Ratio cloud ice moist part to dry part +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PCLDFR ! Cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PICLDFR ! ice cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PWCLDFR ! water or mixed-phase cloud fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSSIO ! Super-saturation with respect to ice in the + ! supersaturated fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PSSIU ! Sub-saturation with respect to ice in the + ! subsaturated fraction +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(OUT) :: PIFR ! Ratio cloud ice moist part to dry part ! -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(INOUT):: PRIS ! Cloud ice m.r. at t+1 -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRR ! Rain water m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRI ! Cloud ice m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRS ! Aggregate m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRG ! Graupel m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(INOUT):: PRIS ! Cloud ice m.r. at t+1 +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRR ! Rain water m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRI ! Cloud ice m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRS ! Aggregate m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), INTENT(IN) :: PRG ! Graupel m.r. to adjust TYPE(TBUDGETDATA), DIMENSION(KBUDGETS), INTENT(INOUT):: TBUDGETS INTEGER, INTENT(IN) :: KBUDGETS -REAL, DIMENSION(D%NIT,D%NJT), OPTIONAL, INTENT(IN) :: PICE_CLD_WGT -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(IN) :: PRH ! Hail m.r. to adjust -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RV ! Adjusted value -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RC ! Adjusted value -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RI ! Adjusted value -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_TH ! Adjusted value -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HRC -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HCF -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HRI -REAL, DIMENSION(D%NIT,D%NJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HCF +REAL, DIMENSION(D%NIJT), OPTIONAL, INTENT(IN) :: PICE_CLD_WGT +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(IN) :: PRH ! Hail m.r. to adjust +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RV ! Adjusted value +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RC ! Adjusted value +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_RI ! Adjusted value +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: POUT_TH ! Adjusted value +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HRC +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLC_HCF +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HRI +REAL, DIMENSION(D%NIJT,D%NKT), OPTIONAL, INTENT(OUT) :: PHLI_HCF ! END SUBROUTINE ICE_ADJUST ! diff --git a/src/mesonh/ext/resolved_cloud.f90 b/src/mesonh/ext/resolved_cloud.f90 index f6353e5ae590f4d56d0557ee924afaaec69b7fb6..18b5cd6ba413b7afe4c4df761d570877e169567e 100644 --- a/src/mesonh/ext/resolved_cloud.f90 +++ b/src/mesonh/ext/resolved_cloud.f90 @@ -304,7 +304,7 @@ USE MODD_PARAM_LIMA, ONLY: LADJ, LCOLD, LPTSPLIT, LSPRO, NMOD_CCN, NMOD_IFN, USE MODD_RAIN_ICE_DESCR, ONLY: XRTMIN, RAIN_ICE_DESCR USE MODD_RAIN_ICE_PARAM, ONLY: RAIN_ICE_PARAM USE MODD_SALT, ONLY: LSALT -USE MODD_TURB_n, ONLY: CSUBG_AUCV_RI, CCONDENS, CLAMBDA3, CSUBG_MF_PDF +USE MODD_TURB_n, ONLY: TURBN, CSUBG_AUCV_RI, CCONDENS, CLAMBDA3, CSUBG_MF_PDF ! USE MODE_ll USE MODE_FILL_DIMPHYEX, ONLY: FILL_DIMPHYEX @@ -754,7 +754,7 @@ SELECT CASE ( HCLOUD ) ENDDO ZZZ = MZF( PZZ ) IF(LRED .AND. LADJ_BEFORE) THEN - CALL ICE_ADJUST (YLDIMPHYEX,CST, RAIN_ICE_PARAM,NEB, TBUCONF, KRR, & + CALL ICE_ADJUST (YLDIMPHYEX,CST, RAIN_ICE_PARAM, NEB, TURBN, TBUCONF, KRR, & CFRAC_ICE_ADJUST, CCONDENS, CLAMBDA3, & 'ADJU', OSUBG_COND, OSIGMAS, .FALSE., .FALSE., & CSUBG_MF_PDF, PTSTEP, ZSIGQSAT2D, & @@ -811,7 +811,7 @@ SELECT CASE ( HCLOUD ) ! ! IF (.NOT. LRED .OR. (LRED .AND. LADJ_AFTER) ) THEN - CALL ICE_ADJUST (YLDIMPHYEX,CST, RAIN_ICE_PARAM,NEB, TBUCONF, KRR, & + CALL ICE_ADJUST (YLDIMPHYEX,CST, RAIN_ICE_PARAM, NEB, TURBN, TBUCONF, KRR, & CFRAC_ICE_ADJUST, CCONDENS, CLAMBDA3, & 'DEPI', OSUBG_COND, OSIGMAS, .FALSE., .FALSE., & CSUBG_MF_PDF, PTSTEP, ZSIGQSAT2D, & @@ -849,7 +849,7 @@ SELECT CASE ( HCLOUD ) ENDDO ZZZ = MZF( PZZ ) IF(LRED .AND. LADJ_BEFORE) THEN - CALL ICE_ADJUST (YLDIMPHYEX,CST, RAIN_ICE_PARAM,NEB, TBUCONF,KRR, & + CALL ICE_ADJUST (YLDIMPHYEX,CST, RAIN_ICE_PARAM, NEB, TURBN, TBUCONF, KRR, & CFRAC_ICE_ADJUST, CCONDENS, CLAMBDA3, & 'ADJU', OSUBG_COND, OSIGMAS, .FALSE., .FALSE., & CSUBG_MF_PDF, PTSTEP, ZSIGQSAT2D, & @@ -910,7 +910,7 @@ SELECT CASE ( HCLOUD ) !* 10.2 Perform the saturation adjustment over cloud ice and cloud water ! IF (.NOT. LRED .OR. (LRED .AND. LADJ_AFTER) ) THEN - CALL ICE_ADJUST (YLDIMPHYEX,CST, RAIN_ICE_PARAM,NEB, TBUCONF, KRR, & + CALL ICE_ADJUST (YLDIMPHYEX,CST, RAIN_ICE_PARAM, NEB, TURBN, TBUCONF, KRR, & CFRAC_ICE_ADJUST, CCONDENS, CLAMBDA3, & 'DEPI', OSUBG_COND, OSIGMAS, .FALSE., .FALSE., & CSUBG_MF_PDF, PTSTEP, ZSIGQSAT2D, & diff --git a/tools/check_commit_mesonh.sh b/tools/check_commit_mesonh.sh index dcd9ef33f0bc9014942ac59c17e8eb4f3945c71f..73ee6a0715d41731af12e993a0d4d0eabb0ccddd 100755 --- a/tools/check_commit_mesonh.sh +++ b/tools/check_commit_mesonh.sh @@ -8,7 +8,8 @@ set -e # Repertoire où MNH-V5-5-0_PHYEX.tar.gz modifie pour accueillir PHYEX se trouve #TARGZDIR=$HOME -availTests="007_16janvier/008_run2, 007_16janvier/008_run2_turb3D, COLD_BUBBLE/002_mesonh, ARMLES/RUN, COLD_BUBBLE_3D/002_mesonh," +availTests="007_16janvier/008_run2, 007_16janvier/008_run2_turb3D, COLD_BUBBLE/002_mesonh, + ARMLES/RUN, COLD_BUBBLE_3D/002_mesonh,OCEAN_LES/004_run2" defaultTest="007_16janvier/008_run2" separator='_' #- be carrefull, gmkpack (at least on belenos) has multiple allergies (':', '.', '@') #- seprator must be in sync with prep_code.sh separator @@ -294,6 +295,9 @@ if [ $check -eq 1 ]; then elif [ $t == ARMLES/RUN ]; then path_user=$path_user_beg/MY_RUN/KTEST/ARMLES/RUN$path_user_end path_ref=$path_ref_beg/MY_RUN/KTEST/ARMLES/RUN$path_ref_end + elif [ $t == OCEAN_LES/004_run2 ]; then + path_user=$path_user_beg/MY_RUN/KTEST/OCEAN_LES/004_run2$path_user_end + path_ref=$path_ref_beg/MY_RUN/KTEST/OCEAN_LES/004_run2$path_ref_end else echo "cas $t non reconnu" fi @@ -361,6 +365,32 @@ if [ $check -eq 1 ]; then fi fi + if [ $case == OCEAN_LES ]; then + echo "Compare with python..." + # Compare variable of both Synchronous files with printing difference + file1=$path_user/SPWAN.2.25m00.001.nc + file2=$path_ref/SPWAN.2.25m00.001.nc + set +e + $PHYEXTOOLSDIR/compare.py --f1 $file1 --f2 $file2 + t=$? + set -e + allt=$(($allt+$t)) + + #Check bit-repro before date of creation of Synchronous file from ncdump of all values (pb with direct .nc file checks) + echo "Compare with ncdump..." + if [ -f $file1 -a -f $file2 ]; then + set +e + diff <(ncdump $file1 | head -c 18400) <(ncdump $file2 | head -c 18400) + t=$? + set -e + allt=$(($allt+$t)) + else + [ ! -f $file1 ] && echo " $file1 is missing" + [ ! -f $file2 ] && echo " $file2 is missing" + allt=$(($allt+1)) + fi + fi + if [ $case == COLD_BUBBLE_3D ]; then echo "Compare with python..." # Compare variable of both Synchronous and Diachronic files with printing difference