diff --git a/docs/Interfaces b/docs/Interfaces new file mode 100644 index 0000000000000000000000000000000000000000..52762422500f377f3ca809e617f8b91b642f53a3 --- /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 0000000000000000000000000000000000000000..aaa81626da190c008c80017a801b134c4ba00b5d --- /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 0000000000000000000000000000000000000000..c111e469fb3d2014b7021eb698d564a94f0cf413 --- /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 0000000000000000000000000000000000000000..09509322d90cfeb2ace272ac779a2a7fdc582c09 --- /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 0000000000000000000000000000000000000000..d6276382965b1b5b1bc27ea2d5314cc8f7547210 --- /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 0000000000000000000000000000000000000000..e45272470ccf31f649b9aac1c2ae0c19551d472c --- /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 82d60bc694f7c25c8cbf2c2615f6ea7248a5ef72..f0f6b11870c2ddd81f19531c01ee76719870a13f 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 806be1b8441c277dcd29822149f4b2e7deaa699a..1f5d39b521df169340f648dcd59e73afbe32b217 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 dec13f81fac495967bd53b6a0b88a804876cc061..06bbc545492660b517fea9f828a6abd13ee66937 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 49ecfb6777011f51d98bdda53bec3ad5926ca7a2..9b18f803fd4181c9136220c02db637666cc20d0a 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 0000000000000000000000000000000000000000..f74faf12893795d671d44a546aacf3d3f5a47681 --- /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