From 1baeba205c4274ab9622b3fbce270d240c9ac841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Riette?= <sebastien.riette@meteo.fr> Date: Thu, 18 Nov 2021 11:10:07 +0100 Subject: [PATCH] AROME fix for the c5b54dd commit Creation of the temporary 'externals' directory for AROME. This directory will contain the AROME specific version of source codes that is not part of the PHYEX package but is needed by the package. Main mods: - XRTM17, LOCEAN and ocean related constants added - AROME specific version of modd_precision, modd_dynn created - creation of a message system for AROME: modd_io and mode_msg Other mods: - mv budget in externals - creation of the docs directory (containing working documents) - creation of src/arome/gmkpack_ignored_files; the file contains the list of the source codes which must be ignored by gmkpack but was present in the main pack. This file is necessary while the ecboundle mechanism is not used. --- docs/Interfaces | 22 +++++ docs/TODO | 11 +++ src/arome/{micro => externals}/budget.F90 | 0 src/arome/externals/modd_io.F90 | 6 ++ src/arome/externals/modd_precision.F90 | 8 ++ src/arome/externals/mode_msg.F90 | 115 ++++++++++++++++++++++ src/arome/gmkpack_ignored_files | 1 + src/arome/micro/ini_cst.F90 | 13 ++- src/arome/micro/modd_cst.F90 | 20 +++- src/arome/turb/ini_cturb.F90 | 4 + src/arome/turb/modd_cturb.F90 | 1 + src/arome/turb/modd_dynn.F90 | 4 + 12 files changed, 201 insertions(+), 4 deletions(-) create mode 100644 docs/Interfaces create mode 100644 docs/TODO rename src/arome/{micro => externals}/budget.F90 (100%) create mode 100644 src/arome/externals/modd_io.F90 create mode 100644 src/arome/externals/modd_precision.F90 create mode 100644 src/arome/externals/mode_msg.F90 create mode 100644 src/arome/gmkpack_ignored_files create mode 100644 src/arome/turb/modd_dynn.F90 diff --git a/docs/Interfaces b/docs/Interfaces new file mode 100644 index 000000000..527624225 --- /dev/null +++ b/docs/Interfaces @@ -0,0 +1,22 @@ +The PHYEX parameterizations can be called from different models (eg. Meso-NH, AROME) and from +a driver (which will be included in this repository). +Moreover, PHYEX parameterizations call externals subroutines, which are dependencies. + +This document aims at listing the interfaces to call the PHYEX parameterizations and the +interfaces of the external modules called by PHYEX. + +PHYEX interfaces: +- lima_adjust +- ice_adjust +- shallow_mf +- turb +- lima, lima_warm, lima_cold et lima_mixed +- rain_ice, rain_ice_old +- ini_... + +Dependencies: +- budget +- mode_msg, modd_io +- modd_precision + + diff --git a/docs/TODO b/docs/TODO new file mode 100644 index 000000000..aaa81626d --- /dev/null +++ b/docs/TODO @@ -0,0 +1,11 @@ +LOCEAN: + La clé LOCEAN est dans un module spécifique à Méso-NH (MODD_DYNn). + Une solution serait de créer un module propre à PHYEX qui contiendrait des clés de contrôle de haut niveau + pour la physique (y en a-t-il d'autres?). Ce module serait initialisé dans Méso-NH à partir de la clé + actuelle qui est sans doute utilisée ailleurs dans le code de Méso-NH + +Dependencies: + - définir les interfaces propres + - créer des codes pour le driver + - liste dans document Interfaces + - pour AROME placés, en attendant, dans phyex/externals diff --git a/src/arome/micro/budget.F90 b/src/arome/externals/budget.F90 similarity index 100% rename from src/arome/micro/budget.F90 rename to src/arome/externals/budget.F90 diff --git a/src/arome/externals/modd_io.F90 b/src/arome/externals/modd_io.F90 new file mode 100644 index 000000000..c111e469f --- /dev/null +++ b/src/arome/externals/modd_io.F90 @@ -0,0 +1,6 @@ +MODULE MODD_IO +IMPLICIT NONE + +INTEGER, PARAMETER :: NVERB_NO=0, NVERB_FATAL=1, NVERB_ERROR=2, NVERB_WARNING=3, NVERB_INFO=4, NVERB_DEBUG=5 +INTEGER, SAVE :: N_ABORT_LEVEL = NVERB_ERROR +ENDMODULE MODD_IO diff --git a/src/arome/externals/modd_precision.F90 b/src/arome/externals/modd_precision.F90 new file mode 100644 index 000000000..09509322d --- /dev/null +++ b/src/arome/externals/modd_precision.F90 @@ -0,0 +1,8 @@ +MODULE MODD_PRECISION +USE PARKIND1 +IMPLICIT NONE +SAVE + +INTEGER, PARAMETER :: MNHREAL = JPRB +INTEGER, PARAMETER :: MNHREAL64 = JPRD +ENDMODULE MODD_PRECISION diff --git a/src/arome/externals/mode_msg.F90 b/src/arome/externals/mode_msg.F90 new file mode 100644 index 000000000..d62763829 --- /dev/null +++ b/src/arome/externals/mode_msg.F90 @@ -0,0 +1,115 @@ +! Author(s) +! S. Riette (18 Nov 2021), adapted from the Meso-NH version +! Modifications: +!----------------------------------------------------------------- +MODULE MODE_MSG + +USE MODD_IO, ONLY: NVERB_FATAL, NVERB_ERROR, NVERB_WARNING, & + &NVERB_INFO, NVERB_DEBUG, N_ABORT_LEVEL + +IMPLICIT NONE + +INTEGER, PARAMETER :: NMSGLGTMAX = 100 ! Maximum length for a message +INTEGER, PARAMETER :: NMSGLLINEMAX = 10 ! Maximum number of lines for a message +CHARACTER(LEN=NMSGLGTMAX), DIMENSION(NMSGLLINEMAX) :: CMNHMSG='' + +#include "abor1.intfb.h" + +INTERFACE PRINT_MSG + MODULE PROCEDURE PRINT_MSG_1LINE, PRINT_MSG_MULTI_CMNHMSG, PRINT_MSG_MULTI +ENDINTERFACE PRINT_MSG + +CONTAINS + +SUBROUTINE PRINT_MSG_1LINE(KVERB, HDOMAIN, HSUBR, HMSG) + INTEGER, INTENT(IN) :: KVERB !Verbosity level + CHARACTER(LEN=*), INTENT(IN) :: HDOMAIN !Domain/category of message + CHARACTER(LEN=*), INTENT(IN) :: HSUBR !Subroutine/function name + CHARACTER(LEN=*), INTENT(IN) :: HMSG !Message + + CALL PRINT_MSG_MULTI(KVERB, HDOMAIN, HSUBR, [HMSG]) + +ENDSUBROUTINE PRINT_MSG_1LINE + +SUBROUTINE PRINT_MSG_MULTI_CMNHMSG(KVERB, HDOMAIN, HSUBR) + INTEGER, INTENT(IN) :: KVERB !Verbosity level + CHARACTER(LEN=*), INTENT(IN) :: HDOMAIN !Domain/category of message + CHARACTER(LEN=*), INTENT(IN) :: HSUBR !Subroutine/function name + + INTEGER :: ILINES + + !Find the last non empty line + ILINES=SIZE(CMNHMSG) + DO WHILE (LEN_TRIM(CMNHMSG(ILINES))==0) + ILINES=ILINES - 1 + ENDDO + + CALL PRINT_MSG_MULTI(KVERB, HDOMAIN, HSUBR, CMNHMSG(1:ILINES)) + + !Empty the message buffer + !This is necessary especially if the next call contain a shorter message + CMNHMSG(1:ILINES)='' + +ENDSUBROUTINE PRINT_MSG_MULTI_CMNHMSG + +SUBROUTINE PRINT_MSG_MULTI(KVERB, HDOMAIN, HSUBR, HMSG) +! +USE YOMLUN, ONLY : NULOUT +! +! +INTEGER, INTENT(IN) :: KVERB !Verbosity level +CHARACTER(LEN=*), INTENT(IN) :: HDOMAIN !Domain/category of message +CHARACTER(LEN=*), INTENT(IN) :: HSUBR !Subroutine/function name +CHARACTER(LEN=*), dimension(:), INTENT(IN) :: HMSG !Message +! +CHARACTER(LEN=2) :: YSZ +CHARACTER(LEN=9) :: YPRE +CHARACTER(LEN=30) :: YSUBR +CHARACTER(LEN=:), ALLOCATABLE :: YFORMAT +INTEGER :: JI +INTEGER :: ILINES +! +ILINES=SIZE(HMSG) + +SELECT CASE(KVERB) + CASE(NVERB_FATAL) + YPRE='FATAL: ' + CASE(NVERB_ERROR) + YPRE='ERROR: ' + CASE(NVERB_WARNING) + YPRE='WARNING: ' + CASE(NVERB_INFO) + YPRE='INFO: ' + CASE(NVERB_DEBUG) + YPRE='DEBUG: ' + CASE DEFAULT + WRITE(UNIT=NULOUT, FMT=*) 'ERROR: PRINT_MSG: wrong verbosity level' +END SELECT +! +YSUBR=TRIM(HSUBR)//':' + +IF (ILINES==1) THEN + WRITE(UNIT=NULOUT, FMT="(A9,A30,A)") YPRE, YSUBR, TRIM(HMSG(1)) +ELSE + IF (ILINES<10) THEN + YSZ = 'I1' + ELSEIF (ILINES<100) THEN + YSZ = 'I2' + ELSEIF (ILINES<1000) THEN + YSZ = 'I3' + ELSE + YSZ = 'I4' + ENDIF + YFORMAT='(A9,A30,' // YSZ // ',''/'',' // YSZ // ','': '',A)' + DO JI=1, ILINES + WRITE(UNIT=NULOUT, FMT=YFORMAT) YPRE, YSUBR, JI, ILINES, TRIM(HMSG(JI)) + ENDDO +ENDIF +! +IF (KVERB<=N_ABORT_LEVEL) THEN + CALL ABOR1(TRIM(HMSG(ILINES))) !Last line repeated +END IF +! +ENDSUBROUTINE PRINT_MSG_MULTI + +ENDMODULE MODE_MSG diff --git a/src/arome/gmkpack_ignored_files b/src/arome/gmkpack_ignored_files new file mode 100644 index 000000000..e45272470 --- /dev/null +++ b/src/arome/gmkpack_ignored_files @@ -0,0 +1 @@ +phyex/micro/budget.F90 diff --git a/src/arome/micro/ini_cst.F90 b/src/arome/micro/ini_cst.F90 index 82d60bc69..f0f6b1187 100644 --- a/src/arome/micro/ini_cst.F90 +++ b/src/arome/micro/ini_cst.F90 @@ -94,6 +94,13 @@ XG = 9.80665 !* 4. REFERENCE PRESSURE ! ------------------- ! +! Ocean model cst same as in 1D/CMO SURFEX +! values used in ini_cst to overwrite XP00 and XTH00 +XRH00OCEAN =1024. +XTH00OCEAN = 286.65 +XSA00OCEAN= 32.6 +XP00OCEAN = 201.E5 +!Atmospheric model XP00 = 1.E5 XTH00 = 300. !------------------------------------------------------------------------------- @@ -133,7 +140,11 @@ XALPW = LOG(XESTT) + (XBETAW /XTT) + (XGAMW *LOG(XTT)) XGAMI = (XCI - XCPV) / XRV XBETAI = (XLSTT/XRV) + (XGAMI * XTT) XALPI = LOG(XESTT) + (XBETAI /XTT) + (XGAMI *LOG(XTT)) -!------------------------------------------------------------------------------- +! Values identical to ones used in CMO1D in SURFEX /could be modified +! Coefficient of thermal expansion of water (K-1) +XALPHAOC = 1.9E-4 +! Coeff of Haline contraction coeff (S-1) +XBETAOC= 7.7475E-4 ! !* 7. PRECOMPUTED CONSTANTS ! --------------------- diff --git a/src/arome/micro/modd_cst.F90 b/src/arome/micro/modd_cst.F90 index 806be1b84..1f5d39b52 100644 --- a/src/arome/micro/modd_cst.F90 +++ b/src/arome/micro/modd_cst.F90 @@ -32,6 +32,7 @@ !! C. Mari 31/10/00 add NDAYSEC !! V. Masson 01/03/03 add conductivity of ice !! R. El Khatib 04/08/14 add pre-computed quantities +!! J.L. Redelsperger 03/2021 add constants for ocean penetrating solar !------------------------------------------------------------------------------- ! !* 0. DECLARATIONS @@ -53,12 +54,14 @@ REAL,SAVE :: XRADIUS,XOMEGA ! Earth radius, earth rotation REAL,SAVE :: XG ! Gravity constant ! REAL,SAVE :: XP00 ! Reference pressure +REAL,SAVE :: XP00OCEAN ! Reference pressure for ocean model +REAL,SAVE :: XRH00OCEAN ! Reference density for ocean model ! REAL,SAVE :: XSTEFAN,XI0 ! Stefan-Boltzman constant, solar constant ! REAL,SAVE :: XMD,XMV ! Molar mass of dry air and molar mass of vapor REAL,SAVE :: XRD,XRV ! Gaz constant for dry air, gaz constant for vapor -REAL,SAVE :: XEPSILO ! XMV/XMD +REAL,SAVE :: XEPSILO ! XMV/XMD REAL,SAVE :: XCPD,XCPV ! Cpd (dry air), Cpv (vapor) REAL,SAVE :: XRHOLW ! Volumic mass of liquid water REAL,SAVE :: XCL,XCI ! Cl (liquid), Ci (ice) @@ -73,8 +76,19 @@ REAL,SAVE :: XALPW,XBETAW,XGAMW ! Constants for saturation vapor REAL,SAVE :: XALPI,XBETAI,XGAMI ! Constants for saturation vapor ! pressure function over solid ice REAL,SAVE :: XCONDI ! thermal conductivity of ice (W m-1 K-1) -REAL, SAVE :: XTH00 ! reference value for the potential - ! temperature +REAL,SAVE :: XALPHAOC ! thermal expansion coefficient for ocean (K-1) +REAL,SAVE :: XBETAOC ! Haline contraction coeff for ocean (S-1) +REAL,SAVE :: XTH00 ! reference value for the potential temperature +REAL,SAVE :: XTH00OCEAN ! Ref value for pot temp in ocean model +REAL,SAVE :: XSA00OCEAN ! Ref value for SAlinity in ocean model +REAL,SAVE :: XROC=0.69! 3 coeffs for SW penetration in Ocean (Hoecker et al) +REAL,SAVE :: XD1=1.1 +REAL,SAVE :: XD2=23. +! Values used in SURFEX CMO +!REAL,SAVE :: XROC=0.58 +!REAL,SAVE :: XD1=0.35 +!REAL,SAVE :: XD2=23. + REAL,SAVE :: XRHOLI ! Volumic mass of liquid water ! INTEGER, SAVE :: NDAYSEC ! Number of seconds in a day diff --git a/src/arome/turb/ini_cturb.F90 b/src/arome/turb/ini_cturb.F90 index dec13f81f..06bbc5454 100644 --- a/src/arome/turb/ini_cturb.F90 +++ b/src/arome/turb/ini_cturb.F90 @@ -144,6 +144,10 @@ XALPSBL = 4.63 ! Stull 1988 = 4.75 ! ! +! 1.11 Value related to the shear term in mixing length computation +! +XRM17 = 0.5 ! Rodier et al 2017 +! ! ! 2. Derivated constants ! ------------------- diff --git a/src/arome/turb/modd_cturb.F90 b/src/arome/turb/modd_cturb.F90 index 49ecfb677..9b18f803f 100644 --- a/src/arome/turb/modd_cturb.F90 +++ b/src/arome/turb/modd_cturb.F90 @@ -58,6 +58,7 @@ REAL,SAVE :: XCDD ! ct. for the destruction term in the dissipation eq. REAL,SAVE :: XCDT ! ct. for the transport term in the dissipation eq. ! REAL,SAVE :: XTKEMIN ! mimimum value for the TKE +REAL,SAVE :: XRM17 ! Rodier et al 2017 constant in shear term for mixing length ! REAL,SAVE :: XLINI ! initial value for BL mixing length REAL,SAVE :: XLINF ! to prevent division by zero in the BL algorithm diff --git a/src/arome/turb/modd_dynn.F90 b/src/arome/turb/modd_dynn.F90 new file mode 100644 index 000000000..f74faf128 --- /dev/null +++ b/src/arome/turb/modd_dynn.F90 @@ -0,0 +1,4 @@ +MODULE MODD_DYN_n +IMPLICIT NONE +LOGICAL, PARAMETER :: LOCEAN=.FALSE. +ENDMODULE MODD_DYN_n -- GitLab