From b5c75a206db85c6f09167b224c68d6c78f736f1e Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Thu, 20 Jun 2019 14:45:34 +0200 Subject: [PATCH] Philippe 20/06/2019: turb: take DELT and DEAR subroutines out of the TURB one (PGI compiler bug workaround) + transform into a mode_ module --- src/MNH/phys_paramn.f90 | 3 +- src/MNH/turb.f90 | 892 +++++++++++++++++++--------------------- src/MNH/turb_ver.f90 | 1 - 3 files changed, 433 insertions(+), 463 deletions(-) diff --git a/src/MNH/phys_paramn.f90 b/src/MNH/phys_paramn.f90 index bedad9dde..ae0b2f7f3 100644 --- a/src/MNH/phys_paramn.f90 +++ b/src/MNH/phys_paramn.f90 @@ -298,7 +298,6 @@ use modd_precision, only: MNHTIME ! USE MODI_SURF_RAD_MODIF USE MODI_GROUND_PARAM_n -USE MODI_TURB USE MODI_SUNPOS_n USE MODI_RADIATIONS USE MODI_CONVECTION @@ -340,6 +339,8 @@ USE MODD_TIME_n USE MODD_PARAM_LIMA, ONLY : MSEDC => LSEDC, XRTMIN_LIMA=>XRTMIN ! USE MODE_MPPDB +USE MODE_TURB +! IMPLICIT NONE ! !* 0.1 declarations of arguments diff --git a/src/MNH/turb.f90 b/src/MNH/turb.f90 index 75a410e40..623044a6f 100644 --- a/src/MNH/turb.f90 +++ b/src/MNH/turb.f90 @@ -1,141 +1,26 @@ - !MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt !MNH_LIC for details. version 1. !----------------------------------------------------------------- -! ################ - MODULE MODI_TURB -! ################ -! -INTERFACE -! - SUBROUTINE TURB(KKA, KKU, KKL, KMI,KRR,KRRL,KRRI,HLBCX,HLBCY, & - KSPLIT,KMODEL_CL, & - OCLOSE_OUT,OTURB_FLX,OTURB_DIAG,OSUBG_COND,ORMC01, & - HTURBDIM,HTURBLEN,HTOM,HTURBLEN_CL,HCLOUD,PIMPL, & - PTSTEP,TPFILE,PDXX,PDYY,PDZZ,PDZX,PDZY,PZZ, & - PDIRCOSXW,PDIRCOSYW,PDIRCOSZW,PCOSSLOPE,PSINSLOPE, & - PRHODJ,PTHVREF, & - PSFTH,PSFRV,PSFSV,PSFU,PSFV, & - PPABST,PUT,PVT,PWT,PTKET,PSVT,PSRCT, & - PBL_DEPTH, PSBL_DEPTH, & - PCEI,PCEI_MIN,PCEI_MAX,PCOEF_AMPL_SAT, & - PTHLT,PRT, & - PRUS,PRVS,PRWS,PRTHLS,PRRS,PRSVS,PRTKES,PRTKEMS,PSIGS,& - PFLXZTHVMF,PWTH,PWRC,PWSV,PDYP,PTHP,PTR,PDISS,PLEM ) +!############### +module mode_turb +!############### -! -USE MODD_IO, ONLY: TFILEDATA -! -INTEGER, INTENT(IN) :: KKA !near ground array index -INTEGER, INTENT(IN) :: KKU !uppest atmosphere array index -INTEGER, INTENT(IN) :: KKL !vert. levels type 1=MNH -1=AR -INTEGER, INTENT(IN) :: KMI ! model index number -INTEGER, INTENT(IN) :: KRR ! number of moist var. -INTEGER, INTENT(IN) :: KRRL ! number of liquid water var. -INTEGER, INTENT(IN) :: KRRI ! number of ice water var. -CHARACTER(LEN=*),DIMENSION(:),INTENT(IN):: HLBCX, HLBCY ! X- and Y-direc LBC -INTEGER, INTENT(IN) :: KSPLIT ! number of time-splitting -INTEGER, INTENT(IN) :: KMODEL_CL ! model number for cloud mixing length -LOGICAL, INTENT(IN) :: OCLOSE_OUT ! switch for syncronous - ! file opening -LOGICAL, INTENT(IN) :: OTURB_FLX ! switch to write the - ! turbulent fluxes in the syncronous FM-file -LOGICAL, INTENT(IN) :: OTURB_DIAG ! switch to write some - ! diagnostic fields in the syncronous FM-file -LOGICAL, INTENT(IN) :: OSUBG_COND ! switch for SUBGrid - ! CONDensation -LOGICAL, INTENT(IN) :: ORMC01 ! switch for RMC01 lengths in SBL -CHARACTER(len=4), INTENT(IN) :: HTURBDIM ! dimensionality of the - ! turbulence scheme -CHARACTER(len=4), INTENT(IN) :: HTURBLEN ! kind of mixing length -CHARACTER(len=4), INTENT(IN) :: HTOM ! kind of Third Order Moment -CHARACTER(len=4), INTENT(IN) :: HTURBLEN_CL ! kind of cloud mixing length - ! surface friction flux -REAL, INTENT(IN) :: PIMPL ! degree of implicitness -CHARACTER (LEN=4), INTENT(IN) :: HCLOUD ! Kind of microphysical scheme -REAL, INTENT(IN) :: PTSTEP ! timestep -TYPE(TFILEDATA), INTENT(IN) :: TPFILE ! Output file -! -REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX,PDYY,PDZZ,PDZX,PDZY - ! metric coefficients -REAL, DIMENSION(:,:,:), INTENT(IN) :: PZZ ! physical distance -! between 2 succesive grid points along the K direction -REAL, DIMENSION(:,:), INTENT(IN) :: PDIRCOSXW, PDIRCOSYW, PDIRCOSZW -! Director Cosinus along x, y and z directions at surface w-point -REAL, DIMENSION(:,:), INTENT(IN) :: PCOSSLOPE ! cosinus of the angle - ! between i and the slope vector -REAL, DIMENSION(:,:), INTENT(IN) :: PSINSLOPE ! sinus of the angle - ! between i and the slope vector -REAL, DIMENSION(:,:,:), INTENT(IN) :: PRHODJ ! dry density * Grid size -REAL, DIMENSION(:,:,:), INTENT(IN) :: PTHVREF ! Virtual Potential - ! Temperature of the reference state -! -REAL, DIMENSION(:,:), INTENT(IN) :: PSFTH,PSFRV, & -! normal surface fluxes of theta and Rv - PSFU,PSFV -! normal surface fluxes of (u,v) parallel to the orography -REAL, DIMENSION(:,:,:), INTENT(IN) :: PSFSV -! normal surface fluxes of Scalar var. -! -! prognostic variables at t- deltat -REAL, DIMENSION(:,:,:), INTENT(IN) :: PPABST ! Pressure at time t -REAL, DIMENSION(:,:,:), INTENT(IN) :: PUT,PVT,PWT ! wind components -REAL, DIMENSION(:,:,:), INTENT(IN) :: PTKET ! TKE -REAL, DIMENSION(:,:,:,:), INTENT(IN) :: PSVT ! passive scal. var. -REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRCT ! Second-order flux - ! s'rc'/2Sigma_s2 at time t-1 multiplied by Lambda_3 -REAL, DIMENSION(:,:), INTENT(INOUT) :: PBL_DEPTH ! BL depth for TOMS -REAL, DIMENSION(:,:), INTENT(INOUT) :: PSBL_DEPTH ! SBL depth for RMC01 -! -! -! variables for cloud mixing length -REAL, DIMENSION(:,:,:), INTENT(IN) :: PCEI ! Cloud Entrainment instability - ! index to emphasize localy - ! turbulent fluxes -REAL, INTENT(IN) :: PCEI_MIN ! minimum threshold for the instability index CEI -REAL, INTENT(IN) :: PCEI_MAX ! maximum threshold for the instability index CEI -REAL, INTENT(IN) :: PCOEF_AMPL_SAT ! saturation of the amplification coefficient -! thermodynamical variables which are transformed in conservative var. -REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PTHLT ! conservative pot. temp. -REAL, DIMENSION(:,:,:,:), INTENT(INOUT) :: PRT ! water var. where - ! PRT(:,:,:,1) is the conservative mixing ratio -! -! sources of momentum, conservative potential temperature, Turb. Kin. Energy, -! TKE dissipation -REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PRUS,PRVS,PRWS,PRTHLS,PRTKES -! Source terms for all water kinds, PRRS(:,:,:,1) is used for the conservative -! mixing ratio -REAL, DIMENSION(:,:,:), INTENT(IN) :: PRTKEMS -REAL, DIMENSION(:,:,:,:), INTENT(INOUT) :: PRRS -! Source terms for all passive scalar variables -REAL, DIMENSION(:,:,:,:), INTENT(INOUT) :: PRSVS -! Sigma_s at time t+1 : square root of the variance of the deviation to the -! saturation -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PSIGS -REAL, DIMENSION(:,:,:), INTENT(IN) :: PFLXZTHVMF -! MF contribution for vert. turb. transport -! used in the buoy. prod. of TKE -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PWTH ! heat flux -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PWRC ! cloud water flux -REAL, DIMENSION(:,:,:,:),INTENT(OUT) :: PWSV ! scalar flux -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDYP ! Dynamical production of TKE -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PTHP ! Thermal production of TKE -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PTR ! Transport production of TKE -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PDISS ! Dissipation of TKE -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLEM ! Mixing length +#ifdef MNH_BITREP +use modi_bitrep +#endif + +implicit none + +private + +public :: turb + +contains -! -!------------------------------------------------------------------------------- -! -END SUBROUTINE TURB -! -END INTERFACE -! -END MODULE MODI_TURB -! ! ################################################################# - SUBROUTINE TURB(KKA,KKU,KKL,KMI,KRR,KRRL,KRRI,HLBCX,HLBCY,KSPLIT,KMODEL_CL, & +SUBROUTINE TURB(KKA,KKU,KKL,KMI,KRR,KRRL,KRRI,HLBCX,HLBCY,KSPLIT,KMODEL_CL, & OCLOSE_OUT,OTURB_FLX,OTURB_DIAG,OSUBG_COND,ORMC01, & HTURBDIM,HTURBLEN,HTOM,HTURBLEN_CL,HCLOUD,PIMPL, & PTSTEP,TPFILE,PDXX,PDYY,PDZZ,PDZX,PDZY,PZZ, & @@ -341,6 +226,7 @@ END MODULE MODI_TURB !! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O !! 01/2018 (Q.Rodier) Introduction of RM17 ! P. Wautelet 20/05/2019: add name argument to ADDnFIELD_ll + new ADD4DFIELD_ll subroutine +! P. Wautelet 20/06/2019: take DELT and DEAR subroutines out of the TURB one (PGI compiler bug workaround) + transform into a mode_ module !! -------------------------------------------------------------------------- ! !* 0. DECLARATIONS @@ -388,9 +274,6 @@ USE MODI_ETHETA ! USE MODI_SECOND_MNH ! -#ifdef MNH_BITREP -USE MODI_BITREP -#endif USE MODE_MPPDB ! !! use, intrinsic :: ISO_C_BINDING @@ -519,20 +402,7 @@ REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLEM ! Mixing length ! ! 0.2 declaration of local variables ! -! REAL, ALLOCATABLE, DIMENSION(:,:,:) ::& -! ZCP, & ! Cp at t-1 -! ZEXN, & ! EXN at t-1 -! ZT, & ! T at t-1 -! ZLOCPEXNM, & ! Lv/Cp/EXNREF at t-1 -! ZLEPS, & ! Dissipative length -! ZTRH, & ! Dynamic and Thermal Production of TKE -! ZATHETA,ZAMOIST, & ! coefficients for s = f (Thetal,Rnp) -! ZCOEF_DISS, & ! 1/(Cph*Exner) for dissipative heating -! ZFRAC_ICE, & ! ri fraction of rc+ri -! ZMWTH,ZMWR,ZMTH2,ZMR2,ZMTHR,& ! 3rd order moments -! ZFWTH,ZFWR,ZFTH2,ZFR2,ZFTHR,& ! opposite of verticale derivate of 3rd order moments -! ZTHLM ! initial potential temp. -REAL,DIMENSION(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ::& +REAL, ALLOCATABLE, DIMENSION(:,:,:) ::& ZCP, & ! Cp at t-1 ZEXN, & ! EXN at t-1 ZT, & ! T at t-1 @@ -598,28 +468,30 @@ REAL, DIMENSION(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) :: ZTMP1_DEVICE,ZTMP2 #endif ! !------------------------------------------------------------------------------------------ -! ALLOCATE ( & -! ZCP(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZEXN(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZT(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZLOCPEXNM(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZLEPS(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZTRH(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZATHETA(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZAMOIST(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZCOEF_DISS(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZFRAC_ICE(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZMWTH(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZMWR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZMTH2(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZMR2(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZMTHR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZFWTH(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZFWR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZFTH2(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZFR2(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZFTHR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & -! ZTHLM(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ) +ALLOCATE ( & + ZCP(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZEXN(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZT(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZLOCPEXNM(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZLEPS(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZTRH(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZATHETA(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZAMOIST(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZCOEF_DISS(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZFRAC_ICE(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZMWTH(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZMWR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZMTH2(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZMR2(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZMTHR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZFWTH(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZFWR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZFTH2(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZFR2(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZFTHR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZTHLM(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZTR(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)), & + ZDISS(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ) ALLOCATE ( ZRM(SIZE(PRT,1),SIZE(PRT,2),SIZE(PRT,3),SIZE(PRT,4)) ) @@ -842,14 +714,15 @@ SELECT CASE (HTURBLEN) PRINT *,'OPENACC: TURB::HTURBLEN=DELT not yet implemented' CALL ABORT #endif - CALL DELT(PLEM) + CALL DELT(KKA,KKU,KKL,IKB, IKE,IKTB, IKTE,ORMC01,HTURBDIM,PDXX, PDYY,PZZ,PDIRCOSZW,PLEM) ! !* 3.4 Deardorff mixing length ! ----------------------- ! CASE ('DEAR') - CALL DEAR(PLEM) -! + CALL DEAR(KKA,KKU,KKL,KRR, KRRI, IKB, IKE,IKTB, IKTE, & + ORMC01,HTURBDIM,PDXX, PDYY, PDZZ,PZZ,PDIRCOSZW,PTHLT,PTHVREF,PTKET,PSRCT,PRT,& + ZLOCPEXNM,ZATHETA, ZAMOIST, PLEM) !* 3.5 Blackadar mixing length ! ----------------------- ! @@ -1642,132 +1515,403 @@ REAL, DIMENSION(SIZE(PEXN,1),SIZE(PEXN,2),SIZE(PEXN,3)) :: ZDRVSATDT ! END SUBROUTINE COMPUTE_FUNCTION_THERMO ! -! #################### - SUBROUTINE DELT(PLM) -! #################### -!! -!!**** *DELT* routine to compute mixing length for DELT case ! +! ######################### + SUBROUTINE CLOUD_MODIF_LM +! ######################### +!! +!!*****CLOUD_MODIF_LM routine to: +!! 1/ change the mixing length in the clouds +!! 2/ emphasize the mixing length in the cloud +!! by the coefficient ZCOEF_AMPL calculated here +!! when the CEI index is above ZCEI_MIN. +!! +!! +!! ZCOEF_AMPL ^ +!! | +!! | +!! ZCOEF_AMPL_SAT - ---------- Saturation +!! (XDUMMY1) | - +!! | - +!! | - +!! | - +!! | - Amplification +!! | - straight +!! | - line +!! | - +!! | - +!! | - +!! | - +!! | - +!! 1 ------------ +!! | +!! | +!! 0 -----------|------------|----------> PCEI +!! 0 ZCEI_MIN ZCEI_MAX +!! (XDUMMY2) (XDUMMY3) +!! +!! +!! !! AUTHOR !! ------ -!! -!! M Tomasini *Meteo-France +!! M. Tomasini *CNRM METEO-FRANCE !! !! MODIFICATIONS !! ------------- -!! Original 01/05 +!! Original 09/07/04 !! !------------------------------------------------------------------------------- ! !* 0. DECLARATIONS ! ------------ ! -!* 0.1 Declarations of dummy arguments -! -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLM -! -!* 0.2 Declarations of local variables +IMPLICIT NONE ! -REAL :: ZD ! distance to the surface +REAL :: ZPENTE ! Slope of the amplification straight line +REAL :: ZCOEF_AMPL_CEI_NUL! Ordonnate at the origin of the + ! amplification straight line +REAL, DIMENSION(SIZE(PUT,1),SIZE(PUT,2),SIZE(PUT,3)) :: ZCOEF_AMPL + ! Amplification coefficient of the mixing length + ! when the instability criterium is verified +REAL, DIMENSION(SIZE(PUT,1),SIZE(PUT,2),SIZE(PUT,3)) :: ZLM_CLOUD + ! Turbulent mixing length in the clouds ! !------------------------------------------------------------------------------- -! #ifdef _OPENACC -PRINT *,'OPENACC: TURB::DELT not yet implemented' +PRINT *,'OPENACC: TURB::CLOUD_MODIF_LM not yet implemented' CALL ABORT #endif -DO JK = IKTB,IKTE ! 1D turbulence scheme - PLM(:,:,JK) = PZZ(:,:,JK+KKL) - PZZ(:,:,JK) -END DO -PLM(:,:,KKU) = PLM(:,:,IKE) -PLM(:,:,KKA) = PZZ(:,:,IKB) - PZZ(:,:,KKA) -IF ( HTURBDIM /= '1DIM' ) THEN ! 3D turbulence scheme - IF ( L2D) THEN - PLM(:,:,:) = SQRT( PLM(:,:,:)*MXF(PDXX(:,:,:)) ) - ELSE - PLM(:,:,:) = (PLM(:,:,:)*MXF(PDXX(:,:,:))*MYF(PDYY(:,:,:)) ) ** (1./3.) - END IF -END IF -! -! mixing length limited by the distance normal to the surface -! (with the same factor as for BL89) ! -IF (.NOT. ORMC01) THEN - ZALPHA=0.5**(-1.5) - ! - DO JJ=1,SIZE(PUT,2) - DO JI=1,SIZE(PUT,1) - DO JK=IKTB,IKTE - ZD=ZALPHA*(0.5*(PZZ(JI,JJ,JK)+PZZ(JI,JJ,JK+KKL))& - -PZZ(JI,JJ,IKB)) *PDIRCOSZW(JI,JJ) - IF ( PLM(JI,JJ,JK)>ZD) THEN - PLM(JI,JJ,JK)=ZD - ELSE - EXIT - ENDIF - END DO - END DO - END DO -END IF +!* 1. INITIALISATION +! -------------- ! -PLM(:,:,KKA) = PLM(:,:,IKB ) -PLM(:,:,KKU ) = PLM(:,:,IKE) +ZPENTE = ( PCOEF_AMPL_SAT - 1. ) / ( PCEI_MAX - PCEI_MIN ) +ZCOEF_AMPL_CEI_NUL = 1. - ZPENTE * PCEI_MIN ! -END SUBROUTINE DELT +ZCOEF_AMPL(:,:,:) = 1. ! -! #################### - SUBROUTINE DEAR(PLM) -! #################### -!! -!!**** *DELT* routine to compute mixing length for DEARdorff case +!* 2. CALCULATION OF THE AMPLIFICATION COEFFICIENT +! -------------------------------------------- ! -!! AUTHOR -!! ------ -!! -!! M Tomasini *Meteo-France -!! -!! MODIFICATIONS -!! ------------- -!! Original 01/05 -!! I.Sandu (Sept.2006) : Modification of the stability criterion -!! (theta_v -> theta_l) -!! -!------------------------------------------------------------------------------- +! Saturation ! -!* 0. DECLARATIONS -! ------------ +WHERE ( PCEI(:,:,:)>=PCEI_MAX ) ZCOEF_AMPL(:,:,:)=PCOEF_AMPL_SAT ! -!* 0.1 Declarations of dummy arguments +! Between the min and max limits of CEI index, linear variation of the +! amplification coefficient ZCOEF_AMPL as a function of CEI ! -REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLM -!$acc declare present(PLM) +WHERE ( PCEI(:,:,:) < PCEI_MAX .AND. & + PCEI(:,:,:) > PCEI_MIN ) & + ZCOEF_AMPL(:,:,:) = ZPENTE * PCEI(:,:,:) + ZCOEF_AMPL_CEI_NUL ! -!* 0.2 Declarations of local variables ! -REAL :: ZD ! distance to the surface -REAL :: ZVAR ! Intermediary variable -REAL, DIMENSION(SIZE(PUT,1),SIZE(PUT,2)) :: ZWORK2D +!* 3. CALCULATION OF THE MIXING LENGTH IN CLOUDS +! ------------------------------------------ ! -REAL, DIMENSION(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) :: & - ZDTHLDZ,ZDRTDZ, &!dtheta_l/dz, drt_dz used for computing the stablity -! ! criterion - ZETHETA,ZEMOIST !coef ETHETA and EMOIST -!$acc declare create(ZWORK2D,ZDTHLDZ,ZDRTDZ,ZETHETA,ZEMOIST) +IF (HTURBLEN_CL == HTURBLEN) THEN + ZLM_CLOUD(:,:,:) = PLEM(:,:,:) +ELSE + SELECT CASE (HTURBLEN_CL) ! -#ifdef _OPENACC -REAL, DIMENSION(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) :: ZTMP1_DEVICE,ZTMP2_DEVICE -!$acc declare create(ZTMP1_DEVICE,ZTMP2_DEVICE) +!* 3.1 BL89 mixing length +! ------------------ + CASE ('BL89','RM17') + ZSHEAR=0. + CALL BL89(KKA,KKU,KKL,PZZ,PDZZ,PTHVREF,ZTHLM,KRR,ZRM,PTKET,ZSHEAR,ZLM_CLOUD) +! +!* 3.2 Delta mixing length +! ------------------- + CASE ('DELT') +! CALL DELT(ZLM_CLOUD) + CALL DELT(KKA,KKU,KKL,IKB, IKE,IKTB, IKTE,ORMC01,HTURBDIM,PDXX, PDYY,PZZ,PDIRCOSZW,ZLM_CLOUD) +! +!* 3.3 Deardorff mixing length +! ----------------------- + CASE ('DEAR') +! CALL DEAR(ZLM_CLOUD) + CALL DEAR(KKA,KKU,KKL,KRR, KRRI, IKB, IKE,IKTB, IKTE, & + ORMC01,HTURBDIM,PDXX, PDYY, PDZZ,PZZ,PDIRCOSZW,PTHLT,PTHVREF,PTKET,PSRCT,PRT,& + ZLOCPEXNM,ZATHETA, ZAMOIST, ZLM_CLOUD) +! + END SELECT +ENDIF +! +!* 4. MODIFICATION OF THE MIXING LENGTH IN THE CLOUDS +! ----------------------------------------------- +! +! Impression before modification of the mixing length +IF ( OTURB_DIAG .AND. OCLOSE_OUT ) THEN + TZFIELD%CMNHNAME = 'LM_CLEAR_SKY' + TZFIELD%CSTDNAME = '' + TZFIELD%CLONGNAME = 'LM_CLEAR_SKY' + TZFIELD%CUNITS = 'm' + TZFIELD%CDIR = 'XY' + TZFIELD%CCOMMENT = 'X_Y_Z_LM CLEAR SKY' + TZFIELD%NGRID = 1 + TZFIELD%NTYPE = TYPEREAL + TZFIELD%NDIMS = 3 + TZFIELD%LTIMEDEP = .TRUE. + CALL IO_Field_write(TPFILE,TZFIELD,PLEM) +ENDIF +! +! Amplification of the mixing length when the criteria are verified +! +WHERE (ZCOEF_AMPL(:,:,:) /= 1.) PLEM(:,:,:) = ZCOEF_AMPL(:,:,:)*ZLM_CLOUD(:,:,:) +! +! Cloud mixing length in the clouds at the points which do not verified the CEI +! +WHERE (PCEI(:,:,:) == -1.) PLEM(:,:,:) = ZLM_CLOUD(:,:,:) +! +! +!* 5. IMPRESSION +! ---------- +! +IF ( OTURB_DIAG .AND. OCLOSE_OUT ) THEN + TZFIELD%CMNHNAME = 'COEF_AMPL' + TZFIELD%CSTDNAME = '' + TZFIELD%CLONGNAME = 'COEF_AMPL' + TZFIELD%CUNITS = '1' + TZFIELD%CDIR = 'XY' + TZFIELD%CCOMMENT = 'X_Y_Z_COEF AMPL' + TZFIELD%NGRID = 1 + TZFIELD%NTYPE = TYPEREAL + TZFIELD%NDIMS = 3 + TZFIELD%LTIMEDEP = .TRUE. + CALL IO_Field_write(TPFILE,TZFIELD,ZCOEF_AMPL) + ! + TZFIELD%CMNHNAME = 'LM_CLOUD' + TZFIELD%CSTDNAME = '' + TZFIELD%CLONGNAME = 'LM_CLOUD' + TZFIELD%CUNITS = 'm' + TZFIELD%CDIR = 'XY' + TZFIELD%CCOMMENT = 'X_Y_Z_LM CLOUD' + TZFIELD%NGRID = 1 + TZFIELD%NTYPE = TYPEREAL + TZFIELD%NDIMS = 3 + CALL IO_Field_write(TPFILE,TZFIELD,ZLM_CLOUD) + ! +ENDIF +! +END SUBROUTINE CLOUD_MODIF_LM +! +END SUBROUTINE TURB + + + +!################### +SUBROUTINE DELT(KKA,KKU,KKL,KKB, KKE,KKTB, KKTE,ORMC01,HTURBDIM,PDXX, PDYY,PZZ,PDIRCOSZW,PLM) +!################### +!! +!!**** *DELT* routine to compute mixing length for DELT case +! +!! AUTHOR +!! ------ +!! +!! M Tomasini *Meteo-France +!! +!! MODIFICATIONS +!! ------------- +!! Original 01/05 +!! +!------------------------------------------------------------------------------- +! +!* 0. DECLARATIONS +! ------------ +use modd_conf, only: l2d + +USE MODI_SHUMAN + +implicit none +! +!* 0.1 Declarations of dummy arguments +! +INTEGER, INTENT(IN) :: KKA !near ground array index +INTEGER, INTENT(IN) :: KKU !uppest atmosphere array index +INTEGER, INTENT(IN) :: KKL !vert. levels type 1=MNH -1=ARO +INTEGER, intent(in) :: KKB, KKE ! index value for the +! Beginning and the End of the physical domain for the mass points +INTEGER, intent(in) :: KKTB, KKTE ! start, end of k loops in physical domain +LOGICAL, INTENT(IN) :: ORMC01 ! switch for RMC01 lengths in SBL +CHARACTER(len=4), INTENT(IN) :: HTURBDIM ! dimensionality of the + ! turbulence scheme +REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX, PDYY + ! metric coefficients +REAL, DIMENSION(:,:,:), INTENT(IN) :: PZZ ! physical distance +! between 2 succesive grid points along the K direction +REAL, DIMENSION(:,:), INTENT(IN) :: PDIRCOSZW +! Director Cosinus along x, y and z directions at surface w-point +REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLM +! +!* 0.2 Declarations of local variables +! + +integer :: ji, jj, jk +REAL :: ZALPHA ! proportionnality constant between Dz/2 and +! ! BL89 mixing length near the surface +REAL :: ZD ! distance to the surface +! +!------------------------------------------------------------------------------- +! +#ifdef _OPENACC +PRINT *,'OPENACC: TURB::DELT not yet implemented' +CALL ABORT +#endif +DO JK = KKTB,KKTE ! 1D turbulence scheme + PLM(:,:,JK) = PZZ(:,:,JK+KKL) - PZZ(:,:,JK) +END DO +PLM(:,:,KKU) = PLM(:,:,KKE) +PLM(:,:,KKA) = PZZ(:,:,KKB) - PZZ(:,:,KKA) +IF ( HTURBDIM /= '1DIM' ) THEN ! 3D turbulence scheme + IF ( L2D) THEN + PLM(:,:,:) = SQRT( PLM(:,:,:)*MXF(PDXX(:,:,:)) ) + ELSE + PLM(:,:,:) = (PLM(:,:,:)*MXF(PDXX(:,:,:))*MYF(PDYY(:,:,:)) ) ** (1./3.) + END IF +END IF +! +! mixing length limited by the distance normal to the surface +! (with the same factor as for BL89) +! +IF (.NOT. ORMC01) THEN + ZALPHA=0.5**(-1.5) + ! + DO JJ=1,SIZE(PLM,2) + DO JI=1,SIZE(PLM,1) + DO JK=KKTB,KKTE + ZD=ZALPHA*(0.5*(PZZ(JI,JJ,JK)+PZZ(JI,JJ,JK+KKL))& + -PZZ(JI,JJ,KKB)) *PDIRCOSZW(JI,JJ) + IF ( PLM(JI,JJ,JK)>ZD) THEN + PLM(JI,JJ,JK)=ZD + ELSE + EXIT + ENDIF + END DO + END DO + END DO +END IF +! +PLM(:,:,KKA) = PLM(:,:,KKB ) +PLM(:,:,KKU ) = PLM(:,:,KKE) +! +END SUBROUTINE DELT + + + +!################### +SUBROUTINE DEAR(KKA,KKU,KKL,KRR, KRRI, KKB, KKE,KKTB, KKTE, & + ORMC01,HTURBDIM,PDXX, PDYY, PDZZ,PZZ,PDIRCOSZW,PTHLT,PTHVREF,PTKET,PSRCT,PRT,& + PLOCPEXNM,PATHETA, PAMOIST, PLM) +!################### +!! +!!**** *DELT* routine to compute mixing length for DEARdorff case +! +!! AUTHOR +!! ------ +!! +!! M Tomasini *Meteo-France +!! +!! MODIFICATIONS +!! ------------- +!! Original 01/05 +!! I.Sandu (Sept.2006) : Modification of the stability criterion +!! (theta_v -> theta_l) +!! +!------------------------------------------------------------------------------- +! +!* 0. DECLARATIONS +! ------------ +use modd_conf, only: l2d +use modd_cst, only: XG, XMNH_EPSILON + +USE MODI_EMOIST +USE MODI_ETHETA +#ifndef _OPENACC +USE MODI_SHUMAN +#else +USE MODI_SHUMAN_DEVICE +#endif + +implicit none +! +!* 0.1 Declarations of dummy arguments +! +INTEGER, INTENT(IN) :: KKA !near ground array index +INTEGER, INTENT(IN) :: KKU !uppest atmosphere array index +INTEGER, INTENT(IN) :: KKL !vert. levels type 1=MNH -1=ARO +INTEGER, INTENT(IN) :: KRR ! number of moist var. +INTEGER, INTENT(IN) :: KRRI ! number of ice water var. +INTEGER, intent(in) :: KKB, KKE ! index value for the +! Beginning and the End of the physical domain for the mass points +INTEGER, intent(in) :: KKTB, KKTE ! start, end of k loops in physical domain +LOGICAL, INTENT(IN) :: ORMC01 ! switch for RMC01 lengths in SBL +CHARACTER(len=4), INTENT(IN) :: HTURBDIM ! dimensionality of the + ! turbulence scheme +REAL, DIMENSION(:,:,:), INTENT(IN) :: PDXX, PDYY, PDZZ + ! metric coefficients +!$acc declare present(PDXX,PDYY,PDZZ) +REAL, DIMENSION(:,:,:), INTENT(IN) :: PZZ ! physical distance +! between 2 succesive grid points along the K direction +!$acc declare present(PZZ) +REAL, DIMENSION(:,:), INTENT(IN) :: PDIRCOSZW +! Director Cosinus along x, y and z directions at surface w-point +!$acc declare present(PDIRCOSZW) +REAL, DIMENSION(:,:,:), INTENT(IN) :: PTHLT ! conservative pot. temp. +!$acc declare present(PTHLT) +REAL, DIMENSION(:,:,:), INTENT(IN) :: PTHVREF ! Virtual Potential + ! Temperature of the reference state +!$acc declare present(PTHVREF) +REAL, DIMENSION(:,:,:), INTENT(IN) :: PTKET ! TKE +!$acc declare present(PTKET) +REAL, DIMENSION(:,:,:), INTENT(IN) :: PSRCT ! Second-order flux + ! s'rc'/2Sigma_s2 at time t-1 multiplied by Lambda_3 +!$acc declare present(PSRCT) +REAL, DIMENSION(:,:,:,:), INTENT(IN) :: PRT ! water var. where + ! PRT(:,:,:,1) is the conservative mixing ratio +!$acc declare present(PRT) +REAL, DIMENSION(:,:,:), INTENT(IN) :: PLOCPEXNM ! Lv/Cp/EXNREF at t-1 +REAL, DIMENSION(:,:,:), INTENT(IN) :: PATHETA, PAMOIST ! coefficients for s = f (Thetal,Rnp) +!$acc declare present(PLOCPEXNM) +REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLM +!$acc declare present(PLM) +! +!* 0.2 Declarations of local variables +! +integer :: ji, jj, jk +REAL :: ZALPHA ! proportionnality constant between Dz/2 and +! ! BL89 mixing length near the surface +REAL :: ZD ! distance to the surface +REAL :: ZVAR ! Intermediary variable +REAL, DIMENSION(:,:), ALLOCATABLE :: ZWORK2D +! +REAL, DIMENSION(:,:,:), ALLOCATABLE :: & + ZDTHLDZ,ZDRTDZ, &!dtheta_l/dz, drt_dz used for computing the stablity +! ! criterion + ZETHETA,ZEMOIST !coef ETHETA and EMOIST +!$acc declare create(ZWORK2D,ZDTHLDZ,ZDRTDZ,ZETHETA,ZEMOIST) +! +#ifdef _OPENACC +REAL, DIMENSION(:,:,:), ALLOCATABLE :: ZTMP1_DEVICE,ZTMP2_DEVICE +!$acc declare create(ZTMP1_DEVICE,ZTMP2_DEVICE) #endif !---------------------------------------------------------------------------- ! !------------------------------------------------------------------------------- +allocate( ZWORK2D(SIZE(PLM,1),SIZE(PLM,2)) ) +allocate( ZDTHLDZ(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ) +allocate( ZDRTDZ (SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ) +allocate( ZETHETA(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ) +allocate( ZEMOIST(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ) +#ifdef _OPENACC +allocate( ZTMP1_DEVICE(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ) +allocate( ZTMP2_DEVICE(SIZE(PTHLT,1),SIZE(PTHLT,2),SIZE(PTHLT,3)) ) +#endif ! ! initialize the mixing length with the mesh grid !$acc kernels ! 1D turbulence scheme -PLM(:,:,IKTB:IKTE) = PZZ(:,:,IKTB+KKL:IKTE+KKL) - PZZ(:,:,IKTB:IKTE) -PLM(:,:,KKU) = PLM(:,:,IKE) -PLM(:,:,KKA) = PZZ(:,:,IKB) - PZZ(:,:,KKA) +PLM(:,:,KKTB:KKTE) = PZZ(:,:,KKTB+KKL:KKTE+KKL) - PZZ(:,:,KKTB:KKTE) +PLM(:,:,KKU) = PLM(:,:,KKE) +PLM(:,:,KKA) = PZZ(:,:,KKB) - PZZ(:,:,KKA) !$acc end kernels IF ( HTURBDIM /= '1DIM' ) THEN ! 3D turbulence scheme IF ( L2D) THEN @@ -1812,20 +1956,20 @@ END IF ! compute a mixing length limited by the stability ! #ifndef _OPENACC -ZETHETA(:,:,:) = ETHETA(KRR,KRRI,PTHLT,PRT,ZLOCPEXNM,ZATHETA,PSRCT) -ZEMOIST(:,:,:) = EMOIST(KRR,KRRI,PTHLT,PRT,ZLOCPEXNM,ZAMOIST,PSRCT) +ZETHETA(:,:,:) = ETHETA(KRR,KRRI,PTHLT,PRT,PLOCPEXNM,PATHETA,PSRCT) +ZEMOIST(:,:,:) = EMOIST(KRR,KRRI,PTHLT,PRT,PLOCPEXNM,PAMOIST,PSRCT) #else -CALL ETHETA(KRR,KRRI,PTHLT,PRT,ZLOCPEXNM,ZATHETA,PSRCT,ZETHETA) -CALL EMOIST(KRR,KRRI,PTHLT,PRT,ZLOCPEXNM,ZAMOIST,PSRCT,ZEMOIST) +CALL ETHETA(KRR,KRRI,PTHLT,PRT,PLOCPEXNM,PATHETA,PSRCT,ZETHETA) +CALL EMOIST(KRR,KRRI,PTHLT,PRT,PLOCPEXNM,PAMOIST,PSRCT,ZEMOIST) #endif ! !$acc kernels present(PDIRCOSZW,PDZZ,PRT,PTHLT,PTHVREF,PTHLT,PZZ,PTKET) ! For dry simulations IF (KRR>0) THEN !$acc loop independent collapse(3) private(ZVAR) - DO JK = IKTB+1,IKTE-1 - DO JJ=1,SIZE(PUT,2) - DO JI=1,SIZE(PUT,1) + DO JK = KKTB+1,KKTE-1 + DO JJ=1,SIZE(PLM,2) + DO JI=1,SIZE(PLM,1) ZDTHLDZ(JI,JJ,JK)= 0.5*((PTHLT(JI,JJ,JK+KKL)-PTHLT(JI,JJ,JK ))/PDZZ(JI,JJ,JK+KKL)+ & (PTHLT(JI,JJ,JK )-PTHLT(JI,JJ,JK-KKL))/PDZZ(JI,JJ,JK )) ZDRTDZ(JI,JJ,JK) = 0.5*((PRT(JI,JJ,JK+KKL,1)-PRT(JI,JJ,JK ,1))/PDZZ(JI,JJ,JK+KKL)+ & @@ -1842,9 +1986,9 @@ IF (KRR>0) THEN END DO ELSE !$acc loop independent collapse(3) private(ZVAR) - DO JK = IKTB+1,IKTE-1 - DO JJ=1,SIZE(PUT,2) - DO JI=1,SIZE(PUT,1) + DO JK = KKTB+1,KKTE-1 + DO JJ=1,SIZE(PLM,2) + DO JI=1,SIZE(PLM,1) ZDTHLDZ(JI,JJ,JK)= 0.5*((PTHLT(JI,JJ,JK+KKL)-PTHLT(JI,JJ,JK ))/PDZZ(JI,JJ,JK+KKL)+ & (PTHLT(JI,JJ,JK )-PTHLT(JI,JJ,JK-KKL))/PDZZ(JI,JJ,JK )) ZVAR=XG/PTHVREF(JI,JJ,JK)*ZETHETA(JI,JJ,JK)*ZDTHLDZ(JI,JJ,JK) @@ -1857,20 +2001,20 @@ ELSE END DO END DO END IF -! special case near the surface -ZDTHLDZ(:,:,IKB)=(PTHLT(:,:,IKB+KKL)-PTHLT(:,:,IKB))/PDZZ(:,:,IKB+KKL) +! special case near the surface +ZDTHLDZ(:,:,KKB)=(PTHLT(:,:,KKB+KKL)-PTHLT(:,:,KKB))/PDZZ(:,:,KKB+KKL) ! For dry simulations IF (KRR>0) THEN - ZDRTDZ(:,:,IKB)=(PRT(:,:,IKB+KKL,1)-PRT(:,:,IKB,1))/PDZZ(:,:,IKB+KKL) + ZDRTDZ(:,:,KKB)=(PRT(:,:,KKB+KKL,1)-PRT(:,:,KKB,1))/PDZZ(:,:,KKB+KKL) ELSE - ZDRTDZ(:,:,IKB)=0 + ZDRTDZ(:,:,KKB)=0 ENDIF ! -ZWORK2D(:,:)=XG/PTHVREF(:,:,IKB)* & - (ZETHETA(:,:,IKB)*ZDTHLDZ(:,:,IKB)+ZEMOIST(:,:,IKB)*ZDRTDZ(:,:,IKB)) +ZWORK2D(:,:)=XG/PTHVREF(:,:,KKB)* & + (ZETHETA(:,:,KKB)*ZDTHLDZ(:,:,KKB)+ZEMOIST(:,:,KKB)*ZDRTDZ(:,:,KKB)) WHERE(ZWORK2D(:,:)>0.) - PLM(:,:,IKB)=MAX(XMNH_EPSILON,MIN( PLM(:,:,IKB), & - 0.76* SQRT(PTKET(:,:,IKB)/ZWORK2D(:,:)))) + PLM(:,:,KKB)=MAX(XMNH_EPSILON,MIN( PLM(:,:,KKB), & + 0.76* SQRT(PTKET(:,:,KKB)/ZWORK2D(:,:)))) END WHERE ! ! mixing length limited by the distance normal to the surface (with the same factor as for BL89) @@ -1878,10 +2022,10 @@ END WHERE IF (.NOT. ORMC01) THEN ZALPHA=0.5**(-1.5) ! - DO JJ=1,SIZE(PUT,2) - DO JI=1,SIZE(PUT,1) - DO JK=IKTB,IKTE - ZD=ZALPHA*(0.5*(PZZ(JI,JJ,JK)+PZZ(JI,JJ,JK+KKL))-PZZ(JI,JJ,IKB)) & + DO JJ=1,SIZE(PLM,2) + DO JI=1,SIZE(PLM,1) + DO JK=KKTB,KKTE + ZD=ZALPHA*(0.5*(PZZ(JI,JJ,JK)+PZZ(JI,JJ,JK+KKL))-PZZ(JI,JJ,KKB)) & *PDIRCOSZW(JI,JJ) IF ( PLM(JI,JJ,JK)>ZD) THEN PLM(JI,JJ,JK)=ZD @@ -1893,185 +2037,11 @@ IF (.NOT. ORMC01) THEN END DO END IF ! -PLM(:,:,KKA) = PLM(:,:,IKB ) -PLM(:,:,IKE ) = PLM(:,:,IKE-KKL) +PLM(:,:,KKA) = PLM(:,:,KKB ) +PLM(:,:,KKE ) = PLM(:,:,KKE-KKL) PLM(:,:,KKU ) = PLM(:,:,KKU-KKL) !$acc end kernels ! END SUBROUTINE DEAR -! -! ######################### - SUBROUTINE CLOUD_MODIF_LM -! ######################### -!! -!!*****CLOUD_MODIF_LM routine to: -!! 1/ change the mixing length in the clouds -!! 2/ emphasize the mixing length in the cloud -!! by the coefficient ZCOEF_AMPL calculated here -!! when the CEI index is above ZCEI_MIN. -!! -!! -!! ZCOEF_AMPL ^ -!! | -!! | -!! ZCOEF_AMPL_SAT - ---------- Saturation -!! (XDUMMY1) | - -!! | - -!! | - -!! | - -!! | - Amplification -!! | - straight -!! | - line -!! | - -!! | - -!! | - -!! | - -!! | - -!! 1 ------------ -!! | -!! | -!! 0 -----------|------------|----------> PCEI -!! 0 ZCEI_MIN ZCEI_MAX -!! (XDUMMY2) (XDUMMY3) -!! -!! -!! -!! AUTHOR -!! ------ -!! M. Tomasini *CNRM METEO-FRANCE -!! -!! MODIFICATIONS -!! ------------- -!! Original 09/07/04 -!! -!------------------------------------------------------------------------------- -! -!* 0. DECLARATIONS -! ------------ -! -IMPLICIT NONE -! -REAL :: ZPENTE ! Slope of the amplification straight line -REAL :: ZCOEF_AMPL_CEI_NUL! Ordonnate at the origin of the - ! amplification straight line -REAL, DIMENSION(SIZE(PUT,1),SIZE(PUT,2),SIZE(PUT,3)) :: ZCOEF_AMPL - ! Amplification coefficient of the mixing length - ! when the instability criterium is verified -REAL, DIMENSION(SIZE(PUT,1),SIZE(PUT,2),SIZE(PUT,3)) :: ZLM_CLOUD - ! Turbulent mixing length in the clouds -! -!------------------------------------------------------------------------------- -#ifdef _OPENACC -PRINT *,'OPENACC: TURB::CLOUD_MODIF_LM not yet implemented' -CALL ABORT -#endif -! -!* 1. INITIALISATION -! -------------- -! -ZPENTE = ( PCOEF_AMPL_SAT - 1. ) / ( PCEI_MAX - PCEI_MIN ) -ZCOEF_AMPL_CEI_NUL = 1. - ZPENTE * PCEI_MIN -! -ZCOEF_AMPL(:,:,:) = 1. -! -!* 2. CALCULATION OF THE AMPLIFICATION COEFFICIENT -! -------------------------------------------- -! -! Saturation -! -WHERE ( PCEI(:,:,:)>=PCEI_MAX ) ZCOEF_AMPL(:,:,:)=PCOEF_AMPL_SAT -! -! Between the min and max limits of CEI index, linear variation of the -! amplification coefficient ZCOEF_AMPL as a function of CEI -! -WHERE ( PCEI(:,:,:) < PCEI_MAX .AND. & - PCEI(:,:,:) > PCEI_MIN ) & - ZCOEF_AMPL(:,:,:) = ZPENTE * PCEI(:,:,:) + ZCOEF_AMPL_CEI_NUL -! -! -!* 3. CALCULATION OF THE MIXING LENGTH IN CLOUDS -! ------------------------------------------ -! -IF (HTURBLEN_CL == HTURBLEN) THEN - ZLM_CLOUD(:,:,:) = PLEM(:,:,:) -ELSE - SELECT CASE (HTURBLEN_CL) -! -!* 3.1 BL89 mixing length -! ------------------ - CASE ('BL89','RM17') - ZSHEAR=0. - CALL BL89(KKA,KKU,KKL,PZZ,PDZZ,PTHVREF,ZTHLM,KRR,ZRM,PTKET,ZSHEAR,ZLM_CLOUD) -! -!* 3.2 Delta mixing length -! ------------------- - CASE ('DELT') - CALL DELT(ZLM_CLOUD) -! -!* 3.3 Deardorff mixing length -! ----------------------- - CASE ('DEAR') - CALL DEAR(ZLM_CLOUD) -! - END SELECT -ENDIF -! -!* 4. MODIFICATION OF THE MIXING LENGTH IN THE CLOUDS -! ----------------------------------------------- -! -! Impression before modification of the mixing length -IF ( OTURB_DIAG .AND. OCLOSE_OUT ) THEN - TZFIELD%CMNHNAME = 'LM_CLEAR_SKY' - TZFIELD%CSTDNAME = '' - TZFIELD%CLONGNAME = 'LM_CLEAR_SKY' - TZFIELD%CUNITS = 'm' - TZFIELD%CDIR = 'XY' - TZFIELD%CCOMMENT = 'X_Y_Z_LM CLEAR SKY' - TZFIELD%NGRID = 1 - TZFIELD%NTYPE = TYPEREAL - TZFIELD%NDIMS = 3 - TZFIELD%LTIMEDEP = .TRUE. - CALL IO_Field_write(TPFILE,TZFIELD,PLEM) -ENDIF -! -! Amplification of the mixing length when the criteria are verified -! -WHERE (ZCOEF_AMPL(:,:,:) /= 1.) PLEM(:,:,:) = ZCOEF_AMPL(:,:,:)*ZLM_CLOUD(:,:,:) -! -! Cloud mixing length in the clouds at the points which do not verified the CEI -! -WHERE (PCEI(:,:,:) == -1.) PLEM(:,:,:) = ZLM_CLOUD(:,:,:) -! -! -!* 5. IMPRESSION -! ---------- -! -IF ( OTURB_DIAG .AND. OCLOSE_OUT ) THEN - TZFIELD%CMNHNAME = 'COEF_AMPL' - TZFIELD%CSTDNAME = '' - TZFIELD%CLONGNAME = 'COEF_AMPL' - TZFIELD%CUNITS = '1' - TZFIELD%CDIR = 'XY' - TZFIELD%CCOMMENT = 'X_Y_Z_COEF AMPL' - TZFIELD%NGRID = 1 - TZFIELD%NTYPE = TYPEREAL - TZFIELD%NDIMS = 3 - TZFIELD%LTIMEDEP = .TRUE. - CALL IO_Field_write(TPFILE,TZFIELD,ZCOEF_AMPL) - ! - TZFIELD%CMNHNAME = 'LM_CLOUD' - TZFIELD%CSTDNAME = '' - TZFIELD%CLONGNAME = 'LM_CLOUD' - TZFIELD%CUNITS = 'm' - TZFIELD%CDIR = 'XY' - TZFIELD%CCOMMENT = 'X_Y_Z_LM CLOUD' - TZFIELD%NGRID = 1 - TZFIELD%NTYPE = TYPEREAL - TZFIELD%NDIMS = 3 - CALL IO_Field_write(TPFILE,TZFIELD,ZLM_CLOUD) - ! -ENDIF -! -END SUBROUTINE CLOUD_MODIF_LM -! -END SUBROUTINE TURB + +end module mode_turb diff --git a/src/MNH/turb_ver.f90 b/src/MNH/turb_ver.f90 index d73fae818..8c3926d9f 100644 --- a/src/MNH/turb_ver.f90 +++ b/src/MNH/turb_ver.f90 @@ -347,7 +347,6 @@ USE MODD_BLANK USE MODI_PRANDTL USE MODI_GRADIENT_M USE MODI_GRADIENT_W -USE MODI_TURB USE MODI_TURB_VER_THERMO_FLUX USE MODI_TURB_VER_THERMO_CORR USE MODI_TURB_VER_DYN_FLUX -- GitLab