Newer
Older
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_WTH2',1,ZHOOK_HANDLE)
END FUNCTION M3_WTH_WTH2
!----------------------------------------------------------------------------
FUNCTION D_M3_WTH_WTH2_O_DDTDZ(D,CSTURB,PM3_WTH_WTH2,PREDTH1,PREDR1,PD,PBLL_O_E,PETHETA)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PM3_WTH_WTH2
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_WTH_WTH2_O_DDTDZ
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_WTH2_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_WTH_WTH2_O_DDTDZ(:,:,:) = ( 0.5*CSTURB%XCSHF*PBLL_O_E(:,:,:)*PETHETA(:,:,:)*0.5/CSTURB%XCTD/PD(:,:,:) &
- PM3_WTH_WTH2(:,:,:)/PD(:,:,:)*(1.5+PREDTH1(:,:,:)+PREDR1(:,:,:)) )&
* PBLL_O_E(:,:,:) * PETHETA(:,:,:) * CSTURB%XCTV
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_WTH_WTH2_O_DDTDZ(:,:,IKB-1)=D_M3_WTH_WTH2_O_DDTDZ(:,:,IKB)
D_M3_WTH_WTH2_O_DDTDZ(:,:,IKE+1)=D_M3_WTH_WTH2_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_WTH2_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_WTH_WTH2_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_WTH_W2TH(D,CSTURB,PREDTH1,PREDR1,PD,PKEFF,PTKE)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PKEFF
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_WTH_W2TH
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_W2TH',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZM(PTKE, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_WTH_W2TH(:,:,:) = CSTURB%XCSHF*PKEFF(:,:,:)*1.5/ZWORK1(:,:,:) &
* (1. - 0.5*PREDR1(:,:,:)*(1.+PREDR1(:,:,:))/PD(:,:,:) ) / (1.+PREDTH1(:,:,:))
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_WTH_W2TH(:,:,IKB-1)=M3_WTH_W2TH(:,:,IKB)
M3_WTH_W2TH(:,:,IKE+1)=M3_WTH_W2TH(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_W2TH',1,ZHOOK_HANDLE)
END FUNCTION M3_WTH_W2TH
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_WTH_W2TH_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PBLL_O_E,PETHETA,PKEFF,PTKE)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PKEFF
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_WTH_W2TH_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_W2TH_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZM(PTKE, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_WTH_W2TH_O_DDTDZ(:,:,:) = &
- CSTURB%XCSHF*PKEFF(:,:,:)*1.5/ZWORK1(:,:,:)/(1.+PREDTH1(:,:,:))**2 &
* CSTURB%XCTV*PBLL_O_E(:,:,:)*PETHETA(:,:,:) &
* (1. - 0.5*PREDR1(:,:,:)*(1.+PREDR1(:,:,:))/PD(:,:,:)* &
( 1.+(1.+PREDTH1(:,:,:))*(1.5+PREDR1(:,:,:)+PREDTH1(:,:,:))/PD(:,:,:)) )
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_WTH_W2TH_O_DDTDZ(:,:,IKB-1)=D_M3_WTH_W2TH_O_DDTDZ(:,:,IKB)
D_M3_WTH_W2TH_O_DDTDZ(:,:,IKE+1)=D_M3_WTH_W2TH_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_W2TH_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_WTH_W2TH_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_WTH_W2R(D,CSTURB,PD,PKEFF,PTKE,PBLL_O_E,PEMOIST,PDTDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PKEFF
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_WTH_W2R
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_W2R',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZM(PTKE, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_WTH_W2R(:,:,:) = - CSTURB%XCSHF*PKEFF(:,:,:)*0.75*CSTURB%XCTV*PBLL_O_E(:,:,:) &
/ZWORK1(:,:,:)*PEMOIST(:,:,:)*PDTDZ(:,:,:)/PD(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_WTH_W2R(:,:,IKB-1)=M3_WTH_W2R(:,:,IKB)
M3_WTH_W2R(:,:,IKE+1)=M3_WTH_W2R(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_W2R',1,ZHOOK_HANDLE)
END FUNCTION M3_WTH_W2R
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_WTH_W2R_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PKEFF,PTKE,PBLL_O_E,PEMOIST)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PKEFF
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_WTH_W2R_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_W2R_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZM(PTKE, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_WTH_W2R_O_DDTDZ(:,:,:) = - CSTURB%XCSHF*PKEFF(:,:,:)*0.75*CSTURB%XCTV*PBLL_O_E(:,:,:) &
/ZWORK1(:,:,:)*PEMOIST(:,:,:)/PD(:,:,:) &
* (1. - PREDTH1(:,:,:)*(1.5+PREDTH1(:,:,:)+PREDR1(:,:,:))/PD(:,:,:))
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_WTH_W2R_O_DDTDZ(:,:,IKB-1)=D_M3_WTH_W2R_O_DDTDZ(:,:,IKB)
D_M3_WTH_W2R_O_DDTDZ(:,:,IKE+1)=D_M3_WTH_W2R_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_W2R_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_WTH_W2R_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_WTH_WR2(D,CSTURB,PD,PKEFF,PTKE,PSQRT_TKE,PBLL_O_E,PBETA,PLEPS,PEMOIST,PDTDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PKEFF
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_WTH_WR2
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_WR2',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZM(PBETA*PLEPS/(PSQRT_TKE*PTKE), D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_WTH_WR2(:,:,:) = - CSTURB%XCSHF*PKEFF(:,:,:)*0.25*PBLL_O_E(:,:,:)*CSTURB%XCTV*PEMOIST(:,:,:)**2 &
*ZWORK1(:,:,:)/CSTURB%XCTD*PDTDZ(:,:,:)/PD(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_WTH_WR2(:,:,IKB-1)=M3_WTH_WR2(:,:,IKB)
M3_WTH_WR2(:,:,IKE+1)=M3_WTH_WR2(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_WR2',1,ZHOOK_HANDLE)
END FUNCTION M3_WTH_WR2
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_WTH_WR2_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PKEFF,PTKE,PSQRT_TKE,PBLL_O_E,PBETA,PLEPS,PEMOIST)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PKEFF
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_WTH_WR2_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_WR2_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZM(PBETA*PLEPS/(PSQRT_TKE*PTKE), D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_WTH_WR2_O_DDTDZ(:,:,:) = - CSTURB%XCSHF*PKEFF(:,:,:)*0.25*PBLL_O_E(:,:,:)*CSTURB%XCTV*PEMOIST(:,:,:)**2 &
*ZWORK1(:,:,:)/CSTURB%XCTD/PD(:,:,:) &
* (1. - PREDTH1(:,:,:)*(1.5+PREDTH1(:,:,:)+PREDR1(:,:,:))/PD(:,:,:))
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_WTH_WR2_O_DDTDZ(:,:,IKB-1)=D_M3_WTH_WR2_O_DDTDZ(:,:,IKB)
D_M3_WTH_WR2_O_DDTDZ(:,:,IKE+1)=D_M3_WTH_WR2_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_WR2_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_WTH_WR2_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_WTH_WTHR(D,CSTURB,PREDR1,PD,PKEFF,PTKE,PSQRT_TKE,PBETA,PLEPS,PEMOIST)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PKEFF
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_WTH_WTHR
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_WTHR',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZM(PBETA/PTKE*PSQRT_TKE, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_WTH_WTHR(:,:,:) = CSTURB%XCSHF*PKEFF(:,:,:)*PEMOIST(:,:,:)*ZWORK1(:,:,:) &
*0.5*PLEPS(:,:,:)/CSTURB%XCTD*(1+PREDR1(:,:,:))/PD(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_WTH_WTHR(:,:,IKB-1)=M3_WTH_WTHR(:,:,IKB)
M3_WTH_WTHR(:,:,IKE+1)=M3_WTH_WTHR(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WTH_WTHR',1,ZHOOK_HANDLE)
END FUNCTION M3_WTH_WTHR
!----------------------------------------------------------------------------
FUNCTION D_M3_WTH_WTHR_O_DDTDZ(D,CSTURB,PM3_WTH_WTHR,PREDTH1,PREDR1,PD,PBLL_O_E,PETHETA)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PM3_WTH_WTHR
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_WTH_WTHR_O_DDTDZ
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_WTHR_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_WTH_WTHR_O_DDTDZ(:,:,:) = - PM3_WTH_WTHR(:,:,:) * (1.5+PREDTH1(:,:,:)+PREDR1(:,:,:))&
/PD(:,:,:)*CSTURB%XCTV*PBLL_O_E(:,:,:)*PETHETA(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_WTH_WTHR_O_DDTDZ(:,:,IKB-1)=D_M3_WTH_WTHR_O_DDTDZ(:,:,IKB)
D_M3_WTH_WTHR_O_DDTDZ(:,:,IKE+1)=D_M3_WTH_WTHR_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WTH_WTHR_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_WTH_WTHR_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_TH2_W2TH(D,CSTURB,PREDTH1,PREDR1,PD,PDTDZ,PLM,PLEPS,PTKE)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLM
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_TH2_W2TH
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_W2TH',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF((1.-0.5*PREDR1*(1.+PREDR1)/PD)/(1.+PREDTH1)*PDTDZ, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_TH2_W2TH(:,:,:) = - ZWORK1(:,:,:) &
* 1.5*PLM(:,:,:)*PLEPS(:,:,:)/PTKE(:,:,:)*CSTURB%XCTV
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_TH2_W2TH(:,:,IKB-1)=M3_TH2_W2TH(:,:,IKB)
M3_TH2_W2TH(:,:,IKE+1)=M3_TH2_W2TH(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_W2TH',1,ZHOOK_HANDLE)
END FUNCTION M3_TH2_W2TH
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_TH2_W2TH_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLM,PLEPS,PTKE,OUSERV)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLM
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
LOGICAL, INTENT(IN) :: OUSERV
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_TH2_W2TH_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_W2TH_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
IF (OUSERV) THEN

RODIER Quentin
committed
! D_M3_TH2_W2TH_O_DDTDZ(:,:,:) = - 1.5*PLM*PLEPS/PTKE*CSTURB%XCTV * MZF( &
! (1.-0.5*PREDR1*(1.+PREDR1)/PD)*(1.-(1.5+PREDTH1+PREDR1)*(1.+PREDTH1)/PD ) &

RODIER Quentin
committed
! / (1.+PREDTH1)**2, D%NKA, D%NKU, D%NKL)
ZWORK1 = MZF((1.-0.5*PREDR1*(1.+PREDR1)/PD)*(1.-(1.5+PREDTH1+PREDR1)* &

RODIER Quentin
committed
PREDTH1*(1.+PREDTH1)/PD ) / (1.+PREDTH1)**2, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_TH2_W2TH_O_DDTDZ(:,:,:) = - 1.5*PLM(:,:,:)*PLEPS(:,:,:)/PTKE(:,:,:)*CSTURB%XCTV * &
ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
ZWORK1 = MZF(1./(1.+PREDTH1)**2, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_TH2_W2TH_O_DDTDZ(:,:,:) = - 1.5*PLM(:,:,:)*PLEPS(:,:,:)/PTKE(:,:,:)*CSTURB%XCTV &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
END IF
!
D_M3_TH2_W2TH_O_DDTDZ(:,:,IKB-1)=D_M3_TH2_W2TH_O_DDTDZ(:,:,IKB)
D_M3_TH2_W2TH_O_DDTDZ(:,:,IKE+1)=D_M3_TH2_W2TH_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_W2TH_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_TH2_W2TH_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_TH2_WTH2(D,CSTURB,PREDTH1,PREDR1,PD,PLEPS,PSQRT_TKE)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_TH2_WTH2
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_WTH2',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF((1.+0.5*PREDTH1+1.5*PREDR1+0.5*PREDR1**2)/PD, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_TH2_WTH2(:,:,:) = PLEPS(:,:,:)*0.5/CSTURB%XCTD/PSQRT_TKE(:,:,:) &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_TH2_WTH2(:,:,IKB-1)=M3_TH2_WTH2(:,:,IKB)
M3_TH2_WTH2(:,:,IKE+1)=M3_TH2_WTH2(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_WTH2',1,ZHOOK_HANDLE)
END FUNCTION M3_TH2_WTH2
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_TH2_WTH2_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PETHETA)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_TH2_WTH2_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_WTH2_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(PBLL_O_E*PETHETA* (0.5/PD &
- (1.5+PREDTH1+PREDR1)*(1.+0.5*PREDTH1+1.5*PREDR1+0.5*PREDR1**2)/PD**2 &

RODIER Quentin
committed
), D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_TH2_WTH2_O_DDTDZ(:,:,:) = PLEPS(:,:,:)*0.5/CSTURB%XCTD/PSQRT_TKE(:,:,:)*CSTURB%XCTV &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_TH2_WTH2_O_DDTDZ(:,:,IKB-1)=D_M3_TH2_WTH2_O_DDTDZ(:,:,IKB)
D_M3_TH2_WTH2_O_DDTDZ(:,:,IKE+1)=D_M3_TH2_WTH2_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_WTH2_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_TH2_WTH2_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_TH2_W2R(D,CSTURB,PD,PLM,PLEPS,PTKE,PBLL_O_E,PEMOIST,PDTDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLM
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_TH2_W2R
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_W2R',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(PBLL_O_E*PEMOIST/PD*PDTDZ**2, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_TH2_W2R(:,:,:) = 0.75*CSTURB%XCTV**2*ZWORK1(:,:,:) &
*PLM(:,:,:)*PLEPS(:,:,:)/PTKE(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_TH2_W2R(:,:,IKB-1)=M3_TH2_W2R(:,:,IKB)
M3_TH2_W2R(:,:,IKE+1)=M3_TH2_W2R(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_W2R',1,ZHOOK_HANDLE)
END FUNCTION M3_TH2_W2R
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_TH2_W2R_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLM,PLEPS,PTKE,PBLL_O_E,PEMOIST,PDTDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLM
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_TH2_W2R_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_W2R_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(PBLL_O_E*PEMOIST/PD*PDTDZ*(2.-PREDTH1*(1.5+PREDTH1+PREDR1)/PD), D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_TH2_W2R_O_DDTDZ(:,:,:) = 0.75*CSTURB%XCTV**2*PLM(:,:,:)*PLEPS(:,:,:)/PTKE(:,:,:) &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_TH2_W2R_O_DDTDZ(:,:,IKB-1)=D_M3_TH2_W2R_O_DDTDZ(:,:,IKB)
D_M3_TH2_W2R_O_DDTDZ(:,:,IKE+1)=D_M3_TH2_W2R_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_W2R_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_TH2_W2R_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_TH2_WR2(D,CSTURB,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PEMOIST,PDTDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_TH2_WR2
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_WR2',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF((PBLL_O_E*PEMOIST*PDTDZ)**2/PD, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_TH2_WR2(:,:,:) = 0.25*CSTURB%XCTV**2*ZWORK1(:,:,:)&
*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_TH2_WR2(:,:,IKB-1)=M3_TH2_WR2(:,:,IKB)
M3_TH2_WR2(:,:,IKE+1)=M3_TH2_WR2(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_WR2',1,ZHOOK_HANDLE)
END FUNCTION M3_TH2_WR2
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_TH2_WR2_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PEMOIST,PDTDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_TH2_WR2_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_WR2_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF((PBLL_O_E*PEMOIST)**2*PDTDZ/PD*(2.-PREDTH1*(1.5+PREDTH1+PREDR1)/PD), D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_TH2_WR2_O_DDTDZ(:,:,:) = 0.25*CSTURB%XCTV**2*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_TH2_WR2_O_DDTDZ(:,:,IKB-1)=D_M3_TH2_WR2_O_DDTDZ(:,:,IKB)
D_M3_TH2_WR2_O_DDTDZ(:,:,IKE+1)=D_M3_TH2_WR2_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_WR2_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_TH2_WR2_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_TH2_WTHR(D,CSTURB,PREDR1,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PEMOIST,PDTDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_TH2_WTHR
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_WTHR',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(PBLL_O_E*PEMOIST*PDTDZ*(1.+PREDR1)/PD, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_TH2_WTHR(:,:,:) = - 0.5*CSTURB%XCTV*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD &
*ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_TH2_WTHR(:,:,IKB-1)=M3_TH2_WTHR(:,:,IKB)
M3_TH2_WTHR(:,:,IKE+1)=M3_TH2_WTHR(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_TH2_WTHR',1,ZHOOK_HANDLE)
END FUNCTION M3_TH2_WTHR
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_TH2_WTHR_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PEMOIST,PDTDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_TH2_WTHR_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_WTHR_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(PBLL_O_E*PEMOIST*(1.+PREDR1)/PD * (1. -PREDTH1*(1.5+PREDTH1+PREDR1)/PD), D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_TH2_WTHR_O_DDTDZ(:,:,:) = - 0.5*CSTURB%XCTV*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_TH2_WTHR_O_DDTDZ(:,:,IKB-1)=D_M3_TH2_WTHR_O_DDTDZ(:,:,IKB)
D_M3_TH2_WTHR_O_DDTDZ(:,:,IKE+1)=D_M3_TH2_WTHR_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_TH2_WTHR_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_TH2_WTHR_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_THR_WTHR(D,CSTURB,PREDTH1,PREDR1,PD,PLEPS,PSQRT_TKE)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_THR_WTHR
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_THR_WTHR',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF((1.+PREDTH1)*(1.+PREDR1)/PD, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_THR_WTHR(:,:,:) = 0.5*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_THR_WTHR(:,:,IKB-1)=M3_THR_WTHR(:,:,IKB)
M3_THR_WTHR(:,:,IKE+1)=M3_THR_WTHR(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_THR_WTHR',1,ZHOOK_HANDLE)
END FUNCTION M3_THR_WTHR
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_THR_WTHR_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PETHETA)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_THR_WTHR_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_WTHR_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(PETHETA*PBLL_O_E/PD*(1.+PREDR1)*(1.-(1.+PREDTH1)*(1.5+PREDTH1+PREDR1)/PD), D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_THR_WTHR_O_DDTDZ(:,:,:) = 0.5*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD * CSTURB%XCTV &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_THR_WTHR_O_DDTDZ(:,:,IKB-1)=D_M3_THR_WTHR_O_DDTDZ(:,:,IKB)
D_M3_THR_WTHR_O_DDTDZ(:,:,IKE+1)=D_M3_THR_WTHR_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_WTHR_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_THR_WTHR_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_THR_WTH2(D,CSTURB,PREDR1,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PETHETA,PDRDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDRDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_THR_WTH2
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_THR_WTH2',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF((1.+PREDR1)*PBLL_O_E*PETHETA*PDRDZ/PD, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_THR_WTH2(:,:,:) = - 0.25*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD*CSTURB%XCTV &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_THR_WTH2(:,:,IKB-1)=M3_THR_WTH2(:,:,IKB)
M3_THR_WTH2(:,:,IKE+1)=M3_THR_WTH2(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_THR_WTH2',1,ZHOOK_HANDLE)
END FUNCTION M3_THR_WTH2
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_THR_WTH2_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PETHETA,PDRDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDRDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_THR_WTH2_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_WTH2_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(-(1.+PREDR1)*(PBLL_O_E*PETHETA/PD)**2*PDRDZ*(1.5+PREDTH1+PREDR1), D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_THR_WTH2_O_DDTDZ(:,:,:) = - 0.25*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD*CSTURB%XCTV**2 &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_THR_WTH2_O_DDTDZ(:,:,IKB-1)=D_M3_THR_WTH2_O_DDTDZ(:,:,IKB)
D_M3_THR_WTH2_O_DDTDZ(:,:,IKE+1)=D_M3_THR_WTH2_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_WTH2_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_THR_WTH2_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_THR_WTH2_O_DDRDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLEPS,PSQRT_TKE,PBLL_O_E,PETHETA)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PSQRT_TKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_THR_WTH2_O_DDRDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_WTH2_O_DDRDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(PBLL_O_E*PETHETA/PD &
*(-(1.+PREDR1)*PREDR1/PD*(1.5+PREDTH1+PREDR1)+(1.+2.*PREDR1)), &

RODIER Quentin
committed
D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_THR_WTH2_O_DDRDZ(:,:,:) = - 0.25*PLEPS(:,:,:)/PSQRT_TKE(:,:,:)/CSTURB%XCTD*CSTURB%XCTV &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_THR_WTH2_O_DDRDZ(:,:,IKB-1)=D_M3_THR_WTH2_O_DDRDZ(:,:,IKB)
D_M3_THR_WTH2_O_DDRDZ(:,:,IKE+1)=D_M3_THR_WTH2_O_DDRDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_WTH2_O_DDRDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_THR_WTH2_O_DDRDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_THR_W2TH(D,CSTURB,PREDR1,PD,PLM,PLEPS,PTKE,PDRDZ)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLM
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDRDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_THR_W2TH
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_THR_W2TH',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF((1.+PREDR1)*PDRDZ/PD, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
M3_THR_W2TH(:,:,:) = - 0.75*PLM(:,:,:)*PLEPS(:,:,:)/PTKE(:,:,:) * CSTURB%XCTV &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
M3_THR_W2TH(:,:,IKB-1)=M3_THR_W2TH(:,:,IKB)
M3_THR_W2TH(:,:,IKE+1)=M3_THR_W2TH(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_THR_W2TH',1,ZHOOK_HANDLE)
END FUNCTION M3_THR_W2TH
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_THR_W2TH_O_DDTDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLM,PLEPS,PTKE,PBLL_O_E,PDRDZ,PETHETA)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLM
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDRDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PETHETA
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_THR_W2TH_O_DDTDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_W2TH_O_DDTDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(-PETHETA*PBLL_O_E*(1.+PREDR1)*PDRDZ*(1.5+PREDTH1+PREDR1)/PD**2, D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_THR_W2TH_O_DDTDZ(:,:,:) = - 0.75*PLM(:,:,:)*PLEPS(:,:,:)/PTKE(:,:,:) * CSTURB%XCTV**2 &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_THR_W2TH_O_DDTDZ(:,:,IKB-1)=D_M3_THR_W2TH_O_DDTDZ(:,:,IKB)
D_M3_THR_W2TH_O_DDTDZ(:,:,IKE+1)=D_M3_THR_W2TH_O_DDTDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_W2TH_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_THR_W2TH_O_DDTDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_THR_W2TH_O_DDRDZ(D,CSTURB,PREDTH1,PREDR1,PD,PLM,PLEPS,PTKE)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLM
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PLEPS
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_THR_W2TH_O_DDRDZ
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: ZWORK1 ! working array
INTEGER :: IKB, IKE, JI,JJ,JK
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_W2TH_O_DDRDZ',0,ZHOOK_HANDLE)
IKB = 1+JPVEXT_TURB
IKE = SIZE(PD,3)-JPVEXT_TURB
ZWORK1 = MZF(-(1.+PREDR1)*PREDR1*(1.5+PREDTH1+PREDR1)/PD**2 &

RODIER Quentin
committed
D%NKA, D%NKU, D%NKL)
!$mnh_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
D_M3_THR_W2TH_O_DDRDZ(:,:,:) = - 0.75*PLM(:,:,:)*PLEPS(:,:,:)/PTKE(:,:,:) * CSTURB%XCTV &
* ZWORK1(:,:,:)
!$mnh_end_expand_array(JI=D%NIB:D%NIE,JJ=D%NJB:D%NJE,JK=1:D%NKT)
!
D_M3_THR_W2TH_O_DDRDZ(:,:,IKB-1)=D_M3_THR_W2TH_O_DDRDZ(:,:,IKB)
D_M3_THR_W2TH_O_DDRDZ(:,:,IKE+1)=D_M3_THR_W2TH_O_DDRDZ(:,:,IKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_THR_W2TH_O_DDRDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_THR_W2TH_O_DDRDZ
!----------------------------------------------------------------------------
!----------------------------------------------------------------------------
!----------------------------------------------------------------------------
!
FUNCTION PSI3(D,CSTURB,PREDR1,PREDTH1,PRED2R3,PRED2TH3,PRED2THR3,HTURBDIM,OUSERV)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2TH3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2R3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2THR3
CHARACTER(LEN=4), INTENT(IN) :: HTURBDIM ! 1DIM or 3DIM turb. scheme
LOGICAL, INTENT(IN) :: OUSERV ! flag to use vapor
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: PSI3
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:PSI3',0,ZHOOK_HANDLE)
PSI3 = PHI3(D,CSTURB,PREDR1,PREDTH1,PRED2R3,PRED2TH3,PRED2THR3,HTURBDIM,OUSERV)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:PSI3',1,ZHOOK_HANDLE)
END FUNCTION PSI3
!----------------------------------------------------------------------------
FUNCTION D_PSI3DRDZ_O_DDRDZ(D,CSTURB,PPSI3,PREDR1,PREDTH1,PRED2R3,PRED2THR3,HTURBDIM,OUSERV)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PPSI3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2R3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2THR3
CHARACTER(LEN=4), INTENT(IN) :: HTURBDIM ! 1DIM or 3DIM turb. scheme
LOGICAL, INTENT(IN) :: OUSERV ! flag to use vapor
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_PSI3DRDZ_O_DDRDZ
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_PSI3DRDZ_O_DDRDZ',0,ZHOOK_HANDLE)
D_PSI3DRDZ_O_DDRDZ = D_PHI3DTDZ_O_DDTDZ(D,CSTURB,PPSI3,PREDR1,PREDTH1,PRED2R3,PRED2THR3,HTURBDIM,OUSERV)
!
!C'est ok?!
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_PSI3DRDZ_O_DDRDZ',1,ZHOOK_HANDLE)
END FUNCTION D_PSI3DRDZ_O_DDRDZ
!----------------------------------------------------------------------------
FUNCTION D_PSI3DTDZ_O_DDTDZ(D,CSTURB,PPSI3,PREDR1,PREDTH1,PRED2R3,PRED2THR3,HTURBDIM,OUSERV)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PPSI3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2R3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2THR3
CHARACTER(LEN=4), INTENT(IN) :: HTURBDIM ! 1DIM or 3DIM turb. scheme
LOGICAL, INTENT(IN) :: OUSERV ! flag to use vapor
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_PSI3DTDZ_O_DDTDZ
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_PSI3DTDZ_O_DDTDZ',0,ZHOOK_HANDLE)
D_PSI3DTDZ_O_DDTDZ = D_PHI3DRDZ_O_DDRDZ(D,CSTURB,PPSI3,PREDR1,PREDTH1,PRED2R3,PRED2THR3,HTURBDIM,OUSERV)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_PSI3DTDZ_O_DDTDZ',1,ZHOOK_HANDLE)
END FUNCTION D_PSI3DTDZ_O_DDTDZ
!----------------------------------------------------------------------------
FUNCTION D_PSI3DRDZ2_O_DDRDZ(D,CSTURB,PPSI3,PREDR1,PREDTH1,PRED2R3,PRED2THR3,PDRDZ,HTURBDIM,OUSERV)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PPSI3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2R3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PRED2THR3
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PDRDZ
CHARACTER(LEN=4), INTENT(IN) :: HTURBDIM ! 1DIM or 3DIM turb. scheme
LOGICAL, INTENT(IN) :: OUSERV ! flag to use vapor
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_PSI3DRDZ2_O_DDRDZ
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_PSI3DRDZ2_O_DDRDZ',0,ZHOOK_HANDLE)
D_PSI3DRDZ2_O_DDRDZ = D_PHI3DTDZ2_O_DDTDZ(D,CSTURB,PPSI3,PREDR1,PREDTH1,PRED2R3,PRED2THR3,PDRDZ,HTURBDIM,OUSERV)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_PSI3DRDZ2_O_DDRDZ',1,ZHOOK_HANDLE)
END FUNCTION D_PSI3DRDZ2_O_DDRDZ
!----------------------------------------------------------------------------
FUNCTION M3_WR_WR2(D,CSTURB,PREDR1,PREDTH1,PD,PBLL_O_E,PEMOIST)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_WR_WR2
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WR_WR2',0,ZHOOK_HANDLE)
M3_WR_WR2 = M3_WTH_WTH2(D,CSTURB,PREDR1,PREDTH1,PD,PBLL_O_E,PEMOIST)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WR_WR2',1,ZHOOK_HANDLE)
END FUNCTION M3_WR_WR2
!----------------------------------------------------------------------------
FUNCTION D_M3_WR_WR2_O_DDRDZ(D,CSTURB,PM3_WR_WR2,PREDR1,PREDTH1,PD,PBLL_O_E,PEMOIST)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PM3_WR_WR2
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PBLL_O_E
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PEMOIST
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: D_M3_WR_WR2_O_DDRDZ
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WR_WR2_O_DDRDZ',0,ZHOOK_HANDLE)
D_M3_WR_WR2_O_DDRDZ = D_M3_WTH_WTH2_O_DDTDZ(D,CSTURB,PM3_WR_WR2,PREDR1,PREDTH1,PD,PBLL_O_E,PEMOIST)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:D_M3_WR_WR2_O_DDRDZ',1,ZHOOK_HANDLE)
END FUNCTION D_M3_WR_WR2_O_DDRDZ
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION M3_WR_W2R(D,CSTURB,PREDR1,PREDTH1,PD,PKEFF,PTKE)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDR1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PREDTH1
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PD
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PKEFF
REAL, DIMENSION(D%NIT,D%NJT,D%NKT), INTENT(IN) :: PTKE
REAL, DIMENSION(D%NIT,D%NJT,D%NKT) :: M3_WR_W2R
!
REAL(KIND=JPRB) :: ZHOOK_HANDLE
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WR_W2R',0,ZHOOK_HANDLE)

RODIER Quentin
committed
M3_WR_W2R = M3_WTH_W2TH(D,CSTURB,PREDR1,PREDTH1,PD,PKEFF,PTKE)
!
IF (LHOOK) CALL DR_HOOK('MODE_PRANDTL:M3_WR_W2R',1,ZHOOK_HANDLE)
END FUNCTION M3_WR_W2R
!----------------------------------------------------------------------------

RODIER Quentin
committed
FUNCTION D_M3_WR_W2R_O_DDRDZ(D,CSTURB,PREDR1,PREDTH1,PD,PBLL_O_E,PEMOIST,PKEFF,PTKE)
TYPE(DIMPHYEX_t), INTENT(IN) :: D
TYPE(CSTURB_t), INTENT(IN) :: CSTURB