diff --git a/build/with_fcm/arch/arch-gnu.fcm b/build/with_fcm/arch/arch-gnu.fcm index 1b16787f6f142ddf99c5738fce46b88bbe7d61c8..b97a5ea34022c4c704dbdc1413556d85e295a036 100644 --- a/build/with_fcm/arch/arch-gnu.fcm +++ b/build/with_fcm/arch/arch-gnu.fcm @@ -3,7 +3,7 @@ $FCOMPILER = gfortran $BASE_FFLAGS = -c -fPIC -fdefault-real-8 -fdefault-double-8 -ffree-line-length-none -fopenmp -fconvert=swap -fallow-argument-mismatch $PROD_FFLAGS = -O3 $DEV_FFLAGS = -O1 -$DEBUG_FFLAGS = -fbounds-check +$DEBUG_FFLAGS = -O0 -g -fbounds-check -finit-real=snan -ffpe-trap=invalid,zero,overflow $CCOMPILER = gcc $BASE_CFLAGS = -c -fPIC -fopenmp $PROD_CFLAGS = -O3 diff --git a/build/with_fcm/fcm-make.cfg b/build/with_fcm/fcm-make.cfg index cf2f0909ab554fddf2567ad1f23cb3b68a29a85a..6a43a1be568ad2f7c37b61c608d179e3f6bb444a 100644 --- a/build/with_fcm/fcm-make.cfg +++ b/build/with_fcm/fcm-make.cfg @@ -64,7 +64,7 @@ build.prop{fc.libs} = $LIBS ############################# # 4.1 Programs and dummy programm to force linking build.source[dummyprog] = src/dummyprog.F90 -build.source[testprogs] = src/ice_adjust/ src/rain_ice/ src/support/ +build.source[testprogs] = src/ice_adjust/ src/rain_ice/ src/turb_mnh/ src/support/ ############################# # 4.2 Main directory diff --git a/src/arome/ext/aroini_turb.F90 b/src/arome/ext/aroini_turb.F90 index b5d06b2109c6e9590dc3ee664d9f82501b0ecea7..1f2d9c7714a1432c99626602aaf8ee5ed9cce54a 100644 --- a/src/arome/ext/aroini_turb.F90 +++ b/src/arome/ext/aroini_turb.F90 @@ -44,7 +44,7 @@ USE YOMHOOK , ONLY : LHOOK, DR_HOOK USE MODD_LES, ONLY : TLES USE MODD_CTURB, ONLY : XLINI USE MODD_TURB_n, ONLY: LHARAT, LSTATNW, CTURBLEN, TURB_GOTO_MODEL, LTURB_FLX, LTURB_DIAG, & - LSUBG_COND, LRMC01, CTURBDIM, XIMPL + LSUBG_COND, LRMC01, CTURBDIM, XIMPL, CTOM USE MODI_INI_CTURB IMPLICIT NONE @@ -86,6 +86,7 @@ LTURB_DIAG = .FALSE. XIMPL = 1. LSUBG_COND = OSUBG_COND LRMC01 = .FALSE. +CTOM = 'NONE' ! ------------------------------------------------------------------ IF (LHOOK) CALL DR_HOOK('AROINI_TURB',1,ZHOOK_HANDLE) diff --git a/src/common/turb/mode_turb_ver_thermo_flux.F90 b/src/common/turb/mode_turb_ver_thermo_flux.F90 index a0109e16f3798cec305350c215f59550ff6bc59e..97366b22aef729e9d8007ddaf0108e881367d009 100644 --- a/src/common/turb/mode_turb_ver_thermo_flux.F90 +++ b/src/common/turb/mode_turb_ver_thermo_flux.F90 @@ -692,6 +692,7 @@ ELSE !$mnh_expand_array(JIJ=IIJB:IIJE) PWTH(IIJB:IIJE,IKA)=0.5*(ZFLXZ(IIJB:IIJE,IKA)+ZFLXZ(IIJB:IIJE,IKA+IKL)) PWTH(IIJB:IIJE,IKE)=PWTH(IIJB:IIJE,IKE-IKL) + PWTH(IIJB:IIJE,IKU)=0. !$mnh_end_expand_array(JIJ=IIJB:IIJE) END IF ! @@ -1079,6 +1080,7 @@ IF (KRR /= 0) THEN !$mnh_expand_array(JIJ=IIJB:IIJE) PWRC(IIJB:IIJE,IKA)=0.5*(ZFLXZ(IIJB:IIJE,IKA)+ZFLXZ(IIJB:IIJE,IKA+IKL)) PWRC(IIJB:IIJE,IKE)=PWRC(IIJB:IIJE,IKE-IKL) + PWRC(IIJB:IIJE,IKU)=0. !$mnh_end_expand_array(JIJ=IIJB:IIJE) ENDIF ! diff --git a/src/common/turb/modi_les_mean_subgrid.F90 b/src/common/turb/modi_les_mean_subgrid.F90 deleted file mode 100644 index 9459d3d81a176e49a0d02adc73aac6121f88c107..0000000000000000000000000000000000000000 --- a/src/common/turb/modi_les_mean_subgrid.F90 +++ /dev/null @@ -1,30 +0,0 @@ -! ######spl -MODULE MODI_LES_MEAN_SUBGRID -! ##################### -! -INTERFACE LES_MEAN_SUBGRID -! - SUBROUTINE LES_MEAN_SUBGRID_3D(PA, PA_MEAN, OSUM) - -REAL, DIMENSION(:,:,:), INTENT(IN) :: PA -! -REAL, DIMENSION(:,:,:), INTENT(INOUT) :: PA_MEAN -! -LOGICAL, OPTIONAL, INTENT(IN) :: OSUM -! -END SUBROUTINE LES_MEAN_SUBGRID_3D -! - - SUBROUTINE LES_MEAN_SUBGRID_SURF(PA, PA_MEAN, OSUM) - -REAL, DIMENSION(:,:), INTENT(IN) :: PA -! -REAL, DIMENSION(:), INTENT(INOUT) :: PA_MEAN -! -LOGICAL, OPTIONAL, INTENT(IN) :: OSUM -! -END SUBROUTINE LES_MEAN_SUBGRID_SURF -! -END INTERFACE -! -END MODULE MODI_LES_MEAN_SUBGRID diff --git a/src/testprogs/ice_adjust/getdata_ice_adjust_mod.F90 b/src/testprogs/ice_adjust/getdata_ice_adjust_mod.F90 index 3637d1b4b3626b1c970540f8ac197685bae4105e..644f9211ccf8cc007f19ce297b63adcb5769dcc7 100644 --- a/src/testprogs/ice_adjust/getdata_ice_adjust_mod.F90 +++ b/src/testprogs/ice_adjust/getdata_ice_adjust_mod.F90 @@ -1,27 +1,7 @@ MODULE GETDATA_ICE_ADJUST_MOD USE OMP_LIB - -INTERFACE REPLICATE - MODULE PROCEDURE REPLICATE3 - MODULE PROCEDURE REPLICATE4 -END INTERFACE - -INTERFACE NPROMIZE - MODULE PROCEDURE NPROMIZE4 - MODULE PROCEDURE NPROMIZE5 -END INTERFACE - -INTERFACE INTERPOLATE - MODULE PROCEDURE INTERPOLATE4 - MODULE PROCEDURE INTERPOLATE5 -END INTERFACE - -INTERFACE SET - MODULE PROCEDURE SET3 - MODULE PROCEDURE SET4 - MODULE PROCEDURE SET5 -END INTERFACE +USE ARRAYS_MANIP, ONLY: SETUP, REPLICATE, NPROMIZE, INTERPOLATE, SET CONTAINS @@ -30,8 +10,6 @@ SUBROUTINE GETDATA_ICE_ADJUST (NPROMA, NGPBLKS, NFLEVG, PRHODJ_B, PEXNREF_B, PRH & PHLI_HRI_B, PHLI_HCF_B, ZRS_B, ZZZ_B, PRS_OUT_B, PSRCS_OUT_B, PCLDFR_OUT_B, PHLC_HRC_OUT_B, PHLC_HCF_OUT_B, & & PHLI_HRI_OUT_B, PHLI_HCF_OUT_B, LDVERBOSE) -USE IEEE_ARITHMETIC, ONLY : IEEE_SIGNALING_NAN, IEEE_VALUE - IMPLICIT NONE INTEGER, PARAMETER :: IFILE = 77 @@ -106,7 +84,8 @@ INTEGER :: NGPTOT, NPROMA, NGPBLKS, NFLEVG INTEGER :: IOFF, IBL LOGICAL :: LLEXIST CHARACTER(LEN=32) :: CLFILE -REAL :: ZNAN + +CALL SETUP() KRR=6 NGPTOT = NPROMA * NGPBLKS @@ -154,9 +133,6 @@ ALLOCATE (PHLC_HCF_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) ALLOCATE (PHLI_HRI_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) ALLOCATE (PHLI_HCF_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) -ZNAN = IEEE_VALUE (ZNAN, IEEE_SIGNALING_NAN) - - CALL SET (ZSIGQSAT_B ) CALL SET (ZICE_CLD_WGT_B) CALL SET (PSRCS_B ) @@ -191,13 +167,6 @@ CALL SET (PHLI_HCF_OUT_B) ZSIGQSAT_B = 2.0000000000000000E-002 ZICE_CLD_WGT_B = 1.5 -PSRCS_B = ZNAN -PCLDFR_B = ZNAN -PHLI_HCF_B = ZNAN -PHLI_HRI_B = ZNAN -PHLC_HCF_B = ZNAN -PHLC_HRC_B = ZNAN - IOFF = 0 IBL = 0 @@ -339,252 +308,4 @@ CALL NPROMIZE (NPROMA, PHLI_HCF_OUT, PHLI_HCF_OUT_B ) END SUBROUTINE -SUBROUTINE REPLICATE4 (KOFF, P) - -INTEGER :: KOFF -REAL :: P (:,:,:,:) - -INTEGER :: I, J - -DO I = KOFF+1, SIZE (P, 1) - J = 1 + MODULO (I - 1, KOFF) - P (I, :, :, :) = P (J, :, :, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE REPLICATE3 (KOFF, P) - -INTEGER :: KOFF -REAL :: P (:,:,:) - -INTEGER :: I, J - -DO I = KOFF+1, SIZE (P, 1) - J = 1 + MODULO (I - 1, KOFF) - P (I, :, :) = P (J, :, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE NPROMIZE4 (KPROMA, PI, PO) - -INTEGER :: KPROMA -REAL, INTENT (IN) :: PI (:,:,:,:) -REAL, INTENT (OUT) :: PO (:,:,:,:) - -INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA - -IF (SIZE (PI, 4) /= 1) STOP 1 - -IGPTOT = SIZE (PI, 1) -IGPBLK = 1 + (IGPTOT-1) / KPROMA - -DO IGP = 1, IGPTOT, KPROMA - IBL = 1 + (IGP - 1) / KPROMA - JIDIA = 1 - JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) - - DO JLON = JIDIA, JFDIA - PO (JLON, :, :, IBL) = PI (IGP + (JLON - 1), :, :, 1) - ENDDO - - DO JLON = JFDIA+1, KPROMA - PO (JLON, :, :, IBL) = PO (JFDIA, :, :, IBL) - ENDDO - -ENDDO - -END SUBROUTINE - -SUBROUTINE NPROMIZE5 (KPROMA, PI, PO) - -INTEGER :: KPROMA -REAL, INTENT (IN) :: PI (:,:,:,:,:) -REAL, INTENT (OUT) :: PO (:,:,:,:,:) - -INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA - -IF (SIZE (PI, 5) /= 1) STOP 1 - -IGPTOT = SIZE (PI, 1) -IGPBLK = 1 + (IGPTOT-1) / KPROMA - -DO IGP = 1, IGPTOT, KPROMA - IBL = 1 + (IGP - 1) / KPROMA - JIDIA = 1 - JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) - - DO JLON = JIDIA, JFDIA - PO (JLON, :, :, :, IBL) = PI (IGP + (JLON - 1), :, :, :, 1) - ENDDO - - DO JLON = JFDIA+1, KPROMA - PO (JLON, :, :, :, IBL) = PI (JFDIA, :, :, :, IBL) - ENDDO - -ENDDO - -END SUBROUTINE - -SUBROUTINE INTERPOLATE4 (KFLEVG, KOFF, P) - -INTEGER :: KFLEVG, KOFF -REAL, ALLOCATABLE :: P (:,:,:,:) -REAL :: Z (LBOUND (P, 1):UBOUND (P, 1), & - & LBOUND (P, 2):UBOUND (P, 2), & - & LBOUND (P, 3):UBOUND (P, 3), & - & LBOUND (P, 4):UBOUND (P, 4)) -INTEGER :: ILEV1A, ILEV1B, ILEV2, NLEV1, NLEV2 -REAL :: ZWA, ZWB, ZLEV1, ZLEV2 - -Z = P - -NLEV1 = SIZE (P, 3) -NLEV2 = KFLEVG - -DEALLOCATE (P) - -ALLOCATE (P (LBOUND (Z, 1):UBOUND (Z, 1), & - & LBOUND (Z, 2):UBOUND (Z, 2), & - & KFLEVG, & - & LBOUND (Z, 4):UBOUND (Z, 4))) - -DO ILEV2 = 1, NLEV2 - ZLEV2 = REAL (ILEV2 - 1) / REAL (NLEV2 -1) - ZLEV1 = 1. + ZLEV2 * REAL (NLEV1 - 1) - ILEV1B = MIN (CEILING (ZLEV1), NLEV1) - ILEV1A = MAX (FLOOR (ZLEV1), 1) - - IF (ILEV1A == ILEV1B) THEN - ZWA = 1. - ZWB = 0. - ELSE - ZWA = REAL (ILEV1B) - ZLEV1 - ZWB = ZLEV1 - REAL (ILEV1A) - ENDIF - -! WRITE (*, '(" ZLEV2 = ",E12.5," ZLEV1 = ",E12.5," ILEV2 = ",I4," ILEV1A = ",I4," ZWA = ",E12.5," ILEV1B = ",I4," ZWB = ",E12.5)') & -! & ZLEV2, ZLEV1, ILEV2, ILEV1A, ZWA, ILEV1B, ZWB - - P (1:KOFF, :, ILEV2, :) = ZWA * Z (1:KOFF, :, ILEV1A, :) + ZWB * Z (1:KOFF, :, ILEV1B, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE INTERPOLATE5 (KFLEVG, KOFF, P) - -INTEGER :: KFLEVG, KOFF -REAL, ALLOCATABLE :: P (:,:,:,:,:) -REAL :: Z (LBOUND (P, 1):UBOUND (P, 1), & - & LBOUND (P, 2):UBOUND (P, 2), & - & LBOUND (P, 3):UBOUND (P, 3), & - & LBOUND (P, 4):UBOUND (P, 4), & - & LBOUND (P, 5):UBOUND (P, 5)) -INTEGER :: ILEV1A, ILEV1B, ILEV2, NLEV1, NLEV2 -REAL :: ZWA, ZWB, ZLEV1, ZLEV2 - -Z = P - -NLEV1 = SIZE (P, 3) -NLEV2 = KFLEVG - -DEALLOCATE (P) - -ALLOCATE (P (LBOUND (Z, 1):UBOUND (Z, 1), & - & LBOUND (Z, 2):UBOUND (Z, 2), & - & KFLEVG, & - & LBOUND (Z, 4):UBOUND (Z, 4), & - & LBOUND (Z, 5):UBOUND (Z, 5))) - -DO ILEV2 = 1, NLEV2 - ZLEV2 = REAL (ILEV2 - 1) / REAL (NLEV2 -1) - ZLEV1 = 1. + ZLEV2 * REAL (NLEV1 - 1) - ILEV1B = MIN (CEILING (ZLEV1), NLEV1) - ILEV1A = MAX (FLOOR (ZLEV1), 1) - - IF (ILEV1A == ILEV1B) THEN - ZWA = 1. - ZWB = 0. - ELSE - ZWA = REAL (ILEV1B) - ZLEV1 - ZWB = ZLEV1 - REAL (ILEV1A) - ENDIF - -! WRITE (*, '(" ZLEV2 = ",E12.5," ZLEV1 = ",E12.5," ILEV2 = ",I4," ILEV1A = ",I4," ZWA = ",E12.5," ILEV1B = ",I4," ZWB = ",E12.5)') & -! & ZLEV2, ZLEV1, ILEV2, ILEV1A, ZWA, ILEV1B, ZWB - - P (1:KOFF, :, ILEV2, :, :) = ZWA * Z (1:KOFF, :, ILEV1A, :, :) + ZWB * Z (1:KOFF, :, ILEV1B, :, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE SET3 (P) - -REAL :: P (:,:,:) -INTEGER :: IBL, IGPBLKS -INTEGER :: NTID, ITID, JBLK1, JBLK2 - - -IGPBLKS = SIZE (P, 3) - -!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) -NTID = OMP_GET_MAX_THREADS () -ITID = OMP_GET_THREAD_NUM () -JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID -JBLK2 = (IGPBLKS * (ITID+1)) / NTID - -DO IBL = JBLK1, JBLK2 - P (:,:,IBL) = ZNAN -ENDDO - -!$OMP END PARALLEL - -END SUBROUTINE - -SUBROUTINE SET4 (P) - -REAL :: P (:,:,:,:) -INTEGER :: IBL, IGPBLKS -INTEGER :: NTID, ITID, JBLK1, JBLK2 - -IGPBLKS = SIZE (P, 4) - -!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) -NTID = OMP_GET_MAX_THREADS () -ITID = OMP_GET_THREAD_NUM () -JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID -JBLK2 = (IGPBLKS * (ITID+1)) / NTID - -DO IBL = JBLK1, JBLK2 - P (:,:,:,IBL) = ZNAN -ENDDO - -!$OMP END PARALLEL - -END SUBROUTINE - -SUBROUTINE SET5 (P) - -REAL :: P (:,:,:,:,:) -INTEGER :: IBL, IGPBLKS -INTEGER :: NTID, ITID, JBLK1, JBLK2 - -IGPBLKS = SIZE (P, 5) - -!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) -NTID = OMP_GET_MAX_THREADS () -ITID = OMP_GET_THREAD_NUM () -JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID -JBLK2 = (IGPBLKS * (ITID+1)) / NTID - -DO IBL = JBLK1, JBLK2 - P (:,:,:,:,IBL) = ZNAN -ENDDO - -!$OMP END PARALLEL - -END SUBROUTINE - - END MODULE diff --git a/src/testprogs/ice_adjust/main_ice_adjust.F90 b/src/testprogs/ice_adjust/main_ice_adjust.F90 index c488c4b41731211a88843f457b85857b600f03c7..8bf8401d9cdd7fe7340c2a69a91615407829466f 100644 --- a/src/testprogs/ice_adjust/main_ice_adjust.F90 +++ b/src/testprogs/ice_adjust/main_ice_adjust.F90 @@ -2,6 +2,7 @@ PROGRAM MAIN_ICE_ADJUST USE XRD_GETOPTIONS USE GETDATA_ICE_ADJUST_MOD +USE COMPUTE_DIFF USE MODI_ICE_ADJUST USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t USE MODD_CST, ONLY: CST @@ -331,12 +332,12 @@ PRINT *, " ZTC = ", ZTC, ZTC / REAL (NPROMA*NGPBLKS*NTIME) IF (LLCHECK .OR. LLSTAT .OR. LLCHECKDIFF) THEN DO IBL = IBLOCK1, IBLOCK2 PRINT *, " IBL = ", IBL - CALL DIFF ("PSRCS", PSRCS_OUT (:,:,:,IBL), PSRCS (:,:,:,IBL)) - CALL DIFF ("PCLDFR", PCLDFR_OUT (:,:,:,IBL), PCLDFR (:,:,:,IBL)) - CALL DIFF ("PHLC_HRC", PHLC_HRC_OUT (:,:,:,IBL), PHLC_HRC (:,:,:,IBL)) - CALL DIFF ("PHLC_HCF", PHLC_HCF_OUT (:,:,:,IBL), PHLC_HCF (:,:,:,IBL)) - CALL DIFF ("PHLI_HRI", PHLI_HRI_OUT (:,:,:,IBL), PHLI_HRI (:,:,:,IBL)) - CALL DIFF ("PHLI_HCF", PHLI_HCF_OUT (:,:,:,IBL), PHLI_HCF (:,:,:,IBL)) + CALL DIFF ("PSRCS", PSRCS_OUT (:,:,:,IBL), PSRCS (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF ("PCLDFR", PCLDFR_OUT (:,:,:,IBL), PCLDFR (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF ("PHLC_HRC", PHLC_HRC_OUT (:,:,:,IBL), PHLC_HRC (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF ("PHLC_HCF", PHLC_HCF_OUT (:,:,:,IBL), PHLC_HCF (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF ("PHLI_HRI", PHLI_HRI_OUT (:,:,:,IBL), PHLI_HRI (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF ("PHLI_HCF", PHLI_HCF_OUT (:,:,:,IBL), PHLI_HCF (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) ENDDO ENDIF @@ -350,53 +351,4 @@ ENDIF STOP -CONTAINS - -SUBROUTINE DIFF (CDNAME, PREF, POUT) - -CHARACTER (LEN=*) :: CDNAME -REAL :: PREF (:,:,:) -REAL :: POUT (:,:,:) - -INTEGER :: JLON, JLEV - -PRINT *, CDNAME -IF (LLSTAT) THEN - PRINT *, MINVAL (PREF), MAXVAL (PREF), SUM (PREF) / SIZE (PREF) - PRINT *, MINVAL (POUT), MAXVAL (POUT), SUM (POUT) / SIZE (POUT) -ENDIF - -IF (LLCHECK) THEN - IF (SUM (ABS (POUT) + ABS (PREF)) > 0) THEN - WRITE (*, '(A4)', ADVANCE='NO') "" - DO JLON = 1, NPROMA - WRITE (*, '("|",I12,A12)', ADVANCE='NO') JLON, "" - ENDDO - WRITE (*, '("|")') - DO JLEV = 1, KLEV - WRITE (*, '(I4)', ADVANCE='NO') JLEV - DO JLON = 1, NPROMA - IF (ABS (PREF (JLON, 1, JLEV)) + ABS (POUT (JLON, 1, JLEV)) == 0.) THEN - WRITE (*, '("|",2A12)', ADVANCE='NO') "", "" - ELSE - WRITE (*, '("|",2E12.5)', ADVANCE='NO') PREF (JLON, 1, JLEV), POUT (JLON, 1, JLEV) - ENDIF - ENDDO - WRITE (*, '("|")') - ENDDO - ENDIF -ENDIF - -IF (LLCHECKDIFF) THEN - IF (SUM(ABS(POUT-PREF)) > 0.) THEN - PRINT*, "THERE ARE DIFF" - LLDIFF = .TRUE. - ELSE - PRINT*, "THERE IS NO DIFF" - ENDIF -ENDIF - -END SUBROUTINE - - END diff --git a/src/testprogs/rain_ice/getdata_rain_ice_mod.F90 b/src/testprogs/rain_ice/getdata_rain_ice_mod.F90 index 57c28b427d7a1b776b1ffcf68894bbf84e8b9e23..9d3751853b8fb3c66303ab643ffd827f951ec18f 100644 --- a/src/testprogs/rain_ice/getdata_rain_ice_mod.F90 +++ b/src/testprogs/rain_ice/getdata_rain_ice_mod.F90 @@ -1,32 +1,6 @@ MODULE GETDATA_RAIN_ICE_MOD -USE OMP_LIB - -INTERFACE REPLICATE - MODULE PROCEDURE REPLICATE2 - MODULE PROCEDURE REPLICATE3 - MODULE PROCEDURE REPLICATE4 - MODULE PROCEDURE REPLICATEL -END INTERFACE - -INTERFACE NPROMIZE - MODULE PROCEDURE NPROMIZE3 - MODULE PROCEDURE NPROMIZE4 - MODULE PROCEDURE NPROMIZE5 - MODULE PROCEDURE NPROMIZEL -END INTERFACE - -INTERFACE INTERPOLATE - MODULE PROCEDURE INTERPOLATE4 - MODULE PROCEDURE INTERPOLATE5 - MODULE PROCEDURE INTERPOLATEL -END INTERFACE - -INTERFACE SET - MODULE PROCEDURE SET3 - MODULE PROCEDURE SET4 - MODULE PROCEDURE SET5 -END INTERFACE +USE ARRAYS_MANIP, ONLY: SETUP, REPLICATE, NPROMIZE, INTERPOLATE, SET CONTAINS @@ -35,8 +9,6 @@ SUBROUTINE GETDATA_RAIN_ICE (NPROMA, NGPBLKS, NFLEVG, LLMICRO_B, PEXNREF_B, PDZZ &PRS_B, PSIGS_B, PSEA_B, PTOWN_B, PCIT_OUT_B, PRS_OUT_B, ZINPRC_B, ZINPRC_OUT_B, PINPRR_B, PINPRR_OUT_B, PEVAP_B, PEVAP_OUT_B, & &PINPRS_B, PINPRS_OUT_B, PINPRG_B, PINPRG_OUT_B, ZINDEP_B, ZINDEP_OUT_B, ZRAINFR_B, ZRAINFR_OUT_B, PFPR_B, PFPR_OUT_B, LDVERBOSE) -USE IEEE_ARITHMETIC, ONLY : IEEE_SIGNALING_NAN, IEEE_VALUE - IMPLICIT NONE INTEGER, PARAMETER :: IFILE = 77 @@ -126,7 +98,8 @@ INTEGER :: NGPTOT, NPROMA, NGPBLKS, NFLEVG INTEGER :: IOFF, IBL LOGICAL :: LLEXIST CHARACTER(LEN=32) :: CLFILE -REAL :: ZNAN + +CALL SETUP() KRR=6 NGPTOT = NPROMA * NGPBLKS @@ -180,9 +153,6 @@ ALLOCATE (PFPR_B (NPROMA,1,NFLEVG,KRR,NGPBLKS)) ALLOCATE (PFPR_OUT_B (NPROMA,1,NFLEVG,KRR,NGPBLKS)) -ZNAN = IEEE_VALUE (ZNAN, IEEE_SIGNALING_NAN) - - !CALL SET (LLMICRO_B ) CALL SET (PEXNREF_B ) CALL SET (PDZZ_B ) @@ -214,15 +184,6 @@ CALL SET (ZINDEP_OUT_B ) CALL SET (ZRAINFR_OUT_B ) CALL SET (PFPR_OUT_B ) -ZINPRC_OUT_B = ZNAN -PINPRR_OUT_B = ZNAN -PEVAP_OUT_B = ZNAN -PINPRS_OUT_B = ZNAN -PINPRG_OUT_B = ZNAN -ZINDEP_OUT_B = ZNAN -ZRAINFR_OUT_B = ZNAN -PFPR_OUT_B = ZNAN - IOFF = 0 IBL = 0 LLEXIST = .TRUE. @@ -416,386 +377,4 @@ CALL NPROMIZE (NPROMA, PFPR_OUT , PFPR_OUT_B ) END SUBROUTINE -SUBROUTINE REPLICATE4 (KOFF, P) - -INTEGER :: KOFF -REAL :: P (:,:,:,:) - -INTEGER :: I, J - -DO I = KOFF+1, SIZE (P, 1) - J = 1 + MODULO (I - 1, KOFF) - P (I, :, :, :) = P (J, :, :, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE REPLICATE3 (KOFF, P) - -INTEGER :: KOFF -REAL :: P (:,:,:) - -INTEGER :: I, J - -DO I = KOFF+1, SIZE (P, 1) - J = 1 + MODULO (I - 1, KOFF) - P (I, :, :) = P (J, :, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE REPLICATE2 (KOFF, P) - -INTEGER :: KOFF -REAL :: P (:,:) - -INTEGER :: I, J - -DO I = KOFF+1, SIZE (P, 1) - J = 1 + MODULO (I - 1, KOFF) - P (I, :) = P (J, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE REPLICATEL (KOFF, L) - -INTEGER :: KOFF -LOGICAL :: L (:,:,:) - -INTEGER :: I, J - -DO I = KOFF+1, SIZE (L, 1) - J = 1 + MODULO (I - 1, KOFF) - L (I, :, :) = L (J, :, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE NPROMIZE3 (KPROMA, PI, PO) - -INTEGER :: KPROMA -REAL, INTENT (IN) :: PI (:,:,:) -REAL, INTENT (OUT) :: PO (:,:,:) - -INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA - -IF (SIZE (PI, 3) /= 1) STOP 1 - -IGPTOT = SIZE (PI, 1) -IGPBLK = 1 + (IGPTOT-1) / KPROMA - -DO IGP = 1, IGPTOT, KPROMA - IBL = 1 + (IGP - 1) / KPROMA - JIDIA = 1 - JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) - - DO JLON = JIDIA, JFDIA - PO (JLON, :, IBL) = PI (IGP + (JLON - 1), :, 1) - ENDDO - - DO JLON = JFDIA+1, KPROMA - PO (JLON, :, IBL) = PO (JFDIA, :, IBL) - ENDDO - -ENDDO - -END SUBROUTINE - -SUBROUTINE NPROMIZE4 (KPROMA, PI, PO) - -INTEGER :: KPROMA -REAL, INTENT (IN) :: PI (:,:,:,:) -REAL, INTENT (OUT) :: PO (:,:,:,:) - -INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA - -IF (SIZE (PI, 4) /= 1) STOP 1 - -IGPTOT = SIZE (PI, 1) -IGPBLK = 1 + (IGPTOT-1) / KPROMA - -DO IGP = 1, IGPTOT, KPROMA - IBL = 1 + (IGP - 1) / KPROMA - JIDIA = 1 - JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) - - DO JLON = JIDIA, JFDIA - PO (JLON, :, :, IBL) = PI (IGP + (JLON - 1), :, :, 1) - ENDDO - - DO JLON = JFDIA+1, KPROMA - PO (JLON, :, :, IBL) = PO (JFDIA, :, :, IBL) - ENDDO - -ENDDO - -END SUBROUTINE - -SUBROUTINE NPROMIZE5 (KPROMA, PI, PO) - -INTEGER :: KPROMA -REAL, INTENT (IN) :: PI (:,:,:,:,:) -REAL, INTENT (OUT) :: PO (:,:,:,:,:) - -INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA - -IF (SIZE (PI, 5) /= 1) STOP 1 - -IGPTOT = SIZE (PI, 1) -IGPBLK = 1 + (IGPTOT-1) / KPROMA - -DO IGP = 1, IGPTOT, KPROMA - IBL = 1 + (IGP - 1) / KPROMA - JIDIA = 1 - JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) - - DO JLON = JIDIA, JFDIA - PO (JLON, :, :, :, IBL) = PI (IGP + (JLON - 1), :, :, :, 1) - ENDDO - - DO JLON = JFDIA+1, KPROMA - PO (JLON, :, :, :, IBL) = PI (JFDIA, :, :, :, IBL) - ENDDO - -ENDDO - -END SUBROUTINE - -SUBROUTINE NPROMIZEL (KPROMA, LI, LO) - -INTEGER :: KPROMA -LOGICAL, INTENT (IN) :: LI (:,:,:,:) -LOGICAL, INTENT (OUT) :: LO (:,:,:,:) - -INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA - -IF (SIZE (LI, 4) /= 1) STOP 1 - -IGPTOT = SIZE (LI, 1) -IGPBLK = 1 + (IGPTOT-1) / KPROMA - -DO IGP = 1, IGPTOT, KPROMA - IBL = 1 + (IGP - 1) / KPROMA - JIDIA = 1 - JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) - - DO JLON = JIDIA, JFDIA - LO (JLON, :, :, IBL) = LI (IGP + (JLON - 1), :, :, 1) - ENDDO - - DO JLON = JFDIA+1, KPROMA - LO (JLON, :, :, IBL) = LI (JFDIA, :, :, IBL) - ENDDO - -ENDDO - -END SUBROUTINE - -SUBROUTINE INTERPOLATE4 (KFLEVG, KOFF, P) - -INTEGER :: KFLEVG, KOFF -REAL, ALLOCATABLE :: P (:,:,:,:) -REAL :: Z (LBOUND (P, 1):UBOUND (P, 1), & - & LBOUND (P, 2):UBOUND (P, 2), & - & LBOUND (P, 3):UBOUND (P, 3), & - & LBOUND (P, 4):UBOUND (P, 4)) -INTEGER :: ILEV1A, ILEV1B, ILEV2, NLEV1, NLEV2 -REAL :: ZWA, ZWB, ZLEV1, ZLEV2 - -Z = P - -NLEV1 = SIZE (P, 3) -NLEV2 = KFLEVG - -DEALLOCATE (P) - -ALLOCATE (P (LBOUND (Z, 1):UBOUND (Z, 1), & - & LBOUND (Z, 2):UBOUND (Z, 2), & - & KFLEVG, & - & LBOUND (Z, 4):UBOUND (Z, 4))) - -DO ILEV2 = 1, NLEV2 - ZLEV2 = REAL (ILEV2 - 1) / REAL (NLEV2 -1) - ZLEV1 = 1. + ZLEV2 * REAL (NLEV1 - 1) - ILEV1B = MIN (CEILING (ZLEV1), NLEV1) - ILEV1A = MAX (FLOOR (ZLEV1), 1) - - IF (ILEV1A == ILEV1B) THEN - ZWA = 1. - ZWB = 0. - ELSE - ZWA = REAL (ILEV1B) - ZLEV1 - ZWB = ZLEV1 - REAL (ILEV1A) - ENDIF - -! WRITE (*, '(" ZLEV2 = ",E12.5," ZLEV1 = ",E12.5," ILEV2 = ",I4," ILEV1A = ",I4," ZWA = ",E12.5," ILEV1B = ",I4," ZWB = ",E12.5)') & -! & ZLEV2, ZLEV1, ILEV2, ILEV1A, ZWA, ILEV1B, ZWB - - P (1:KOFF, :, ILEV2, :) = ZWA * Z (1:KOFF, :, ILEV1A, :) + ZWB * Z (1:KOFF, :, ILEV1B, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE INTERPOLATE5 (KFLEVG, KOFF, P) - -INTEGER :: KFLEVG, KOFF -REAL, ALLOCATABLE :: P (:,:,:,:,:) -REAL :: Z (LBOUND (P, 1):UBOUND (P, 1), & - & LBOUND (P, 2):UBOUND (P, 2), & - & LBOUND (P, 3):UBOUND (P, 3), & - & LBOUND (P, 4):UBOUND (P, 4), & - & LBOUND (P, 5):UBOUND (P, 5)) -INTEGER :: ILEV1A, ILEV1B, ILEV2, NLEV1, NLEV2 -REAL :: ZWA, ZWB, ZLEV1, ZLEV2 - -Z = P - -NLEV1 = SIZE (P, 3) -NLEV2 = KFLEVG - -DEALLOCATE (P) - -ALLOCATE (P (LBOUND (Z, 1):UBOUND (Z, 1), & - & LBOUND (Z, 2):UBOUND (Z, 2), & - & KFLEVG, & - & LBOUND (Z, 4):UBOUND (Z, 4), & - & LBOUND (Z, 5):UBOUND (Z, 5))) - -DO ILEV2 = 1, NLEV2 - ZLEV2 = REAL (ILEV2 - 1) / REAL (NLEV2 -1) - ZLEV1 = 1. + ZLEV2 * REAL (NLEV1 - 1) - ILEV1B = MIN (CEILING (ZLEV1), NLEV1) - ILEV1A = MAX (FLOOR (ZLEV1), 1) - - IF (ILEV1A == ILEV1B) THEN - ZWA = 1. - ZWB = 0. - ELSE - ZWA = REAL (ILEV1B) - ZLEV1 - ZWB = ZLEV1 - REAL (ILEV1A) - ENDIF - -! WRITE (*, '(" ZLEV2 = ",E12.5," ZLEV1 = ",E12.5," ILEV2 = ",I4," ILEV1A = ",I4," ZWA = ",E12.5," ILEV1B = ",I4," ZWB = ",E12.5)') & -! & ZLEV2, ZLEV1, ILEV2, ILEV1A, ZWA, ILEV1B, ZWB - - P (1:KOFF, :, ILEV2, :, :) = ZWA * Z (1:KOFF, :, ILEV1A, :, :) + ZWB * Z (1:KOFF, :, ILEV1B, :, :) -ENDDO - -END SUBROUTINE - -SUBROUTINE INTERPOLATEL (KFLEVG, KOFF, L) - -INTEGER :: KFLEVG, KOFF -LOGICAL, ALLOCATABLE :: L (:,:,:,:) -LOGICAL :: Z (LBOUND (L, 1):UBOUND (L, 1), & - & LBOUND (L, 2):UBOUND (L, 2), & - & LBOUND (L, 3):UBOUND (L, 3), & - & LBOUND (L, 4):UBOUND (L, 4)) -INTEGER :: ILEV1A, ILEV1B, ILEV2, NLEV1, NLEV2 -REAL :: ZWA, ZWB, ZLEV1, ZLEV2 - -Z = L - -NLEV1 = SIZE (L, 3) -NLEV2 = KFLEVG - -DEALLOCATE (L) - -ALLOCATE (L (LBOUND (Z, 1):UBOUND (Z, 1), & - & LBOUND (Z, 2):UBOUND (Z, 2), & - & KFLEVG, & - & LBOUND (Z, 4):UBOUND (Z, 4))) - -DO ILEV2 = 1, NLEV2 - ZLEV2 = REAL (ILEV2 - 1) / REAL (NLEV2 -1) - ZLEV1 = 1. + ZLEV2 * REAL (NLEV1 - 1) - ILEV1B = MIN (CEILING (ZLEV1), NLEV1) - ILEV1A = MAX (FLOOR (ZLEV1), 1) - - IF (ILEV1A == ILEV1B) THEN - ZWA = 1. - ZWB = 0. - ELSE - ZWA = REAL (ILEV1B) - ZLEV1 - ZWB = ZLEV1 - REAL (ILEV1A) - ENDIF - -! WRITE (*, '(" ZLEV2 = ",E12.5," ZLEV1 = ",E12.5," ILEV2 = ",I4," ILEV1A = ",I4," ZWA = ",E12.5," ILEV1B = ",I4," ZWB = ",E12.5)') & -! & ZLEV2, ZLEV1, ILEV2, ILEV1A, ZWA, ILEV1B, ZWB - - L (1:KOFF, :, ILEV2, :) = ZWA * MERGE(1., 0., Z (1:KOFF, :, ILEV1A, :)) + ZWB * MERGE(1., 0., Z (1:KOFF, :, ILEV1B, :)) >= 0.5 -ENDDO - -END SUBROUTINE - - -SUBROUTINE SET3 (P) - -REAL :: P (:,:,:) -INTEGER :: IBL, IGPBLKS -INTEGER :: NTID, ITID, JBLK1, JBLK2 - - -IGPBLKS = SIZE (P, 3) - -!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) -NTID = OMP_GET_MAX_THREADS () -ITID = OMP_GET_THREAD_NUM () -JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID -JBLK2 = (IGPBLKS * (ITID+1)) / NTID - -DO IBL = JBLK1, JBLK2 - P (:,:,IBL) = ZNAN -ENDDO - -!$OMP END PARALLEL - -END SUBROUTINE - -SUBROUTINE SET4 (P) - -REAL :: P (:,:,:,:) -INTEGER :: IBL, IGPBLKS -INTEGER :: NTID, ITID, JBLK1, JBLK2 - -IGPBLKS = SIZE (P, 4) - -!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) -NTID = OMP_GET_MAX_THREADS () -ITID = OMP_GET_THREAD_NUM () -JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID -JBLK2 = (IGPBLKS * (ITID+1)) / NTID - -DO IBL = JBLK1, JBLK2 - P (:,:,:,IBL) = ZNAN -ENDDO - -!$OMP END PARALLEL - -END SUBROUTINE - -SUBROUTINE SET5 (P) - -REAL :: P (:,:,:,:,:) -INTEGER :: IBL, IGPBLKS -INTEGER :: NTID, ITID, JBLK1, JBLK2 - -IGPBLKS = SIZE (P, 5) - -!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) -NTID = OMP_GET_MAX_THREADS () -ITID = OMP_GET_THREAD_NUM () -JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID -JBLK2 = (IGPBLKS * (ITID+1)) / NTID - -DO IBL = JBLK1, JBLK2 - P (:,:,:,:,IBL) = ZNAN -ENDDO - -!$OMP END PARALLEL - -END SUBROUTINE - - END MODULE diff --git a/src/testprogs/rain_ice/main_rain_ice.F90 b/src/testprogs/rain_ice/main_rain_ice.F90 index 7dc8676231d3a8a50a0356994e857f0f3a18a25a..b9c3522f28d59a1ac2f7120dae89565578357c72 100644 --- a/src/testprogs/rain_ice/main_rain_ice.F90 +++ b/src/testprogs/rain_ice/main_rain_ice.F90 @@ -2,6 +2,7 @@ PROGRAM MAIN_RAIN_ICE USE XRD_GETOPTIONS USE GETDATA_RAIN_ICE_MOD +USE COMPUTE_DIFF USE MODD_CONF USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t USE MODD_CST, ONLY: CST_t, CST @@ -304,20 +305,20 @@ IF (LLCHECK .OR. LLSTAT .OR. LLCHECKDIFF) THEN PRINT *, " IBL = ", IBL DO JRR=1, KRR WRITE (CLTEXT, '("PRS JRR=",I3.3)') JRR - CALL DIFF3 (CLTEXT, PRS_OUT (:,:,:,JRR,IBL), PRS (:,:,:,JRR,IBL)) + CALL DIFF3 (CLTEXT, PRS_OUT (:,:,:,JRR,IBL), PRS (:,:,:,JRR,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) IF(JRR>=2) THEN WRITE (CLTEXT, '("PFPR JRR=",I3.3)') JRR - CALL DIFF3 (CLTEXT, PFPR_OUT (:,:,:,JRR,IBL), PFPR (:,:,:,JRR,IBL)) + CALL DIFF3 (CLTEXT, PFPR_OUT (:,:,:,JRR,IBL), PFPR (:,:,:,JRR,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) ENDIF ENDDO - CALL DIFF3 ("PCIT", PCIT_OUT (:,:,:,IBL), PCIT (:,:,:,IBL)) - CALL DIFF2 ("ZINPRC", ZINPRC_OUT (:,:,IBL), ZINPRC (:,:,IBL)) - CALL DIFF2 ("PINPRRRS", PINPRR_OUT (:,:,IBL), PINPRR (:,:,IBL)) - CALL DIFF3 ("PEVAP", PEVAP_OUT (:,:,:,IBL), PEVAP (:,:,:,IBL)) - CALL DIFF2 ("PINPRS", PINPRS_OUT (:,:,IBL), PINPRS (:,:,IBL)) - CALL DIFF2 ("PINPRG", PINPRG_OUT (:,:,IBL), PINPRG (:,:,IBL)) - CALL DIFF2 ("ZINDEP", ZINDEP_OUT (:,:,IBL), ZINDEP (:,:,IBL)) - CALL DIFF3 ("ZRAINFR", ZRAINFR_OUT (:,:,:,IBL), ZRAINFR (:,:,:,IBL)) + CALL DIFF3 ("PCIT", PCIT_OUT (:,:,:,IBL), PCIT (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF2 ("ZINPRC", ZINPRC_OUT (:,:,IBL), ZINPRC (:,:,IBL) , LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF2 ("PINPRRRS", PINPRR_OUT (:,:,IBL), PINPRR (:,:,IBL) , LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PEVAP", PEVAP_OUT (:,:,:,IBL), PEVAP (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF2 ("PINPRS", PINPRS_OUT (:,:,IBL), PINPRS (:,:,IBL) , LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF2 ("PINPRG", PINPRG_OUT (:,:,IBL), PINPRG (:,:,IBL) , LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF2 ("ZINDEP", ZINDEP_OUT (:,:,IBL), ZINDEP (:,:,IBL) , LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("ZRAINFR", ZRAINFR_OUT (:,:,:,IBL), ZRAINFR (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) ENDDO ENDIF @@ -333,97 +334,6 @@ STOP CONTAINS -SUBROUTINE DIFF3 (CDNAME, PREF, POUT) - -CHARACTER (LEN=*) :: CDNAME -REAL :: PREF (:,:,:) -REAL :: POUT (:,:,:) - -INTEGER :: JLON, JLEV - -PRINT *, CDNAME -IF (LLSTAT) THEN - PRINT *, MINVAL (PREF), MAXVAL (PREF), SUM (PREF) / SIZE (PREF) - PRINT *, MINVAL (POUT), MAXVAL (POUT), SUM (POUT) / SIZE (POUT) -ENDIF - -IF (LLCHECK) THEN - IF (SUM (ABS (POUT) + ABS (PREF)) > 0) THEN - WRITE (*, '(A4)', ADVANCE='NO') "" - DO JLON = 1, NPROMA - WRITE (*, '("|",I12,A12)', ADVANCE='NO') JLON, "" - ENDDO - WRITE (*, '("|")') - DO JLEV = 1, KLEV - WRITE (*, '(I4)', ADVANCE='NO') JLEV - DO JLON = 1, NPROMA - IF (ABS (PREF (JLON, 1, JLEV)) + ABS (POUT (JLON, 1, JLEV)) == 0.) THEN - WRITE (*, '("|",2A12)', ADVANCE='NO') "", "" - ELSE - WRITE (*, '("|",2E12.5)', ADVANCE='NO') PREF (JLON, 1, JLEV), POUT (JLON, 1, JLEV) - ENDIF - ENDDO - WRITE (*, '("|")') - ENDDO - ENDIF -ENDIF - -IF (LLCHECKDIFF) THEN - IF (SUM(ABS(POUT-PREF)) > 0.) THEN - PRINT*, "THERE ARE DIFF" - LLDIFF = .TRUE. - ELSE - PRINT*, "THERE IS NO DIFF" - ENDIF -ENDIF - -END SUBROUTINE - -SUBROUTINE DIFF2 (CDNAME, PREF, POUT) - -CHARACTER (LEN=*) :: CDNAME -REAL :: PREF (:,:) -REAL :: POUT (:,:) - -INTEGER :: JLON - -PRINT *, CDNAME -IF (LLSTAT) THEN - PRINT *, MINVAL (PREF), MAXVAL (PREF), SUM (PREF) / SIZE (PREF) - PRINT *, MINVAL (POUT), MAXVAL (POUT), SUM (POUT) / SIZE (POUT) -ENDIF - -IF (LLCHECK) THEN - IF (SUM (ABS (POUT) + ABS (PREF)) > 0) THEN - WRITE (*, '(A4)', ADVANCE='NO') "" - DO JLON = 1, NPROMA - WRITE (*, '("|",I12,A12)', ADVANCE='NO') JLON, "" - ENDDO - WRITE (*, '("|")') - WRITE (*, '(I4)', ADVANCE='NO') 0 - DO JLON = 1, NPROMA - IF (ABS (PREF (JLON, 1)) + ABS (POUT (JLON, 1)) == 0.) THEN - WRITE (*, '("|",2A12)', ADVANCE='NO') "", "" - ELSE - WRITE (*, '("|",2E12.5)', ADVANCE='NO') PREF (JLON, 1), POUT (JLON, 1) - ENDIF - ENDDO - WRITE (*, '("|")') - ENDIF -ENDIF - -IF (LLCHECKDIFF) THEN - IF (SUM(ABS(POUT-PREF)) > 0.) THEN - PRINT*, "THERE ARE DIFF" - LLDIFF = .TRUE. - ELSE - PRINT*, "THERE IS NO DIFF" - ENDIF -ENDIF - -END SUBROUTINE - - SUBROUTINE INIT_PHYEX(KULOUT,LDWARM,CMICRO,CCSEDIM,LDCRIAUTI,& PCRIAUTI,PT0CRIAUTI,PCRIAUTC) @@ -432,7 +342,6 @@ USE MODD_RAIN_ICE_PARAM USE MODD_PARAM_ICE USE MODD_TURB_N, ONLY: TURB_GOTO_MODEL, CSUBG_MF_PDF -USE MODD_REF USE MODI_INI_RAIN_ICE IMPLICIT NONE @@ -501,7 +410,6 @@ XVDEPOSC=0.02 ! deposition speed (2 cm.s-1) ! ! 2. Set implicit default values for MODD_RAIN_ICE_DESCR ! et MODD_RAIN_ICE_PARAM -XTHVREFZ=300. ! CALL INI_RAIN_ICE (KULOUT, CMICRO) !update values from namparar diff --git a/src/testprogs/support/arrays_manip.F90 b/src/testprogs/support/arrays_manip.F90 new file mode 100644 index 0000000000000000000000000000000000000000..0556f3b559fc705fda2fbc8e9b3aff6d4eecf7bb --- /dev/null +++ b/src/testprogs/support/arrays_manip.F90 @@ -0,0 +1,436 @@ +MODULE ARRAYS_MANIP + +USE OMP_LIB +USE IEEE_ARITHMETIC, ONLY : IEEE_SIGNALING_NAN, IEEE_VALUE + +INTERFACE REPLICATE + MODULE PROCEDURE REPLICATE2 + MODULE PROCEDURE REPLICATE3 + MODULE PROCEDURE REPLICATE4 + MODULE PROCEDURE REPLICATEL +END INTERFACE + +INTERFACE NPROMIZE + MODULE PROCEDURE NPROMIZE3 + MODULE PROCEDURE NPROMIZE4 + MODULE PROCEDURE NPROMIZE5 + MODULE PROCEDURE NPROMIZEL +END INTERFACE + +INTERFACE INTERPOLATE + MODULE PROCEDURE INTERPOLATE4 + MODULE PROCEDURE INTERPOLATE5 + MODULE PROCEDURE INTERPOLATEL +END INTERFACE + +INTERFACE SET + MODULE PROCEDURE SET3 + MODULE PROCEDURE SET4 + MODULE PROCEDURE SET5 +END INTERFACE + +REAL, SAVE :: XINVALID + +CONTAINS + +SUBROUTINE SETUP() + !XINVALID = IEEE_VALUE (1., IEEE_SIGNALING_NAN) + XINVALID = HUGE(1.) +END SUBROUTINE SETUP + +SUBROUTINE REPLICATE4 (KOFF, P) +IMPLICIT NONE + +INTEGER :: KOFF +REAL :: P (:,:,:,:) + +INTEGER :: I, J + +DO I = KOFF+1, SIZE (P, 1) + J = 1 + MODULO (I - 1, KOFF) + P (I, :, :, :) = P (J, :, :, :) +ENDDO + +END SUBROUTINE + +SUBROUTINE REPLICATE3 (KOFF, P) +IMPLICIT NONE + +INTEGER :: KOFF +REAL :: P (:,:,:) + +INTEGER :: I, J + +DO I = KOFF+1, SIZE (P, 1) + J = 1 + MODULO (I - 1, KOFF) + P (I, :, :) = P (J, :, :) +ENDDO + +END SUBROUTINE + +SUBROUTINE REPLICATE2 (KOFF, P) +IMPLICIT NONE + +INTEGER :: KOFF +REAL :: P (:,:) + +INTEGER :: I, J + +DO I = KOFF+1, SIZE (P, 1) + J = 1 + MODULO (I - 1, KOFF) + P (I, :) = P (J, :) +ENDDO + +END SUBROUTINE + +SUBROUTINE REPLICATEL (KOFF, L) +IMPLICIT NONE + +INTEGER :: KOFF +LOGICAL :: L (:,:,:) + +INTEGER :: I, J + +DO I = KOFF+1, SIZE (L, 1) + J = 1 + MODULO (I - 1, KOFF) + L (I, :, :) = L (J, :, :) +ENDDO + +END SUBROUTINE + +SUBROUTINE NPROMIZE3 (KPROMA, PI, PO) +IMPLICIT NONE + +INTEGER :: KPROMA +REAL, INTENT (IN) :: PI (:,:,:) +REAL, INTENT (OUT) :: PO (:,:,:) + +INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA, IBL + +IF (SIZE (PI, 3) /= 1) STOP 1 + +IGPTOT = SIZE (PI, 1) +IGPBLK = 1 + (IGPTOT-1) / KPROMA + +DO IGP = 1, IGPTOT, KPROMA + IBL = 1 + (IGP - 1) / KPROMA + JIDIA = 1 + JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) + + DO JLON = JIDIA, JFDIA + PO (JLON, :, IBL) = PI (IGP + (JLON - 1), :, 1) + ENDDO + + DO JLON = JFDIA+1, KPROMA + PO (JLON, :, IBL) = PO (JFDIA, :, IBL) + ENDDO + +ENDDO + +END SUBROUTINE + +SUBROUTINE NPROMIZE4 (KPROMA, PI, PO) +IMPLICIT NONE + +INTEGER :: KPROMA +REAL, INTENT (IN) :: PI (:,:,:,:) +REAL, INTENT (OUT) :: PO (:,:,:,:) + +INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA, IBL + +IF (SIZE (PI, 4) /= 1) STOP 1 + +IGPTOT = SIZE (PI, 1) +IGPBLK = 1 + (IGPTOT-1) / KPROMA + +DO IGP = 1, IGPTOT, KPROMA + IBL = 1 + (IGP - 1) / KPROMA + JIDIA = 1 + JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) + + DO JLON = JIDIA, JFDIA + PO (JLON, :, :, IBL) = PI (IGP + (JLON - 1), :, :, 1) + ENDDO + + DO JLON = JFDIA+1, KPROMA + PO (JLON, :, :, IBL) = PO (JFDIA, :, :, IBL) + ENDDO + +ENDDO + +END SUBROUTINE + +SUBROUTINE NPROMIZE5 (KPROMA, PI, PO) +IMPLICIT NONE + +INTEGER :: KPROMA +REAL, INTENT (IN) :: PI (:,:,:,:,:) +REAL, INTENT (OUT) :: PO (:,:,:,:,:) + +INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA, IBL + +IF (SIZE (PI, 5) /= 1) STOP 1 + +IGPTOT = SIZE (PI, 1) +IGPBLK = 1 + (IGPTOT-1) / KPROMA + +DO IGP = 1, IGPTOT, KPROMA + IBL = 1 + (IGP - 1) / KPROMA + JIDIA = 1 + JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) + + DO JLON = JIDIA, JFDIA + PO (JLON, :, :, :, IBL) = PI (IGP + (JLON - 1), :, :, :, 1) + ENDDO + + DO JLON = JFDIA+1, KPROMA + PO (JLON, :, :, :, IBL) = PI (JFDIA, :, :, :, IBL) + ENDDO + +ENDDO + +END SUBROUTINE + +SUBROUTINE NPROMIZEL (KPROMA, LI, LO) +IMPLICIT NONE + +INTEGER :: KPROMA +LOGICAL, INTENT (IN) :: LI (:,:,:,:) +LOGICAL, INTENT (OUT) :: LO (:,:,:,:) + +INTEGER :: I, J, IGPBLK, IGPTOT, IGP, JLON, JIDIA, JFDIA, IBL + +IF (SIZE (LI, 4) /= 1) STOP 1 + +IGPTOT = SIZE (LI, 1) +IGPBLK = 1 + (IGPTOT-1) / KPROMA + +DO IGP = 1, IGPTOT, KPROMA + IBL = 1 + (IGP - 1) / KPROMA + JIDIA = 1 + JFDIA = MIN (KPROMA, IGPTOT - (IBL - 1) * KPROMA) + + DO JLON = JIDIA, JFDIA + LO (JLON, :, :, IBL) = LI (IGP + (JLON - 1), :, :, 1) + ENDDO + + DO JLON = JFDIA+1, KPROMA + LO (JLON, :, :, IBL) = LI (JFDIA, :, :, IBL) + ENDDO + +ENDDO + +END SUBROUTINE + +SUBROUTINE INTERPOLATE4 (KFLEVG, KOFF, P) +IMPLICIT NONE + +INTEGER :: KFLEVG, KOFF +REAL, ALLOCATABLE :: P (:,:,:,:) +REAL :: Z (LBOUND (P, 1):UBOUND (P, 1), & + & LBOUND (P, 2):UBOUND (P, 2), & + & LBOUND (P, 3):UBOUND (P, 3), & + & LBOUND (P, 4):UBOUND (P, 4)) +INTEGER :: ILEV1A, ILEV1B, ILEV2, NLEV1, NLEV2 +REAL :: ZWA, ZWB, ZLEV1, ZLEV2 + +Z = P + +NLEV1 = SIZE (P, 3) +NLEV2 = KFLEVG + +DEALLOCATE (P) + +ALLOCATE (P (LBOUND (Z, 1):UBOUND (Z, 1), & + & LBOUND (Z, 2):UBOUND (Z, 2), & + & KFLEVG, & + & LBOUND (Z, 4):UBOUND (Z, 4))) + +DO ILEV2 = 1, NLEV2 + ZLEV2 = REAL (ILEV2 - 1) / REAL (NLEV2 -1) + ZLEV1 = 1. + ZLEV2 * REAL (NLEV1 - 1) + ILEV1B = MIN (CEILING (ZLEV1), NLEV1) + ILEV1A = MAX (FLOOR (ZLEV1), 1) + + IF (ILEV1A == ILEV1B) THEN + ZWA = 1. + ZWB = 0. + ELSE + ZWA = REAL (ILEV1B) - ZLEV1 + ZWB = ZLEV1 - REAL (ILEV1A) + ENDIF + +! WRITE (*, '(" ZLEV2 = ",E12.5," ZLEV1 = ",E12.5," ILEV2 = ",I4," ILEV1A = ",I4," ZWA = ",E12.5," ILEV1B = ",I4," ZWB = ",E12.5)') & +! & ZLEV2, ZLEV1, ILEV2, ILEV1A, ZWA, ILEV1B, ZWB + + P (1:KOFF, :, ILEV2, :) = ZWA * Z (1:KOFF, :, ILEV1A, :) + ZWB * Z (1:KOFF, :, ILEV1B, :) +ENDDO + +END SUBROUTINE + +SUBROUTINE INTERPOLATE5 (KFLEVG, KOFF, P) +IMPLICIT NONE + +INTEGER :: KFLEVG, KOFF +REAL, ALLOCATABLE :: P (:,:,:,:,:) +REAL :: Z (LBOUND (P, 1):UBOUND (P, 1), & + & LBOUND (P, 2):UBOUND (P, 2), & + & LBOUND (P, 3):UBOUND (P, 3), & + & LBOUND (P, 4):UBOUND (P, 4), & + & LBOUND (P, 5):UBOUND (P, 5)) +INTEGER :: ILEV1A, ILEV1B, ILEV2, NLEV1, NLEV2 +REAL :: ZWA, ZWB, ZLEV1, ZLEV2 + +Z = P + +NLEV1 = SIZE (P, 3) +NLEV2 = KFLEVG + +DEALLOCATE (P) + +ALLOCATE (P (LBOUND (Z, 1):UBOUND (Z, 1), & + & LBOUND (Z, 2):UBOUND (Z, 2), & + & KFLEVG, & + & LBOUND (Z, 4):UBOUND (Z, 4), & + & LBOUND (Z, 5):UBOUND (Z, 5))) + +DO ILEV2 = 1, NLEV2 + ZLEV2 = REAL (ILEV2 - 1) / REAL (NLEV2 -1) + ZLEV1 = 1. + ZLEV2 * REAL (NLEV1 - 1) + ILEV1B = MIN (CEILING (ZLEV1), NLEV1) + ILEV1A = MAX (FLOOR (ZLEV1), 1) + + IF (ILEV1A == ILEV1B) THEN + ZWA = 1. + ZWB = 0. + ELSE + ZWA = REAL (ILEV1B) - ZLEV1 + ZWB = ZLEV1 - REAL (ILEV1A) + ENDIF + +! WRITE (*, '(" ZLEV2 = ",E12.5," ZLEV1 = ",E12.5," ILEV2 = ",I4," ILEV1A = ",I4," ZWA = ",E12.5," ILEV1B = ",I4," ZWB = ",E12.5)') & +! & ZLEV2, ZLEV1, ILEV2, ILEV1A, ZWA, ILEV1B, ZWB + + P (1:KOFF, :, ILEV2, :, :) = ZWA * Z (1:KOFF, :, ILEV1A, :, :) + ZWB * Z (1:KOFF, :, ILEV1B, :, :) +ENDDO + +END SUBROUTINE + +SUBROUTINE INTERPOLATEL (KFLEVG, KOFF, L) +IMPLICIT NONE + +INTEGER :: KFLEVG, KOFF +LOGICAL, ALLOCATABLE :: L (:,:,:,:) +LOGICAL :: Z (LBOUND (L, 1):UBOUND (L, 1), & + & LBOUND (L, 2):UBOUND (L, 2), & + & LBOUND (L, 3):UBOUND (L, 3), & + & LBOUND (L, 4):UBOUND (L, 4)) +INTEGER :: ILEV1A, ILEV1B, ILEV2, NLEV1, NLEV2 +REAL :: ZWA, ZWB, ZLEV1, ZLEV2 + +Z = L + +NLEV1 = SIZE (L, 3) +NLEV2 = KFLEVG + +DEALLOCATE (L) + +ALLOCATE (L (LBOUND (Z, 1):UBOUND (Z, 1), & + & LBOUND (Z, 2):UBOUND (Z, 2), & + & KFLEVG, & + & LBOUND (Z, 4):UBOUND (Z, 4))) + +DO ILEV2 = 1, NLEV2 + ZLEV2 = REAL (ILEV2 - 1) / REAL (NLEV2 -1) + ZLEV1 = 1. + ZLEV2 * REAL (NLEV1 - 1) + ILEV1B = MIN (CEILING (ZLEV1), NLEV1) + ILEV1A = MAX (FLOOR (ZLEV1), 1) + + IF (ILEV1A == ILEV1B) THEN + ZWA = 1. + ZWB = 0. + ELSE + ZWA = REAL (ILEV1B) - ZLEV1 + ZWB = ZLEV1 - REAL (ILEV1A) + ENDIF + +! WRITE (*, '(" ZLEV2 = ",E12.5," ZLEV1 = ",E12.5," ILEV2 = ",I4," ILEV1A = ",I4," ZWA = ",E12.5," ILEV1B = ",I4," ZWB = ",E12.5)') & +! & ZLEV2, ZLEV1, ILEV2, ILEV1A, ZWA, ILEV1B, ZWB + + L (1:KOFF, :, ILEV2, :) = ZWA * MERGE(1., 0., Z (1:KOFF, :, ILEV1A, :)) + ZWB * MERGE(1., 0., Z (1:KOFF, :, ILEV1B, :)) >= 0.5 +ENDDO + +END SUBROUTINE + + +SUBROUTINE SET3 (P) +IMPLICIT NONE + +REAL :: P (:,:,:) +INTEGER :: IBL, IGPBLKS +INTEGER :: NTID, ITID, JBLK1, JBLK2 + + +IGPBLKS = SIZE (P, 3) + +!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) +NTID = OMP_GET_MAX_THREADS () +ITID = OMP_GET_THREAD_NUM () +JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID +JBLK2 = (IGPBLKS * (ITID+1)) / NTID + +DO IBL = JBLK1, JBLK2 + P (:,:,IBL) = XINVALID +ENDDO + +!$OMP END PARALLEL + +END SUBROUTINE + +SUBROUTINE SET4 (P) +IMPLICIT NONE + +REAL :: P (:,:,:,:) +INTEGER :: IBL, IGPBLKS +INTEGER :: NTID, ITID, JBLK1, JBLK2 + +IGPBLKS = SIZE (P, 4) + +!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) +NTID = OMP_GET_MAX_THREADS () +ITID = OMP_GET_THREAD_NUM () +JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID +JBLK2 = (IGPBLKS * (ITID+1)) / NTID + +DO IBL = JBLK1, JBLK2 + P (:,:,:,IBL) = XINVALID +ENDDO + +!$OMP END PARALLEL + +END SUBROUTINE + +SUBROUTINE SET5 (P) +IMPLICIT NONE + +REAL :: P (:,:,:,:,:) +INTEGER :: IBL, IGPBLKS +INTEGER :: NTID, ITID, JBLK1, JBLK2 + +IGPBLKS = SIZE (P, 5) + +!$OMP PARALLEL PRIVATE (ITID, JBLK1, JBLK2, NTID) +NTID = OMP_GET_MAX_THREADS () +ITID = OMP_GET_THREAD_NUM () +JBLK1 = 1 + (IGPBLKS * (ITID+0)) / NTID +JBLK2 = (IGPBLKS * (ITID+1)) / NTID + +DO IBL = JBLK1, JBLK2 + P (:,:,:,:,IBL) = XINVALID +ENDDO + +!$OMP END PARALLEL + +END SUBROUTINE + +END MODULE ARRAYS_MANIP diff --git a/src/testprogs/support/diff.F90 b/src/testprogs/support/diff.F90 new file mode 100644 index 0000000000000000000000000000000000000000..37603ee04b065182f4a2b4a7b01ddbd1fb316a16 --- /dev/null +++ b/src/testprogs/support/diff.F90 @@ -0,0 +1,114 @@ +MODULE COMPUTE_DIFF + +INTERFACE DIFF + MODULE PROCEDURE DIFF3 + MODULE PROCEDURE DIFF2 +END INTERFACE DIFF + +CONTAINS + +SUBROUTINE DIFF3 (CDNAME, PREF, POUT, LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) +IMPLICIT NONE + +CHARACTER (LEN=*) :: CDNAME +REAL, INTENT(IN) :: PREF (:,:,:) +REAL, INTENT(IN) :: POUT (:,:,:) +LOGICAL, INTENT(IN) :: LLSTAT, LLCHECK, LLCHECKDIFF +INTEGER, INTENT(IN) :: NPROMA +LOGICAL, INTENT(OUT) :: LLDIFF + +INTEGER :: JLON, JLEV, KLEV + +KLEV=SIZE(PREF, 3) + +PRINT *, CDNAME +IF (LLSTAT) THEN + PRINT *, MINVAL (PREF), MAXVAL (PREF), SUM (PREF) / SIZE (PREF) + PRINT *, MINVAL (POUT), MAXVAL (POUT), SUM (POUT) / SIZE (POUT) +ENDIF + +IF (LLCHECK) THEN + IF (SUM (ABS (POUT) + ABS (PREF)) > 0) THEN + WRITE (*, '(A4)', ADVANCE='NO') "" + DO JLON = 1, NPROMA + WRITE (*, '("|",I12,"..",A12)', ADVANCE='NO') JLON, "" + ENDDO + WRITE (*, '("|")') + DO JLEV = 1, KLEV + WRITE (*, '(I4)', ADVANCE='NO') JLEV + DO JLON = 1, NPROMA + IF (ABS (PREF (JLON, 1, JLEV)) + ABS (POUT (JLON, 1, JLEV)) == 0.) THEN + WRITE (*, '("|",A12,"..",A12)', ADVANCE='NO') "", "" + ELSE + IF(ABS(POUT (JLON, 1, JLEV)-PREF (JLON, 1, JLEV))>0.001 * ABS(PREF (JLON, 1, JLEV))) THEN + WRITE (*, '("|",E12.5,"!=",E12.5)', ADVANCE='NO') PREF (JLON, 1, JLEV), POUT (JLON, 1, JLEV) + ELSE + WRITE (*, '("|",E12.5,"~=",E12.5)', ADVANCE='NO') PREF (JLON, 1, JLEV), POUT (JLON, 1, JLEV) + ENDIF + ENDIF + ENDDO + WRITE (*, '("|")') + ENDDO + ENDIF +ENDIF + +IF (LLCHECKDIFF) THEN + IF (SUM(ABS(POUT-PREF)) > 0.) THEN + PRINT*, "THERE ARE DIFF" + LLDIFF = .TRUE. + ELSE + PRINT*, "THERE IS NO DIFF" + ENDIF +ENDIF + +END SUBROUTINE + +SUBROUTINE DIFF2 (CDNAME, PREF, POUT, LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) +IMPLICIT NONE + +CHARACTER (LEN=*) :: CDNAME +REAL, INTENT(IN) :: PREF (:,:) +REAL, INTENT(IN) :: POUT (:,:) +LOGICAL, INTENT(IN) :: LLSTAT, LLCHECK, LLCHECKDIFF +INTEGER, INTENT(IN) :: NPROMA +LOGICAL, INTENT(OUT) :: LLDIFF + +INTEGER :: JLON + +PRINT *, CDNAME +IF (LLSTAT) THEN + PRINT *, MINVAL (PREF), MAXVAL (PREF), SUM (PREF) / SIZE (PREF) + PRINT *, MINVAL (POUT), MAXVAL (POUT), SUM (POUT) / SIZE (POUT) +ENDIF + +IF (LLCHECK) THEN + IF (SUM (ABS (POUT) + ABS (PREF)) > 0) THEN + WRITE (*, '(A4)', ADVANCE='NO') "" + DO JLON = 1, NPROMA + WRITE (*, '("|",I12,A12)', ADVANCE='NO') JLON, "" + ENDDO + WRITE (*, '("|")') + WRITE (*, '(I4)', ADVANCE='NO') 0 + DO JLON = 1, NPROMA + IF (ABS (PREF (JLON, 1)) + ABS (POUT (JLON, 1)) == 0.) THEN + WRITE (*, '("|",2A12)', ADVANCE='NO') "", "" + ELSE + WRITE (*, '("|",2E12.5)', ADVANCE='NO') PREF (JLON, 1), POUT (JLON, 1) + ENDIF + ENDDO + WRITE (*, '("|")') + ENDIF +ENDIF + +IF (LLCHECKDIFF) THEN + IF (SUM(ABS(POUT-PREF)) > 0.) THEN + PRINT*, "THERE ARE DIFF" + LLDIFF = .TRUE. + ELSE + PRINT*, "THERE IS NO DIFF" + ENDIF +ENDIF + +END SUBROUTINE + +END MODULE COMPUTE_DIFF diff --git a/src/testprogs/turb_mnh/getdata_turb_mod.F90 b/src/testprogs/turb_mnh/getdata_turb_mod.F90 new file mode 100644 index 0000000000000000000000000000000000000000..30fa20586d763d69b69a0f185d2eb29c6e5d61de --- /dev/null +++ b/src/testprogs/turb_mnh/getdata_turb_mod.F90 @@ -0,0 +1,784 @@ +MODULE GETDATA_TURB_MOD + +USE ARRAYS_MANIP, ONLY: SETUP, REPLICATE, NPROMIZE, INTERPOLATE, SET + +CONTAINS + +SUBROUTINE GETDATA_TURB (NPROMA, NGPBLKS, NFLEVG, KRR, KRRL, KRRI, KSV, KLEV, & + !IN and INOUT (allocation and reading) + &ZDXX_B, ZDYY_B, ZDZZ_B, ZDZX_B, ZDZY_B, ZZZ_B, & + &ZDIRCOSXW_B, ZDIRCOSYW_B, ZDIRCOSZW_B, ZCOSSLOPE_B, ZSINSLOPE_B, & + &PRHODJ_B, PTHVREF_B, & + &PSFTH_B, PSFRV_B, PSFU_B, PSFV_B, PSFSV_B, & + &PPABSM_B, PUM_B, PVM_B, PWM_B, PTKEM_B, ZSVM_B, PSRCM_B, & + &PLENGTHM_B, PLENGTHH_B, MFMOIST_B, & + &ZBL_DEPTH_B, ZSBL_DEPTH_B, & + &ZCEI_B, & + &PTHM_B, ZRM_B, & + &PRUS_B, PRVS_B, PRWS_B, PRTHS_B, ZRRS_B, ZRSVS_B, PRTKES_OUT_B, & + &PFLXZTHVMF_B, & + &PHGRAD_B, PZS_B, & + !OUT (allocation) + &PSIGS_B, & + &ZWTH_B,ZWRC_B,ZWSV_B,PDP_B,PTP_B,PTDIFF_B,PTDISS_B, & + &PEDR_B,PTPMF_B, & + &PDRUS_TURB_B,PDRVS_TURB_B, & + &PDRTHLS_TURB_B,PDRRTS_TURB_B,ZDRSVS_TURB_B, & + !OUT and INOUT (expected values) + &ZBL_DEPTH_OUT_B, ZSBL_DEPTH_OUT_B, & + &PTHM_OUT_B, ZRM_OUT_B, & + &PRUS_OUT_B, PRVS_OUT_B, PRWS_OUT_B, PRTHS_OUT_B, ZRRS_OUT_B, ZRSVS_OUT_B, PRTKES_OUT_OUT_B, & + &PSIGS_OUT_B, & + &ZWTH_OUT_B, ZWRC_OUT_B, ZWSV_OUT_B, PDP_OUT_B, PTP_OUT_B, PTDIFF_OUT_B, PTDISS_OUT_B, & + &PEDR_OUT_B, PTPMF_OUT_B, & + &PDRUS_TURB_OUT_B, PDRVS_TURB_OUT_B, & + &PDRTHLS_TURB_OUT_B, PDRRTS_TURB_OUT_B, ZDRSVS_TURB_OUT_B) + +IMPLICIT NONE + +INTEGER, PARAMETER :: IFILE = 77 + +INTEGER :: KLON +INTEGER :: KIDIA +INTEGER :: KFDIA +INTEGER :: KLEV +INTEGER :: KRR, KRRL, KRRI +INTEGER :: KSV +INTEGER :: KDUM + +LOGICAL :: LDVERBOSE + +!IN and INOUTS +REAL, ALLOCATABLE :: ZDXX_B (:,:,:,:) +REAL, ALLOCATABLE :: ZDYY_B (:,:,:,:) +REAL, ALLOCATABLE :: ZDZZ_B (:,:,:,:) +REAL, ALLOCATABLE :: ZDZX_B (:,:,:,:) +REAL, ALLOCATABLE :: ZDZY_B (:,:,:,:) +REAL, ALLOCATABLE :: ZZZ_B (:,:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSXW_B (:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSYW_B (:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSZW_B (:,:,:) +REAL, ALLOCATABLE :: ZCOSSLOPE_B (:,:,:) +REAL, ALLOCATABLE :: ZSINSLOPE_B (:,:,:) +REAL, ALLOCATABLE :: PRHODJ_B (:,:,:,:) +REAL, ALLOCATABLE :: PTHVREF_B (:,:,:,:) +REAL, ALLOCATABLE :: PSFTH_B (:,:,:) +REAL, ALLOCATABLE :: PSFRV_B (:,:,:) +REAL, ALLOCATABLE :: PSFU_B (:,:,:) +REAL, ALLOCATABLE :: PSFV_B (:,:,:) +REAL, ALLOCATABLE :: PSFSV_B (:,:,:,:) !(KLON, 1, KSV) +REAL, ALLOCATABLE :: PPABSM_B (:,:,:,:) +REAL, ALLOCATABLE :: PUM_B (:,:,:,:) +REAL, ALLOCATABLE :: PVM_B (:,:,:,:) +REAL, ALLOCATABLE :: PWM_B (:,:,:,:) +REAL, ALLOCATABLE :: PTKEM_B (:,:,:,:) +REAL, ALLOCATABLE :: ZSVM_B (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PSRCM_B (:,:,:,:) +REAL, ALLOCATABLE :: PLENGTHM_B (:,:,:,:) +REAL, ALLOCATABLE :: PLENGTHH_B (:,:,:,:) +REAL, ALLOCATABLE :: MFMOIST_B (:,:,:,:) +REAL, ALLOCATABLE :: ZBL_DEPTH_B (:,:,:) +REAL, ALLOCATABLE :: ZSBL_DEPTH_B (:,:,:) +REAL, ALLOCATABLE :: ZCEI_B (:,:,:,:) +REAL, ALLOCATABLE :: PTHM_B (:,:,:,:) +REAL, ALLOCATABLE :: ZRM_B (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: PRUS_B (:,:,:,:) +REAL, ALLOCATABLE :: PRVS_B (:,:,:,:) +REAL, ALLOCATABLE :: PRWS_B (:,:,:,:) +REAL, ALLOCATABLE :: PRTHS_B (:,:,:,:) +REAL, ALLOCATABLE :: ZRRS_B (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: ZRSVS_B (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PRTKES_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PFLXZTHVMF_B (:,:,:,:) +REAL, ALLOCATABLE :: PHGRAD_B (:,:,:,:,:) !(KLON,1,KLEV+2,KGRADIENTS) +REAL, ALLOCATABLE :: PZS_B (:,:,:) + +!OUT +REAL, ALLOCATABLE :: PSIGS_B (:,:,:,:) +REAL, ALLOCATABLE :: ZWTH_B (:,:,:,:) +REAL, ALLOCATABLE :: ZWRC_B (:,:,:,:) +REAL, ALLOCATABLE :: ZWSV_B (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PDP_B (:,:,:,:) +REAL, ALLOCATABLE :: PTP_B (:,:,:,:) +REAL, ALLOCATABLE :: PTDIFF_B (:,:,:,:) +REAL, ALLOCATABLE :: PTDISS_B (:,:,:,:) +REAL, ALLOCATABLE :: PEDR_B (:,:,:,:) +REAL, ALLOCATABLE :: PTPMF_B (:,:,:,:) +REAL, ALLOCATABLE :: PDRUS_TURB_B (:,:,:,:) +REAL, ALLOCATABLE :: PDRVS_TURB_B (:,:,:,:) +REAL, ALLOCATABLE :: PDRTHLS_TURB_B (:,:,:,:) +REAL, ALLOCATABLE :: PDRRTS_TURB_B (:,:,:,:) +REAL, ALLOCATABLE :: ZDRSVS_TURB_B (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) + +!Expected values +REAL, ALLOCATABLE :: ZBL_DEPTH_OUT_B (:,:,:) +REAL, ALLOCATABLE :: ZSBL_DEPTH_OUT_B (:,:,:) +REAL, ALLOCATABLE :: PTHM_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: ZRM_OUT_B (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: PRUS_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PRVS_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PRWS_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PRTHS_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: ZRRS_OUT_B (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: ZRSVS_OUT_B (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PRTKES_OUT_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PSIGS_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: ZWTH_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: ZWRC_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: ZWSV_OUT_B (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PDP_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PTP_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PTDIFF_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PTDISS_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PEDR_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PTPMF_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PDRUS_TURB_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PDRVS_TURB_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PDRTHLS_TURB_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: PDRRTS_TURB_OUT_B (:,:,:,:) +REAL, ALLOCATABLE :: ZDRSVS_TURB_OUT_B (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) + +!Inputs to read +REAL, ALLOCATABLE :: ZDXX (:,:,:,:) +REAL, ALLOCATABLE :: ZDYY (:,:,:,:) +REAL, ALLOCATABLE :: ZDZZ (:,:,:,:) +REAL, ALLOCATABLE :: ZDZX (:,:,:,:) +REAL, ALLOCATABLE :: ZDZY (:,:,:,:) +REAL, ALLOCATABLE :: ZZZ (:,:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSXW (:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSYW (:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSZW (:,:,:) +REAL, ALLOCATABLE :: ZCOSSLOPE (:,:,:) +REAL, ALLOCATABLE :: ZSINSLOPE (:,:,:) +REAL, ALLOCATABLE :: PRHODJ (:,:,:,:) +REAL, ALLOCATABLE :: PTHVREF (:,:,:,:) +REAL, ALLOCATABLE :: PSFTH (:,:,:) +REAL, ALLOCATABLE :: PSFRV (:,:,:) +REAL, ALLOCATABLE :: PSFU (:,:,:) +REAL, ALLOCATABLE :: PSFV (:,:,:) +REAL, ALLOCATABLE :: PSFSV (:,:,:,:) !(KLON, 1, KSV) +REAL, ALLOCATABLE :: PPABSM (:,:,:,:) +REAL, ALLOCATABLE :: PUM (:,:,:,:) +REAL, ALLOCATABLE :: PVM (:,:,:,:) +REAL, ALLOCATABLE :: PWM (:,:,:,:) +REAL, ALLOCATABLE :: PTKEM (:,:,:,:) +REAL, ALLOCATABLE :: ZSVM (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PSRCM (:,:,:,:) +REAL, ALLOCATABLE :: PLENGTHM (:,:,:,:) +REAL, ALLOCATABLE :: PLENGTHH (:,:,:,:) +REAL, ALLOCATABLE :: MFMOIST (:,:,:,:) +REAL, ALLOCATABLE :: ZBL_DEPTH (:,:,:) +REAL, ALLOCATABLE :: ZSBL_DEPTH (:,:,:) +REAL, ALLOCATABLE :: ZCEI (:,:,:,:) +REAL, ALLOCATABLE :: PTHM (:,:,:,:) +REAL, ALLOCATABLE :: ZRM (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: PRUS (:,:,:,:) +REAL, ALLOCATABLE :: PRVS (:,:,:,:) +REAL, ALLOCATABLE :: PRWS (:,:,:,:) +REAL, ALLOCATABLE :: PRTHS (:,:,:,:) +REAL, ALLOCATABLE :: ZRRS (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: ZRSVS (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PRTKES_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PFLXZTHVMF (:,:,:,:) +!Expected values to read +REAL, ALLOCATABLE :: ZBL_DEPTH_OUT (:,:,:) +REAL, ALLOCATABLE :: ZSBL_DEPTH_OUT (:,:,:) +REAL, ALLOCATABLE :: PTHM_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZRM_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: PRUS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PRVS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PRWS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PRTHS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZRRS_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: ZRSVS_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PRTKES_OUT_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PSIGS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZWTH_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZWRC_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZWSV_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PDP_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PTP_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PTDIFF_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PTDISS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PEDR_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PTPMF_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PDRUS_TURB_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PDRVS_TURB_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PDRTHLS_TURB_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PDRRTS_TURB_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZDRSVS_TURB_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) + +INTEGER :: NGPTOT, NPROMA, NGPBLKS, NFLEVG +INTEGER :: IOFF, IBL +LOGICAL :: LLEXIST +CHARACTER(LEN=32) :: CLFILE + +CALL SETUP() + +NGPTOT = NPROMA * NGPBLKS + +IBL = 1 +WRITE (CLFILE, '("data/",I8.8,".dat")') IBL +OPEN (IFILE, FILE=TRIM (CLFILE), FORM='UNFORMATTED') +READ (IFILE) KLON, KDUM, KLEV +READ (IFILE) KRR, KRRL, KRRI, KSV +CLOSE (IFILE) + +IF (NFLEVG < 0) NFLEVG = KLEV + +ALLOCATE (ZDXX_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZDYY_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZDZZ_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZDZX_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZDZY_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZZZ_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZDIRCOSXW_B (NPROMA,1,NGPBLKS)) +ALLOCATE (ZDIRCOSYW_B (NPROMA,1,NGPBLKS)) +ALLOCATE (ZDIRCOSZW_B (NPROMA,1,NGPBLKS)) +ALLOCATE (ZCOSSLOPE_B (NPROMA,1,NGPBLKS)) +ALLOCATE (ZSINSLOPE_B (NPROMA,1,NGPBLKS)) +ALLOCATE (PRHODJ_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTHVREF_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PSFTH_B (NPROMA,1,NGPBLKS)) +ALLOCATE (PSFRV_B (NPROMA,1,NGPBLKS)) +ALLOCATE (PSFU_B (NPROMA,1,NGPBLKS)) +ALLOCATE (PSFV_B (NPROMA,1,NGPBLKS)) +ALLOCATE (PSFSV_B (NPROMA,1,KSV,NGPBLKS)) +ALLOCATE (PPABSM_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PUM_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PVM_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PWM_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTKEM_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZSVM_B (NPROMA,1,NFLEVG,KSV,NGPBLKS)) +ALLOCATE (PSRCM_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PLENGTHM_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PLENGTHH_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (MFMOIST_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZBL_DEPTH_B (NPROMA,1,NGPBLKS)) +ALLOCATE (ZSBL_DEPTH_B (NPROMA,1,NGPBLKS)) +ALLOCATE (ZCEI_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTHM_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZRM_B (NPROMA,1,NFLEVG,KRR,NGPBLKS)) +ALLOCATE (PRUS_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PRVS_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PRWS_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PRTHS_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZRRS_B (NPROMA,1,NFLEVG,KRR,NGPBLKS)) +ALLOCATE (ZRSVS_B (NPROMA,1,NFLEVG,KSV,NGPBLKS)) +ALLOCATE (PRTKES_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PFLXZTHVMF_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PHGRAD_B (NPROMA,1,NFLEVG,0,NGPBLKS)) +ALLOCATE (PZS_B (NPROMA,1,NGPBLKS)) + +ALLOCATE (PSIGS_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZWTH_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZWRC_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZWSV_B (NPROMA,1,NFLEVG,KSV,NGPBLKS)) +ALLOCATE (PDP_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTP_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTDIFF_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTDISS_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PEDR_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTPMF_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PDRUS_TURB_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PDRVS_TURB_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PDRTHLS_TURB_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PDRRTS_TURB_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZDRSVS_TURB_B (NPROMA,1,NFLEVG,KSV,NGPBLKS)) + +ALLOCATE (ZBL_DEPTH_OUT_B (NPROMA,1,NGPBLKS)) +ALLOCATE (ZSBL_DEPTH_OUT_B (NPROMA,1,NGPBLKS)) +ALLOCATE (PTHM_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZRM_OUT_B (NPROMA,1,NFLEVG,KRR,NGPBLKS)) +ALLOCATE (PRUS_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PRVS_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PRWS_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PRTHS_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZRRS_OUT_B (NPROMA,1,NFLEVG,KRR,NGPBLKS)) +ALLOCATE (ZRSVS_OUT_B (NPROMA,1,NFLEVG,KSV,NGPBLKS)) +ALLOCATE (PRTKES_OUT_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PSIGS_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZWTH_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZWRC_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZWSV_OUT_B (NPROMA,1,NFLEVG,KSV,NGPBLKS)) +ALLOCATE (PDP_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTP_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTDIFF_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTDISS_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PEDR_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PTPMF_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PDRUS_TURB_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PDRVS_TURB_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PDRTHLS_TURB_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (PDRRTS_TURB_OUT_B (NPROMA,1,NFLEVG,NGPBLKS)) +ALLOCATE (ZDRSVS_TURB_OUT_B (NPROMA,1,NFLEVG,KSV,NGPBLKS)) + +CALL SET (ZDXX_B ) +CALL SET (ZDYY_B ) +CALL SET (ZDZZ_B ) +CALL SET (ZDZX_B ) +CALL SET (ZDZY_B ) +CALL SET (ZZZ_B ) +CALL SET (ZDIRCOSXW_B ) +CALL SET (ZDIRCOSYW_B ) +CALL SET (ZDIRCOSZW_B ) +CALL SET (ZCOSSLOPE_B ) +CALL SET (ZSINSLOPE_B ) +CALL SET (PRHODJ_B ) +CALL SET (PTHVREF_B ) +CALL SET (PSFTH_B ) +CALL SET (PSFRV_B ) +CALL SET (PSFU_B ) +CALL SET (PSFV_B ) +CALL SET (PSFSV_B ) +CALL SET (PPABSM_B ) +CALL SET (PUM_B ) +CALL SET (PVM_B ) +CALL SET (PWM_B ) +CALL SET (PTKEM_B ) +CALL SET (ZSVM_B ) +CALL SET (PSRCM_B ) +CALL SET (PLENGTHM_B ) +CALL SET (PLENGTHH_B ) +CALL SET (MFMOIST_B ) +CALL SET (ZBL_DEPTH_B ) +CALL SET (ZSBL_DEPTH_B ) +CALL SET (ZCEI_B ) +CALL SET (PTHM_B ) +CALL SET (ZRM_B ) +CALL SET (PRUS_B ) +CALL SET (PRVS_B ) +CALL SET (PRWS_B ) +CALL SET (PRTHS_B ) +CALL SET (ZRRS_B ) +CALL SET (ZRSVS_B ) +CALL SET (PRTKES_OUT_B ) +CALL SET (PFLXZTHVMF_B ) +CALL SET (PHGRAD_B ) +CALL SET (PZS_B ) + +CALL SET (PSIGS_B ) +CALL SET (ZWTH_B ) +CALL SET (ZWRC_B ) +CALL SET (ZWSV_B ) +CALL SET (PDP_B ) +CALL SET (PTP_B ) +CALL SET (PTDIFF_B ) +CALL SET (PTDISS_B ) +CALL SET (PEDR_B ) +CALL SET (PTPMF_B ) +CALL SET (PDRUS_TURB_B ) +CALL SET (PDRVS_TURB_B ) +CALL SET (PDRTHLS_TURB_B ) +CALL SET (PDRRTS_TURB_B ) +CALL SET (ZDRSVS_TURB_B ) + +CALL SET (ZBL_DEPTH_OUT_B ) +CALL SET (ZSBL_DEPTH_OUT_B ) +CALL SET (PTHM_OUT_B ) +CALL SET (ZRM_OUT_B ) +CALL SET (PRUS_OUT_B ) +CALL SET (PRVS_OUT_B ) +CALL SET (PRWS_OUT_B ) +CALL SET (PRTHS_OUT_B ) +CALL SET (ZRRS_OUT_B ) +CALL SET (ZRSVS_OUT_B ) +CALL SET (PRTKES_OUT_OUT_B ) +CALL SET (PSIGS_OUT_B ) +CALL SET (ZWTH_OUT_B ) +CALL SET (ZWRC_OUT_B ) +CALL SET (ZWSV_OUT_B ) +CALL SET (PDP_OUT_B ) +CALL SET (PTP_OUT_B ) +CALL SET (PTDIFF_OUT_B ) +CALL SET (PTDISS_OUT_B ) +CALL SET (PEDR_OUT_B ) +CALL SET (PTPMF_OUT_B ) +CALL SET (PDRUS_TURB_OUT_B ) +CALL SET (PDRVS_TURB_OUT_B ) +CALL SET (PDRTHLS_TURB_OUT_B ) +CALL SET (PDRRTS_TURB_OUT_B ) +CALL SET (ZDRSVS_TURB_OUT_B ) + +IOFF = 0 +IBL = 0 +LLEXIST = .TRUE. + +DO WHILE(LLEXIST) + IBL = IBL + 1 + WRITE (CLFILE, '("data/",I8.8,".dat")') IBL + + INQUIRE (FILE=TRIM (CLFILE), EXIST=LLEXIST) + + IF (LDVERBOSE) PRINT *, TRIM (CLFILE) + + IF (.NOT. LLEXIST) EXIT + + OPEN (IFILE, FILE=TRIM (CLFILE), FORM='UNFORMATTED') + + READ (IFILE) KLON, KDUM, KLEV + READ (IFILE) KRR, KRRL, KRRI, KSV + + IF (IBL == 1) THEN + ALLOCATE (ZDXX (NGPTOT,1,KLEV,1)) + ALLOCATE (ZDYY (NGPTOT,1,KLEV,1)) + ALLOCATE (ZDZZ (NGPTOT,1,KLEV,1)) + ALLOCATE (ZDZX (NGPTOT,1,KLEV,1)) + ALLOCATE (ZDZY (NGPTOT,1,KLEV,1)) + ALLOCATE (ZZZ (NGPTOT,1,KLEV,1)) + ALLOCATE (ZDIRCOSXW (NGPTOT,1,1)) + ALLOCATE (ZDIRCOSYW (NGPTOT,1,1)) + ALLOCATE (ZDIRCOSZW (NGPTOT,1,1)) + ALLOCATE (ZCOSSLOPE (NGPTOT,1,1)) + ALLOCATE (ZSINSLOPE (NGPTOT,1,1)) + ALLOCATE (PRHODJ (NGPTOT,1,KLEV,1)) + ALLOCATE (PTHVREF (NGPTOT,1,KLEV,1)) + ALLOCATE (PSFTH (NGPTOT,1,1)) + ALLOCATE (PSFRV (NGPTOT,1,1)) + ALLOCATE (PSFU (NGPTOT,1,1)) + ALLOCATE (PSFV (NGPTOT,1,1)) + ALLOCATE (PSFSV (NGPTOT,1,KSV,1)) + ALLOCATE (PPABSM (NGPTOT,1,KLEV,1)) + ALLOCATE (PUM (NGPTOT,1,KLEV,1)) + ALLOCATE (PVM (NGPTOT,1,KLEV,1)) + ALLOCATE (PWM (NGPTOT,1,KLEV,1)) + ALLOCATE (PTKEM (NGPTOT,1,KLEV,1)) + ALLOCATE (ZSVM (NGPTOT,1,KLEV,KSV,1)) + ALLOCATE (PSRCM (NGPTOT,1,KLEV,1)) + ALLOCATE (PLENGTHM (NGPTOT,1,KLEV,1)) + ALLOCATE (PLENGTHH (NGPTOT,1,KLEV,1)) + ALLOCATE (MFMOIST (NGPTOT,1,KLEV,1)) + ALLOCATE (ZBL_DEPTH (NGPTOT,1,1)) + ALLOCATE (ZSBL_DEPTH (NGPTOT,1,1)) + ALLOCATE (ZCEI (NGPTOT,1,KLEV,1)) + ALLOCATE (PTHM (NGPTOT,1,KLEV,1)) + ALLOCATE (ZRM (NGPTOT,1,KLEV,KRR,1)) + ALLOCATE (PRUS (NGPTOT,1,KLEV,1)) + ALLOCATE (PRVS (NGPTOT,1,KLEV,1)) + ALLOCATE (PRWS (NGPTOT,1,KLEV,1)) + ALLOCATE (PRTHS (NGPTOT,1,KLEV,1)) + ALLOCATE (ZRRS (NGPTOT,1,KLEV,KRR,1)) + ALLOCATE (ZRSVS (NGPTOT,1,KLEV,KSV,1)) + ALLOCATE (PRTKES_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PFLXZTHVMF (NGPTOT,1,KLEV,1)) + + ALLOCATE (ZBL_DEPTH_OUT (NGPTOT,1,1)) + ALLOCATE (ZSBL_DEPTH_OUT (NGPTOT,1,1)) + ALLOCATE (PTHM_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (ZRM_OUT (NGPTOT,1,KLEV,KRR,1)) + ALLOCATE (PRUS_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PRVS_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PRWS_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PRTHS_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (ZRRS_OUT (NGPTOT,1,KLEV,KRR,1)) + ALLOCATE (ZRSVS_OUT (NGPTOT,1,KLEV,KSV,1)) + ALLOCATE (PRTKES_OUT_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PSIGS_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (ZWTH_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (ZWRC_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (ZWSV_OUT (NGPTOT,1,KLEV,KSV,1)) + ALLOCATE (PDP_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PTP_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PTDIFF_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PTDISS_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PEDR_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PTPMF_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PDRUS_TURB_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PDRVS_TURB_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PDRTHLS_TURB_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (PDRRTS_TURB_OUT (NGPTOT,1,KLEV,1)) + ALLOCATE (ZDRSVS_TURB_OUT (NGPTOT,1,KLEV,KSV,1)) + ENDIF + + IF (IOFF+KLON > NGPTOT) THEN + EXIT + ENDIF + + READ(IFILE) ZDXX (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZDYY (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZDZZ (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZDZX (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZDZY (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZZZ (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZDIRCOSXW (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) ZDIRCOSYW (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) ZDIRCOSZW (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) ZCOSSLOPE (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) ZSINSLOPE (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) PRHODJ (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PTHVREF (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PSFTH (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) PSFRV (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) PSFU (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) PSFV (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) PSFSV (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PPABSM (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PUM (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PVM (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PWM (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PTKEM (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZSVM (IOFF+1:IOFF+KLON,:,:,:,1) + READ(IFILE) PSRCM (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PLENGTHM (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PLENGTHH (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) MFMOIST (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZBL_DEPTH (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) ZSBL_DEPTH (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) ZCEI (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PTHM (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZRM (IOFF+1:IOFF+KLON,:,:,:,1) + READ(IFILE) PRUS (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PRVS (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PRWS (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PRTHS (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZRRS (IOFF+1:IOFF+KLON,:,:,:,1) + READ(IFILE) ZRSVS (IOFF+1:IOFF+KLON,:,:,:,1) + READ(IFILE) PRTKES_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PFLXZTHVMF (IOFF+1:IOFF+KLON,:,:,1) + + READ(IFILE) ZBL_DEPTH_OUT (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) ZSBL_DEPTH_OUT (IOFF+1:IOFF+KLON,:,1) + READ(IFILE) PTHM_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZRM_OUT (IOFF+1:IOFF+KLON,:,:,:,1) + READ(IFILE) PRUS_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PRVS_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PRWS_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PRTHS_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZRRS_OUT (IOFF+1:IOFF+KLON,:,:,:,1) + READ(IFILE) ZRSVS_OUT (IOFF+1:IOFF+KLON,:,:,:,1) + READ(IFILE) PRTKES_OUT_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PSIGS_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZWTH_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZWRC_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZWSV_OUT (IOFF+1:IOFF+KLON,:,:,:,1) + READ(IFILE) PDP_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PTP_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PTDIFF_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PTDISS_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PEDR_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PTPMF_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PDRUS_TURB_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PDRVS_TURB_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PDRTHLS_TURB_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) PDRRTS_TURB_OUT (IOFF+1:IOFF+KLON,:,:,1) + READ(IFILE) ZDRSVS_TURB_OUT (IOFF+1:IOFF+KLON,:,:,:,1) + + CLOSE (IFILE) + + IOFF = IOFF + KLON + +ENDDO + +IF (NFLEVG /= KLEV) THEN + CALL INTERPOLATE (NFLEVG, IOFF, ZDXX ) + CALL INTERPOLATE (NFLEVG, IOFF, ZDYY ) + CALL INTERPOLATE (NFLEVG, IOFF, ZDZZ ) + CALL INTERPOLATE (NFLEVG, IOFF, ZDZX ) + CALL INTERPOLATE (NFLEVG, IOFF, ZDZY ) + CALL INTERPOLATE (NFLEVG, IOFF, ZZZ ) +! CALL INTERPOLATE (NFLEVG, IOFF, ZDIRCOSXW_B ) +! CALL INTERPOLATE (NFLEVG, IOFF, ZDIRCOSYW_B ) +! CALL INTERPOLATE (NFLEVG, IOFF, ZDIRCOSZW_B ) +! CALL INTERPOLATE (NFLEVG, IOFF, ZCOSSLOPE ) +! CALL INTERPOLATE (NFLEVG, IOFF, ZSINSLOPE ) + CALL INTERPOLATE (NFLEVG, IOFF, PRHODJ ) + CALL INTERPOLATE (NFLEVG, IOFF, PTHVREF ) +! CALL INTERPOLATE (NFLEVG, IOFF, PSFTH ) +! CALL INTERPOLATE (NFLEVG, IOFF, PSFRV ) +! CALL INTERPOLATE (NFLEVG, IOFF, PSFU ) +! CALL INTERPOLATE (NFLEVG, IOFF, PSFV ) +! CALL INTERPOLATE (NFLEVG, IOFF, PSFSV ) + CALL INTERPOLATE (NFLEVG, IOFF, PPABSM ) + CALL INTERPOLATE (NFLEVG, IOFF, PUM ) + CALL INTERPOLATE (NFLEVG, IOFF, PVM ) + CALL INTERPOLATE (NFLEVG, IOFF, PWM ) + CALL INTERPOLATE (NFLEVG, IOFF, PTKEM ) + CALL INTERPOLATE (NFLEVG, IOFF, ZSVM ) + CALL INTERPOLATE (NFLEVG, IOFF, PSRCM ) + CALL INTERPOLATE (NFLEVG, IOFF, PLENGTHM ) + CALL INTERPOLATE (NFLEVG, IOFF, PLENGTHH ) + CALL INTERPOLATE (NFLEVG, IOFF, MFMOIST ) +! CALL INTERPOLATE (NFLEVG, IOFF, ZBL_DEPTH ) +! CALL INTERPOLATE (NFLEVG, IOFF, ZSBL_DEPTH ) + CALL INTERPOLATE (NFLEVG, IOFF, ZCEI ) + CALL INTERPOLATE (NFLEVG, IOFF, PTHM ) + CALL INTERPOLATE (NFLEVG, IOFF, ZRM ) + CALL INTERPOLATE (NFLEVG, IOFF, PRUS ) + CALL INTERPOLATE (NFLEVG, IOFF, PRVS ) + CALL INTERPOLATE (NFLEVG, IOFF, PRWS ) + CALL INTERPOLATE (NFLEVG, IOFF, PRTHS ) + CALL INTERPOLATE (NFLEVG, IOFF, ZRRS ) + CALL INTERPOLATE (NFLEVG, IOFF, ZRSVS ) + CALL INTERPOLATE (NFLEVG, IOFF, PRTKES_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PFLXZTHVMF ) + +! CALL INTERPOLATE (NFLEVG, IOFF, ZBL_DEPTH_OUT ) +! CALL INTERPOLATE (NFLEVG, IOFF, ZSBL_DEPTH_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PTHM_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, ZRM_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PRUS_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PRVS_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PRWS_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PRTHS_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, ZRRS_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, ZRSVS_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PRTKES_OUT_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PSIGS_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, ZWTH_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, ZWRC_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, ZWSV_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PDP_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PTP_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PTDIFF_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PTDISS_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PEDR_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PTPMF_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PDRUS_TURB_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PDRVS_TURB_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PDRTHLS_TURB_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, PDRRTS_TURB_OUT ) + CALL INTERPOLATE (NFLEVG, IOFF, ZDRSVS_TURB_OUT ) + +ENDIF + +CALL REPLICATE (IOFF, ZDXX (:,:,:,1)) +CALL REPLICATE (IOFF, ZDYY (:,:,:,1)) +CALL REPLICATE (IOFF, ZDZZ (:,:,:,1)) +CALL REPLICATE (IOFF, ZDZX (:,:,:,1)) +CALL REPLICATE (IOFF, ZDZY (:,:,:,1)) +CALL REPLICATE (IOFF, ZZZ (:,:,:,1)) +CALL REPLICATE (IOFF, ZDIRCOSXW (:,:,1)) +CALL REPLICATE (IOFF, ZDIRCOSYW (:,:,1)) +CALL REPLICATE (IOFF, ZDIRCOSZW (:,:,1)) +CALL REPLICATE (IOFF, ZCOSSLOPE (:,:,1)) +CALL REPLICATE (IOFF, ZSINSLOPE (:,:,1)) +CALL REPLICATE (IOFF, PRHODJ (:,:,:,1)) +CALL REPLICATE (IOFF, PTHVREF (:,:,:,1)) +CALL REPLICATE (IOFF, PSFTH (:,:,1)) +CALL REPLICATE (IOFF, PSFRV (:,:,1)) +CALL REPLICATE (IOFF, PSFU (:,:,1)) +CALL REPLICATE (IOFF, PSFV (:,:,1)) +CALL REPLICATE (IOFF, PSFSV (:,:,:,1)) +CALL REPLICATE (IOFF, PPABSM (:,:,:,1)) +CALL REPLICATE (IOFF, PUM (:,:,:,1)) +CALL REPLICATE (IOFF, PVM (:,:,:,1)) +CALL REPLICATE (IOFF, PWM (:,:,:,1)) +CALL REPLICATE (IOFF, PTKEM (:,:,:,1)) +CALL REPLICATE (IOFF, ZSVM (:,:,:,:,1)) +CALL REPLICATE (IOFF, PSRCM (:,:,:,1)) +CALL REPLICATE (IOFF, PLENGTHM (:,:,:,1)) +CALL REPLICATE (IOFF, PLENGTHH (:,:,:,1)) +CALL REPLICATE (IOFF, MFMOIST (:,:,:,1)) +CALL REPLICATE (IOFF, ZBL_DEPTH (:,:,1)) +CALL REPLICATE (IOFF, ZSBL_DEPTH (:,:,1)) +CALL REPLICATE (IOFF, ZCEI (:,:,:,1)) +CALL REPLICATE (IOFF, PTHM (:,:,:,1)) +CALL REPLICATE (IOFF, ZRM (:,:,:,:,1)) +CALL REPLICATE (IOFF, PRUS (:,:,:,1)) +CALL REPLICATE (IOFF, PRVS (:,:,:,1)) +CALL REPLICATE (IOFF, PRWS (:,:,:,1)) +CALL REPLICATE (IOFF, PRTHS (:,:,:,1)) +CALL REPLICATE (IOFF, ZRRS (:,:,:,:,1)) +CALL REPLICATE (IOFF, ZRSVS (:,:,:,:,1)) +CALL REPLICATE (IOFF, PRTKES_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PFLXZTHVMF (:,:,:,1)) + +CALL REPLICATE (IOFF, ZBL_DEPTH_OUT (:,:,1)) +CALL REPLICATE (IOFF, ZSBL_DEPTH_OUT (:,:,1)) +CALL REPLICATE (IOFF, PTHM_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, ZRM_OUT (:,:,:,:,1)) +CALL REPLICATE (IOFF, PRUS_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PRVS_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PRWS_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PRTHS_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, ZRRS_OUT (:,:,:,:,1)) +CALL REPLICATE (IOFF, ZRSVS_OUT (:,:,:,:,1)) +CALL REPLICATE (IOFF, PRTKES_OUT_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PSIGS_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, ZWTH_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, ZWRC_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, ZWSV_OUT (:,:,:,:,1)) +CALL REPLICATE (IOFF, PDP_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PTP_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PTDIFF_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PTDISS_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PEDR_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PTPMF_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PDRUS_TURB_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PDRVS_TURB_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PDRTHLS_TURB_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, PDRRTS_TURB_OUT (:,:,:,1)) +CALL REPLICATE (IOFF, ZDRSVS_TURB_OUT (:,:,:,:,1)) + +CALL NPROMIZE (NPROMA, ZDXX , ZDXX_B ) +CALL NPROMIZE (NPROMA, ZDYY , ZDYY_B ) +CALL NPROMIZE (NPROMA, ZDZZ , ZDZZ_B ) +CALL NPROMIZE (NPROMA, ZDZX , ZDZX_B ) +CALL NPROMIZE (NPROMA, ZDZY , ZDZY_B ) +CALL NPROMIZE (NPROMA, ZZZ , ZZZ_B ) +CALL NPROMIZE (NPROMA, ZDIRCOSXW , ZDIRCOSXW_B ) +CALL NPROMIZE (NPROMA, ZDIRCOSYW , ZDIRCOSYW_B ) +CALL NPROMIZE (NPROMA, ZDIRCOSZW , ZDIRCOSZW_B ) +CALL NPROMIZE (NPROMA, ZCOSSLOPE , ZCOSSLOPE_B ) +CALL NPROMIZE (NPROMA, ZSINSLOPE , ZSINSLOPE_B ) +CALL NPROMIZE (NPROMA, PRHODJ , PRHODJ_B ) +CALL NPROMIZE (NPROMA, PTHVREF , PTHVREF_B ) +CALL NPROMIZE (NPROMA, PSFTH , PSFTH_B ) +CALL NPROMIZE (NPROMA, PSFRV , PSFRV_B ) +CALL NPROMIZE (NPROMA, PSFU , PSFU_B ) +CALL NPROMIZE (NPROMA, PSFV , PSFV_B ) +CALL NPROMIZE (NPROMA, PSFSV , PSFSV_B ) +CALL NPROMIZE (NPROMA, PPABSM , PPABSM_B ) +CALL NPROMIZE (NPROMA, PUM , PUM_B ) +CALL NPROMIZE (NPROMA, PVM , PVM_B ) +CALL NPROMIZE (NPROMA, PWM , PWM_B ) +CALL NPROMIZE (NPROMA, PTKEM , PTKEM_B ) +CALL NPROMIZE (NPROMA, ZSVM , ZSVM_B ) +CALL NPROMIZE (NPROMA, PSRCM , PSRCM_B ) +CALL NPROMIZE (NPROMA, PLENGTHM , PLENGTHM_B ) +CALL NPROMIZE (NPROMA, PLENGTHH , PLENGTHH_B ) +CALL NPROMIZE (NPROMA, MFMOIST , MFMOIST_B ) +CALL NPROMIZE (NPROMA, ZBL_DEPTH , ZBL_DEPTH_B ) +CALL NPROMIZE (NPROMA, ZSBL_DEPTH , ZSBL_DEPTH_B ) +CALL NPROMIZE (NPROMA, ZCEI , ZCEI_B ) +CALL NPROMIZE (NPROMA, PTHM , PTHM_B ) +CALL NPROMIZE (NPROMA, ZRM , ZRM_B ) +CALL NPROMIZE (NPROMA, PRUS , PRUS_B ) +CALL NPROMIZE (NPROMA, PRVS , PRVS_B ) +CALL NPROMIZE (NPROMA, PRWS , PRWS_B ) +CALL NPROMIZE (NPROMA, PRTHS , PRTHS_B ) +CALL NPROMIZE (NPROMA, ZRRS , ZRRS_B ) +CALL NPROMIZE (NPROMA, ZRSVS , ZRSVS_B ) +CALL NPROMIZE (NPROMA, PRTKES_OUT , PRTKES_OUT_B ) +CALL NPROMIZE (NPROMA, PFLXZTHVMF , PFLXZTHVMF_B ) + +CALL NPROMIZE (NPROMA, ZBL_DEPTH_OUT , ZBL_DEPTH_OUT_B ) +CALL NPROMIZE (NPROMA, ZSBL_DEPTH_OUT , ZSBL_DEPTH_OUT_B ) +CALL NPROMIZE (NPROMA, PTHM_OUT , PTHM_OUT_B ) +CALL NPROMIZE (NPROMA, ZRM_OUT , ZRM_OUT_B ) +CALL NPROMIZE (NPROMA, PRUS_OUT , PRUS_OUT_B ) +CALL NPROMIZE (NPROMA, PRVS_OUT , PRVS_OUT_B ) +CALL NPROMIZE (NPROMA, PRWS_OUT , PRWS_OUT_B ) +CALL NPROMIZE (NPROMA, PRTHS_OUT , PRTHS_OUT_B ) +CALL NPROMIZE (NPROMA, ZRRS_OUT , ZRRS_OUT_B ) +CALL NPROMIZE (NPROMA, ZRSVS_OUT , ZRSVS_OUT_B ) +CALL NPROMIZE (NPROMA, PRTKES_OUT_OUT , PRTKES_OUT_OUT_B ) +CALL NPROMIZE (NPROMA, PSIGS_OUT , PSIGS_OUT_B ) +CALL NPROMIZE (NPROMA, ZWTH_OUT , ZWTH_OUT_B ) +CALL NPROMIZE (NPROMA, ZWRC_OUT , ZWRC_OUT_B ) +CALL NPROMIZE (NPROMA, ZWSV_OUT , ZWSV_OUT_B ) +CALL NPROMIZE (NPROMA, PDP_OUT , PDP_OUT_B ) +CALL NPROMIZE (NPROMA, PTP_OUT , PTP_OUT_B ) +CALL NPROMIZE (NPROMA, PTDIFF_OUT , PTDIFF_OUT_B ) +CALL NPROMIZE (NPROMA, PTDISS_OUT , PTDISS_OUT_B ) +CALL NPROMIZE (NPROMA, PEDR_OUT , PEDR_OUT_B ) +CALL NPROMIZE (NPROMA, PTPMF_OUT , PTPMF_OUT_B ) +CALL NPROMIZE (NPROMA, PDRUS_TURB_OUT , PDRUS_TURB_OUT_B ) +CALL NPROMIZE (NPROMA, PDRVS_TURB_OUT , PDRVS_TURB_OUT_B ) +CALL NPROMIZE (NPROMA, PDRTHLS_TURB_OUT , PDRTHLS_TURB_OUT_B ) +CALL NPROMIZE (NPROMA, PDRRTS_TURB_OUT , PDRRTS_TURB_OUT_B ) +CALL NPROMIZE (NPROMA, ZDRSVS_TURB_OUT , ZDRSVS_TURB_OUT_B ) + +END SUBROUTINE + +END MODULE diff --git a/src/testprogs/turb_mnh/main_turb.F90 b/src/testprogs/turb_mnh/main_turb.F90 new file mode 100644 index 0000000000000000000000000000000000000000..214a91a1123956c09ac8e5bdf84dba6cb1fc3bf1 --- /dev/null +++ b/src/testprogs/turb_mnh/main_turb.F90 @@ -0,0 +1,524 @@ +PROGRAM MAIN_TURB + +USE XRD_GETOPTIONS +USE GETDATA_TURB_MOD +USE COMPUTE_DIFF +USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t +USE MODD_CST, ONLY: CST +USE MODD_CTURB +USE MODD_LES, ONLY: TLES +USE MODD_TURB_n, ONLY: TURBN +USE MODD_IO, ONLY: TFILEDATA +USE MODI_TURB +USE MODI_INI_CST +USE MODD_BUDGET!, ONLY: TBUCONF_ASSOCIATE, TBUDGETDATA, NBUDGET_RH, TBUCONF +USE STACK_MOD +USE OMP_LIB +USE YOMHOOK, ONLY : LHOOK, DR_HOOK +USE PARKIND1, ONLY : JPRB, JPIM + + +IMPLICIT NONE + +INTEGER :: KLON +INTEGER :: KLEV +INTEGER :: KRR, KRRL, KRRI +INTEGER :: KSV + +!IN and INOUTS +REAL, ALLOCATABLE :: ZDXX (:,:,:,:) +REAL, ALLOCATABLE :: ZDYY (:,:,:,:) +REAL, ALLOCATABLE :: ZDZZ (:,:,:,:) +REAL, ALLOCATABLE :: ZDZX (:,:,:,:) +REAL, ALLOCATABLE :: ZDZY (:,:,:,:) +REAL, ALLOCATABLE :: ZZZ (:,:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSXW (:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSYW (:,:,:) +REAL, ALLOCATABLE :: ZDIRCOSZW (:,:,:) +REAL, ALLOCATABLE :: ZCOSSLOPE (:,:,:) +REAL, ALLOCATABLE :: ZSINSLOPE (:,:,:) +REAL, ALLOCATABLE :: PRHODJ (:,:,:,:) +REAL, ALLOCATABLE :: PTHVREF (:,:,:,:) +REAL, ALLOCATABLE :: PSFTH (:,:,:) +REAL, ALLOCATABLE :: PSFRV (:,:,:) +REAL, ALLOCATABLE :: PSFU (:,:,:) +REAL, ALLOCATABLE :: PSFV (:,:,:) +REAL, ALLOCATABLE :: PSFSV (:,:,:,:) !(KLON, 1, KSV) +REAL, ALLOCATABLE :: PPABSM (:,:,:,:) +REAL, ALLOCATABLE :: PUM (:,:,:,:) +REAL, ALLOCATABLE :: PVM (:,:,:,:) +REAL, ALLOCATABLE :: PWM (:,:,:,:) +REAL, ALLOCATABLE :: PTKEM (:,:,:,:) +REAL, ALLOCATABLE :: ZSVM (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PSRCM (:,:,:,:) +REAL, ALLOCATABLE :: PLENGTHM (:,:,:,:) +REAL, ALLOCATABLE :: PLENGTHH (:,:,:,:) +REAL, ALLOCATABLE :: MFMOIST (:,:,:,:) +REAL, ALLOCATABLE :: ZBL_DEPTH (:,:,:) +REAL, ALLOCATABLE :: ZSBL_DEPTH (:,:,:) +REAL, ALLOCATABLE :: ZCEI (:,:,:,:) +REAL, ALLOCATABLE :: PTHM (:,:,:,:) +REAL, ALLOCATABLE :: ZRM (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: PRUS (:,:,:,:) +REAL, ALLOCATABLE :: PRVS (:,:,:,:) +REAL, ALLOCATABLE :: PRWS (:,:,:,:) +REAL, ALLOCATABLE :: PRTHS (:,:,:,:) +REAL, ALLOCATABLE :: ZRRS (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: ZRSVS (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PRTKES_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PFLXZTHVMF (:,:,:,:) +REAL, ALLOCATABLE :: PHGRAD (:,:,:,:,:) !(KLON,1,KLEV+2,KGRADIENTS) +REAL, ALLOCATABLE :: PZS (:,:,:) + +!OUT +REAL, ALLOCATABLE :: PSIGS (:,:,:,:) +REAL, ALLOCATABLE :: ZWTH (:,:,:,:) +REAL, ALLOCATABLE :: ZWRC (:,:,:,:) +REAL, ALLOCATABLE :: ZWSV (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PDP (:,:,:,:) +REAL, ALLOCATABLE :: PTP (:,:,:,:) +REAL, ALLOCATABLE :: PTDIFF (:,:,:,:) +REAL, ALLOCATABLE :: PTDISS (:,:,:,:) +REAL, ALLOCATABLE :: PEDR (:,:,:,:) +REAL, ALLOCATABLE :: PTPMF (:,:,:,:) +REAL, ALLOCATABLE :: PDRUS_TURB (:,:,:,:) +REAL, ALLOCATABLE :: PDRVS_TURB (:,:,:,:) +REAL, ALLOCATABLE :: PDRTHLS_TURB (:,:,:,:) +REAL, ALLOCATABLE :: PDRRTS_TURB (:,:,:,:) +REAL, ALLOCATABLE :: ZDRSVS_TURB (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) + +!Expected values +REAL, ALLOCATABLE :: ZBL_DEPTH_OUT (:,:,:) +REAL, ALLOCATABLE :: ZSBL_DEPTH_OUT (:,:,:) +REAL, ALLOCATABLE :: PTHM_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZRM_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: PRUS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PRVS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PRWS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PRTHS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZRRS_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KRR) +REAL, ALLOCATABLE :: ZRSVS_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PRTKES_OUT_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PSIGS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZWTH_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZWRC_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZWSV_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) +REAL, ALLOCATABLE :: PDP_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PTP_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PTDIFF_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PTDISS_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PEDR_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PTPMF_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PDRUS_TURB_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PDRVS_TURB_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PDRTHLS_TURB_OUT (:,:,:,:) +REAL, ALLOCATABLE :: PDRRTS_TURB_OUT (:,:,:,:) +REAL, ALLOCATABLE :: ZDRSVS_TURB_OUT (:,:,:,:,:) !(KLON,1,KLEV+2,KSV) + +INTEGER :: NPROMA, NGPBLKS, NFLEVG +INTEGER :: IBL, JLON, JLEV + +TYPE(DIMPHYEX_t) :: D, D0 +INTEGER :: IMI, ISPLIT, KSV_LGBEG, KSV_LGEND, KGRADIENTS +INTEGER :: KSV_LIMA_NR, KSV_LIMA_NS, KSV_LIMA_NG, KSV_LIMA_NH +CHARACTER(LEN=4),DIMENSION(2) :: HLBCX, HLBCY +CHARACTER(LEN=6) :: HPROGRAM +LOGICAL :: O2D, ONOMIXLG, OFLAT, OCOUPLES, OBLOWSNOW, OCOMPUTE_SRC, OOCEAN, ODEEPOC +TYPE(TFILEDATA) :: ZTFILE +REAL :: ZCEI_MAX, ZCEI_MIN, ZCOEF_AMPL_SAT +CHARACTER (LEN=4) :: CMICRO +REAL :: PTSTEP +TYPE(TBUDGETDATA), DIMENSION(NBUDGET_RH) :: YLBUDGET +LOGICAL :: LLCHECK +LOGICAL :: LLCHECKDIFF +LOGICAL :: LLDIFF +INTEGER :: IBLOCK1, IBLOCK2 +INTEGER :: ISTSZ, JBLK1, JBLK2 +INTEGER :: NTID, ITID +INTEGER :: JRR + + +REAL, ALLOCATABLE :: PSTACK(:,:) +TYPE (STACK) :: YLSTACK + +REAL(KIND=8) :: TS,TE +REAL(KIND=8) :: TSC, TEC, TSD, TED, ZTC, ZTD +INTEGER :: ITIME, NTIME +INTEGER :: IRANK, ISIZE +LOGICAL :: LLVERBOSE, LLSTAT, LLBIND +REAL (KIND=JPRB) :: ZHOOK_HANDLE +CHARACTER(LEN=32) :: CLTEXT + +CALL INITOPTIONS () +NGPBLKS = 150 +CALL GETOPTION ("--blocks", NGPBLKS) +NPROMA = 32 +CALL GETOPTION ("--nproma", NPROMA) +NFLEVG = -1 +CALL GETOPTION ("--nflevg", NFLEVG) +CALL GETOPTION ("--check", LLCHECK) +CALL GETOPTION ("--checkdiff", LLCHECKDIFF) +IBLOCK1 = 1 +CALL GETOPTION ("--check-block-1", IBLOCK1) +IBLOCK2 = NGPBLKS +CALL GETOPTION ("--check-block-2", IBLOCK2) +CALL GETOPTION ("--stat", LLSTAT) +NTIME = 1 +CALL GETOPTION ("--times", NTIME) +CALL GETOPTION ("--verbose", LLVERBOSE) +CALL GETOPTION ("--bind", LLBIND) +CALL CHECKOPTIONS () + +LLDIFF = .FALSE. + +IRANK = 0 +ISIZE = 1 +IF (LLBIND) THEN + CALL LINUX_BIND (IRANK, ISIZE) + CALL LINUX_BIND_DUMP (IRANK, ISIZE) +ENDIF + +CALL GETDATA_TURB (NPROMA, NGPBLKS, NFLEVG, KRR, KRRL, KRRI, KSV, KLEV, & + !IN and INOUT (allocation and values are needed for the call) + &ZDXX, ZDYY, ZDZZ, ZDZX, ZDZY, ZZZ, & + &ZDIRCOSXW, ZDIRCOSYW, ZDIRCOSZW, ZCOSSLOPE, ZSINSLOPE, & + &PRHODJ, PTHVREF, & + &PSFTH, PSFRV, PSFU, PSFV, PSFSV, & + &PPABSM, PUM, PVM, PWM, PTKEM, ZSVM, PSRCM, & + &PLENGTHM, PLENGTHH, MFMOIST, & + &ZBL_DEPTH, ZSBL_DEPTH, & + &ZCEI, & + &PTHM, ZRM, & + &PRUS, PRVS, PRWS, PRTHS, ZRRS, ZRSVS, PRTKES_OUT, & + &PFLXZTHVMF, & + &PHGRAD, PZS, & + !OUT only (needed to allocate the array to be passed to the subroutine) + &PSIGS, & + &ZWTH,ZWRC,ZWSV,PDP,PTP,PTDIFF,PTDISS, & + &PEDR,PTPMF, & + &PDRUS_TURB,PDRVS_TURB, & + &PDRTHLS_TURB,PDRRTS_TURB,ZDRSVS_TURB, & + !OUT and INOUT (expected values) + &ZBL_DEPTH_OUT, ZSBL_DEPTH_OUT, & + &PTHM_OUT, ZRM_OUT, & + &PRUS_OUT, PRVS_OUT, PRWS_OUT, PRTHS_OUT, ZRRS_OUT, ZRSVS_OUT, PRTKES_OUT_OUT, & + &PSIGS_OUT, & + &ZWTH_OUT, ZWRC_OUT, ZWSV_OUT, PDP_OUT, PTP_OUT, PTDIFF_OUT, PTDISS_OUT, & + &PEDR_OUT, PTPMF_OUT, & + &PDRUS_TURB_OUT, PDRVS_TURB_OUT, & + &PDRTHLS_TURB_OUT, PDRRTS_TURB_OUT, ZDRSVS_TURB_OUT) + +IF (LLVERBOSE) PRINT *, " KLEV = ", KLEV, " KRR = ", KRR + +PRINT *, " NPROMA = ", NPROMA, " KLEV = ", KLEV, " NGPBLKS = ", NGPBLKS + +IMI = 1 +HLBCX(:)='CYCLCYCL' +HLBCY(:)='CYCLCYCL' +ISPLIT = 1 +KSV_LGBEG = 0 +KSV_LGEND = 0 +HPROGRAM='AROME ' +O2D=.FALSE. +ONOMIXLG=.FALSE. +OFLAT=.FALSE. +OCOUPLES=.FALSE. +OBLOWSNOW=.FALSE. +OCOMPUTE_SRC=SIZE(PSIGS, 3)/=0 +OOCEAN=.FALSE. +ODEEPOC=.FALSE. +CMICRO='ICE3' +ZTFILE%LOPENED=.FALSE. +ZCEI_MAX=1.0 +ZCEI_MIN=0.0 +ZCOEF_AMPL_SAT=0.0 +KGRADIENTS=0 +KSV_LIMA_NR=0 +KSV_LIMA_NS=0 +KSV_LIMA_NG=0 +KSV_LIMA_NH=0 +TLES%LLES=.FALSE. +! +PTSTEP = 25.0000000000000 + +CALL INIT_PHYEX () + +DO JRR=1, NBUDGET_RH + YLBUDGET(JRR)%NBUDGET=JRR +ENDDO + +D0%NIT = NPROMA +D0%NIB = 1 +D0%NIE = NPROMA +D0%NJT = 1 +D0%NJB = 1 +D0%NJE = 1 +D0%NIJT = D0%NIT * D0%NJT +D0%NIJB = 1 +D0%NIJE = NPROMA +D0%NKL = -1 +D0%NKT = KLEV +D0%NKA = KLEV +D0%NKU = 1 +D0%NKB = KLEV-1 +D0%NKE = 2 +D0%NKTB = 2 +D0%NKTE = KLEV-1 +D0%NIBC = 1 +D0%NJBC = 1 +D0%NIEC = D0%NIE +D0%NJEC = D0%NJT + +ISTSZ = NPROMA * 20 * KLEV +ALLOCATE (PSTACK (ISTSZ, NGPBLKS)) + +TS = OMP_GET_WTIME () + +ZTD = 0. +ZTC = 0. + +IF (LHOOK) CALL DR_HOOK ('MAIN',0,ZHOOK_HANDLE) + +DO ITIME = 1, NTIME + + TSD = OMP_GET_WTIME () + +!!! !directives pas a jour !$acc data & +!!! !directives pas a jour !$acc & copyin (D0, CST, ICEP, NEB, KRR, HFRAC_ICE, HCONDENS, HLAMBDA3, HBUNAME, OSUBG_COND, OSIGMAS, OCND2, HSUBG_MF_PDF, PTSTEP, LMFCONV, & +!!! !directives pas a jour !$acc & ZSIGQSAT, PRHODJ, PEXNREF, PRHODREF, PSIGS, PMFCONV, PPABSM, ZZZ, PCF_MF, PRC_MF, PRI_MF, ZRS, ZICE_CLD_WGT) & +!!! !directives pas a jour !$acc & copy (PRS, PTHS), & +!!! !directives pas a jour !$acc & copyout (PSRCS, PCLDFR, PHLC_HRC, PHLC_HCF, PHLI_HRI, PHLI_HCF) & +!!! !directives pas a jour !$acc & create (PSTACK) + + TSC = OMP_GET_WTIME () + +#ifdef USE_OPENMP +!$OMP PARALLEL PRIVATE (D, ITID, JBLK1, JBLK2) +#endif + +#ifdef _OPENACC +JBLK1 = 1 +JBLK2 = NGPBLKS +#endif + +#ifdef USE_OPENMP +NTID = OMP_GET_MAX_THREADS () +ITID = OMP_GET_THREAD_NUM () +JBLK1 = 1 + (NGPBLKS * (ITID+0)) / NTID +JBLK2 = (NGPBLKS * (ITID+1)) / NTID + + +!PRINT *, ITID, JBLK1, JBLK2 + +#endif + +!$acc parallel loop gang vector private (YLSTACK, IBL, JLON, D) collapse (2) + + DO IBL = JBLK1, JBLK2 + + +#ifdef _OPENACC + DO JLON = 1, NPROMA + D = D0 + D%NIB = JLON + D%NIE = JLON + D%NIJB = JLON + D%NIJE = JLON + D%NIBC = JLON + D%NIEC = JLON +#endif + +#ifdef USE_OPENMP + D = D0 +#endif + +#ifdef USE_STACK + YLSTACK%L = LOC (PSTACK (1, IBL)) + YLSTACK%U = YLSTACK%L + ISTSZ * KIND (PSTACK) +#else + YLSTACK%L = 0 + YLSTACK%U = 0 +#endif + +CALL TURB (CST,CSTURB,TBUCONF,TURBN, D, TLES,& + & IMI, KRR, KRRL, KRRI, HLBCX, HLBCY, KGRADIENTS, 1,& + & ISPLIT,IMI, KSV, KSV_LGBEG, KSV_LGEND, & + & HPROGRAM, & + & KSV_LIMA_NR, KSV_LIMA_NS, KSV_LIMA_NG, KSV_LIMA_NH,& + & O2D, ONOMIXLG, OFLAT, OCOUPLES,OBLOWSNOW,.FALSE.,& + & OCOMPUTE_SRC, 1.0, & + & OOCEAN,ODEEPOC, .FALSE., & + & 'NONE',CMICRO, & + & 2*PTSTEP,ZTFILE, & + & ZDXX(:,:,:,IBL),ZDYY(:,:,:,IBL),ZDZZ(:,:,:,IBL),ZDZX(:,:,:,IBL),ZDZY(:,:,:,IBL),ZZZ(:,:,:,IBL), & + & ZDIRCOSXW,ZDIRCOSYW,ZDIRCOSZW,ZCOSSLOPE,ZSINSLOPE, & + & PRHODJ(:,:,:,IBL),PTHVREF(:,:,:,IBL), PHGRAD, PZS, & + & PSFTH(:,:,IBL),PSFRV(:,:,IBL),PSFSV(:,:,:,IBL),PSFU(:,:,IBL),PSFV(:,:,IBL), & + & PPABSM(:,:,:,IBL),PUM(:,:,:,IBL),PVM(:,:,:,IBL),PWM(:,:,:,IBL),PTKEM(:,:,:,IBL),ZSVM(:,:,:,:,IBL),PSRCM(:,:,:,IBL), & + & PLENGTHM(:,:,:,IBL),PLENGTHH(:,:,:,IBL),MFMOIST(:,:,:,IBL), & + & ZBL_DEPTH(:,:,IBL),ZSBL_DEPTH(:,:,IBL), & + & ZCEI(:,:,:,IBL),ZCEI_MIN,ZCEI_MAX,ZCOEF_AMPL_SAT, & + & PTHM(:,:,:,IBL),ZRM(:,:,:,:,IBL), & + & PRUS(:,:,:,IBL),PRVS(:,:,:,IBL),PRWS(:,:,:,IBL),PRTHS(:,:,:,IBL),ZRRS(:,:,:,:,IBL),ZRSVS(:,:,:,:,IBL),PRTKES_OUT(:,:,:,IBL), & + & PSIGS(:,:,:,IBL), & + & PFLXZTHVMF(:,:,:,IBL),ZWTH(:,:,:,IBL),ZWRC(:,:,:,IBL),ZWSV(:,:,:,:,IBL),PDP(:,:,:,IBL),PTP(:,:,:,IBL),PTDIFF(:,:,:,IBL),PTDISS(:,:,:,IBL),& + & YLBUDGET, KBUDGETS=SIZE(YLBUDGET),PEDR=PEDR(:,:,:,IBL),PTPMF=PTPMF(:,:,:,IBL),& + & PDRUS_TURB=PDRUS_TURB(:,:,:,IBL),PDRVS_TURB=PDRVS_TURB(:,:,:,IBL), & + & PDRTHLS_TURB=PDRTHLS_TURB(:,:,:,IBL),PDRRTS_TURB=PDRRTS_TURB(:,:,:,IBL),PDRSVS_TURB=ZDRSVS_TURB(:,:,:,:,IBL)) + +#ifdef _OPENACC + ENDDO +#endif + + ENDDO + +#ifdef USE_OPENMP +!$OMP END PARALLEL +#endif + +!$acc end parallel loop + + TEC = OMP_GET_WTIME () + +!$acc end data + + TED = OMP_GET_WTIME () + + ZTC = ZTC + (TEC - TSC) + ZTD = ZTD + (TED - TSD) + +ENDDO + +IF (LHOOK) CALL DR_HOOK ('MAIN',1,ZHOOK_HANDLE) + +TE = OMP_GET_WTIME() + +WRITE (*,'(A,F8.2,A)') 'elapsed time : ',TE-TS,' s' +WRITE (*,'(A,F8.4,A)') ' i.e. ',1000.*(TE-TS)/(NPROMA*NGPBLKS)/NTIME,' ms/gp' + +PRINT *, " ZTD = ", ZTD, ZTD / REAL (NPROMA*NGPBLKS*NTIME) +PRINT *, " ZTC = ", ZTC, ZTC / REAL (NPROMA*NGPBLKS*NTIME) + +IF (LLCHECK .OR. LLSTAT .OR. LLCHECKDIFF) THEN + DO IBL = IBLOCK1, IBLOCK2 + PRINT *, " IBL = ", IBL + DO JRR=1, KRR + WRITE (CLTEXT, '("ZRM JRR=",I3.3)') JRR + CALL DIFF3 (CLTEXT, ZRM_OUT (:,:,:,JRR,IBL), ZRM (:,:,:,JRR,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + WRITE (CLTEXT, '("ZRRS JRR=",I3.3)') JRR + CALL DIFF3 (CLTEXT, ZRRS_OUT (:,:,:,JRR,IBL), ZRRS (:,:,:,JRR,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + ENDDO + CALL DIFF2 ("ZBL_DEPTH ", ZBL_DEPTH_OUT (:,:,IBL) , ZBL_DEPTH (:,:,IBL) , LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF2 ("ZSBL_DEPTH ", ZSBL_DEPTH_OUT (:,:,IBL) , ZSBL_DEPTH (:,:,IBL) , LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PTHM ", PTHM_OUT (:,:,:,IBL), PTHM (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PRUS ", PRUS_OUT (:,:,:,IBL), PRUS (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PRVS ", PRVS_OUT (:,:,:,IBL), PRVS (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PRWS ", PRWS_OUT (:,:,:,IBL), PRWS (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PRTHS ", PRTHS_OUT (:,:,:,IBL), PRTHS (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PRTKES_OUT ", PRTKES_OUT_OUT (:,:,:,IBL), PRTKES_OUT (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PSIGS ", PSIGS_OUT (:,:,:,IBL), PSIGS (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("ZWTH ", ZWTH_OUT (:,:,:,IBL), ZWTH (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("ZWRC ", ZWRC_OUT (:,:,:,IBL), ZWRC (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PDP ", PDP_OUT (:,:,:,IBL), PDP (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PTP ", PTP_OUT (:,:,:,IBL), PTP (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PTDIFF ", PTDIFF_OUT (:,:,:,IBL), PTDIFF (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PTDISS ", PTDISS_OUT (:,:,:,IBL), PTDISS (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PEDR ", PEDR_OUT (:,:,:,IBL), PEDR (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PTPMF ", PTPMF_OUT (:,:,:,IBL), PTPMF (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PDRUS_TURB ", PDRUS_TURB_OUT (:,:,:,IBL), PDRUS_TURB (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PDRVS_TURB ", PDRVS_TURB_OUT (:,:,:,IBL), PDRVS_TURB (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PDRTHLS_TURB", PDRTHLS_TURB_OUT (:,:,:,IBL), PDRTHLS_TURB(:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + CALL DIFF3 ("PDRRTS_TURB ", PDRRTS_TURB_OUT (:,:,:,IBL), PDRRTS_TURB (:,:,:,IBL), LLSTAT, LLCHECK, NPROMA, LLCHECKDIFF, LLDIFF) + ENDDO +ENDIF + +IF (LLCHECKDIFF) THEN + IF (LLDIFF) THEN + PRINT*, "THERE ARE DIFF SOMEWHERE" + ELSE + PRINT*, "THERE IS NO DIFF AT ALL" + ENDIF +ENDIF + +STOP + +CONTAINS + +SUBROUTINE INIT_PHYEX() +USE MODD_TURB_N, ONLY: TURB_GOTO_MODEL +IMPLICIT NONE +! +CALL INI_CST +CALL TURB_GOTO_MODEL(1,1) +CALL CTURB_ASSOCIATE() +CALL TBUCONF_ASSOCIATE +LBU_ENABLE=.FALSE. +LBUDGET_U=.FALSE. +LBUDGET_V=.FALSE. +LBUDGET_W=.FALSE. +LBUDGET_TH=.FALSE. +LBUDGET_TKE=.FALSE. +LBUDGET_RV=.FALSE. +LBUDGET_RC=.FALSE. +LBUDGET_RR=.FALSE. +LBUDGET_RI=.FALSE. +LBUDGET_RS=.FALSE. +LBUDGET_RG=.FALSE. +LBUDGET_RH=.FALSE. +LBUDGET_SV=.FALSE. + +TURBN%LHARAT=.FALSE. +TURBN%CTURBDIM = '1DIM' +TURBN%XIMPL=1. +TURBN%CTURBLEN='BL89' +TURBN%LSTATNW=.FALSE. +TURBN%LTURB_DIAG=.FALSE. +TURBN%LTURB_FLX=.FALSE. +TURBN%LSUBG_COND=.TRUE. +TURBN%LRMC01=.FALSE. +TURBN%CTOM='NONE' +TURBN%LLEONARD=.FALSE. + +XCED = 0.85 +XCEP = 2.11 +XA0 = 0.6 +XA2 = 1. +XA3 = 0. +XCTD = 1.2 +IF (TURBN%LSTATNW) THEN + XCTP = 4.0 + ELSE + XCTP = 4.65 +ENDIF +XA5 = 1./3. +XCET = 0.40 +XALPSBL = 4.63 +XRM17 = 0.5 ! Rodier et al 2017 +XCMFS= 2./3./XCEP*(1.-XA0) !Constant for the momentum flux due to shear (RS) +XCSHF= 2./3./XCTP !Constant for the sensible heat flux(RS) +XCHF= XCSHF !Constant for the humidity flux(RS) +XCTV= 2./3./XCTP/XCTD !Constant for the temperature variance(RS) +XCHV= XCTV !Constant for the humidity variance(RS) +XCHT1= XCTV/2. !Constants for the temperature-humidity correlation(RS) +XCHT2= XCTV/2. +XCPR1= XCTV !Constants for the turbulent Prandtl and Schmidt numbers +XCPR2= XCHT1 +XCPR3= XCPR2 ! used only for the Schmidt number for scalar variables +XCPR4= XCPR2 +XCPR5= XCPR2 +XTKEMIN=1.E-6 +!XLINI=10. ! BL mixing length +XLINI=0.1 ! BL mixing length +XLINF=1.E-10! to prevent division by zero +XPHI_LIM = 3. +XCDP = 1.46 +XCDD = 1.83 +XCDT = 0.42 +XSBL_O_BL = 0.05 ! SBL height / BL height ratio +XFTOP_O_FSURF = 0.05 ! Fraction of surface (heat or momentum) flux used to define top of BL + +! +END SUBROUTINE INIT_PHYEX + +END PROGRAM + diff --git a/tools/check_commit_testprogs.sh b/tools/check_commit_testprogs.sh index b94833cfb75968a38659d811c58ce48f62333a79..87e1e3f6f03f02719e6e346bc1ef4ad7444f8c82 100755 --- a/tools/check_commit_testprogs.sh +++ b/tools/check_commit_testprogs.sh @@ -9,10 +9,15 @@ set -e #ice_adjust: the ice adjust test case -#ref is commit 855b8f8 for ice_adjust, rain_ice, turb and shallow_mf +#ref is commit 855b8f8 for ice_adjust, rain_ice +#ref is commit 4171c53 for turb + +#Commit 4171c53 can be used for turb (ref commit for this testprogs), and for +#rain_ice and ice_adjust (as it gives the same results as commit 855b8f8 +#for these test cases). specialName="ref" -availTests="ice_adjust,rain_ice" +availTests="ice_adjust,rain_ice,turb" defaultTest='ALL' separator='_' #- seprator must be in sync with prep_code.sh separator @@ -182,7 +187,7 @@ if [ $compilation -eq 1 ]; then else expand_options="" fi - subs="$subs -s turb -s micro -s aux -s ice_adjust -s rain_ice -s support" + subs="$subs -s turb -s turb_mnh -s micro -s aux -s ice_adjust -s rain_ice -s support" prep_code=$PHYEXTOOLSDIR/prep_code.sh if [ "$fromdir" == '' ]; then @@ -258,9 +263,13 @@ if [ $check -eq 1 ]; then fi if [ $te -eq 0 ]; then set +e - mess=$(cmp $file1 $file2 246 246 2>&1) + mess=$(cmp <(cat $file1 | sed 's/\.\.//g' | sed 's/~=//g' | sed 's/!=//g') \ + <(cat $file2 | sed 's/\.\.//g' | sed 's/~=//g' | sed 's/!=//g') 246 246 2>&1) te=$? set -e + #The use of "<()" bash syntax replaces the actual file name seen by cmp + #We modify the cmp output to display the actual file names + mess=$(echo $mess | sed "s#^.*differ# $file1 $file2 differ#") fi [ $te -ne 0 ] && message="$message $mess \n" alltests=$(($alltests+$te))