From 4d05690877c4c6656e05cd132aa1e036145c8970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Riette?= <sebastien.riette@meteo.fr> Date: Fri, 21 Jan 2022 17:07:39 +0100 Subject: [PATCH] SR 21/01/2022 compute_frac_ice as fortran include mode_compute_frac_ice becomes an include file which must be used in contains section of subroutines through an #include or a fortran INCLUDE --- docs/TODO | 2 - src/arome/turb/shallow_mf.F90 | 5 +- ...e_frac_ice.F90 => compute_frac_ice.func.h} | 64 ++++--------------- src/common/micro/condensation.F90 | 5 +- src/common/turb/mode_th_r_from_thl_rt_1d.F90 | 5 +- src/mesonh/turb/shallow_mf.f90 | 4 +- 6 files changed, 27 insertions(+), 58 deletions(-) rename src/common/micro/{mode_compute_frac_ice.F90 => compute_frac_ice.func.h} (52%) diff --git a/docs/TODO b/docs/TODO index 65fbe237e..f7bca7628 100644 --- a/docs/TODO +++ b/docs/TODO @@ -57,5 +57,3 @@ SPP Gradients/shuman: - essayer de mettre des abort dans les routines arome (shuman doit suffire) - -compute_frac_ice: prendre la solution retenue à la fin de la discussion entre LAERO et GMAP diff --git a/src/arome/turb/shallow_mf.F90 b/src/arome/turb/shallow_mf.F90 index 6aebb5ea3..b64680f24 100644 --- a/src/arome/turb/shallow_mf.F90 +++ b/src/arome/turb/shallow_mf.F90 @@ -70,7 +70,6 @@ USE MODI_COMPUTE_UPDRAFT_RAHA USE MODI_MF_TURB USE MODI_MF_TURB_EXPL USE MODI_COMPUTE_MF_CLOUD -USE MODE_COMPUTE_FRAC_ICE, ONLY : COMPUTE_FRAC_ICE ! IMPLICIT NONE @@ -295,4 +294,8 @@ IF( HMF_UPDRAFT == 'DUAL') THEN ENDIF ! IF (LHOOK) CALL DR_HOOK('SHALLOW_MF',1,ZHOOK_HANDLE) +! +CONTAINS +INCLUDE "compute_frac_ice.func.h" +! END SUBROUTINE SHALLOW_MF diff --git a/src/common/micro/mode_compute_frac_ice.F90 b/src/common/micro/compute_frac_ice.func.h similarity index 52% rename from src/common/micro/mode_compute_frac_ice.F90 rename to src/common/micro/compute_frac_ice.func.h index ba2dffd7f..1943d7c2f 100644 --- a/src/common/micro/mode_compute_frac_ice.F90 +++ b/src/common/micro/compute_frac_ice.func.h @@ -2,29 +2,13 @@ !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_FRAC_ICE -! ############################ + ELEMENTAL SUBROUTINE COMPUTE_FRAC_ICE(HFRAC_ICE,PFRAC_ICE,PT,KERR) + +! ******* TO BE INCLUDED IN THE *CONTAINS* OF A SUBROUTINE, IN ORDER TO EASE AUTOMATIC INLINING ****** +! => Don't use drHook !!! ! !!**** *COMPUTE_FRAC_ICE* - computes ice fraction -!! -!! PURPOSE -!! ------- -!! -!!** METHOD -!! ------ -!! -!! -!! EXTERNAL -!! -------- -!! -!! IMPLICIT ARGUMENTS -!! ------------------ -!! -!! -!! REFERENCE -!! --------- -!! +! !! AUTHOR !! ------ !! Julien PERGAUD * Meteo-France * @@ -34,43 +18,21 @@ !! Original 13/03/06 !! S. Riette April 2011 optimisation !! S. Riette 08/2016 add option O -!! P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg -!! R. El Khatib 24-Aug-2021 Optimization by cache re-use + assume data is contiguous -!! S. Riette Jan-2022 Merge the 3 procedures in one module + array shape declaration -! R. El Khatib / S. Riette Jan-2022 written as an elemental subroutine +!! R. El Khatib 12-Aug-2021 written as a include file ! -! -! - - -!****************** Don't use drHook !!! - - - -IMPLICIT NONE -CONTAINS - -ELEMENTAL SUBROUTINE COMPUTE_FRAC_ICE(HFRAC_ICE, PFRAC_ICE, PT, KERR) !! -------------------------------------------------------------------------- -! 0. DECLARATIONS -! ------------ -! USE MODD_NEB, ONLY : XTMINMIX, XTMAXMIX USE MODD_CST, ONLY : XTT ! IMPLICIT NONE ! +CHARACTER(LEN=1), INTENT(IN) :: HFRAC_ICE ! scheme to use +REAL, INTENT(IN) :: PT ! temperature +REAL, INTENT(INOUT) :: PFRAC_ICE ! Ice fraction (1 for ice only, 0 for liquid only) +INTEGER, INTENT(OUT) :: KERR ! Error code in return ! -!* 0.1 declarations of arguments -! -CHARACTER(LEN=1), INTENT(IN) :: HFRAC_ICE ! scheme to use -REAL, INTENT(IN) :: PT ! Temperature -REAL, INTENT(INOUT) :: PFRAC_ICE ! Ice fraction (1 for ice only, 0 for liquid only) -INTEGER, INTENT(OUT) :: KERR ! Error code in return -! -! 0.2 declaration of local variables -! !------------------------------------------------------------------------ + ! 1. Compute FRAC_ICE ! KERR=0 @@ -87,7 +49,5 @@ SELECT CASE(HFRAC_ICE) CASE DEFAULT KERR=1 END SELECT -! + END SUBROUTINE COMPUTE_FRAC_ICE -! -END MODULE MODE_COMPUTE_FRAC_ICE diff --git a/src/common/micro/condensation.F90 b/src/common/micro/condensation.F90 index 49cf4e896..8c2118a5b 100644 --- a/src/common/micro/condensation.F90 +++ b/src/common/micro/condensation.F90 @@ -87,7 +87,6 @@ USE YOMHOOK , ONLY : LHOOK, DR_HOOK USE MODD_CST USE MODD_PARAMETERS USE MODD_RAIN_ICE_PARAM, ONLY : XCRIAUTC, XCRIAUTI, XACRIAUTI, XBCRIAUTI -USE MODE_COMPUTE_FRAC_ICE, ONLY : COMPUTE_FRAC_ICE USE MODE_TIWMX, ONLY : ESATW, ESATI USE MODE_ICECLOUD, ONLY : ICECLOUD ! @@ -552,4 +551,8 @@ DO JK=IKTB,IKTE END DO ! IF (LHOOK) CALL DR_HOOK('CONDENSATION',1,ZHOOK_HANDLE) +! +CONTAINS +INCLUDE "compute_frac_ice.func.h" +! END SUBROUTINE CONDENSATION diff --git a/src/common/turb/mode_th_r_from_thl_rt_1d.F90 b/src/common/turb/mode_th_r_from_thl_rt_1d.F90 index d042e376d..2356b4f3a 100644 --- a/src/common/turb/mode_th_r_from_thl_rt_1d.F90 +++ b/src/common/turb/mode_th_r_from_thl_rt_1d.F90 @@ -50,7 +50,6 @@ CONTAINS ! USE PARKIND1, ONLY : JPRB USE YOMHOOK , ONLY : LHOOK, DR_HOOK -USE MODE_COMPUTE_FRAC_ICE, ONLY : COMPUTE_FRAC_ICE USE MODD_CST!, ONLY: XP00, XRD, XCPD, XCPV, XCL, XCI, XLVTT, XTT, XLSTT USE MODD_DYN_n, ONLY : LOCEAN USE MODE_THERMO @@ -202,5 +201,9 @@ ENDDO IF (LHOOK) CALL DR_HOOK('TH_R_FROM_THL_RT_1D',1,ZHOOK_HANDLE) +! +CONTAINS +INCLUDE "compute_frac_ice.func.h" +! END SUBROUTINE TH_R_FROM_THL_RT_1D END MODULE MODE_TH_R_FROM_THL_RT_1D diff --git a/src/mesonh/turb/shallow_mf.f90 b/src/mesonh/turb/shallow_mf.f90 index 23dbbec39..5e6713851 100644 --- a/src/mesonh/turb/shallow_mf.f90 +++ b/src/mesonh/turb/shallow_mf.f90 @@ -188,7 +188,6 @@ USE MODI_MF_TURB USE MODI_MF_TURB_EXPL USE MODI_MF_TURB_GREYZONE USE MODI_COMPUTE_MF_CLOUD -USE MODE_COMPUTE_FRAC_ICE, ONLY : COMPUTE_FRAC_ICE USE MODI_SHUMAN_MF ! USE MODI_COMPUTE_BL89_ML @@ -435,4 +434,7 @@ IF( HMF_UPDRAFT == 'DUAL') THEN ! PDVDT_MF=0. ENDIF ! +CONTAINS +INCLUDE "compute_frac_ice.func.h" +! END SUBROUTINE SHALLOW_MF -- GitLab