From af19b338abcb9f661cc700afb81058431f9fffe4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Riette?= <sebastien.riette@meteo.fr>
Date: Tue, 25 Jan 2022 09:20:41 +0100
Subject: [PATCH] =?UTF-8?q?S=C3=A9bastien=20Riette=2025/01/2022=20merge=20?=
 =?UTF-8?q?compute=5Fmf=5Fcloud*?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/arome/gmkpack_ignored_files               |   9 +
 src/arome/turb/modi_compute_mf_cloud.F90      |  53 -----
 .../turb/modi_compute_mf_cloud_bigaus.F90     |  37 ----
 .../turb/modi_compute_mf_cloud_direct.F90     |  28 ---
 src/arome/turb/modi_compute_mf_cloud_stat.F90 |  42 ----
 src/arome/turb/shallow_mf.F90                 |   2 +-
 .../turb/mode_compute_mf_cloud.F90}           |  29 ++-
 .../turb/mode_compute_mf_cloud_bigaus.F90}    |  42 ++--
 .../turb/mode_compute_mf_cloud_direct.F90}    |  10 +
 .../turb/mode_compute_mf_cloud_stat.F90}      |  11 +
 src/mesonh/turb/compute_mf_cloud.f90          | 196 ----------------
 src/mesonh/turb/compute_mf_cloud_bigaus.f90   | 209 ------------------
 src/mesonh/turb/compute_mf_cloud_direct.f90   | 119 ----------
 src/mesonh/turb/compute_mf_cloud_stat.f90     | 181 ---------------
 src/mesonh/turb/shallow_mf.f90                |   2 +-
 15 files changed, 70 insertions(+), 900 deletions(-)
 delete mode 100644 src/arome/turb/modi_compute_mf_cloud.F90
 delete mode 100644 src/arome/turb/modi_compute_mf_cloud_bigaus.F90
 delete mode 100644 src/arome/turb/modi_compute_mf_cloud_direct.F90
 delete mode 100644 src/arome/turb/modi_compute_mf_cloud_stat.F90
 rename src/{arome/turb/compute_mf_cloud.F90 => common/turb/mode_compute_mf_cloud.F90} (86%)
 rename src/{arome/turb/compute_mf_cloud_bigaus.F90 => common/turb/mode_compute_mf_cloud_bigaus.F90} (88%)
 rename src/{arome/turb/compute_mf_cloud_direct.F90 => common/turb/mode_compute_mf_cloud_direct.F90} (89%)
 rename src/{arome/turb/compute_mf_cloud_stat.F90 => common/turb/mode_compute_mf_cloud_stat.F90} (92%)
 delete mode 100644 src/mesonh/turb/compute_mf_cloud.f90
 delete mode 100644 src/mesonh/turb/compute_mf_cloud_bigaus.f90
 delete mode 100644 src/mesonh/turb/compute_mf_cloud_direct.f90
 delete mode 100644 src/mesonh/turb/compute_mf_cloud_stat.f90

diff --git a/src/arome/gmkpack_ignored_files b/src/arome/gmkpack_ignored_files
index 0115464cf..f9d5a7ad2 100644
--- a/src/arome/gmkpack_ignored_files
+++ b/src/arome/gmkpack_ignored_files
@@ -106,3 +106,12 @@ phyex/turb/compute_function_thermo_mf.F90
 phyex/turb/modd_cmfshall.F90
 phyex/turb/mf_turb_expl.F90
 phyex/turb/modi_mf_turb_expl.F90
+phyex/turb/compute_mf_cloud.F90
+phyex/turb/compute_mf_cloud_bigaus.F90
+phyex/turb/compute_mf_cloud_direct.F90
+phyex/turb/compute_mf_cloud_stat.F90
+phyex/turb/modi_compute_mf_cloud.F90
+phyex/turb/modi_compute_mf_cloud_bigaus.F90
+phyex/turb/modi_compute_mf_cloud_direct.F90
+phyex/turb/modi_compute_mf_cloud_stat.F90
+
diff --git a/src/arome/turb/modi_compute_mf_cloud.F90 b/src/arome/turb/modi_compute_mf_cloud.F90
deleted file mode 100644
index 059f46630..000000000
--- a/src/arome/turb/modi_compute_mf_cloud.F90
+++ /dev/null
@@ -1,53 +0,0 @@
-!     ######spl
-     MODULE MODI_COMPUTE_MF_CLOUD
-!    ############################
-!
-INTERFACE
-!     #################################################################
-      SUBROUTINE COMPUTE_MF_CLOUD(KKA,KKB,KKE,KKU,KKL,KRR,KRRL,KRRI,HMF_CLOUD,&
-                                  PFRAC_ICE,                                &
-                                  PRC_UP,PRI_UP,PEMF,                       &
-                                  PTHL_UP, PRT_UP, PFRAC_UP,                &
-                                  PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,          &
-                                  PEXNM, PTHLM, PRTM, PTHM, PTHVM, PRM,     &
-                                  PDZZ, PZZ, KKLCL,                         &
-                                  PPABSM, PRHODREF,                         &
-                                  PRC_MF, PRI_MF, PCF_MF, PSIGMF, PDEPTH    )
-!     #################################################################
-!!
-!               
-!*               1.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   ::  KKL          ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-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=4),      INTENT(IN)   ::  HMF_CLOUD    ! Type of statistical cloud scheme
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_ICE    ! liquid/ice fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PRC_UP,PRI_UP,PEMF ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHL_UP, PRT_UP  
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_UP
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHV_UP           ! updraft thetaV
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_ICE_UP      ! liquid/solid fraction in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PRSAT_UP          ! Rsat in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PEXNM             ! exner function
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHLM, PRTM ! cons. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHM, PTHVM ! theta and thetaV
-REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PRM         ! water var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PDZZ, PZZ
-INTEGER, DIMENSION(:),  INTENT(IN)   ::  KKLCL       ! index of updraft condensation level
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PPABSM, PRHODREF ! environement
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PRC_MF, PRI_MF   ! cloud content and
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PCF_MF           ! cloud fraction for MF scheme
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PSIGMF ! SQRT(variance) for statistical cloud scheme
-REAL, DIMENSION(:),     INTENT(IN)   ::  PDEPTH ! Deepness of cloud
-
-END SUBROUTINE COMPUTE_MF_CLOUD
-
-END INTERFACE
-!
-END MODULE MODI_COMPUTE_MF_CLOUD
diff --git a/src/arome/turb/modi_compute_mf_cloud_bigaus.F90 b/src/arome/turb/modi_compute_mf_cloud_bigaus.F90
deleted file mode 100644
index 9be4f5548..000000000
--- a/src/arome/turb/modi_compute_mf_cloud_bigaus.F90
+++ /dev/null
@@ -1,37 +0,0 @@
-!     ######spl
-     MODULE MODI_COMPUTE_MF_CLOUD_BIGAUS
-!    ###################################
-!
-INTERFACE
-!     #################################################################
-      SUBROUTINE COMPUTE_MF_CLOUD_BIGAUS(KKA, KKB, KKE, KKU, KKL,&
-                                  PRC_UP, PRI_UP, PEMF, PDEPTH,&
-                                  PRT_UP, PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,&
-                                  PRTM, PTHM, PTHVM,&
-                                  PDZZ, PZZ, PRHODREF,&
-                                  PRC_MF, PRI_MF, PCF_MF)
-!     #################################################################
-!!
-!
-!*               1.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   :: KKL                     ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PRC_UP,PRI_UP,PEMF      ! updraft characteritics
-REAL, DIMENSION(:),     INTENT(IN)   :: PDEPTH                  ! Deepness of cloud
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHV_UP, PRSAT_UP, PRT_UP ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_ICE_UP            ! liquid/ice fraction in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHM, PRTM, PTHVM       ! env. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PDZZ, PZZ
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PRHODREF
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PRC_MF, PRI_MF          ! cloud content
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PCF_MF                  ! and cloud fraction for MF scheme
-
-END SUBROUTINE COMPUTE_MF_CLOUD_BIGAUS
-
-END INTERFACE
-!
-END MODULE MODI_COMPUTE_MF_CLOUD_BIGAUS
diff --git a/src/arome/turb/modi_compute_mf_cloud_direct.F90 b/src/arome/turb/modi_compute_mf_cloud_direct.F90
deleted file mode 100644
index d58977f51..000000000
--- a/src/arome/turb/modi_compute_mf_cloud_direct.F90
+++ /dev/null
@@ -1,28 +0,0 @@
-!     ######spl
-     MODULE MODI_COMPUTE_MF_CLOUD_DIRECT
-!    ###################################
-!
-INTERFACE
-!     #################################################################
-      SUBROUTINE COMPUTE_MF_CLOUD_DIRECT(KKB, KKE, KKL, &
-                                        &KKLCL, PFRAC_UP, PRC_UP, PRI_UP,&
-                                        &PRC_MF, PRI_MF, PCF_MF)
-!     #################################################################
-!!
-!
-!*               1.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKB            ! near groud physical index
-INTEGER,                INTENT(IN)   :: KKE            ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKL            ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-INTEGER, DIMENSION(:),  INTENT(IN)   :: KKLCL          ! index of updraft condensation level
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_UP       ! Updraft Fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PRC_UP,PRI_UP  ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PRC_MF, PRI_MF ! cloud content (INPUT=environment, OUTPUT=conv. cloud)
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PCF_MF         ! and cloud fraction for MF scheme
-
-END SUBROUTINE COMPUTE_MF_CLOUD_DIRECT
-
-END INTERFACE
-!
-END MODULE MODI_COMPUTE_MF_CLOUD_DIRECT
diff --git a/src/arome/turb/modi_compute_mf_cloud_stat.F90 b/src/arome/turb/modi_compute_mf_cloud_stat.F90
deleted file mode 100644
index 94d9b5b2e..000000000
--- a/src/arome/turb/modi_compute_mf_cloud_stat.F90
+++ /dev/null
@@ -1,42 +0,0 @@
-!     ######spl
-     MODULE MODI_COMPUTE_MF_CLOUD_STAT
-!    ############################
-!
-INTERFACE
-!     #################################################################
-      SUBROUTINE COMPUTE_MF_CLOUD_STAT(KKA, KKB, KKE, KKU, KKL, KRR, KRRL, KRRI,&
-                            &PFRAC_ICE,&
-                            &PTHLM, PRTM, PPABSM, PRM,&
-                            &PDZZ, PTHM, PEXNM,&
-                            &PEMF, PTHL_UP, PRT_UP,&
-                            &PSIGMF)
-!     #################################################################
-!!
-!
-!*               1.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   :: KKL                     ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-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.
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_ICE               ! liquid/ice fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHLM, PRTM             ! cons. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PPABSM                  ! Pressure at time t-1
-REAL, DIMENSION(:,:,:), INTENT(IN)   :: PRM                     ! water var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PDZZ
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHM                    ! environement
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PEXNM
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PEMF                    ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHL_UP, PRT_UP         ! rc,w,Mass Flux,Thetal,rt
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PSIGMF                  ! SQRT(variance) for statistical cloud scheme
-
-
-END SUBROUTINE COMPUTE_MF_CLOUD_STAT
-
-END INTERFACE
-!
-END MODULE MODI_COMPUTE_MF_CLOUD_STAT
diff --git a/src/arome/turb/shallow_mf.F90 b/src/arome/turb/shallow_mf.F90
index 2ffd24749..6997ea17a 100644
--- a/src/arome/turb/shallow_mf.F90
+++ b/src/arome/turb/shallow_mf.F90
@@ -69,7 +69,7 @@ USE MODI_COMPUTE_UPDRAFT_RHCJ10
 USE MODI_COMPUTE_UPDRAFT_RAHA
 USE MODI_MF_TURB
 USE MODI_MF_TURB_EXPL
-USE MODI_COMPUTE_MF_CLOUD
+USE MODE_COMPUTE_MF_CLOUD, ONLY: COMPUTE_MF_CLOUD
 USE MODE_COMPUTE_FRAC_ICE, ONLY : COMPUTE_FRAC_ICE
 !
 IMPLICIT NONE
diff --git a/src/arome/turb/compute_mf_cloud.F90 b/src/common/turb/mode_compute_mf_cloud.F90
similarity index 86%
rename from src/arome/turb/compute_mf_cloud.F90
rename to src/common/turb/mode_compute_mf_cloud.F90
index a8582c0cf..7792adb25 100644
--- a/src/arome/turb/compute_mf_cloud.F90
+++ b/src/common/turb/mode_compute_mf_cloud.F90
@@ -1,3 +1,15 @@
+!MNH_LIC Copyright 2009-2021 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.
+!-----------------------------------------------------------------
+!     ######spl
+     MODULE MODE_COMPUTE_MF_CLOUD
+!    ############################
+!
+IMPLICIT NONE
+CONTAINS
+!
 !     ######spl
       SUBROUTINE COMPUTE_MF_CLOUD(KKA,KKB,KKE,KKU,KKL,KRR,KRRL,KRRI,HMF_CLOUD,&
                                   PFRAC_ICE,                                &
@@ -42,14 +54,17 @@
 !!      S. Riette Dec 2010 BIGA case
 !!      S. Riette Aug 2011 code is split into subroutines
 !!      S. Riette Jan 2012: support for both order of vertical levels
+!  P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg
 !! --------------------------------------------------------------------------
 !
 !*      0. DECLARATIONS
 !          ------------
 !
-USE MODI_COMPUTE_MF_CLOUD_DIRECT
-USE MODI_COMPUTE_MF_CLOUD_STAT
-USE MODI_COMPUTE_MF_CLOUD_BIGAUS
+USE MODE_MSG
+!
+USE MODE_COMPUTE_MF_CLOUD_DIRECT, ONLY: COMPUTE_MF_CLOUD_DIRECT
+USE MODE_COMPUTE_MF_CLOUD_STAT, ONLY: COMPUTE_MF_CLOUD_STAT
+USE MODE_COMPUTE_MF_CLOUD_BIGAUS, ONLY: COMPUTE_MF_CLOUD_BIGAUS
 !
 USE PARKIND1, ONLY : JPRB
 USE YOMHOOK , ONLY : LHOOK, DR_HOOK
@@ -123,7 +138,7 @@ ELSEIF (HMF_CLOUD == 'STAT') THEN
 ELSEIF (HMF_CLOUD == 'BIGA') THEN
   !Statistical scheme using the bi-gaussian PDF proposed by E. Perraud.
   CALL COMPUTE_MF_CLOUD_BIGAUS(KKA, KKB, KKE, KKU, KKL,&
-                              &PRC_UP, PRI_UP, PEMF, PDEPTH,&
+                              &PEMF, PDEPTH,&
                               &PRT_UP, PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,&
                               &PRTM, PTHM, PTHVM,&
                               &PDZZ, PZZ, PRHODREF,&
@@ -133,12 +148,10 @@ ELSEIF  (HMF_CLOUD == 'NONE') THEN
   ! No CONVECTIVE CLOUD SCHEME
   ! Nothing to do: PRC_MF, PRI_MF, PCF_MF, PSIGMF are already filled with zero
 ELSE
-  WRITE(*,*) ' STOP'
-  WRITE(*,*) ' Shallow convection cloud scheme not valid : HMF_CLOUD =',TRIM(HMF_CLOUD)
-  CALL ABORT
-  STOP
+  CALL PRINT_MSG(NVERB_FATAL,'GEN','COMPUTE_MF_CLOUD','Shallow convection cloud scheme not valid: HMF_CLOUD='//TRIM(HMF_CLOUD))
 ENDIF
 
 IF (LHOOK) CALL DR_HOOK('COMPUTE_MF_CLOUD',1,ZHOOK_HANDLE)
 
 END SUBROUTINE COMPUTE_MF_CLOUD
+END MODULE MODE_COMPUTE_MF_CLOUD
diff --git a/src/arome/turb/compute_mf_cloud_bigaus.F90 b/src/common/turb/mode_compute_mf_cloud_bigaus.F90
similarity index 88%
rename from src/arome/turb/compute_mf_cloud_bigaus.F90
rename to src/common/turb/mode_compute_mf_cloud_bigaus.F90
index eb382de5a..86d33090b 100644
--- a/src/arome/turb/compute_mf_cloud_bigaus.F90
+++ b/src/common/turb/mode_compute_mf_cloud_bigaus.F90
@@ -1,6 +1,16 @@
+!MNH_LIC Copyright 2011-2021 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.
+!-----------------------------------------------------------------
 !     ######spl
+     MODULE MODE_COMPUTE_MF_CLOUD_BIGAUS
+!    ###################################
+!
+IMPLICIT NONE
+CONTAINS
       SUBROUTINE COMPUTE_MF_CLOUD_BIGAUS(KKA, KKB, KKE, KKU, KKL,&
-                                  PRC_UP, PRI_UP, PEMF, PDEPTH,&
+                                  PEMF, PDEPTH,&
                                   PRT_UP, PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,&
                                   PRTM, PTHM, PTHVM,&
                                   PDZZ, PZZ, PRHODREF,&
@@ -42,6 +52,7 @@
 !!    -------------
 !!      Original 25 Aug 2011
 !!      S. Riette Jan 2012: support for both order of vertical levels
+!!      S. Riette Jun 2019: remove unused PRC_UP and PRI_UP, use SIGN in ERFC computation
 !! --------------------------------------------------------------------------
 !
 !*      0. DECLARATIONS
@@ -66,7 +77,7 @@ INTEGER,                INTENT(IN)   :: KKB          ! near ground physical inde
 INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
 INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
 INTEGER,                INTENT(IN)   :: KKL                     ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PRC_UP,PRI_UP,PEMF      ! updraft characteritics
+REAL, DIMENSION(:,:),   INTENT(IN)   :: PEMF                    ! updraft characteritics
 REAL, DIMENSION(:),     INTENT(IN)   :: PDEPTH                  ! Deepness of cloud
 REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHV_UP, PRSAT_UP, PRT_UP ! updraft characteritics
 REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_ICE_UP            ! liquid/ice fraction in updraft
@@ -86,8 +97,7 @@ REAL, DIMENSION(SIZE(PTHM,1))              :: ZOMEGA_UP_M              !
 REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZW1 ! working array
 INTEGER                                    :: JK  ! vertical loop control
 REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZEMF_M, ZTHV_UP_M, &   !
-                                            & ZRSAT_UP_M, ZRC_UP_M,& ! Interpolation on mass points
-                                            & ZRI_UP_M, ZRT_UP_M,&   !
+                                            & ZRSAT_UP_M, ZRT_UP_M,& ! Interpolation on mass points
                                             & ZFRAC_ICE_UP_M         !
 REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZCOND ! condensate
 REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZA, ZGAM ! used for integration
@@ -109,8 +119,6 @@ ZGRAD_Z_RT(:,:)=MZF_MF(ZW1(:,:), KKA, KKU, KKL)
 !Interpolation on mass points
 ZTHV_UP_M(:,:) = MZF_MF(PTHV_UP(:,:), KKA, KKU, KKL)
 ZRSAT_UP_M(:,:)= MZF_MF(PRSAT_UP(:,:), KKA, KKU, KKL)
-ZRC_UP_M(:,:)  = MZF_MF(PRC_UP(:,:), KKA, KKU, KKL)
-ZRI_UP_M(:,:)  = MZF_MF(PRI_UP(:,:), KKA, KKU, KKL)
 ZRT_UP_M(:,:)  = MZF_MF(PRT_UP(:,:), KKA, KKU, KKL)
 ZEMF_M(:,:)    = MZF_MF(PEMF(:,:), KKA, KKU, KKL)
 ZFRAC_ICE_UP_M(:,:) = MZF_MF(PFRAC_ICE_UP(:,:), KKA, KKU, KKL)
@@ -157,25 +165,8 @@ ZSIGMF(:,:)=SQRT(MAX(ABS(ZSIGMF(:,:)), 1.E-40))
 !Computation of ZA and ZGAM (=efrc(ZA)) coefficient
 ZA(:,:)=(ZRSAT_UP_M(:,:)-ZRT_UP_M(:,:))/(sqrt(2.)*ZSIGMF(:,:))
 
-!erf computed by an incomplete gamma function approximation
-!DO JK=KKA,KKU,KKL
-!  DO JI=1, SIZE(PCF_MF,1)
-!    IF(ZA(JI,JK)>1E-20) THEN
-!      ZGAM(JI,JK)=1-GAMMA_INC(0.5,ZA(JI,JK)**2)
-!    ELSEIF(ZA(JI,JK)<-1E-20) THEN
-!      ZGAM(JI,JK)=1+GAMMA_INC(0.5,ZA(JI,JK)**2)
-!    ELSE
-!      ZGAM(JI,JK)=1
-!    ENDIF
-!  ENDDO
-!ENDDO
-
-!alternative approximation of erf function (better for vectorisation)
-WHERE(ZA(:,:)>0)
-  ZGAM(:,:)=1-SQRT(1-EXP(-4*ZA(:,:)**2/XPI))
-ELSEWHERE
-  ZGAM(:,:)=1+SQRT(1-EXP(-4*ZA(:,:)**2/XPI))
-ENDWHERE
+!Approximation of erf function
+ZGAM(:,:)=1-SIGN(1., ZA(:,:))*SQRT(1-EXP(-4*ZA(:,:)**2/XPI))
 
 !computation of cloud fraction
 PCF_MF(:,:)=MAX( 0., MIN(1.,0.5*ZGAM(:,:) * ZALPHA_UP_M(:,:)))
@@ -189,3 +180,4 @@ PRI_MF(:,:)=(   ZFRAC_ICE_UP_M(:,:)) * ZCOND(:,:)
 IF (LHOOK) CALL DR_HOOK('COMPUTE_MF_CLOUD_BIGAUS',1,ZHOOK_HANDLE)
 
 END SUBROUTINE COMPUTE_MF_CLOUD_BIGAUS
+END MODULE MODE_COMPUTE_MF_CLOUD_BIGAUS
diff --git a/src/arome/turb/compute_mf_cloud_direct.F90 b/src/common/turb/mode_compute_mf_cloud_direct.F90
similarity index 89%
rename from src/arome/turb/compute_mf_cloud_direct.F90
rename to src/common/turb/mode_compute_mf_cloud_direct.F90
index c35cfc12b..090e49e48 100644
--- a/src/arome/turb/compute_mf_cloud_direct.F90
+++ b/src/common/turb/mode_compute_mf_cloud_direct.F90
@@ -1,4 +1,13 @@
+!MNH_LIC Copyright 1994-2014 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.
 !     ######spl
+     MODULE MODE_COMPUTE_MF_CLOUD_DIRECT
+!    ###################################
+!
+IMPLICIT NONE
+CONTAINS
       SUBROUTINE COMPUTE_MF_CLOUD_DIRECT(KKB, KKE, KKL, &
                                         &KKLCL, PFRAC_UP, PRC_UP, PRI_UP,&
                                         &PRC_MF, PRI_MF, PCF_MF)
@@ -97,3 +106,4 @@ END DO
 IF (LHOOK) CALL DR_HOOK('COMPUTE_MF_CLOUD_DIRECT',1,ZHOOK_HANDLE)
 
 END SUBROUTINE COMPUTE_MF_CLOUD_DIRECT
+END MODULE MODE_COMPUTE_MF_CLOUD_DIRECT
diff --git a/src/arome/turb/compute_mf_cloud_stat.F90 b/src/common/turb/mode_compute_mf_cloud_stat.F90
similarity index 92%
rename from src/arome/turb/compute_mf_cloud_stat.F90
rename to src/common/turb/mode_compute_mf_cloud_stat.F90
index dd36bc4d9..12fcce462 100644
--- a/src/arome/turb/compute_mf_cloud_stat.F90
+++ b/src/common/turb/mode_compute_mf_cloud_stat.F90
@@ -1,3 +1,13 @@
+!MNH_LIC Copyright 1994-2014 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.
+!     ######spl
+     MODULE MODE_COMPUTE_MF_CLOUD_STAT
+!    ############################
+!
+IMPLICIT NONE
+CONTAINS
 !     ######spl
       SUBROUTINE COMPUTE_MF_CLOUD_STAT(KKA, KKB, KKE, KKU, KKL, KRR, KRRL, KRRI,&
                             &PFRAC_ICE,&
@@ -138,3 +148,4 @@ END IF
 IF (LHOOK) CALL DR_HOOK('COMPUTE_MF_CLOUD_STAT',1,ZHOOK_HANDLE)
 !
 END SUBROUTINE COMPUTE_MF_CLOUD_STAT
+END MODULE MODE_COMPUTE_MF_CLOUD_STAT
diff --git a/src/mesonh/turb/compute_mf_cloud.f90 b/src/mesonh/turb/compute_mf_cloud.f90
deleted file mode 100644
index 23f94bce5..000000000
--- a/src/mesonh/turb/compute_mf_cloud.f90
+++ /dev/null
@@ -1,196 +0,0 @@
-!MNH_LIC Copyright 2009-2021 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.
-!-----------------------------------------------------------------
-!     ######spl
-     MODULE MODI_COMPUTE_MF_CLOUD
-!    ############################
-!
-INTERFACE
-!     #################################################################
-      SUBROUTINE COMPUTE_MF_CLOUD(KKA,KKB,KKE,KKU,KKL,KRR,KRRL,KRRI,HMF_CLOUD,&
-                                  PFRAC_ICE,                                &
-                                  PRC_UP,PRI_UP,PEMF,                       &
-                                  PTHL_UP, PRT_UP, PFRAC_UP,                &
-                                  PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,          &
-                                  PEXNM, PTHLM, PRTM, PTHM, PTHVM, PRM,     &
-                                  PDZZ, PZZ, KKLCL,                         &
-                                  PPABSM, PRHODREF,                         &
-                                  PRC_MF, PRI_MF, PCF_MF, PSIGMF, PDEPTH    )
-!     #################################################################
-!!
-!               
-!*               1.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   ::  KKL          ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-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=4),      INTENT(IN)   ::  HMF_CLOUD    ! Type of statistical cloud scheme
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_ICE    ! liquid/ice fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PRC_UP,PRI_UP,PEMF ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHL_UP, PRT_UP  
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_UP
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHV_UP           ! updraft thetaV
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_ICE_UP      ! liquid/solid fraction in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PRSAT_UP          ! Rsat in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PEXNM             ! exner function
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHLM, PRTM ! cons. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHM, PTHVM ! theta and thetaV
-REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PRM         ! water var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PDZZ, PZZ
-INTEGER, DIMENSION(:),  INTENT(IN)   ::  KKLCL       ! index of updraft condensation level
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PPABSM, PRHODREF ! environement
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PRC_MF, PRI_MF   ! cloud content and
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PCF_MF           ! cloud fraction for MF scheme
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PSIGMF ! SQRT(variance) for statistical cloud scheme
-REAL, DIMENSION(:),     INTENT(IN)   ::  PDEPTH ! Deepness of cloud
-
-END SUBROUTINE COMPUTE_MF_CLOUD
-
-END INTERFACE
-!
-END MODULE MODI_COMPUTE_MF_CLOUD
-!     ######spl
-      SUBROUTINE COMPUTE_MF_CLOUD(KKA,KKB,KKE,KKU,KKL,KRR,KRRL,KRRI,HMF_CLOUD,          &
-                                  PFRAC_ICE,                                &
-                                  PRC_UP,PRI_UP,PEMF,                 &
-                                  PTHL_UP, PRT_UP, PFRAC_UP,                &
-                                  PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,          &
-                                  PEXNM, PTHLM, PRTM, PTHM, PTHVM, PRM,     &
-                                  PDZZ, PZZ, KKLCL,                         &
-                                  PPABSM, PRHODREF,                         &
-                                  PRC_MF, PRI_MF, PCF_MF, PSIGMF, PDEPTH    )
-!     #################################################################
-!!
-!!****  *COMPUTE_MF_CLOUD* - 
-!!       compute diagnostic subgrid cumulus cloud caracteristics
-!!
-!!    PURPOSE
-!!    -------
-!!****  The purpose of this routine is to compute the cloud fraction and 
-!!      the mean cloud content associated with clouds described by the 
-!!      mass flux scheme
-!!
-!
-!!**  METHOD
-!!    ------
-!!
-!!    EXTERNAL
-!!    --------
-!!      
-!!    IMPLICIT ARGUMENTS
-!!    ------------------
-!!
-!!     REFERENCE
-!!     ---------
-!!
-!!
-!!     AUTHOR
-!!     ------
-!!
-!!    MODIFICATIONS
-!!    -------------
-!!      Original
-!!      S. Riette Dec 2010 BIGA case
-!!      S. Riette Aug 2011 code is split into subroutines
-!!      S. Riette Jan 2012: support for both order of vertical levels
-!  P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg
-!! --------------------------------------------------------------------------
-!
-!*      0. DECLARATIONS
-!          ------------
-!
-use mode_msg
-!
-USE MODI_COMPUTE_MF_CLOUD_BIGAUS
-USE MODI_COMPUTE_MF_CLOUD_DIRECT
-USE MODI_COMPUTE_MF_CLOUD_STAT
-!
-
-IMPLICIT NONE
-
-!*                    1.1  Declaration of Arguments
-!
-!
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   ::  KKL          ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-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=4),      INTENT(IN)   ::  HMF_CLOUD    ! Type of statistical cloud scheme
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_ICE    ! liquid/ice fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PRC_UP,PRI_UP,PEMF! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHL_UP, PRT_UP   ! rc,w,Mass Flux,Thetal,rt
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_UP          ! Updraft Fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHV_UP           ! updraft thetaV
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PFRAC_ICE_UP      ! liquid/solid fraction in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PRSAT_UP          ! Rsat in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PEXNM             ! exner function
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHLM, PRTM       ! cons. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PTHM, PTHVM       ! theta and thetaV
-REAL, DIMENSION(:,:,:), INTENT(IN)   ::  PRM               ! water var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PDZZ, PZZ
-INTEGER, DIMENSION(:),  INTENT(IN)   ::  KKLCL             ! index of updraft condensation level
-REAL, DIMENSION(:,:),   INTENT(IN)   ::  PPABSM, PRHODREF  ! environement
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PRC_MF, PRI_MF    ! cloud content (INPUT=environment, OUTPUT=conv. cloud)
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PCF_MF            ! and cloud fraction for MF scheme
-REAL, DIMENSION(:,:),   INTENT(OUT)  ::  PSIGMF            ! SQRT(variance) for statistical cloud scheme
-REAL, DIMENSION(:),     INTENT(IN)   ::  PDEPTH            ! Deepness of cloud
-
-!
-!                       1.2  Declaration of local variables
-!
-!------------------------------------------------------------------------
-
-!                     1. INITIALISATION
-!
-!
-!                     2.1 Internal domain
-
-PRC_MF = 0.
-PRI_MF = 0.
-PCF_MF = 0.
-PSIGMF = 0.
-
-IF (HMF_CLOUD == 'DIRE') THEN
-  !Direct cloud scheme
-  CALL COMPUTE_MF_CLOUD_DIRECT(KKE, KKL, &
-                              &KKLCL(:), PFRAC_UP(:,:), PRC_UP(:,:), PRI_UP(:,:),&
-                              &PRC_MF(:,:), PRI_MF(:,:), PCF_MF(:,:))
-  !
-ELSEIF (HMF_CLOUD == 'STAT') THEN
-  !Statistical scheme using the PDF proposed by Bougeault (81, 82) and
-  !Bechtold et al (95).
-  CALL COMPUTE_MF_CLOUD_STAT(KKA, KKB, KKE, KKU, KKL, KRR, KRRL, KRRI,&
-                            &PFRAC_ICE,&
-                            &PTHLM, PRTM, PPABSM, PRM,&
-                            &PDZZ, PTHM, PEXNM,&
-                            &PEMF, PTHL_UP, PRT_UP,&
-                            &PSIGMF)
-ELSEIF (HMF_CLOUD == 'BIGA') THEN
-  !Statistical scheme using the bi-gaussian PDF proposed by E. Perraud.
-  CALL COMPUTE_MF_CLOUD_BIGAUS(KKA, KKB, KKE, KKU, KKL,&
-                              &PEMF, PDEPTH,&
-                              &PRT_UP, PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,&
-                              &PRTM, PTHM, PTHVM,&
-                              &PDZZ, PZZ, PRHODREF,&
-                              &PRC_MF, PRI_MF, PCF_MF)
-  !
-ELSEIF  (HMF_CLOUD == 'NONE') THEN
-  ! No CONVECTIVE CLOUD SCHEME
-  ! Nothing to do: PRC_MF, PRI_MF, PCF_MF, PSIGMF are already filled with zero
-ELSE
-  call Print_msg(NVERB_FATAL,'GEN','COMPUTE_MF_CLOUD','Shallow convection cloud scheme not valid: HMF_CLOUD='//TRIM(HMF_CLOUD))
-ENDIF
-
-END SUBROUTINE COMPUTE_MF_CLOUD
diff --git a/src/mesonh/turb/compute_mf_cloud_bigaus.f90 b/src/mesonh/turb/compute_mf_cloud_bigaus.f90
deleted file mode 100644
index b080f9923..000000000
--- a/src/mesonh/turb/compute_mf_cloud_bigaus.f90
+++ /dev/null
@@ -1,209 +0,0 @@
-!MNH_LIC Copyright 2011-2021 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.
-!-----------------------------------------------------------------
-!     ######spl
-     MODULE MODI_COMPUTE_MF_CLOUD_BIGAUS
-!    ###################################
-!
-INTERFACE
-!     #################################################################
-      SUBROUTINE COMPUTE_MF_CLOUD_BIGAUS(KKA, KKB, KKE, KKU, KKL,&
-                                  PEMF, PDEPTH,&
-                                  PRT_UP, PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,&
-                                  PRTM, PTHM, PTHVM,&
-                                  PDZZ, PZZ, PRHODREF,&
-                                  PRC_MF, PRI_MF, PCF_MF)
-!     #################################################################
-!!
-!
-!*               1.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   :: KKL                     ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PEMF                    ! updraft characteritics
-REAL, DIMENSION(:),     INTENT(IN)   :: PDEPTH                  ! Deepness of cloud
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHV_UP, PRSAT_UP, PRT_UP ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_ICE_UP            ! liquid/ice fraction in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHM, PRTM, PTHVM       ! env. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PDZZ, PZZ
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PRHODREF
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PRC_MF, PRI_MF          ! cloud content
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PCF_MF                  ! and cloud fraction for MF scheme
-
-END SUBROUTINE COMPUTE_MF_CLOUD_BIGAUS
-
-END INTERFACE
-!
-END MODULE MODI_COMPUTE_MF_CLOUD_BIGAUS
-!     ######spl
-      SUBROUTINE COMPUTE_MF_CLOUD_BIGAUS(KKA, KKB, KKE, KKU, KKL,&
-                                  PEMF, PDEPTH,&
-                                  PRT_UP, PTHV_UP, PFRAC_ICE_UP, PRSAT_UP,&
-                                  PRTM, PTHM, PTHVM,&
-                                  PDZZ, PZZ, PRHODREF,&
-                                  PRC_MF, PRI_MF, PCF_MF)
-!     #################################################################
-!!
-!!****  *COMPUTE_MF_CLOUD_BIGAUS* -
-!!       compute diagnostic subgrid cumulus cloud caracteristics with a statistical scheme
-!!       based on a bi-gaussian PDF. In this routine, we only compute the shallow convection
-!!       part of this bi-gaussian
-!!
-!!    PURPOSE
-!!    -------
-!!****  With this option, a formulation for the computation of the variance of the departure
-!!      to saturation is proposed. This variance is used to compute the cloud fraction and
-!!      the mean convective cloud content from the bi-gaussian PDF proposed by E. Perraud
-!!
-!
-!!**  METHOD
-!!    ------
-!!      Updraft variables are used to diagnose the variance
-!!      Perraud et al (2011)
-!!
-!!    EXTERNAL
-!!    --------
-!!
-!!    IMPLICIT ARGUMENTS
-!!    ------------------
-!!
-!!     REFERENCE
-!!     ---------
-!!
-!!
-!!     AUTHOR
-!!     ------
-!!     S. Riette moving of code previously in compute_mf_cloud code
-!!
-!!    MODIFICATIONS
-!!    -------------
-!!      Original 25 Aug 2011
-!!      S. Riette Jan 2012: support for both order of vertical levels
-!!      S. Riette Jun 2019: remove unused PRC_UP and PRI_UP, use SIGN in ERFC computation
-!! --------------------------------------------------------------------------
-!
-!*      0. DECLARATIONS
-!          ------------
-USE MODD_PARAM_MFSHALL_n, ONLY : XALPHA_MF, XSIGMA_MF
-USE MODD_CST, ONLY  : XPI, XG
-!
-USE MODI_SHUMAN_MF
-USE MODI_GAMMA_INC
-!
-USE MODE_THERMO
-!
-!
-IMPLICIT NONE
-!
-!*                    0.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   :: KKL                     ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PEMF                    ! updraft characteritics
-REAL, DIMENSION(:),     INTENT(IN)   :: PDEPTH                  ! Deepness of cloud
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHV_UP, PRSAT_UP, PRT_UP ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_ICE_UP            ! liquid/ice fraction in updraft
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHM, PRTM, PTHVM       ! env. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PDZZ, PZZ
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PRHODREF
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PRC_MF, PRI_MF          ! cloud content
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PCF_MF                  ! and cloud fraction for MF scheme
-!
-!*                    0.1  Declaration of local variables
-!
-!
-REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZGRAD_Z_RT, &            !
-                                            & ZALPHA_UP_M, &           ! Variables used to compute variance
-                                            & ZSIGMF                   ! and sqrt(variance)
-REAL, DIMENSION(SIZE(PTHM,1))              :: ZOMEGA_UP_M              !
-REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZW1 ! working array
-INTEGER                                    :: JK  ! vertical loop control
-REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZEMF_M, ZTHV_UP_M, &   !
-                                            & ZRSAT_UP_M, ZRT_UP_M,& ! Interpolation on mass points
-                                            & ZFRAC_ICE_UP_M         !
-REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZCOND ! condensate
-REAL, DIMENSION(SIZE(PTHM,1),SIZE(PTHM,2)) :: ZA, ZGAM ! used for integration
-
-
-!Computation is done on mass points
-!----------------------------------------------------------------------------
-!
-!*      1. Computation of the variance
-!          ------------------------------------------------
-!
-!
-!Vertical gradient of RT, result on mass points
-ZW1(:,:)=GZ_M_W_MF(KKA,KKU,KKL, PRTM(:,:), PDZZ(:,:))
-ZGRAD_Z_RT(:,:)=MZF_MF(KKA,KKU,KKL, ZW1(:,:))
-
-!Interpolation on mass points
-ZTHV_UP_M(:,:) = MZF_MF(KKA,KKU,KKL, PTHV_UP(:,:))
-ZRSAT_UP_M(:,:)= MZF_MF(KKA,KKU,KKL, PRSAT_UP(:,:))
-ZRT_UP_M(:,:)  = MZF_MF(KKA,KKU,KKL, PRT_UP(:,:))
-ZEMF_M(:,:)    = MZF_MF(KKA,KKU,KKL, PEMF(:,:))
-ZFRAC_ICE_UP_M(:,:) = MZF_MF(KKA,KKU,KKL, PFRAC_ICE_UP(:,:))
-
-!computation of omega star up
-ZOMEGA_UP_M(:)=0.
-DO JK=KKB,KKE,KKL
-  !Vertical integration over the entire column but only buoyant points are used
-  !ZOMEGA_UP_M(:)=ZOMEGA_UP_M(:) + &
-  !                ZEMF_M(:,JK) * &
-  !                MAX(0.,(ZTHV_UP_M(:,JK)-PTHVM(:,JK))) * &
-  !                (PZZ(:,JK+KKL)-PZZ(:,JK)) / &
-  !                (PTHM(:,JK) * PRHODREF(:,JK))
-
-  !Vertical integration over the entire column
-  ZOMEGA_UP_M(:)=ZOMEGA_UP_M(:) + &
-                 ZEMF_M(:,JK) * &
-                 (ZTHV_UP_M(:,JK)-PTHVM(:,JK)) * &
-                 (PZZ(:,JK+KKL)-PZZ(:,JK)) / &
-                 (PTHM(:,JK) * PRHODREF(:,JK))
-ENDDO
-ZOMEGA_UP_M(:)=MAX(ZOMEGA_UP_M(:), 1.E-20)
-ZOMEGA_UP_M(:)=(XG*ZOMEGA_UP_M(:))**(1./3.)
-
-!computation of alpha up
-DO JK=KKA,KKU,KKL
-  ZALPHA_UP_M(:,JK)=ZEMF_M(:,JK)/(XALPHA_MF*PRHODREF(:,JK)*ZOMEGA_UP_M(:))
-ENDDO
-ZALPHA_UP_M(:,:)=MAX(0., MIN(ZALPHA_UP_M(:,:), 1.))
-
-!computation of sigma of the distribution
-DO JK=KKA,KKU,KKL
-  ZSIGMF(:,JK)=ZEMF_M(:,JK) * &
-               (ZRT_UP_M(:,JK) - PRTM(:,JK)) * &
-               PDEPTH(:) * ZGRAD_Z_RT(:,JK) / &
-               (XSIGMA_MF * ZOMEGA_UP_M(:) * PRHODREF(:,JK))
-ENDDO
-ZSIGMF(:,:)=SQRT(MAX(ABS(ZSIGMF(:,:)), 1.E-40))
-!
-!*      2. PDF integration
-!          ------------------------------------------------
-!
-!The mean of the distribution is ZRT_UP
-!Computation of ZA and ZGAM (=efrc(ZA)) coefficient
-ZA(:,:)=(ZRSAT_UP_M(:,:)-ZRT_UP_M(:,:))/(sqrt(2.)*ZSIGMF(:,:))
-
-!Approximation of erf function
-ZGAM(:,:)=1-SIGN(1., ZA(:,:))*SQRT(1-EXP(-4*ZA(:,:)**2/XPI))
-
-!computation of cloud fraction
-PCF_MF(:,:)=MAX( 0., MIN(1.,0.5*ZGAM(:,:) * ZALPHA_UP_M(:,:)))
-
-!computation of condensate, then PRC and PRI
-ZCOND(:,:)=(EXP(-ZA(:,:)**2)-ZA(:,:)*SQRT(XPI)*ZGAM(:,:))*ZSIGMF(:,:)/SQRT(2.*XPI) * ZALPHA_UP_M(:,:)
-ZCOND(:,:)=MAX(ZCOND(:,:), 0.) !due to approximation of ZGAM value, ZCOND could be slightly negative
-PRC_MF(:,:)=(1.-ZFRAC_ICE_UP_M(:,:)) * ZCOND(:,:)
-PRI_MF(:,:)=(   ZFRAC_ICE_UP_M(:,:)) * ZCOND(:,:)
-
-
-END SUBROUTINE COMPUTE_MF_CLOUD_BIGAUS
diff --git a/src/mesonh/turb/compute_mf_cloud_direct.f90 b/src/mesonh/turb/compute_mf_cloud_direct.f90
deleted file mode 100644
index c1c1b6220..000000000
--- a/src/mesonh/turb/compute_mf_cloud_direct.f90
+++ /dev/null
@@ -1,119 +0,0 @@
-!MNH_LIC Copyright 1994-2014 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.
-!     ######spl
-     MODULE MODI_COMPUTE_MF_CLOUD_DIRECT
-!    ###################################
-!
-INTERFACE
-!     #################################################################
-      SUBROUTINE COMPUTE_MF_CLOUD_DIRECT(KKE, KKL, &
-                                        &KKLCL, PFRAC_UP, PRC_UP, PRI_UP,&
-                                        &PRC_MF, PRI_MF, PCF_MF)
-!     #################################################################
-!!
-!
-!*               1.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKE            ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKL            ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-INTEGER, DIMENSION(:),  INTENT(IN)   :: KKLCL          ! index of updraft condensation level
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_UP       ! Updraft Fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PRC_UP,PRI_UP  ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PRC_MF, PRI_MF ! cloud content (INPUT=environment, OUTPUT=conv. cloud)
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PCF_MF         ! and cloud fraction for MF scheme
-
-END SUBROUTINE COMPUTE_MF_CLOUD_DIRECT
-
-END INTERFACE
-!
-END MODULE MODI_COMPUTE_MF_CLOUD_DIRECT
-!     ######spl
-      SUBROUTINE COMPUTE_MF_CLOUD_DIRECT(KKE, KKL, &
-                                        &KKLCL, PFRAC_UP, PRC_UP, PRI_UP,&
-                                        &PRC_MF, PRI_MF, PCF_MF)
-!     #################################################################
-!!
-!!****  *COMPUTE_MF_CLOUD_DIRECT* -
-!!       compute diagnostic subgrid cumulus cloud caracteristics with a direct scheme
-!!
-!!    PURPOSE
-!!    -------
-!!****  The purpose of this routine is to compute the cloud fraction and
-!!      the mean cloud content associated with clouds described by the
-!!      mass flux scheme
-!!
-!
-!!**  METHOD
-!!    ------
-!!      Updraft variables are used directly to diagnose subgrid clouds
-!!      This scheme may be activated only if the selected updraft model
-!!      gives the updraft fraction as an output
-!!
-!!    EXTERNAL
-!!    --------
-!!
-!!    IMPLICIT ARGUMENTS
-!!    ------------------
-!!
-!!     REFERENCE
-!!     ---------
-!!
-!!
-!!     AUTHOR
-!!     ------
-!!     S. Riette moving of code previously in compute_mf_cloud code
-!!
-!!    MODIFICATIONS
-!!    -------------
-!!      Original 25 Aug 2011
-!!      S. Riette Jan 2012: support for both order of vertical levels
-!! --------------------------------------------------------------------------
-!
-!*      0. DECLARATIONS
-!          ------------
-USE MODD_PARAM_MFSHALL_n, ONLY : XKCF_MF
-!
-IMPLICIT NONE
-!
-!*                    0.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKE            ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKL            ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-INTEGER, DIMENSION(:),  INTENT(IN)   :: KKLCL          ! index of updraft condensation level
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_UP       ! Updraft Fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PRC_UP,PRI_UP  ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PRC_MF, PRI_MF ! cloud content
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PCF_MF         ! and cloud fraction for MF scheme
-!
-!*                    0.1  Declaration of local variables
-!
-INTEGER  :: JI,JK
-!
-!*                    0.2 Initialisation
-!
-!
-!*      1. COMPUTATION OF SUBGRID CLOUD
-!          ----------------------------
-
-!
-! Warning: updraft variables are on flux levels
-! and PRC_MF, PRI_MF and PCF_MF are on mass levels
-PRC_MF(:,:)=0.
-PRI_MF(:,:)=0.
-PCF_MF(:,:)=0.
-
-DO JI=1,SIZE(PCF_MF,1)
-  DO JK=KKLCL(JI),KKE-KKL,KKL
-    PCF_MF(JI,JK ) = MAX( 0., MIN(1.,XKCF_MF *0.5* (       &
-                &    PFRAC_UP(JI,JK) +  PFRAC_UP(JI,JK+KKL) ) ))
-    PRC_MF(JI,JK)  = 0.5* XKCF_MF * ( PFRAC_UP(JI,JK)*PRC_UP(JI,JK)  &
-                         + PFRAC_UP(JI,JK+KKL)*PRC_UP(JI,JK+KKL) )
-    PRI_MF(JI,JK)  = 0.5* XKCF_MF * ( PFRAC_UP(JI,JK)*PRI_UP(JI,JK)  &
-                         + PFRAC_UP(JI,JK+KKL)*PRI_UP(JI,JK+KKL) )
-  END DO
-END DO
-
-
-END SUBROUTINE COMPUTE_MF_CLOUD_DIRECT
diff --git a/src/mesonh/turb/compute_mf_cloud_stat.f90 b/src/mesonh/turb/compute_mf_cloud_stat.f90
deleted file mode 100644
index 431052be0..000000000
--- a/src/mesonh/turb/compute_mf_cloud_stat.f90
+++ /dev/null
@@ -1,181 +0,0 @@
-!MNH_LIC Copyright 1994-2014 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.
-!     ######spl
-     MODULE MODI_COMPUTE_MF_CLOUD_STAT
-!    ############################
-!
-INTERFACE
-!     #################################################################
-      SUBROUTINE COMPUTE_MF_CLOUD_STAT(KKA, KKB, KKE, KKU, KKL, KRR, KRRL, KRRI,&
-                            &PFRAC_ICE,&
-                            &PTHLM, PRTM, PPABSM, PRM,&
-                            &PDZZ, PTHM, PEXNM,&
-                            &PEMF, PTHL_UP, PRT_UP,&
-                            &PSIGMF)
-!     #################################################################
-!!
-!
-!*               1.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   :: KKL                     ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-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.
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_ICE               ! liquid/ice fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHLM, PRTM             ! cons. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PPABSM                  ! Pressure at time t-1
-REAL, DIMENSION(:,:,:), INTENT(IN)   :: PRM                     ! water var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PDZZ
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHM                    ! environement
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PEXNM
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PEMF                    ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHL_UP, PRT_UP         ! rc,w,Mass Flux,Thetal,rt
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PSIGMF                  ! SQRT(variance) for statistical cloud scheme
-
-
-END SUBROUTINE COMPUTE_MF_CLOUD_STAT
-
-END INTERFACE
-!
-END MODULE MODI_COMPUTE_MF_CLOUD_STAT
-!     ######spl
-      SUBROUTINE COMPUTE_MF_CLOUD_STAT(KKA, KKB, KKE, KKU, KKL, KRR, KRRL, KRRI,&
-                            &PFRAC_ICE,&
-                            &PTHLM, PRTM, PPABSM, PRM,&
-                            &PDZZ, PTHM, PEXNM, &
-                            &PEMF, PTHL_UP, PRT_UP,&
-                            &PSIGMF)
-!     #################################################################
-!!
-!!****  *COMPUTE_MF_CLOUD_STAT* -
-!!       compute diagnostic subgrid cumulus cloud caracteristics with a statistical scheme
-!!
-!!    PURPOSE
-!!    -------
-!!****  With this option, a formulation for the computation of the variance of the departure
-!!      to saturation is proposed.
-!!
-!
-!!**  METHOD
-!!    ------
-!!      Updraft variables are used to diagnose the variance
-!!
-!!    EXTERNAL
-!!    --------
-!!
-!!    IMPLICIT ARGUMENTS
-!!    ------------------
-!!
-!!     REFERENCE
-!!     ---------
-!!
-!!
-!!     AUTHOR
-!!     ------
-!!     S. Riette moving of code previously in compute_mf_cloud code
-!!
-!!    MODIFICATIONS
-!!    -------------
-!!      Original 25 Aug 2011
-!!      S. Riette Jan 2012: support for both order of vertical levels
-!! --------------------------------------------------------------------------
-!
-!*      0. DECLARATIONS
-!          ------------
-USE MODD_PARAM_MFSHALL_n, ONLY :  XTAUSIGMF
-USE MODD_PARAMETERS, ONLY : JPHEXT, JPVEXT
-!
-USE MODI_SHUMAN_MF
-USE MODE_COMPUTE_FUNCTION_THERMO_MF, ONLY: COMPUTE_FUNCTION_THERMO_MF
-!
-!
-IMPLICIT NONE
-!
-!*                    0.1  Declaration of Arguments
-!
-INTEGER,                INTENT(IN)   :: KKA          ! near ground array index
-INTEGER,                INTENT(IN)   :: KKB          ! near ground physical index
-INTEGER,                INTENT(IN)   :: KKE          ! uppest atmosphere physical index
-INTEGER,                INTENT(IN)   :: KKU          ! uppest atmosphere array index
-INTEGER,                INTENT(IN)   :: KKL                     ! +1 if grid goes from ground to atmosphere top, -1 otherwise
-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.
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PFRAC_ICE               ! liquid/ice fraction
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHLM, PRTM             ! cons. var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PPABSM                  ! Pressure at time t-1
-REAL, DIMENSION(:,:,:), INTENT(IN)   :: PRM                     ! water var. at t-dt
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PDZZ
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHM                    ! environement
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PEXNM
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PEMF                    ! updraft characteritics
-REAL, DIMENSION(:,:),   INTENT(IN)   :: PTHL_UP, PRT_UP         ! rc,w,Mass Flux,Thetal,rt
-REAL, DIMENSION(:,:),   INTENT(OUT)  :: PSIGMF                  ! SQRT(variance) for statistical cloud scheme
-!
-!*                    0.1  Declaration of local variables
-!
-!
-REAL, DIMENSION(SIZE(PTHLM,1),SIZE(PTHLM,2)) :: ZFLXZ
-REAL, DIMENSION(SIZE(PTHLM,1),SIZE(PTHLM,2)) :: ZT
-REAL, DIMENSION(SIZE(PTHLM,1),SIZE(PTHLM,2)) :: ZAMOIST, ZATHETA
-!
-!*                    0.2 initialisation
-!
-!
-!----------------------------------------------------------------------------
-!
-!*      1. COMPUTE SIGMA_MF (saturation deviation variance)
-!          Soares et al (2004) formulation
-!          ------------------------------------------------
-!
-! Thermodynamics functions
-CALL COMPUTE_FUNCTION_THERMO_MF( KRR,KRRL,KRRI,                   &
-                                 PTHM,PRM,PEXNM,PFRAC_ICE,PPABSM, &
-                                 ZT,ZAMOIST,ZATHETA               )
-!
-IF (KRRL > 0)  THEN
-!
-!*       1.1 contribution from <THl THl>
-!
-
-!
-    ZFLXZ(:,:) = -2 * XTAUSIGMF * PEMF(:,:)*(PTHL_UP(:,:)-MZM_MF(KKA,KKU,KKL,PTHLM(:,:))) * &
-                      GZ_M_W_MF(KKA,KKU,KKL,PTHLM(:,:),PDZZ(:,:))
-!
-!   Avoid negative values
-    ZFLXZ(:,:) = MAX(0.,ZFLXZ(:,:))
-
-
-    PSIGMF(:,:) = MZF_MF(KKA,KKU,KKL,ZFLXZ(:,:)) * ZATHETA(:,:)**2
-
-!
-!
-!*       1.2  contribution from <Rnp Rnp>
-!
-!
-!
-!
-    ZFLXZ(:,:) = -2 * XTAUSIGMF * PEMF(:,:)*(PRT_UP(:,:)-MZM_MF(KKA,KKU,KKL,PRTM(:,:))) * &
-                      GZ_M_W_MF(KKA,KKU,KKL,PRTM(:,:),PDZZ(:,:))
-!
-!   Avoid negative values
-    ZFLXZ(:,:) = MAX(0.,ZFLXZ(:,:))
-!
-
-    PSIGMF(:,:) = PSIGMF(:,:) + ZAMOIST(:,:) **2 * MZF_MF(KKA,KKU,KKL,ZFLXZ(:,:))
-!
-!        1.3  Vertical part of Sigma_s
-!
-  PSIGMF(:,:) =  SQRT( MAX (PSIGMF(:,:) , 0.) )
-ELSE
-  PSIGMF(:,:) = 0.
-END IF
-!
-!
-END SUBROUTINE COMPUTE_MF_CLOUD_STAT
diff --git a/src/mesonh/turb/shallow_mf.f90 b/src/mesonh/turb/shallow_mf.f90
index 23dbbec39..b005921d7 100644
--- a/src/mesonh/turb/shallow_mf.f90
+++ b/src/mesonh/turb/shallow_mf.f90
@@ -187,7 +187,7 @@ USE MODI_COMPUTE_UPDRAFT_RAHA
 USE MODI_MF_TURB
 USE MODI_MF_TURB_EXPL
 USE MODI_MF_TURB_GREYZONE
-USE MODI_COMPUTE_MF_CLOUD
+USE MODE_COMPUTE_MF_CLOUD, ONLY: COMPUTE_MF_CLOUD
 USE MODE_COMPUTE_FRAC_ICE, ONLY : COMPUTE_FRAC_ICE
 USE MODI_SHUMAN_MF
 !
-- 
GitLab