diff --git a/A-INSTALL b/A-INSTALL index 62da66fa012facf7878a9b12ba8555ef44dcd6e8..14ef158756ed91d741f6384f049c749be1b371b5 100644 --- a/A-INSTALL +++ b/A-INSTALL @@ -1,7 +1,7 @@ # # Version of PACKAGE MESONH "Open distribution" # PACK-MNH-V5-6-1 -# DATE : 05/09/2023 +# DATE : 25/09/2023 # VERSION : MESONH MASDEV5_6 + BUG-1 # # MAP @@ -609,26 +609,58 @@ sbatch job_make_examples_BullX_occigen # At TGCC , you have two architectures accessible throw 2 differents frontals # but with a commun disk space , connect to : # -# - ssh irene-fr : for Intel SkyLake/KNL processors -# On Intel processors the MPI use is OPENMPI/2.0.4 +# - ssh irene-fr : for Intel SkyLake processors +# On Intel processors the MPI use is OPENMPI/4.1.4 # the configure will generate a # profile_mesonh-LXifort-R8I4-MNH-V5-6-1-MPIAUTO-O2 # # - ssh irene-amd : for AMD , processors -# On AMD processors the MPI use is OPENMPI/4.02 +# On AMD processors the MPI use is OPENMPI/4.1.4 # the configure will generate a # profile_mesonh-LXifort-R8I4-MNH-V5-6-1-AMD-MPIAUTO-O2 # -# - install the PACKAGE in your $CCCHOME ( default 20Go of quota ) -# - Compile in interactive mode ( see IDRIS ) # +# At TGCC they use 'one login' for multi-project allocation . +# This induce 'strange' problem with the installation of eccodes +# resulting in file with the wrong default group and 'disk quota excedeed' error +# +# You could get your different project info by 'ccc_myproject' +# +# I recommand you first, supposing that the "Genci Allocation" you want to use +# as for projet group "genXXXX" +# +# 1) to add in your "~/.bash_profile" +# +module switch dfldatadir dfldatadir/genXXXX +newgrp genXXXX + +# 2) "logout & login" again +# and check that you have now the good default group +# +id -ng +--> genXXXX +echo $CCCHOME +--> /ccc/.../home/genXXXX/{your_login} + +# If all is OK , you could install the code in interactive as usally +# +# - install the PACKAGE in your ${CCCHOME} ( default 20Go of quota ) +# for example on Intel frontal +cd ${CCCHOME} +cd MNH-V5-6-1/src +./configure +. ../conf/profile_mesonh-LXifort-R8I4-MNH-V5-6-1-MPIAUTO-O2 +make -j16 |& tee error$XYZ +make installmaster + +# REM: The eccode lib will be installed in your ${CCCWORKDIR} +# also for the quota problem ... +# # - to run the test case examples run # # On intel Skylake ccc_msub job_make_examples_BullX_irene -# On intel Knl -ccc_msub -q knl job_make_examples_BullX_irene # On intel AMD ccc_msub job_make_examples_BullX_irene_AMD diff --git a/conf/profile_mesonh.ihm b/conf/profile_mesonh.ihm index 74bcb1f6d5887136a68edb09031c584fbe1d8bb5..5c6660914f7a99c8dbf81157426baceb3652e517 100755 --- a/conf/profile_mesonh.ihm +++ b/conf/profile_mesonh.ihm @@ -148,6 +148,7 @@ fi ########################################################## # export XYZ="-\${ARCH}-R\${MNH_REAL}I\${MNH_INT}-\${VERSION_XYZ}\${MNH_ECRAD:+-ECRAD${VER_ECRAD}}\${MNH_FOREFIRE:+-FF}\${VER_USER:+-\${VER_USER}}-\${VER_MPI}-\${OPTLEVEL}" +export XYZM="-\${ARCH}-R\${MNH_REAL}I\${MNH_INT}-\${VERSION_XYZ}\${MNH_ECRAD:+-ECRAD${VER_ECRAD}}\${MNH_FOREFIRE:+-FF}-\${VER_MPI}-\${OPTLEVEL}" #[ "x\${VER_USER}" != "x" ] && export XYZ="\${XYZ}-\${VER_USER}" # PATH to find tools like "makegen, etc ..." export BIN_TOOLS=${BIN_TOOLS} diff --git a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 index 3f5860da56c6be4bf8b67fbd5b0dd7409779490c..9559f6b17ca0dcaa3816b5dcb764b2db48b8a678 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 @@ -2301,7 +2301,9 @@ subroutine Write_flyer_time_coord( tpflyer ) type(tdimnc), pointer :: tzdim !Do it only if correct model level and has really flown - if ( tpflyer%nmodel == imi .and. Count( tpflyer%xx /= XUNDEF) > 1 ) then + if ( tpflyer%nmodel == imi ) then + ! Do the second if only if the first one is OK (if not, xx may be not allocated) + if ( Count( tpflyer%xx /= XUNDEF) > 1 ) then Allocate( tzdim ) istatus = NF90_INQ_NCID( tpfile%nncid, 'Flyers', icatid ) @@ -2342,6 +2344,7 @@ subroutine Write_flyer_time_coord( tpflyer ) !Restore file identifier to root group incid = tpfile%nncid end if + end if end subroutine Write_flyer_time_coord diff --git a/src/LIB/SURCOUCHE/src/mode_msg.f90 b/src/LIB/SURCOUCHE/src/mode_msg.f90 index 5dfbdc2ef71b07d9d8c8c501566c1ddace78c0fc..272868b6c9cf23ed78181077ecacf7617724abbd 100644 --- a/src/LIB/SURCOUCHE/src/mode_msg.f90 +++ b/src/LIB/SURCOUCHE/src/mode_msg.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 2017-2022 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 2017-2023 CNRS, Meteo-France and Universite Paul Sabatier !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt !MNH_LIC for details. version 1. @@ -65,7 +65,7 @@ subroutine Print_msg_multi_cmnhmsg( kverb, hdomain, hsubr, olocal ) ilines = ilines - 1 end do - call Print_msg_multi( kverb, hdomain, hsubr, cmnhmsg(1 : ilines) ) + call Print_msg_multi( kverb, hdomain, hsubr, cmnhmsg(1 : ilines), olocal ) !Empty the message buffer !This is necessary especially if the next call contain a shorter message diff --git a/src/MNH/aeroopt_get.f90 b/src/MNH/aeroopt_get.f90 index d8ec58193f7c308daba8bf8ad069ab21f2e7a976..994608c3da4bbb2bcab4f8ad5382131f9e67adc8 100644 --- a/src/MNH/aeroopt_get.f90 +++ b/src/MNH/aeroopt_get.f90 @@ -132,8 +132,9 @@ REAL, DIMENSION(size(ZMASS,1),size(ZMASS,2),size(ZMASS,3)) :: VEXTR COMPLEX, DIMENSION(size(ZMASS,1),size(ZMASS,2),size(ZMASS,3),6)::Req ! Equivalent refractive index REAL, PARAMETER :: EPSILON=1.d-8 ![um] a small number used to avoid zero - - INTEGER ::JJJ, JI, JSV + REAL,DIMENSION(NSP+NCARB+NSOA) :: ZFAC + REAL,DIMENSION(NSP+NCARB+NSOA) :: ZRHOI + INTEGER ::JJJ, JI, JSV, JJ !------------------------------------------------------------------------- !------------------------------------------------------------------------- @@ -212,25 +213,33 @@ NMODE_AER=JPMODE ! in case of ORILAM ! VDDST(:,:,:)=0. ! ENDIF - - VOC(:,:,:)=(ZMASS(:,:,:,JP_AER_OC,JMDE))/XFAC(JP_AER_OC) - VH2O(:,:,:)=(ZMASS(:,:,:,JP_AER_H2O,JMDE))/XFAC(JP_AER_H2O) - VAM(:,:,:)=(ZMASS(:,:,:,JP_AER_NH3,JMDE))/XFAC(JP_AER_NH3) - VSU(:,:,:)=(ZMASS(:,:,:,JP_AER_SO4,JMDE))/XFAC(JP_AER_SO4) - VNI(:,:,:)=(ZMASS(:,:,:,JP_AER_NO3,JMDE))/XFAC(JP_AER_NO3) - VBC(:,:,:)=(ZMASS(:,:,:,JP_AER_BC,JMDE))/XFAC(JP_AER_BC) - VDDST(:,:,:)=(ZMASS(:,:,:,JP_AER_DST,JMDE))/XFAC(JP_AER_DST) +! Cf Ackermann (all to black carbon except water) +!Set molecular weightn g/mol +ZRHOI(:) = 1.8e3 +ZRHOI(JP_AER_H2O) = 1.0e3 ! water +ZRHOI(JP_AER_DST) = XDENSITY_DUST ! dusts +DO JJ=1,NSP+NCARB+NSOA + ZFAC(JJ)=(4./3.)*XPI*ZRHOI(JJ)*1.e-9 +ENDDO + + VOC(:,:,:)=(ZMASS(:,:,:,JP_AER_OC,JMDE))/ZFAC(JP_AER_OC) + VH2O(:,:,:)=(ZMASS(:,:,:,JP_AER_H2O,JMDE))/ZFAC(JP_AER_H2O) + VAM(:,:,:)=(ZMASS(:,:,:,JP_AER_NH3,JMDE))/ZFAC(JP_AER_NH3) + VSU(:,:,:)=(ZMASS(:,:,:,JP_AER_SO4,JMDE))/ZFAC(JP_AER_SO4) + VNI(:,:,:)=(ZMASS(:,:,:,JP_AER_NO3,JMDE))/ZFAC(JP_AER_NO3) + VBC(:,:,:)=(ZMASS(:,:,:,JP_AER_BC,JMDE))/ZFAC(JP_AER_BC) + VDDST(:,:,:)=(ZMASS(:,:,:,JP_AER_DST,JMDE))/ZFAC(JP_AER_DST) IF (NSOA .EQ. 10) THEN - VSOA1(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA1,JMDE))/XFAC(JP_AER_SOA1) - VSOA2(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA2,JMDE))/XFAC(JP_AER_SOA2) - VSOA3(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA3,JMDE))/XFAC(JP_AER_SOA3) - VSOA4(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA4,JMDE))/XFAC(JP_AER_SOA4) - VSOA5(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA5,JMDE))/XFAC(JP_AER_SOA5) - VSOA6(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA6,JMDE))/XFAC(JP_AER_SOA6) - VSOA7(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA7,JMDE))/XFAC(JP_AER_SOA7) - VSOA8(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA8,JMDE))/XFAC(JP_AER_SOA8) - VSOA9(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA9,JMDE))/XFAC(JP_AER_SOA9) - VSOA10(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA10,JMDE))/XFAC(JP_AER_SOA10) + VSOA1(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA1,JMDE))/ZFAC(JP_AER_SOA1) + VSOA2(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA2,JMDE))/ZFAC(JP_AER_SOA2) + VSOA3(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA3,JMDE))/ZFAC(JP_AER_SOA3) + VSOA4(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA4,JMDE))/ZFAC(JP_AER_SOA4) + VSOA5(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA5,JMDE))/ZFAC(JP_AER_SOA5) + VSOA6(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA6,JMDE))/ZFAC(JP_AER_SOA6) + VSOA7(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA7,JMDE))/ZFAC(JP_AER_SOA7) + VSOA8(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA8,JMDE))/ZFAC(JP_AER_SOA8) + VSOA9(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA9,JMDE))/ZFAC(JP_AER_SOA9) + VSOA10(:,:,:)=(ZMASS(:,:,:,JP_AER_SOA10,JMDE))/ZFAC(JP_AER_SOA10) VSOA(:,:,:)=VSOA1(:,:,:)+VSOA2(:,:,:)+VSOA3(:,:,:)+VSOA4(:,:,:)+& VSOA5(:,:,:)+VSOA6(:,:,:)+VSOA7(:,:,:)+VSOA8(:,:,:)+& VSOA9(:,:,:)+VSOA10(:,:,:) diff --git a/src/MNH/aircraft_balloon_evol.f90 b/src/MNH/aircraft_balloon_evol.f90 index d59b33721819904ac9baabd7719c0572b91a2433..dcbdd6349d012cb4ceea2734c75146d1c55a5c4b 100644 --- a/src/MNH/aircraft_balloon_evol.f90 +++ b/src/MNH/aircraft_balloon_evol.f90 @@ -31,6 +31,8 @@ MODULE MODE_AIRCRAFT_BALLOON_EVOL ! ########################## +USE MODD_PRECISION, ONLY: MNHREAL + USE MODE_MSG IMPLICIT NONE @@ -43,6 +45,8 @@ PUBLIC :: AIRCRAFT_COMPUTE_POSITION PUBLIC :: FLYER_GET_RANK_MODEL_ISCRASHED +REAL, PARAMETER :: XTIMETHRESH = 1.E-8_MNHREAL + CONTAINS ! ######################################################## SUBROUTINE AIRCRAFT_BALLOON_EVOL(PTSTEP, & @@ -202,6 +206,11 @@ SELECT TYPE ( TPFLYER ) IF ( TDTCUR >= TPFLYER%TLAUNCH .AND. TDTCUR <= TPFLYER%TLAND ) THEN TPFLYER%LFLY = .TRUE. TPFLYER%LTOOKOFF = .TRUE. + WRITE( CMNHMSG(1), "( 'aircraft ', A, ' takeoff on ', I2, '/', I2, '/', I4, ' at ', F18.12, 's' )" ) & + TRIM( TPFLYER%CNAME ), TDTCUR%NDAY, TDTCUR%NMONTH, TDTCUR%NYEAR, TDTCUR%XTIME + CALL PRINT_MSG( NVERB_INFO, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) + ELSE + TPFLYER%LFLY = .FALSE. END IF END IF END IF TAKEOFF @@ -253,14 +262,34 @@ SELECT TYPE ( TPFLYER ) IF ( TZNEXT >= TPFLYER%TLAUNCH .AND. TZNEXT <= TPFLYER%TLAND ) THEN TPFLYER%LFLY = .TRUE. ! Force LTOOKOFF to prevent to do it again (at a next timestep) - TPFLYER%LTOOKOFF = .TRUE. + IF ( .NOT. TPFLYER%LTOOKOFF ) THEN + TPFLYER%LTOOKOFF = .TRUE. + WRITE( CMNHMSG(1), "( 'aircraft ', A, ' will take off at next store on ', & + I2, '/', I2, '/', I4, ' at ', F18.12, 's' )" ) & + TRIM( TPFLYER%CNAME ), TZNEXT%NDAY, TZNEXT%NMONTH, TZNEXT%NYEAR, TZNEXT%XTIME + CALL PRINT_MSG( NVERB_INFO, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) + END IF ! Compute next position CALL AIRCRAFT_COMPUTE_POSITION( TZNEXT, TPFLYER ) ! Get rank of the process where the aircraft is and the model number CALL FLYER_GET_RANK_MODEL_ISCRASHED( TPFLYER ) + + IF ( TPFLYER%LCRASH .AND. TPFLYER%NCRASH == NCRASH_OUT_HORIZ ) THEN + WRITE( CMNHMSG(1), "( 'aircraft ', A, ' crashed on ', I2, '/', I2, '/', I4, ' at ', F18.12, & + 's (out of the horizontal boundaries)' )" ) & + TRIM( TPFLYER%CNAME ), TZNEXT%NDAY, TZNEXT%NMONTH, TZNEXT%NYEAR, TZNEXT%XTIME + CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) + END IF ELSE + IF ( TPFLYER%LFLY ) THEN + ! Aircraft was in flight and will have landed at next store + WRITE( CMNHMSG(1), "( 'aircraft ', A, ' will have landed at next store on ', & + I2, '/', I2, '/', I4, ' at ', F18.12, 's' )" ) & + TRIM( TPFLYER%CNAME ), TZNEXT%NDAY, TZNEXT%NMONTH, TZNEXT%NYEAR, TZNEXT%XTIME + CALL PRINT_MSG( NVERB_INFO, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) + END IF TPFLYER%LFLY = .FALSE. END IF END IF @@ -274,28 +303,32 @@ SELECT TYPE ( TPFLYER ) ! Launch? LAUNCH: IF ( .NOT. TPFLYER%LFLY .AND. .NOT. TPFLYER%LCRASH .AND. TPFLYER%NMODEL == IMI ) THEN ! Check if it is launchtime - LAUNCHTIME: IF ( ( TDTCUR - TPFLYER%TLAUNCH ) >= -1.e-10 ) THEN + LAUNCHTIME: IF ( ( TDTCUR - TPFLYER%TLAUNCH ) >= -XTIMETHRESH ) THEN TPFLYER%LFLY = .TRUE. GLAUNCH = .TRUE. TPFLYER%XX_CUR = TPFLYER%XXLAUNCH TPFLYER%XY_CUR = TPFLYER%XYLAUNCH TPFLYER%TPOS_CUR = TDTCUR + WRITE( CMNHMSG(1), "( 'balloon ', A, ' launched on ', I2, '/', I2, '/', I4, ' at ', F18.12, 's' )" ) & + TRIM( TPFLYER%CNAME ), TDTCUR%NDAY, TDTCUR%NMONTH, TDTCUR%NYEAR, TDTCUR%XTIME + CALL PRINT_MSG( NVERB_INFO, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) END IF LAUNCHTIME END IF LAUNCH ! Check if it is time to store data. This has also to be checked if the balloon ! is not yet launched or is crashed (data is also written in these cases, but with default values) IF ( TPFLYER%NMODEL == IMI .AND. & - ( .NOT. TPFLYER%LFLY .OR. TPFLYER%LCRASH .OR. ABS( TPFLYER%TPOS_CUR - TDTCUR ) < 1.e-8 ) ) THEN + ( .NOT. TPFLYER%LFLY .OR. TPFLYER%LCRASH .OR. ABS( TPFLYER%TPOS_CUR - TDTCUR ) < XTIMETHRESH ) ) THEN !Do we have to store balloon data? TPFLYER%LSTORE = TPFLYER%TFLYER_TIME%STORESTEP_CHECK_AND_SET( ISTORE ) IF ( TPFLYER%LSTORE ) TPFLYER%NSTORE_CUR = ISTORE END IF ! In flight + ! The condition "ABS( TPFLYER%TPOS_CUR - TDTCUR ) < XTIMETHRESH" is necessary if the balloon changes of model INFLIGHTONMODEL: IF ( TPFLYER%LFLY .AND. .NOT. TPFLYER%LCRASH .AND. TPFLYER%NMODEL == IMI & - .AND. ABS( TPFLYER%TPOS_CUR - TDTCUR ) < 1.e-8 ) THEN + .AND. ABS( TPFLYER%TPOS_CUR - TDTCUR ) < XTIMETHRESH ) THEN ISOWNERBAL: IF ( TPFLYER%NRANK_CUR == ISP ) THEN CALL FLYER_INTERP_TO_MASSPOINTS() @@ -316,10 +349,6 @@ SELECT TYPE ( TPFLYER ) CRASH_VERT: IF ( TPFLYER%LCRASH ) THEN TPFLYER%LFLY = .FALSE. - WRITE( CMNHMSG(1), "( 'Balloon ', A, ' crashed the ', I2, '/', I2, '/', I4, ' at ', F18.12, & - 's (too low or too high)' )" ) & - TRIM( TPFLYER%CNAME ), TDTCUR%NDAY, TDTCUR%NMONTH, TDTCUR%NYEAR, TDTCUR%XTIME - CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) ELSE CRASH_VERT !No vertical crash @@ -362,6 +391,9 @@ CLASS(TBALLOONDATA), INTENT(INOUT) :: TPBALLOON LOGICAL :: GLOW, GHIGH +GLOW = .FALSE. +GHIGH = .FALSE. + SELECT CASE ( TPBALLOON%CTYPE ) ! ! Iso-density balloon @@ -468,6 +500,8 @@ USE MODD_NESTING, ONLY: NDAD, NDTRATIO USE MODD_TIME, only: TDTSEG USE MODD_TIME_n, ONLY: TDTCUR +USE MODE_DATETIME + IMPLICIT NONE CLASS(TBALLOONDATA), INTENT(INOUT) :: TPBALLOON @@ -480,6 +514,7 @@ REAL :: ZDIVTMP REAL :: ZMAP ! map factor at balloon location REAL :: ZU_BAL ! horizontal wind speed at balloon location (along x) REAL :: ZV_BAL ! horizontal wind speed at balloon location (along y) +TYPE(DATE_TIME) :: TZNEXT ! Time for next position ZTSTEP = PTSTEP @@ -505,10 +540,12 @@ IMODEL_OLD = TPBALLOON%NMODEL ! Get rank of the process where the balloon is and the model number CALL FLYER_GET_RANK_MODEL_ISCRASHED( TPBALLOON ) -IF ( TPBALLOON%LCRASH ) THEN - WRITE( CMNHMSG(1), "( 'Balloon ', A, ' crashed the ', I2, '/', I2, '/', I4, ' at ', F18.12, & - 's (out of the horizontal boundaries)' )" ) & - TRIM( TPBALLOON%CNAME ), TDTCUR%NDAY, TDTCUR%NMONTH, TDTCUR%NYEAR, TDTCUR%XTIME +TZNEXT = TDTCUR + ZTSTEP + +IF ( TPBALLOON%LCRASH .AND. TPBALLOON%NCRASH == NCRASH_OUT_HORIZ ) THEN + WRITE( CMNHMSG(1), "( 'balloon ', A, ' crashed on ', I2, '/', I2, '/', I4, ' at ', F18.12, & + 's (out of the horizontal boundaries)' )" ) & + TRIM( TPBALLOON%CNAME ), TZNEXT%NDAY, TZNEXT%NMONTH, TZNEXT%NYEAR, TZNEXT%XTIME CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) END IF @@ -516,6 +553,11 @@ IF ( TPBALLOON%NMODEL /= IMODEL_OLD .AND. .NOT. TPBALLOON%LCRASH ) THEN ! Balloon has changed of model IF ( NDAD(TPBALLOON%NMODEL ) == IMODEL_OLD ) THEN ! Nothing special to do when going to child model + WRITE( CMNHMSG(1), "( 'balloon ', A, ': change of model: ', I2, '->', I2, ' going to child' )" ) & + TRIM( TPFLYER%CNAME ), IMODEL_OLD, TPBALLOON%NMODEL + WRITE( CMNHMSG(2), "( 'on ', I2, '/', I2, '/', I4, ' at ', F18.12, 's' )" ) & + TZNEXT%NDAY, TZNEXT%NMONTH, TZNEXT%NYEAR, TZNEXT%XTIME + CALL PRINT_MSG( NVERB_INFO, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) ELSE IF ( TPBALLOON%NMODEL == NDAD(IMODEL_OLD) ) THEN ! Balloon go to parent model ! Recompute position to be compatible with parent timestep @@ -547,15 +589,23 @@ IF ( TPBALLOON%NMODEL /= IMODEL_OLD .AND. .NOT. TPBALLOON%LCRASH ) THEN !Remark: by construction here, ISTORE is always > 1 => no risk with ISTORE-1 value TPBALLOON%TFLYER_TIME%TPDATES(ISTORE) = TPBALLOON%TFLYER_TIME%TPDATES(ISTORE-1) + TPBALLOON%TFLYER_TIME%XTSTEP - WRITE( CMNHMSG(1), "( 'Balloon ', A, ': store skipped at ', I2, '/', I2, '/', I4, ' at ', F18.12, 's' )" ) & + WRITE( CMNHMSG(1), "( 'balloon ', A, ': store skipped on ', I2, '/', I2, '/', I4, ' at ', F18.12, 's' )" ) & TRIM( TPBALLOON%CNAME ), & TPBALLOON%TFLYER_TIME%TPDATES(ISTORE)%NDAY, TPBALLOON%TFLYER_TIME%TPDATES(ISTORE)%NMONTH, & TPBALLOON%TFLYER_TIME%TPDATES(ISTORE)%NYEAR, TPBALLOON%TFLYER_TIME%TPDATES(ISTORE)%XTIME CMNHMSG(2) = 'due to change of model (child to its parent)' - CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) + CALL PRINT_MSG( NVERB_INFO, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) END IF END IF + TZNEXT = TDTCUR + ZTSTEP + + WRITE( CMNHMSG(1), "( 'balloon ', A, ': change of model: ', I2, '->', I2, ' going to parent' )" ) & + TRIM( TPFLYER%CNAME ), IMODEL_OLD, TPBALLOON%NMODEL + WRITE( CMNHMSG(2), "( 'on ', I2, '/', I2, '/', I4, ' at ', F18.12, 's' )" ) & + TZNEXT%NDAY, TZNEXT%NMONTH, TZNEXT%NYEAR, TZNEXT%XTIME + CALL PRINT_MSG( NVERB_INFO, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) + ! Compute new horizontal position TPBALLOON%XX_CUR = TPBALLOON%XX_CUR + ZU_BAL * ZTSTEP * ZMAP TPBALLOON%XY_CUR = TPBALLOON%XY_CUR + ZV_BAL * ZTSTEP * ZMAP @@ -564,10 +614,11 @@ IF ( TPBALLOON%NMODEL /= IMODEL_OLD .AND. .NOT. TPBALLOON%LCRASH ) THEN ! Model number is now imposed IMODEL = TPBALLOON%NMODEL CALL FLYER_GET_RANK_MODEL_ISCRASHED( TPBALLOON, KMODEL = IMODEL ) - IF ( TPBALLOON%LCRASH ) THEN - WRITE( CMNHMSG(1), "( 'Balloon ', A, ' crashed the ', I2, '/', I2, '/', I4, ' at ', F18.12, & - 's (out of the horizontal boundaries)' )" ) & - TRIM( TPBALLOON%CNAME ), TDTCUR%NDAY, TDTCUR%NMONTH, TDTCUR%NYEAR, TDTCUR%XTIME + + IF ( TPBALLOON%LCRASH .AND. TPBALLOON%NCRASH == NCRASH_OUT_HORIZ ) THEN + WRITE( CMNHMSG(1), "( 'balloon ', A, ' crashed on ', I2, '/', I2, '/', I4, ' at ', F18.12, & + 's (out of the horizontal boundaries)' )" ) & + TRIM( TPBALLOON%CNAME ), TZNEXT%NDAY, TZNEXT%NMONTH, TZNEXT%NYEAR, TZNEXT%XTIME CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) END IF ELSE @@ -767,7 +818,7 @@ LOGICAL :: GLOW, GHIGH ! Find indices surrounding the vertical box where the flyer is SELECT TYPE ( TPFLYER ) - CLASS IS ( TAIRCRAFTDATA) + CLASS IS ( TAIRCRAFTDATA ) IF ( TPFLYER%LALTDEF ) THEN ZFLYER_EXN = (TPFLYER%XP_CUR/XP00)**(XRD/XCPD) CALL TPFLYER%COMPUTE_VERTICAL_INTERP_COEFF( 'MASS', ZFLYER_EXN, ZEXN, GLOW, GHIGH, ODONOLOWCRASH = .TRUE. ) @@ -775,7 +826,7 @@ SELECT TYPE ( TPFLYER ) CALL TPFLYER%COMPUTE_VERTICAL_INTERP_COEFF( 'MASS', TPFLYER%XZ_CUR, ZZM, GLOW, GHIGH, ODONOLOWCRASH = .TRUE. ) END IF - CLASS IS ( TBALLOONDATA) + CLASS IS ( TBALLOONDATA ) IF ( TPFLYER%CTYPE == 'ISODEN' ) THEN CALL TPFLYER%COMPUTE_VERTICAL_INTERP_COEFF( 'MASS', TPFLYER%XRHO, ZRHO, GLOW, GHIGH, ODONOLOWCRASH = .TRUE. ) ELSE IF ( TPFLYER%CTYPE == 'RADIOS' .OR. TPFLYER%CTYPE == 'CVBALL' ) THEN @@ -788,6 +839,16 @@ END SELECT IF ( GHIGH ) THEN TPFLYER%LCRASH = .TRUE. TPFLYER%NCRASH = NCRASH_OUT_HIGH + + SELECT TYPE ( TPFLYER ) + CLASS IS ( TAIRCRAFTDATA ) + WRITE( CMNHMSG(1), "( 'aircraft ', A, ' crashed on ', I2, '/', I2, '/', I4, ' at ', F18.12, 's (too high)' )" ) & + TRIM( TPFLYER%CNAME ), TDTCUR%NDAY, TDTCUR%NMONTH, TDTCUR%NYEAR, TDTCUR%XTIME + CLASS IS ( TBALLOONDATA ) + WRITE( CMNHMSG(1), "( 'balloon ', A, ' crashed on ', I2, '/', I2, '/', I4, ' at ', F18.12, 's (too high)' )" ) & + TRIM( TPFLYER%CNAME ), TDTCUR%NDAY, TDTCUR%NMONTH, TDTCUR%NYEAR, TDTCUR%XTIME + END SELECT + CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'AIRCRAFT_BALLOON_EVOL', OLOCAL = .TRUE. ) END IF SELECT TYPE ( TPFLYER ) diff --git a/src/MNH/diag.f90 b/src/MNH/diag.f90 index 82bd467578c6d746c07bab7c9685efeeb49408a9..acbfb23657c157e0c34caaf13723093089fc97fd 100644 --- a/src/MNH/diag.f90 +++ b/src/MNH/diag.f90 @@ -63,7 +63,6 @@ !! 03/2010 (G.Tanguy) Clean up of unuseful variables !! 05/2010 Add lidar !!! 03/2012 (S. Bielli) Add NAM_NCOUT for netcdf output (removed 11/07/2016) -!! 03/2013 (O.Caumont) Modif call aircraft_balloon !! 03/2013 (C. Augros) Add variables for radar simulator in NAMELIST: !! NBAZIM,LSNRT,XSNRMIN !! D.Ricard 2015 : add LMOIST_ES @@ -83,24 +82,22 @@ !! 01/2018 (J.-P. Chaboureau) Add altitude interpolation !! 01/2018 (J.-P. Chaboureau) Add coarse graining !! 01/2018 (G.Delautier) SURFEX 8.1 -!! 03/2018 (P.Wautelet) replace SUBTRACT_TO_DATE and ADD_FORECAST_TO_DATE -!! by DATETIME_CORRECTDATE !! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O !! V.Vionnet 07/2017 add LWIND_CONTRAV !! 11/2017 (D. Ricard, P. Marquet) add diagnostics for THETAS ! P. Wautelet 07/02/2019: force TYPE to a known value for IO_File_add2list ! P. Wautelet 11/02/2019: added missing use of MODI_CH_MONITOR_n ! P. Wautelet 28/03/2019: use MNHTIME for time measurement variables -! P. Wautelet 26/07/2019: bug correction: deallocate of zsea done too early ! P. Wautelet 13/09/2019: budget: simplify and modernize date/time management ! P. Wautelet 06/07/2021: use FINALIZE_MNH +! P. Wautelet 15/09/2023! remove offline balloons !------------------------------------------------------------------------------- ! !* 0. DECLARATIONS ! ------------ ! USE MODD_ADV_n -USE MODD_AIRCRAFT_BALLOON +USE MODD_AIRCRAFT_BALLOON, ONLY: LFLYER USE MODD_BUDGET USE MODD_CONF USE MODD_CONF_n @@ -113,7 +110,7 @@ USE MODD_FIELD_n USE MODD_GR_FIELD_n USE MODD_GRID, ONLY: XLONORI, XLATORI USE MODD_GRID_n -USE MODD_IO, ONLY: CIO_DIR, NIO_VERB, NVERB_DEBUG, TFILEDATA, TFILE_SURFEX +USE MODD_IO, ONLY: NIO_VERB, NVERB_DEBUG, TFILEDATA, TFILE_SURFEX USE MODD_LBC_n USE MODD_LES USE MODD_LES_BUDGET @@ -141,11 +138,9 @@ USE MODD_TIME_n USE MODD_TURB_n USE MODD_VAR_ll ! -USE MODE_AIRCRAFT_BALLOON USE MODE_DATETIME USE MODE_FINALIZE_MNH, only: FINALIZE_MNH USE MODE_IO_FILE, only: IO_File_close, IO_File_open -USE MODE_IO_FIELD_WRITE, only: IO_Header_write USE MODE_IO, only: IO_Config_set, IO_Init USE MODE_IO_MANAGE_STRUCT, only: IO_File_add2list USE MODE_ll @@ -157,14 +152,11 @@ USE MODE_MODELN_HANDLER USE MODE_MSG USE MODE_POS USE MODE_TIME -USE MODE_WRITE_AIRCRAFT_BALLOON -use mode_write_lfifmn_fordiachro_n, only: WRITE_LFIFMN_FORDIACHRO_n ! USE MODI_CH_MONITOR_n USE MODI_COMPUTE_R00 USE MODI_DIAG_SURF_ATM_N USE MODI_INIT_MNH -USE MODI_MNHGET_SURF_PARAM_n USE MODI_PHYS_PARAM_n USE MODI_VERSION USE MODI_WRITE_DIAG_SURF_ATM_N @@ -181,8 +173,6 @@ IMPLICIT NONE ! !* 0.1 declarations of local variables ! -TYPE(DATE_TIME) :: TXDTBAL ! current time and date for BALLOON and AIRCRAFT trajectories -TYPE(DATE_TIME) :: TPDTCUR_SAVE CHARACTER (LEN=28), DIMENSION(1) :: YINIFILE ! names of the INPUT FM-file CHARACTER (LEN=28), DIMENSION(1) :: YINIFILEPGD ! names of the INPUT FM-file CHARACTER (LEN=5) :: YSUFFIX ! character string for the OUTPUT FM-file number @@ -193,9 +183,8 @@ CHARACTER (LEN=4) :: YTURB ! initial flag to call to turbulence schemes INTEGER :: ILUOUT0 ! Logical unit number for the output listing REAL(kind=MNHTIME), DIMENSION(2) :: ZTIME0, ZTIME1, ZTIME2, ZRAD, ZDCONV, ZSHADOWS, ZGROUND, & ZTRACER, ZDRAG, ZTURB, ZMAFL, ZCHEM, ZTIME_BU, ZEOL ! CPU times -REAL(kind=MNHTIME), DIMENSION(2) :: ZSTART, ZINIT, ZWRIT, ZBALL, ZPHYS, ZSURF, ZWRITS, ZTRAJ ! storing variables +REAL(kind=MNHTIME), DIMENSION(2) :: ZSTART, ZINIT, ZWRIT, ZPHYS, ZSURF, ZWRITS, ZTRAJ ! storing variables INTEGER(KIND=LFIINT) :: INPRAR ! number of articles predicted in the LFIFM file -INTEGER :: ISTEPBAL ! loop indice for balloons and aircraft INTEGER :: ILUNAM ! Logical unit numbers for the namelist file ! and for output_listing file INTEGER :: JF =0 ! loop index @@ -205,10 +194,8 @@ LOGICAL:: GCLOUD_ONLY ! conditionnal radiation computations for ! the only cloudy columns ! INTEGER :: IIU, IJU, IKU -REAL, DIMENSION(:,:),ALLOCATABLE :: ZSEA REAL, DIMENSION(:,:,:,:),ALLOCATABLE :: ZWETDEPAER ! -TYPE(TFILEDATA),POINTER :: TZDIACFILE => NULL() TYPE(TFILEDATA),POINTER :: TZNMLFILE => NULL() !Namelist file ! NAMELIST/NAM_DIAG/ CISO, LVAR_RS, LVAR_LS, & @@ -222,9 +209,7 @@ NAMELIST/NAM_DIAG/ CISO, LVAR_RS, LVAR_LS, & LCLD_COV, LVAR_PR, LTOTAL_PR, LMEAN_PR, XMEAN_PR, & NCAPE, LBV_FR, LRADAR, CBLTOP, LTRAJ, & LDIAG,XDIAG,LCHEMDIAG,LCHAQDIAG,XCHEMLAT,XCHEMLON,& - CSPEC_BU_DIAG,CSPEC_DIAG,LAIRCRAFT_BALLOON,NTIME_AIRCRAFT_BALLOON,& - XSTEP_AIRCRAFT_BALLOON,& - XLAT_BALLOON,XLON_BALLOON,XALT_BALLOON,& + CSPEC_BU_DIAG,CSPEC_DIAG, & LC2R2, LC3R5, LELECDIAG, CAERDIAG, & NGPS,XLAT_GPS,XLON_GPS,XZS_GPS,CNAM_GPS,XDIFFORO, & NVERSION_RAD, NCURV_INTERPOL, LCART_RAD, CARF,LREFR,LDNDZ,& @@ -314,13 +299,6 @@ CSPEC_DIAG='' LTRAJ=.FALSE. LLIMA_DIAG=.FALSE. ! -LAIRCRAFT_BALLOON=.FALSE. -NTIME_AIRCRAFT_BALLOON=NUNDEF -XSTEP_AIRCRAFT_BALLOON=XUNDEF -XLAT_BALLOON(:)=XUNDEF -XLON_BALLOON(:)=XUNDEF -XALT_BALLOON(:)=XUNDEF -! NGPS=-1 CNAM_GPS(:)='' XLAT_GPS(:)=XUNDEF @@ -516,60 +494,6 @@ ZWRIT =ZTIME2-ZTIME1 ZTIME1=ZTIME2 !------------------------------------------------------------------------------- ! -!* 4.1 BALLOON and AIRCRAFT -! -IF ( LAIRCRAFT_BALLOON ) THEN -! - CALL IO_File_add2list(TZDIACFILE,TRIM(CINIFILE)//'BAL','MNHDIACHRONIC','WRITE', & - HDIRNAME=CIO_DIR,KLFINPRAR=INPRAR,KLFITYPE=1,KLFIVERB=NVERB) -! - CALL IO_File_open(TZDIACFILE) -! - WRITE(ILUOUT0,*) ' ' - WRITE(ILUOUT0,*) 'DIAG AFTER OPEN DIACHRONIC FILE' - WRITE(ILUOUT0,*) ' ' -! - TPDTCUR_SAVE = TDTCUR -! - TXDTBAL%nyear = TDTCUR%nyear - TXDTBAL%nmonth = TDTCUR%nmonth - TXDTBAL%nday = TDTCUR%nday - TXDTBAL%xtime = TDTCUR%xtime - NTIME_AIRCRAFT_BALLOON/2. - CALL DATETIME_CORRECTDATE(TXDTBAL) - TDTCUR = TXDTBAL !TDTCUR is used in AIRCRAFT_BALLOON -! - ALLOCATE (ZSEA(SIZE(XRHODJ,1),SIZE(XRHODJ,2))) - ZSEA(:,:) = 0. - CALL MNHGET_SURF_PARAM_n (PSEA=ZSEA(:,:)) - DO ISTEPBAL = 1, NTIME_AIRCRAFT_BALLOON, INT(XSTEP_AIRCRAFT_BALLOON) - CALL AIRCRAFT_BALLOON( XSTEP_AIRCRAFT_BALLOON, XZZ, XMAP, XLONORI, XLATORI, XUT, XVT, XWT, & - XPABST, XTHT, XRT, XSVT, XTKET, XTSRAD, XRHODREF, XCIT, ZSEA ) - - TXDTBAL%xtime = TXDTBAL%xtime + XSTEP_AIRCRAFT_BALLOON - CALL DATETIME_CORRECTDATE(TXDTBAL) - TDTCUR = TXDTBAL !TDTCUR is used in AIRCRAFT_BALLOON - END DO - DEALLOCATE (ZSEA) -! - TDTCUR = TPDTCUR_SAVE -! - CALL IO_Header_write(TZDIACFILE) - CALL WRITE_LFIFMN_FORDIACHRO_n(TZDIACFILE) - CALL WRITE_AIRCRAFT_BALLOON(TZDIACFILE) -#ifdef MNH_IOLFI - CALL MENU_DIACHRO(TZDIACFILE,'END') -#endif - CALL IO_File_close(TZDIACFILE) - WRITE(ILUOUT0,*) ' ' - WRITE(ILUOUT0,*) 'DIAG AFTER CLOSE DIACHRONIC FILE' - WRITE(ILUOUT0,*) ' ' -END IF -! -CALL SECOND_MNH2(ZTIME2) -ZBALL =ZTIME2-ZTIME1 -ZTIME1=ZTIME2 -!------------------------------------------------------------------------------- -! !* 5.0 Call to physics ! !* initialise the source terms @@ -772,7 +696,6 @@ ZTIME2=ZTIME2-ZTIME0 !WRITE(ILUOUT0,YFMT) '| START | ',ZSTART,' | ',100.*ZSTART/ZTIME2,' |' !WRITE(ILUOUT0,YFMT) '| INIT | ',ZINIT,' | ',100.*ZINIT/ZTIME2,' |' !WRITE(ILUOUT0,YFMT) '| WRIT | ',ZWRIT,' | ',100.*ZWRIT/ZTIME2,' |' -!WRITE(ILUOUT0,YFMT) '| BALL | ',ZBALL,' | ',100.*ZBALL/ZTIME2,' |' !WRITE(ILUOUT0,YFMT) '| PHYS | ',ZPHYS,' | ',100.*ZPHYS/ZTIME2,' |' !IF (ZRAD>0.) & ! WRITE(ILUOUT0,YFMT2) '| ',CRAD,' | ',ZRAD diff --git a/src/MNH/ini_aircraft.f90 b/src/MNH/ini_aircraft.f90 index 90beb1354dca150ada71e2b156dfdd2a2907ef1d..64e39beb3c82047dd42ed9f19ccd5d9c94f2a434 100644 --- a/src/MNH/ini_aircraft.f90 +++ b/src/MNH/ini_aircraft.f90 @@ -18,74 +18,6 @@ CONTAINS ! ####################### SUBROUTINE INI_AIRCRAFT ! ####################### -! -! -!!**** *INI_AIRCRAFT* - user initializes the aircraft flight path -!! -!! PURPOSE -!! ------- -! -! -!!** METHOD -!! ------ -!! -!! Must be defined (for each aircraft): -!! --------------- -!! -!! No default exist for these variables. -!! ************************************ -!! -!! 1) the model in which the aircraft will evolve -!! if NOT initialized, the aircraft is NOT used. -!! -!! 2) the possibility to switch from a model to its dad or kid -!! 'FIX' : NMODEL used during the run -!! 'MOB' : best resolution model used. NMODEL=1 is used at the beginning -!! -!! -!! 3) the type of aircraft -!! -!! 'AIRCRAFT' for aircraft -!! -!! 4) the takeoff date and time -!! -!! 5) the number of flight path segments (SEG) -!! -!! 6) the (SEG ) duration of flight in the segments, in the flight order (sec.) -!! -!! 6bis) TAIRCRAFT%LALTDEF : flag to define the mode of initialisation of -!! aircraft altitude TRUE for pressure (corresponding to %XSEGP) -!! or FALSE for Z (corresponding to %XSEGZ) -!! -!! 7) the (SEG+1) latitudes of the segments ends, in the flight order -!! first point is take-off -!! last point is landing -!! -!! 8) the (SEG+1) longitudes of the segments ends, in the flight order -!! -!! 9) the (SEG+1) pressure (%XSEGP) or Z (%XSEGZ) of the segments ends, in the flight order -!! -!! -!! -!! Can be defined (for each aircraft): -!! -------------- -!! -!! -!! 9) the time step for data storage. -!! default is 60s -!! -!! 10) the name or title describing the aircraft (8 characters) -!! default is the aircraft type (6 characters) + the aircraft numbers (2 characters) -!! -!! -!! EXTERNAL -!! -------- -!! -!! IMPLICIT ARGUMENTS -!! ------------------ -!! -!! REFERENCE -!! --------- !! !! AUTHOR !! ------ @@ -122,6 +54,8 @@ DO JI = 1, NAIRCRAFTS TZAIRCRAFT%NID = JI + TZAIRCRAFT%LFIX = .FALSE. + IF ( CTITLE(JI) == '' ) THEN WRITE( CTITLE(JI), FMT = '( A, I3.3) ') TRIM( CTYPE(JI) ), JI diff --git a/src/MNH/ini_aircraft_balloon.f90 b/src/MNH/ini_aircraft_balloon.f90 index fb6aba612e8967dd2daf11d5ecdff81004720d73..f31a5584a3f4d9018367801a666ac2644e9098a0 100644 --- a/src/MNH/ini_aircraft_balloon.f90 +++ b/src/MNH/ini_aircraft_balloon.f90 @@ -7,6 +7,7 @@ ! P. Wautelet 01/10/2020: bugfix: DEFAULT_FLYER: add missing default values ! P. Wautelet 06/2022: reorganize flyers ! P. Wautelet 25/08/2022: write balloon positions in netCDF4 files inside HDF5 groups +! P. Wautelet 15/09/2023: remove offline balloons !----------------------------------------------------------------- !############################### @@ -66,12 +67,11 @@ CONTAINS ! ------------ ! USE MODD_AIRCRAFT_BALLOON -USE MODD_CONF, ONLY: CPROGRAM -USE MODD_DIAG_FLAG, ONLY: LAIRCRAFT_BALLOON, NTIME_AIRCRAFT_BALLOON, & - XALT_BALLOON, XLAT_BALLOON, XLON_BALLOON, XSTEP_AIRCRAFT_BALLOON +USE MODD_CONF, ONLY: CPROGRAM, NMODEL USE MODD_DYN_n, ONLY: DYN_MODEL USE MODD_IO, ONLY: ISP, TFILEDATA USE MODD_PARAMETERS, ONLY: NUNDEF +USE MODD_PARAM_n, ONLY: PARAM_MODEL ! USE MODE_GRIDPROJ, ONLY: SM_XYHAT USE MODE_INI_AIRCRAFT, ONLY: INI_AIRCRAFT @@ -93,29 +93,16 @@ REAL, INTENT(IN) :: PLONOR ! longitude of origine point ! INTEGER :: IMI ! current model index INTEGER :: JI +LOGICAL :: GCHECK ! !---------------------------------------------------------------------------- -! -IMI=GET_CURRENT_MODEL_INDEX() -!---------------------------------------------------------------------------- -! -!* 1. Default values -! -------------- -! -IF ( CPROGRAM == 'DIAG ') THEN - IF ( .NOT. LAIRCRAFT_BALLOON ) RETURN - IF (NTIME_AIRCRAFT_BALLOON == NUNDEF .OR. XSTEP_AIRCRAFT_BALLOON == XUNDEF) THEN - CMNHMSG(1) = "NTIME_AIRCRAFT_BALLOON and/or XSTEP_AIRCRAFT_BALLOON not initialized in DIAG " - CMNHMSG(2) = "No calculations for Balloons and Aircraft" - CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'INI_AIRCRAFT_BALLOON' ) - - LAIRCRAFT_BALLOON=.FALSE. - RETURN - ENDIF -ENDIF + +IF ( CPROGRAM == 'DIAG ') RETURN IF ( NAIRCRAFTS > 0 .OR. NBALLOONS > 0 ) LFLYER = .TRUE. -! + +IMI = GET_CURRENT_MODEL_INDEX() + !---------------------------------------------------------------------------- ! !* 2. Balloon initialization @@ -162,13 +149,50 @@ END IF !* 4. Allocations of storage arrays ! ----------------------------- ! -IF ( IMI == 1 .AND. ISP == NFLYER_DEFAULT_RANK ) THEN +! Check that CCLOUD, CRAD and CTURB are the same for all models if some flyers have CMODEL='MOB' +! This is necessary because we need to allocate and compute the same data on every model if the flyer is allowed to change model +! This check is only done once (on MODEL IMI=1) +! This check has to be done AFTER the calls to INI_AIRCRAFT and INI_BALLOON +IF ( IMI == 1 .AND. NMODEL > 1 .AND. ISP == NFLYER_DEFAULT_RANK ) THEN + GCHECK = .FALSE. + DO JI = 1, NBALLOONS - CALL TBALLOONS(JI)%TBALLOON%DATA_ARRAYS_ALLOCATE() + IF ( TBALLOONS(JI)%TBALLOON%CMODEL == 'MOB' ) THEN + GCHECK = .TRUE. + EXIT + END IF END DO DO JI = 1, NAIRCRAFTS - CALL TAIRCRAFTS(JI)%TAIRCRAFT%DATA_ARRAYS_ALLOCATE() + IF ( TAIRCRAFTS(JI)%TAIRCRAFT%CMODEL == 'MOB' ) THEN + GCHECK = .TRUE. + EXIT + END IF + END DO + + IF ( GCHECK ) THEN + DO JI = 2, NMODEL + IF ( PARAM_MODEL(JI)%CCLOUD /= PARAM_MODEL(1)%CCLOUD ) & + CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'INI_AIRCRAFT_BALLOON', & + 'CCLOUD must be the same on all nested domains if aircraft/balloon has CMODEL="MOB"' ) + IF ( PARAM_MODEL(JI)%CRAD /= PARAM_MODEL(1)%CRAD ) & + CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'INI_AIRCRAFT_BALLOON', & + 'CRAD must be the same on all nested domains if aircraft/balloon has CMODEL="MOB"' ) + IF ( PARAM_MODEL(JI)%CTURB /= PARAM_MODEL(1)%CTURB ) & + CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'INI_AIRCRAFT_BALLOON', & + 'CTURB must be the same on all nested domains if aircraft/balloon has CMODEL="MOB"' ) + END DO + END IF +END IF + +! Allocate data arrays of flyers +IF ( ISP == NFLYER_DEFAULT_RANK ) THEN + DO JI = 1, NBALLOONS + IF ( TBALLOONS(JI)%TBALLOON%NMODEL == IMI ) CALL TBALLOONS(JI)%TBALLOON%DATA_ARRAYS_ALLOCATE() + END DO + + DO JI = 1, NAIRCRAFTS + IF ( TAIRCRAFTS(JI)%TAIRCRAFT%NMODEL == IMI ) CALL TAIRCRAFTS(JI)%TAIRCRAFT%DATA_ARRAYS_ALLOCATE() END DO END IF ! @@ -223,6 +247,7 @@ CALL SM_XYHAT( PLATOR, PLONOR, TPFLYER%XLATLAUNCH, TPFLYER%XLONLAUNCH, TPFLYER%X IF ( CPROGRAM == 'MESONH' .OR. CPROGRAM == 'SPAWN ' .OR. CPROGRAM == 'REAL ' ) THEN ! Read the current location in the synchronous file + ! Remark: if the balloon is not yet in flight or is crashed, position is not available in file IF ( TPINIFILE%CFORMAT == 'LFI' & .OR. ( TPINIFILE%CFORMAT == 'NETCDF4' .AND. & @@ -413,24 +438,6 @@ IF ( CPROGRAM == 'MESONH' .OR. CPROGRAM == 'SPAWN ' .OR. CPROGRAM == 'REAL ' ) CALL FLYER_TIMESTEP_CORRECT( DYN_MODEL(IMODEL)%XTSTEP, TPFLYER ) END IF - ! -ELSE IF ( CPROGRAM == 'DIAG ' ) THEN - IF ( LAIRCRAFT_BALLOON ) THEN - ! read the current location in MODD_DIAG_FLAG - ! - ZLAT=XLAT_BALLOON(KNBR) - ZLON=XLON_BALLOON(KNBR) - TPFLYER%XZ_CUR=XALT_BALLOON(KNBR) - IF (TPFLYER%XZ_CUR /= XUNDEF .AND. ZLAT /= XUNDEF .AND. ZLON /= XUNDEF ) THEN - CALL SM_XYHAT( PLATOR, PLONOR, ZLAT, ZLON, TPFLYER%XX_CUR, TPFLYER%XY_CUR ) - TPFLYER%LFLY = .TRUE. - CMNHMSG(1) = 'current location read from MODD_DIAG_FLAG for ' // TRIM( TPFLYER%CNAME ) - WRITE( CMNHMSG(2), * ) " Lat=", ZLAT, " Lon=", ZLON," Alt=",TPFLYER%XZ_CUR - CALL PRINT_MSG( NVERB_INFO, 'GEN', 'INI_LAUNCH' ) - END IF - ! - CALL FLYER_TIMESTEP_CORRECT( XSTEP_AIRCRAFT_BALLOON, TPFLYER ) - END IF END IF ! Restore correct value of GSMONOPROC diff --git a/src/MNH/ini_balloon.f90 b/src/MNH/ini_balloon.f90 index 3b60fd7e5509ca79ac61429a68a738c1f1fb99a1..e3ca63c57f4548453f78fef314f1cf78e9f11ed2 100644 --- a/src/MNH/ini_balloon.f90 +++ b/src/MNH/ini_balloon.f90 @@ -17,84 +17,6 @@ CONTAINS SUBROUTINE INI_BALLOON ! ###################### ! -! -!!**** *INI_BALLOON* - user initializes the balloon characteristics -!! -!! PURPOSE -!! ------- -! -! -!!** METHOD -!! ------ -!! -!! For constant volume Balloon, horizontal advection using horizontal wind -!! vertical speed of the balloon calculated using the balloon equation -!! (Koffi et AL 2000, JAS vol 57 P.2007-2021) -!! -!! Must be defined (for each balloon): -!! --------------- -!! -!! No default exist for these variables. -!! ************************************ -!! -!! 1) the model in which the balloon will evolve -!! if NOT initialized, the balloon is NOT used. -!! 1.1) the possibility to switch from a model to its dad or kid -!! 'FIX' : NMODEL used during the run -!! 'MOB' : best resolution model used. NMODEL=1 is used at the beginning -!! -!! 2) the type of balloon -!! -!! 'RADIOS' for radiosounding balloon -!! 'ISODEN' for iso-density balloon -!! 'CVBALL' for constant volume Balloon -!! -!! 3) the launching date and time -!! -!! 4) the latitude of the launching site -!! -!! 5) the longitude of the launching site -!! -!! 6) the altitude of the launching site (for 'RADIOS') -!! -!! OR -!! -!! the altitude OR pressure of balloon at start of the leveled flight -!! (for 'ISODEN'). In this case, the density of this level will be computed, -!! and the balloon will evolve at this density level. -!! -!! -!! -!! Can be defined (for each balloon): -!! -------------- -!! -!! 7) the ascentional vertical speed of the ballon (in calm air) (for 'RADIOS') -!! default is 5m/s -!! -!! 8) the time step for data storage. -!! default is 60s -!! -!! 9) the name or title describing the balloon (8 characters) -!! default is the balloon type (6 characters) + the balloon numbers (2 characters) -!! -!! 10) for 'CVBALL' the aerodynamic drag coefficient of the balloon -!! -!! 11) for 'CVBALL' the induced drag coefficient (i.e. air shifted by the balloon) -!! -!! 12) for 'CVBALL' the volume of the balloon -!! -!! 13) for 'CVBALL' the mass of the balloon -!! -!! -!! EXTERNAL -!! -------- -!! -!! IMPLICIT ARGUMENTS -!! ------------------ -!! -!! REFERENCE -!! --------- -!! !! AUTHOR !! ------ !! Valery Masson * Meteo-France * @@ -126,6 +48,8 @@ DO JI = 1, NBALLOONS TZBALLOON%NID = JI + TZBALLOON%LFIX = .FALSE. + IF ( CTITLE(JI) == '' ) THEN WRITE( CTITLE(JI), FMT = '( A, I3.3) ') TRIM( CTYPE(JI) ), JI diff --git a/src/MNH/ini_posprofilern.f90 b/src/MNH/ini_posprofilern.f90 index 4ce19c1558c9b1b90c8c30c16ab0631bd4037214..6a50b045d044f43e3a1ae420c44edadfc66d488c 100644 --- a/src/MNH/ini_posprofilern.f90 +++ b/src/MNH/ini_posprofilern.f90 @@ -141,6 +141,7 @@ END IF LPROFILER = ( INUMBPROF > 0 ) DO JI = 1, NUMBPROFILER_LOC + TPROFILERS(JI)%LFIX = .TRUE. CALL TPROFILERS(JI)%DATA_ARRAYS_ALLOCATE( ISTORE ) END DO !---------------------------------------------------------------------------- diff --git a/src/MNH/ini_surfstationn.f90 b/src/MNH/ini_surfstationn.f90 index c1eb1a20dab4975e5cb9021e1154403505ed7996..a14cc771c37a1852a1ff9cd1991400cfb71795d7 100644 --- a/src/MNH/ini_surfstationn.f90 +++ b/src/MNH/ini_surfstationn.f90 @@ -142,6 +142,7 @@ END IF LSTATION = ( INUMBSTAT > 0 ) DO JI = 1, NUMBSTAT_LOC + TSTATIONS(JI)%LFIX = .TRUE. CALL TSTATIONS(JI)%DATA_ARRAYS_ALLOCATE( ISTORE ) END DO diff --git a/src/MNH/modd_aircraft_balloon.f90 b/src/MNH/modd_aircraft_balloon.f90 index 4f71f50fcc3b61fd1118e120068a9e519641605a..a5bf6a96a1edb53bf932b8160d49327571e885c5 100644 --- a/src/MNH/modd_aircraft_balloon.f90 +++ b/src/MNH/modd_aircraft_balloon.f90 @@ -214,9 +214,7 @@ CONTAINS SUBROUTINE DATA_ARRAYS_ALLOCATE_FLYER( TPSENSOR, KSTORE ) ! ####################################################### - USE MODD_CONF, ONLY: CPROGRAM USE MODD_CONF_n, ONLY: NRR - USE MODD_DIAG_FLAG, ONLY: NTIME_AIRCRAFT_BALLOON USE MODD_DIM_n, ONLY: NKMAX USE MODD_DYN, ONLY: XSEGLEN USE MODD_DYN_n, ONLY: DYN_MODEL @@ -243,11 +241,7 @@ SUBROUTINE DATA_ARRAYS_ALLOCATE_FLYER( TPSENSOR, KSTORE ) IF ( PRESENT( KSTORE ) ) THEN ISTORE = KSTORE ELSE - IF ( CPROGRAM == 'DIAG ' ) THEN - ISTORE = INT ( NTIME_AIRCRAFT_BALLOON / TPSENSOR%TFLYER_TIME%XTSTEP ) + 1 - ELSE - ISTORE = NINT ( ( XSEGLEN - DYN_MODEL(1)%XTSTEP ) / TPSENSOR%TFLYER_TIME%XTSTEP ) + 1 - ENDIF + ISTORE = NINT ( ( XSEGLEN - DYN_MODEL(1)%XTSTEP ) / TPSENSOR%TFLYER_TIME%XTSTEP ) + 1 END IF CALL TPSENSOR%Data_arrays_allocate_sensor( .TRUE., KLEVELS = 1, KSTORE = ISTORE ) diff --git a/src/MNH/modd_diag_flag.f90 b/src/MNH/modd_diag_flag.f90 index a7eaf4b92f2d868c23c4df9d87abd2fac95b50ee..3115f14260767f60d010c5ecf7d427d6fd95c643 100644 --- a/src/MNH/modd_diag_flag.f90 +++ b/src/MNH/modd_diag_flag.f90 @@ -1,13 +1,8 @@ -!MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 1998-2023 CNRS, Meteo-France and Universite Paul Sabatier !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence -!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt !MNH_LIC for details. version 1. !----------------------------------------------------------------- -!--------------- special set of characters for RCS information -!----------------------------------------------------------------- -! $Source: /home/cvsroot/MNH-VX-Y-Z/src/MNH/modd_diag_flag.f90,v $ $Revision: 1.2.4.1.2.2.10.2.2.2.2.2 $ -! masdev4_8 modd 2008/06/30 15:13:13 -!----------------------------------------------------------------- ! ##################### MODULE MODD_DIAG_FLAG ! ###################### @@ -43,7 +38,8 @@ !! T. Dauhut 10/2017 add parallel 3D clustering !! J.-P. Chaboureau 01/2018 add altitude interpolation !! J.-P. Chaboureau 01/2018 add coarse graining -!! +! P. Wautelet 15/09/2023: remove offline balloons +! !------------------------------------------------------------------------------- ! !* 0. DECLARATIONS @@ -109,13 +105,6 @@ LOGICAL :: LCHAQDIAG ! flag for aqueous phase chemistry REAL, DIMENSION(10) :: XCHEMLAT,XCHEMLON ! positions of vertical profiles written by routine write_ts1d CHARACTER (LEN=1024) :: CSPEC_BU_DIAG CHARACTER (LEN=1024) :: CSPEC_DIAG -LOGICAL :: LAIRCRAFT_BALLOON ! aircraft and balloon trajectories -INTEGER :: NTIME_AIRCRAFT_BALLOON ! time in seconds of trajectories computing -REAL :: XSTEP_AIRCRAFT_BALLOON ! minimum time step for trajectories calculations (s) -REAL, DIMENSION(9) :: XLAT_BALLOON ! initial latitudes of the balloons - !(at file time minus NTIME_AIRCRAFT_BALLOON/2) -REAL, DIMENSION(9) :: XLON_BALLOON ! initial longitudes of the balloons -REAL, DIMENSION(9) :: XALT_BALLOON ! initial altitude of the balloons (m) LOGICAL :: LC2R2 LOGICAL :: LC3R5 LOGICAL :: LELECDIAG ! flag for atmospheric electricity diff --git a/src/MNH/modd_sensor.f90 b/src/MNH/modd_sensor.f90 index 18ca64c27d6941aaa3a87a398614b0900f1867ae..b780c39137fc86ee7ed5d63c5a9af8921b9b8c04 100644 --- a/src/MNH/modd_sensor.f90 +++ b/src/MNH/modd_sensor.f90 @@ -21,6 +21,8 @@ MODULE MODD_SENSOR INTEGER, PARAMETER :: NTAG_NCUR = 145 INTEGER, PARAMETER :: NTAG_PACK = 245 + + INTEGER, PARAMETER :: NEMPTYDATA = -1 ! Size to communicate if exchange of no sensor data TYPE :: TSENSORTIME INTEGER :: N_CUR = 0 ! current step of storage REAL :: XTSTEP = 60. ! storage time step (default reset later) @@ -71,6 +73,7 @@ MODULE MODD_SENSOR INTEGER :: NV01 = NNEGUNDEF ! Z position for ni_m , nj_v+1 INTEGER :: NV10 = NNEGUNDEF ! Z position for ni_m+1, nj_v INTEGER :: NV11 = NNEGUNDEF ! Z position for ni_m+1, nj_v+1 + ! Coefficient to interpolate values (sensors are usually not exactly on mesh points) REAL :: XXMCOEF = XUNDEF ! Interpolation coefficient for X (mass-point) REAL :: XYMCOEF = XUNDEF ! Interpolation coefficient for Y (mass-point) @@ -380,7 +383,6 @@ MODULE MODD_SENSOR INTEGER :: IK00, IK01, IK10, IK11 INTEGER :: IKB, IKE, IKU INTEGER :: JI, JJ - LOGICAL :: GCHANGE ! set to true if at least an index has been forced to change LOGICAL :: GDONE ! set to true if coefficient computation has been done LOGICAL :: GDONOLOWCRASH REAL :: ZZCOEF00, ZZCOEF01, ZZCOEF10, ZZCOEF11 @@ -388,7 +390,6 @@ MODULE MODD_SENSOR OLOW = .FALSE. OHIGH = .FALSE. - GCHANGE = .FALSE. GDONE = .FALSE. IKB = 1 + JPVEXT @@ -419,9 +420,9 @@ MODULE MODD_SENSOR IF ( ANY( [ IK00, IK01, IK10, IK11 ] < IKB ) ) THEN ! Sensor is low (too near the ground or below it) OLOW = .TRUE. + IF ( GDONOLOWCRASH ) THEN ! Do not allow crash on the ground: set position on the ground if too low - GCHANGE = .TRUE. !Minimum altitude is on the ground at ikb (no crash if too low) IK00 = MAX ( IK00, IKB ) IK01 = MAX ( IK01, IKB ) @@ -454,25 +455,20 @@ MODULE MODD_SENSOR OHIGH = .TRUE. ! Limit ik?? indices to prevent out of bound accesses - IF ( IK00 > IKU-1) THEN - IK00 = IKU-1 - GCHANGE = .TRUE. - END IF - IF ( IK01 > IKU-1) THEN - IK01 = IKU-1 - GCHANGE = .TRUE. - END IF - IF ( IK10 > IKU-1) THEN - IK10 = IKU-1 - GCHANGE = .TRUE. - END IF - IF ( IK11 > IKU-1) THEN - IK11 = IKU-1 - GCHANGE = .TRUE. - END IF + IK00 = MIN( IK00, IKE ) + IK01 = MIN( IK01, IKE ) + IK10 = MIN( IK10, IKE ) + IK11 = MIN( IK11, IKE ) CALL PRINT_MSG( NVERB_WARNING, 'GEN', 'Compute_vertical_interp_coeff', & 'sensor ' // TRIM( TPSENSOR%CNAME ) // ' is too high', OLOCAL = .TRUE. ) + + ZZCOEF00 = XUNDEF + ZZCOEF01 = XUNDEF + ZZCOEF10 = XUNDEF + ZZCOEF11 = XUNDEF + + GDONE = .TRUE. END IF IF ( .NOT. GDONE ) THEN @@ -1258,9 +1254,9 @@ MODULE MODD_SENSOR END SUBROUTINE BUFFER_RECV - ! ################################################################## - SUBROUTINE SENSOR_COMM_SEND( TPSENSOR, KTO, OSEND_SIZE_TO_RECEIVER ) - ! ################################################################## + ! ############################################################################## + SUBROUTINE SENSOR_COMM_SEND( TPSENSOR, KTO, OSEND_SIZE_TO_RECEIVER, OEMPTYSEND ) + ! ############################################################################## USE MODD_IO, ONLY: ISP @@ -1269,10 +1265,12 @@ MODULE MODD_SENSOR CLASS(TSENSOR), INTENT(INOUT) :: TPSENSOR INTEGER, INTENT(IN) :: KTO ! Process to which to send data LOGICAL, OPTIONAL, INTENT(IN) :: OSEND_SIZE_TO_RECEIVER ! If the buffer size has to be send to the receiver + LOGICAL, OPTIONAL, INTENT(IN) :: OEMPTYSEND ! True if the sensor data has not to be sent CHARACTER(LEN=10) :: YFROM, YTO INTEGER :: IPACKSIZE INTEGER :: IPOS + LOGICAL :: GEMPTYSEND LOGICAL :: GSEND_SIZE_TO_RECEIVER REAL, DIMENSION(:), ALLOCATABLE :: ZPACK ! buffer to store raw data of the sensor @@ -1281,27 +1279,45 @@ MODULE MODD_SENSOR CALL PRINT_MSG( NVERB_DEBUG, 'GEN', 'Sensor_comm_send', & 'send sensor ' // TRIM(TPSENSOR%CNAME) // ': ' // TRIM(YFROM) // '->' // TRIM(YTO), OLOCAL = .TRUE. ) + IF ( PRESENT( OEMPTYSEND ) ) THEN + GEMPTYSEND = OEMPTYSEND + ELSE + GEMPTYSEND = .FALSE. + END IF + IF ( PRESENT( OSEND_SIZE_TO_RECEIVER ) ) THEN GSEND_SIZE_TO_RECEIVER = OSEND_SIZE_TO_RECEIVER ELSE GSEND_SIZE_TO_RECEIVER = .FALSE. END IF - IPACKSIZE = TPSENSOR%BUFFER_SIZE_COMPUTE( TPSENSOR%NSTORE_CUR ) + IF ( GEMPTYSEND .AND. .NOT.GSEND_SIZE_TO_RECEIVER ) & + CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'Sensor_comm_send', & + 'incompatible options: gemptysend=T and gsend_size_to_receiver=F', OLOCAL = .TRUE. ) + + IF ( GEMPTYSEND ) THEN + ! If 'empty send', ipacksize is set to NEMPTYDATA + ! This will allow the receiver to know that no sensor data will be sent + IPACKSIZE = NEMPTYDATA + ELSE + IPACKSIZE = TPSENSOR%BUFFER_SIZE_COMPUTE( TPSENSOR%NSTORE_CUR ) + END IF IF ( GSEND_SIZE_TO_RECEIVER ) CALL TPSENSOR%BUFFER_SIZE_SEND( TPSENSOR%NSTORE_CUR, IPACKSIZE, KTO ) - ALLOCATE( ZPACK(IPACKSIZE) ) + IF ( .NOT. GEMPTYSEND ) THEN + ALLOCATE( ZPACK(IPACKSIZE) ) - IPOS = 1 - CALL TPSENSOR%BUFFER_PACK( ZPACK, IPOS, TPSENSOR%NSTORE_CUR ) + IPOS = 1 + CALL TPSENSOR%BUFFER_PACK( ZPACK, IPOS, TPSENSOR%NSTORE_CUR ) - IF ( IPOS-1 /= IPACKSIZE ) & - CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'Sensor_comm_send', 'IPOS-1 /= IPACKSIZE', OLOCAL = .TRUE. ) + IF ( IPOS-1 /= IPACKSIZE ) & + CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'Sensor_comm_send', 'IPOS-1 /= IPACKSIZE', OLOCAL = .TRUE. ) - CALL TPSENSOR%BUFFER_SEND( ZPACK, KTO ) + CALL TPSENSOR%BUFFER_SEND( ZPACK, KTO ) - DEALLOCATE( ZPACK ) + DEALLOCATE( ZPACK ) + END IF END SUBROUTINE SENSOR_COMM_SEND @@ -1320,26 +1336,28 @@ MODULE MODD_SENSOR END SUBROUTINE SENSOR_COMM_SEND_DEALLOCATE - ! #################################################################################################### - SUBROUTINE SENSOR_COMM_RECV_ALLOCATE( TPSENSOR, KFROM, KSTORE_CUR, KSTORE_MAX, ORECV_SIZE_FROM_OWNER ) - ! #################################################################################################### + ! ################################################################################################################ + SUBROUTINE SENSOR_COMM_RECV_ALLOCATE( TPSENSOR, KFROM, KSTORE_CUR, KSTORE_MAX, ORECV_SIZE_FROM_OWNER, OEMPTYRECV ) + ! ################################################################################################################ USE MODD_IO, ONLY: ISP USE MODE_MSG CLASS(TSENSOR), INTENT(INOUT) :: TPSENSOR - INTEGER, INTENT(IN) :: KFROM ! Process from which to receive data + INTEGER, INTENT(IN) :: KFROM ! Process from which to receive data INTEGER, OPTIONAL, INTENT(IN) :: KSTORE_CUR ! Number of storage steps to receive INTEGER, OPTIONAL, INTENT(IN) :: KSTORE_MAX ! Maximum number of storage steps to store in sensor ! (if not provided, kstore_* size must be given by the sender) LOGICAL, OPTIONAL, INTENT(IN) :: ORECV_SIZE_FROM_OWNER ! If the buffer size has to be send to the receiver + LOGICAL, OPTIONAL, INTENT(OUT) :: OEMPTYRECV ! True if the sensor data has not been received CHARACTER(LEN=10) :: YFROM, YTO INTEGER :: IPACKSIZE INTEGER :: IPOS INTEGER :: ISTORE_CUR INTEGER :: ISTORE_MAX + LOGICAL :: GEMPTYRECV LOGICAL :: GRECV_SIZE_FROM_OWNER REAL, DIMENSION(:), ALLOCATABLE :: ZPACK ! buffer to store raw data of the sensor @@ -1348,6 +1366,8 @@ MODULE MODD_SENSOR CALL PRINT_MSG( NVERB_DEBUG, 'GEN', 'Sensor_comm_recv_allocate', & 'receive sensor (name not yet known): ' // TRIM(YFROM) // '->' // TRIM(YTO), OLOCAL = .TRUE. ) + GEMPTYRECV = .FALSE. + IF ( PRESENT( ORECV_SIZE_FROM_OWNER ) ) THEN GRECV_SIZE_FROM_OWNER = ORECV_SIZE_FROM_OWNER ELSE @@ -1387,19 +1407,29 @@ MODULE MODD_SENSOR IPACKSIZE = TPSENSOR%BUFFER_SIZE_COMPUTE( ISTORE_CUR ) END IF - ! Allocate receive buffer - ALLOCATE( ZPACK(IPACKSIZE) ) + IF ( IPACKSIZE == NEMPTYDATA ) THEN + GEMPTYRECV = .TRUE. + !call Print_msg( NVERB_DEBUG, 'GEN', 'Sensor_comm_recv_allocate', 'empty receive', olocal = .true. ) + IF ( .NOT. PRESENT( OEMPTYRECV) ) & + CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'Sensor_comm_recv_allocate', & + 'optional dummy argument oemptyrecv must be provided in case of empty communication', OLOCAL = .TRUE. ) + ELSE + ! Allocate receive buffer + ALLOCATE( ZPACK(IPACKSIZE) ) - ! Allocation of sensor must be done only once the total number of stores is known (and only if not yet allocated) - IF (TPSENSOR%NSTORE_MAX < 0 ) CALL TPSENSOR%DATA_ARRAYS_ALLOCATE( ISTORE_MAX ) + ! Allocation of sensor must be done only once the total number of stores is known (and only if not yet allocated) + IF (TPSENSOR%NSTORE_MAX < 0 ) CALL TPSENSOR%DATA_ARRAYS_ALLOCATE( ISTORE_MAX ) - CALL TPSENSOR%BUFFER_RECV( ZPACK, KFROM ) + CALL TPSENSOR%BUFFER_RECV( ZPACK, KFROM ) - IPOS = 1 - CALL TPSENSOR%BUFFER_UNPACK( ZPACK, IPOS, ISTORE_CUR ) + IPOS = 1 + CALL TPSENSOR%BUFFER_UNPACK( ZPACK, IPOS, ISTORE_CUR ) + + IF ( IPOS-1 /= IPACKSIZE ) & + CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'Sensor_comm_recv_allocate', 'IPOS-1 /= IPACKSIZE', OLOCAL = .TRUE. ) + END IF - IF ( IPOS-1 /= IPACKSIZE ) & - CALL PRINT_MSG( NVERB_ERROR, 'GEN', 'Sensor_comm_recv_allocate', 'IPOS-1 /= IPACKSIZE', OLOCAL = .TRUE. ) + IF ( PRESENT( OEMPTYRECV) ) OEMPTYRECV = GEMPTYRECV END SUBROUTINE SENSOR_COMM_RECV_ALLOCATE diff --git a/src/MNH/mode_sensor.f90 b/src/MNH/mode_sensor.f90 index e3488cbb81204546a28a7caced39f18a80d77ad5..f744202fdb31b55026417e9467e5cbf5b33ca1d2 100644 --- a/src/MNH/mode_sensor.f90 +++ b/src/MNH/mode_sensor.f90 @@ -54,6 +54,7 @@ CONTAINS TPSENSOR%XLWCZ(:,KSTORE_ID) = 0. TPSENSOR%XIWCZ(:,KSTORE_ID) = 0. + !TODO: add ICE4? IF ( CCLOUD == "LIMA" .OR. CCLOUD=="ICE3" ) THEN TPSENSOR%XLWCZ(:,KSTORE_ID) = TPSENSOR%INTERP_HOR_FROM_MASSPOINT( (PR(:,:,:,2)+PR(:,:,:,3) ) * PRHODREF(:,:,:) ) TPSENSOR%XIWCZ(:,KSTORE_ID) = TPSENSOR%INTERP_HOR_FROM_MASSPOINT( (PR(:,:,:,4)+PR(:,:,:,5)+PR(:,:,:,6)) * PRHODREF(:,:,:) ) @@ -136,6 +137,7 @@ CONTAINS TPSENSOR%XCRARE (:,KSTORE_ID) = 0. TPSENSOR%XCRARE_ATT(:,KSTORE_ID) = 0. + !TODO: add ICE4? IF ( CCLOUD == "LIMA" .OR. CCLOUD=="ICE3" ) THEN ZTEMPZ(:) = TPSENSOR%INTERP_HOR_FROM_MASSPOINT( PTH_EXN(:,:,:) ) ZRHODREFZ(:) = TPSENSOR%INTERP_HOR_FROM_MASSPOINT( PRHODREF(:,:,:) ) @@ -519,7 +521,6 @@ CONTAINS SUBROUTINE ADD_ORILAM_DATA( TPSENSOR, KLEVEL, KSTORE ) USE MODD_CH_AEROSOL USE MODD_CONF_N, ONLY: NRR - USE MODD_CH_AEROSOL, ONLY: NCARB, NSOA, NSP USE MODD_CST, ONLY: XP00, XCPD, XRD, XRV USE MODD_NSV, ONLY: NSV_AER, NSV_AERBEG, NSV_AEREND diff --git a/src/MNH/phys_paramn.f90 b/src/MNH/phys_paramn.f90 index ef93f2ccca1bcd8df3a68c8ada3b37176d740461..6ac206daab1f8e77961e803fa395103266fe0737 100644 --- a/src/MNH/phys_paramn.f90 +++ b/src/MNH/phys_paramn.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 1995-2022 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 1995-2023 CNRS, Meteo-France and Universite Paul Sabatier !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt !MNH_LIC for details. version 1. @@ -499,7 +499,7 @@ IKB = 1 + JPVEXT IKE = IKU - JPVEXT ! CALL GET_INDICE_ll (IIB,IJB,IIE,IJE) -CALL FILL_DIMPHYEX(YLDIMPHYEX, SIZE(XTHT,1), SIZE(XTHT,2), SIZE(XTHT,3),.TRUE.,NLES_TIMES) +CALL FILL_DIMPHYEX( YLDIMPHYEX, SIZE(XTHT,1), SIZE(XTHT,2), SIZE(XTHT,3), LTURB=.TRUE., KLES_TIMES=NLES_TIMES, KLES_K=NLES_K ) ! ZTIME1 = 0.0_MNHTIME ZTIME2 = 0.0_MNHTIME diff --git a/src/MNH/profilern.f90 b/src/MNH/profilern.f90 index 425ddf294fe45f0831ace0799a09e9cdf660735d..f95533090650d9f5c3252f178feb93068d322e3a 100644 --- a/src/MNH/profilern.f90 +++ b/src/MNH/profilern.f90 @@ -212,6 +212,8 @@ IF ( .NOT. TPROFILERS_TIME%STORESTEP_CHECK_AND_SET( IN ) ) RETURN !No profiler s !* 8. DATA RECORDING ! -------------- ! +IF ( NUMBPROFILER_LOC == 0 ) RETURN ! No profiler on this process + ZTEMP(:,:,:)=PTH(:,:,:)*(PP(:,:,:)/ XP00) **(XRD/XCPD) ! Theta_v ZTHV(:,:,:) = PTH(:,:,:) / (1.+WATER_SUM(PR(:,:,:,:)))*(1.+PR(:,:,:,1)/ZRDSRV) diff --git a/src/MNH/write_aircraft_balloon.f90 b/src/MNH/write_aircraft_balloon.f90 index 61be44dab866a3aeb3082d101aaf1cf9608bebd0..a1b978be286734a3a65d09439ffd0d0792e0300c 100644 --- a/src/MNH/write_aircraft_balloon.f90 +++ b/src/MNH/write_aircraft_balloon.f90 @@ -78,7 +78,9 @@ SUBROUTINE WRITE_AIRCRAFT_BALLOON(TPDIAFILE) ! USE MODD_AIRCRAFT_BALLOON USE MODD_IO, ONLY: ISP, TFILEDATA -! + +USE MODE_MODELN_HANDLER, ONLY: GET_CURRENT_MODEL_INDEX + IMPLICIT NONE ! ! @@ -90,16 +92,21 @@ TYPE(TFILEDATA), INTENT(IN) :: TPDIAFILE ! file to write ! ! 0.2 declaration of local variables ! +INTEGER :: IMI INTEGER :: JI +LOGICAL :: GEMPTYCOMM ! if TRUE, the communication is empty (no data is exchanged) ! !---------------------------------------------------------------------------- +IMI = GET_CURRENT_MODEL_INDEX() + DO JI = 1, NBALLOONS ! The balloon data is only available on the process where it is physically located => transfer it if necessary ! Send data from owner to writer if necessary IF ( ISP == NRANKCUR_BALLOON(JI) .AND. NRANKCUR_BALLOON(JI) /= TPDIAFILE%NMASTER_RANK ) THEN - CALL TBALLOONS(JI)%TBALLOON%SEND( KTO = TPDIAFILE%NMASTER_RANK, OSEND_SIZE_TO_RECEIVER = .TRUE. ) + GEMPTYCOMM = ( TBALLOONS(JI)%TBALLOON%NMODEL /= IMI ) + CALL TBALLOONS(JI)%TBALLOON%SEND( KTO = TPDIAFILE%NMASTER_RANK, OSEND_SIZE_TO_RECEIVER = .TRUE., OEMPTYSEND = GEMPTYCOMM ) END IF IF ( ISP == TPDIAFILE%NMASTER_RANK ) THEN @@ -108,11 +115,12 @@ DO JI = 1, NBALLOONS IF ( ASSOCIATED( TBALLOONS(JI)%TBALLOON ) ) & call Print_msg( NVERB_FATAL, 'GEN', 'WRITE_AIRCRAFT_BALLOON', 'balloon already associated' ) ALLOCATE( TBALLOONS(JI)%TBALLOON ) - CALL TBALLOONS(JI)%TBALLOON%RECV_ALLOCATE( KFROM = NRANKCUR_BALLOON(JI), ORECV_SIZE_FROM_OWNER = .TRUE. ) + CALL TBALLOONS(JI)%TBALLOON%RECV_ALLOCATE( KFROM = NRANKCUR_BALLOON(JI), ORECV_SIZE_FROM_OWNER = .TRUE., & + OEMPTYRECV = GEMPTYCOMM ) END IF - ! Write data - CALL FLYER_DIACHRO( TPDIAFILE, TBALLOONS(JI)%TBALLOON ) + ! Write data (if balloon is on this model (GEMPTYCOMM=F)) + IF ( .NOT. GEMPTYCOMM ) CALL FLYER_DIACHRO( TPDIAFILE, TBALLOONS(JI)%TBALLOON ) ! Remark: release of memory is done later by a call to AIRCRAFT_BALLOON_FREE_NONLOCAL ! This call must be done after the file is closed because flyer data is needed on the @@ -125,7 +133,8 @@ DO JI = 1, NAIRCRAFTS ! Send data from owner to writer if necessary IF ( ISP == NRANKCUR_AIRCRAFT(JI) .AND. NRANKCUR_AIRCRAFT(JI) /= TPDIAFILE%NMASTER_RANK ) THEN - CALL TAIRCRAFTS(JI)%TAIRCRAFT%SEND( KTO = TPDIAFILE%NMASTER_RANK, OSEND_SIZE_TO_RECEIVER = .TRUE. ) + GEMPTYCOMM = ( TAIRCRAFTS(JI)%TAIRCRAFT%NMODEL /= IMI ) + CALL TAIRCRAFTS(JI)%TAIRCRAFT%SEND( KTO = TPDIAFILE%NMASTER_RANK, OSEND_SIZE_TO_RECEIVER = .TRUE., OEMPTYSEND = GEMPTYCOMM ) END IF IF ( ISP == TPDIAFILE%NMASTER_RANK ) THEN @@ -134,11 +143,12 @@ DO JI = 1, NAIRCRAFTS IF ( ASSOCIATED( TAIRCRAFTS(JI)%TAIRCRAFT ) ) & call Print_msg( NVERB_FATAL, 'GEN', 'WRITE_AIRCRAFT_BALLOON', 'aircraft already associated' ) ALLOCATE( TAIRCRAFTS(JI)%TAIRCRAFT ) - CALL TAIRCRAFTS(JI)%TAIRCRAFT%RECV_ALLOCATE( KFROM = NRANKCUR_AIRCRAFT(JI), ORECV_SIZE_FROM_OWNER = .TRUE. ) + CALL TAIRCRAFTS(JI)%TAIRCRAFT%RECV_ALLOCATE( KFROM = NRANKCUR_AIRCRAFT(JI), ORECV_SIZE_FROM_OWNER = .TRUE., & + OEMPTYRECV = GEMPTYCOMM ) END IF - ! Write data - CALL FLYER_DIACHRO( TPDIAFILE, TAIRCRAFTS(JI)%TAIRCRAFT ) + ! Write data (if aircraft is on this model (GEMPTYCOMM=F)) + IF ( .NOT. GEMPTYCOMM ) CALL FLYER_DIACHRO( TPDIAFILE, TAIRCRAFTS(JI)%TAIRCRAFT ) ! Remark: release of memory is done later by a call to AIRCRAFT_BALLOON_FREE_NONLOCAL ! This call must be done after the file is closed because flyer data is needed on the @@ -168,7 +178,7 @@ IF ( ISP == TPDIAFILE%NMASTER_RANK ) THEN DO JI = 1, NBALLOONS ! Free ballon data if it was not stored on this process IF ( NRANKCUR_BALLOON(JI) /= TPDIAFILE%NMASTER_RANK ) THEN - CALL TBALLOONS(JI)%TBALLOON%DATA_ARRAYS_DEALLOCATE() + IF ( TBALLOONS(JI)%TBALLOON%NSTORE_MAX >= 0 ) CALL TBALLOONS(JI)%TBALLOON%DATA_ARRAYS_DEALLOCATE() DEALLOCATE( TBALLOONS(JI)%TBALLOON ) END IF END DO @@ -176,7 +186,7 @@ IF ( ISP == TPDIAFILE%NMASTER_RANK ) THEN DO JI = 1, NAIRCRAFTS ! Free aircraft data if it was not stored on this process IF ( NRANKCUR_AIRCRAFT(JI) /= TPDIAFILE%NMASTER_RANK ) THEN - CALL TAIRCRAFTS(JI)%TAIRCRAFT%DATA_ARRAYS_DEALLOCATE() + IF ( TAIRCRAFTS(JI)%TAIRCRAFT%NSTORE_MAX >= 0 ) CALL TAIRCRAFTS(JI)%TAIRCRAFT%DATA_ARRAYS_DEALLOCATE() DEALLOCATE( TAIRCRAFTS(JI)%TAIRCRAFT ) END IF END DO @@ -239,10 +249,8 @@ IMI = GET_CURRENT_MODEL_INDEX() IRR = SIZE( tpflyer%xr, 3 ) -IF (TPFLYER%NMODEL==0) RETURN -IF (ALL(TPFLYER%XX==XUNDEF)) RETURN -IF (COUNT(TPFLYER%XX/=XUNDEF)<=1) RETURN IF ( IMI /= TPFLYER%NMODEL ) RETURN +IF ( ALL( TPFLYER%XX == XUNDEF ) ) RETURN ! IKU = SIZE(TPFLYER%XRTZ,1) !number of vertical levels ! diff --git a/src/MNH/write_balloonn.f90 b/src/MNH/write_balloonn.f90 index 4c0e7d02b4acb61d35441843c96319153e74a333..e519c2b99e0d289941727eb4106293c8abab8ac6 100644 --- a/src/MNH/write_balloonn.f90 +++ b/src/MNH/write_balloonn.f90 @@ -73,12 +73,13 @@ TYPE(TFILEDATA), INTENT(IN) :: TPFILE ! File characteristics ! INTEGER :: IMI INTEGER :: JI -LOGICAL :: OMONOPROC_SAVE ! Copy of true value of GSMONOPROC +LOGICAL :: GEMPTYCOMM ! if TRUE, the communication is empty (no data is exchanged) +LOGICAL :: GMONOPROC_SAVE ! Copy of true value of GSMONOPROC IMI = GET_CURRENT_MODEL_INDEX() ! Save GSMONOPROC value -OMONOPROC_SAVE = GSMONOPROC +GMONOPROC_SAVE = GSMONOPROC ! Force GSMONOPROC to true to allow IO_Field_write on only 1 process! (not very clean hack) GSMONOPROC = .TRUE. @@ -87,30 +88,33 @@ DO JI = 1, NBALLOONS ! Send data from owner to writer if necessary IF ( ISP == NRANKCUR_BALLOON(JI) .AND. NRANKCUR_BALLOON(JI) /= TPFILE%NMASTER_RANK ) THEN - CALL TBALLOONS(JI)%TBALLOON%SEND( KTO = TPFILE%NMASTER_RANK, OSEND_SIZE_TO_RECEIVER = .TRUE. ) + GEMPTYCOMM = ( TBALLOONS(JI)%TBALLOON%NMODEL /= IMI ) + CALL TBALLOONS(JI)%TBALLOON%SEND( KTO = TPFILE%NMASTER_RANK, OSEND_SIZE_TO_RECEIVER = .TRUE., OEMPTYSEND = GEMPTYCOMM ) END IF IF ( ISP == TPFILE%NMASTER_RANK ) THEN ! Receive data from owner if not available on the writer process IF ( NRANKCUR_BALLOON(JI) /= TPFILE%NMASTER_RANK ) THEN ALLOCATE( TBALLOONS(JI)%TBALLOON ) - CALL TBALLOONS(JI)%TBALLOON%RECV_ALLOCATE( KFROM = NRANKCUR_BALLOON(JI), ORECV_SIZE_FROM_OWNER = .TRUE. ) + CALL TBALLOONS(JI)%TBALLOON%RECV_ALLOCATE( KFROM = NRANKCUR_BALLOON(JI), ORECV_SIZE_FROM_OWNER = .TRUE., & + OEMPTYRECV = GEMPTYCOMM ) END IF ! Write data (only if flyer is on the current model) ! It will also be written in the ancestry model files - IF ( TBALLOONS(JI)%TBALLOON%NMODEL == IMI ) CALL WRITE_BALLOON_POSITION( TPFILE, TBALLOONS(JI)%TBALLOON ) + ! if GEMPTYCOMM=FALSE => flyer is on the current model (equivalent to TBALLOONS(JI)%TBALLOON%NMODEL==IMI) + IF ( .NOT. GEMPTYCOMM ) CALL WRITE_BALLOON_POSITION( TPFILE, TBALLOONS(JI)%TBALLOON ) ! Free ballon data if it was not stored on this process IF ( NRANKCUR_BALLOON(JI) /= TPFILE%NMASTER_RANK ) THEN - CALL TBALLOONS(JI)%TBALLOON%DATA_ARRAYS_DEALLOCATE() + IF ( TBALLOONS(JI)%TBALLOON%NSTORE_MAX >= 0 ) CALL TBALLOONS(JI)%TBALLOON%DATA_ARRAYS_DEALLOCATE() DEALLOCATE( TBALLOONS(JI)%TBALLOON ) END IF END IF END DO ! Restore correct value of GSMONOPROC -GSMONOPROC = OMONOPROC_SAVE +GSMONOPROC = GMONOPROC_SAVE END SUBROUTINE WRITE_BALLOON_n !------------------------------------------------------------------------------- @@ -151,7 +155,7 @@ REAL :: ZLON ! longitude of the balloon type(tfiledata) :: tzfile TYPE(TFIELDMETADATA) :: TZFIELD -! Do not write balloon position if not yet in fly or crashed +! Do not write balloon position if not yet in flight or crashed IF ( .NOT.TPFLYER%LFLY .OR. TPFLYER%LCRASH ) RETURN ! Check if current model time is the same as the time corresponding to the balloon position diff --git a/src/Makefile b/src/Makefile index 8daef858a9d44a5653aedf07f5bdddb90bef7e7d..b9544933e469b27e86b676f28b9b5a4d788c1694 100644 --- a/src/Makefile +++ b/src/Makefile @@ -238,13 +238,13 @@ cleanlibmaster : rm -f $(LIB_MASTER) cleanmaster : - test -d $(OBJDIR_MASTER) && rm -fr $(OBJDIR_MASTER) + - [ -d $(OBJDIR_MASTER) ] && rm -fr $(OBJDIR_MASTER) cleanobjmaster : - test -d $(OBJDIR_MASTER) && find $(OBJDIR_MASTER) -follow -name "*.o" -o -name "*.mod" | xargs rm + - [ -d $(OBJDIR_MASTER) ] && find $(OBJDIR_MASTER) -follow -name "*.o" -o -name "*.mod" | xargs rm cleanprogmaster : - test -d $(OBJDIR_MASTER) && cd $(OBJDIR_MASTER) && rm -f $(PROG_LIST) + - [ -d $(OBJDIR_MASTER) ] && cd $(OBJDIR_MASTER) && rm -f $(PROG_LIST) ########################################################## # # @@ -331,9 +331,10 @@ $(ECCODES_MOD) : -DCMAKE_Fortran_FLAGS=$(ECCODES_FFLAGS) -DCMAKE_C_FLAGS=$(ECCODES_CFLAGS) ${EC_CONF} && \ $(MAKE) && $(MAKE) install && $(MAKE) clean +cleanmaster : eccodes_lib_clean eccodes_lib_clean : - - [ -d ${DIR_ECCODES_BUILD} ] && rm -fr ${DIR_ECCODES_BUILD} - - [ -d ${DIR_ECCODES_INSTALL} ] && rm -fr ${DIR_ECCODES_INSTALL} + - [ -d $(DIR_ECCODES_BUILD) ] && rm -fr $(DIR_ECCODES_BUILD) + - [ -d $(DIR_ECCODES_INSTALL) ] && rm -fr $(DIR_ECCODES_INSTALL) ########################################################## # # # EXTRA LIB : NETCDF # diff --git a/src/Makefile.MESONH.mk b/src/Makefile.MESONH.mk index 7dd4df70140b7da2cc954b45b2f6fd88d66c242d..bcf99b13e6d6c0027dea4f93dc80c41dbf893f6d 100644 --- a/src/Makefile.MESONH.mk +++ b/src/Makefile.MESONH.mk @@ -342,7 +342,7 @@ INC_MPI = -I$(B)$(DIR_MPI) DIR_MASTER += $(DIR_MPI) OBJS_LISTE_MASTER += mpivide.o INC += $(INC_MPI) -mpivide.o : CPPFLAGS += -DMNH_INT=$(MNH_INT) -DMNH_REAL=$(MNH_REAL) \ +mpivide.o : CPPFLAGS_C += -DMNH_INT=$(MNH_INT) -DMNH_REAL=$(MNH_REAL) \ -I$(DIR_MPI)/include VPATH += $(DIR_MPI) endif @@ -479,11 +479,11 @@ ifneq "$(MNH_GRIBAPI)" "yes" DIR_ECCODES_SRC?=${SRC_MESONH}/src/LIB/eccodes-${VERSION_ECCODES}-Source DIR_ECCODES_BUILD?=${OBJDIR_MASTER}/build_eccodes-${VERSION_ECCODES} DIR_ECCODES_INSTALL?=${OBJDIR_MASTER}/ECCODES-${VERSION_ECCODES} -ECCODES_MOD?=${DIR_ECCODES_INSTALL}/include/grib_api.mod +ECCODES_MOD?=$(DIR_ECCODES_INSTALL)/include/grib_api.mod # ifdef DIR_ECCODES_SRC -INC_ECCODES ?= -I${DIR_ECCODES_INSTALL}/include -LIB_ECCODES ?= -L${DIR_ECCODES_INSTALL}/lib -L${DIR_ECCODES_INSTALL}/lib64 -leccodes_f90 -leccodes +INC_ECCODES ?= -I$(DIR_ECCODES_INSTALL)/include +LIB_ECCODES ?= -L$(DIR_ECCODES_INSTALL)/lib -L$(DIR_ECCODES_INSTALL)/lib64 -leccodes_f90 -leccodes INC += $(INC_ECCODES) LIBS += $(LIB_ECCODES) VPATH += $(DIR_ECCODES_INSTALL)/include diff --git a/src/PHYEX/aux/modd_dimphyexn.f90 b/src/PHYEX/aux/modd_dimphyexn.f90 index cac698c823aa8e03727ee9d744341830f5e9ef9a..f9b5cf5f0a39d20e5345ececc6006b5dc983e5b0 100644 --- a/src/PHYEX/aux/modd_dimphyexn.f90 +++ b/src/PHYEX/aux/modd_dimphyexn.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 1995-2021 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 2022-2023 CNRS, Meteo-France and Universite Paul Sabatier !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt !MNH_LIC for details. version 1. @@ -53,7 +53,7 @@ TYPE DIMPHYEX_t ! 1: as for Méso-NH, levels are numbered from ground to space ! -1: as for AROME, levels are numbered from space to ground INTEGER :: NKT ! Array total dimension - INTEGER :: NKLES ! Total physical k dimension (for LES diag) + INTEGER :: NKLES ! Number of vertical levels for LES diagnostics INTEGER :: NKA ! Near ground array index (is an unphysical level if JPVEXT!=0) INTEGER :: NKU ! Uppest atmosphere array index (is an unphysical level if JPVEXT!=0) INTEGER :: NKB ! Near ground physical array index (e.g. equal to 1+JPVEXT if NKL==1) diff --git a/src/PHYEX/aux/mode_fill_dimphyexn.f90 b/src/PHYEX/aux/mode_fill_dimphyexn.f90 index 5f965be18b7d6a788d424ab047032aded219485c..469ae60851a7750d02d1e5c37a652c0502c7901f 100644 --- a/src/PHYEX/aux/mode_fill_dimphyexn.f90 +++ b/src/PHYEX/aux/mode_fill_dimphyexn.f90 @@ -1,4 +1,4 @@ -!MNH_LIC Copyright 1995-2021 CNRS, Meteo-France and Universite Paul Sabatier +!MNH_LIC Copyright 2022-2023 CNRS, Meteo-France and Universite Paul Sabatier !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence !MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt !MNH_LIC for details. version 1. @@ -6,7 +6,7 @@ MODULE MODE_FILL_DIMPHYEX IMPLICIT NONE CONTAINS -SUBROUTINE FILL_DIMPHYEX(YDDIMPHYEX, KIT, KJT, KKT, LTURB,KLES_TIMES) +SUBROUTINE FILL_DIMPHYEX( YDDIMPHYEX, KIT, KJT, KKT, LTURB, KLES_TIMES, KLES_K ) ! ######################### ! !! @@ -29,6 +29,7 @@ SUBROUTINE FILL_DIMPHYEX(YDDIMPHYEX, KIT, KJT, KKT, LTURB,KLES_TIMES) !! MODIFICATIONS !! ------------- !! Original January 2022 +! P. Wautelet 04/10/2023: bugfix: set NKLES correctly ! !----------------------------------------------------------------- !* 0. DECLARATIONS @@ -48,9 +49,11 @@ IMPLICIT NONE ! TYPE(DIMPHYEX_t), INTENT(OUT) :: YDDIMPHYEX ! Structure to fill in INTEGER, INTENT(IN) :: KIT, KJT, KKT ! Array dimensions -INTEGER, INTENT(IN), OPTIONAL :: KLES_TIMES ! Number of LES data storage frequency LOGICAL, INTENT(IN), OPTIONAL :: LTURB ! Flag to replace array dimensions I/JB and I/JE to the full array size ! needed if computation in HALO points (e.g. in turbulence) +INTEGER, INTENT(IN), OPTIONAL :: KLES_TIMES ! number of LES computations in time +INTEGER, INTENT(IN), OPTIONAL :: KLES_K ! number of vertical levels for LES diagnostics + LOGICAL :: YTURB ! !* 0.2 declaration of local variables @@ -75,7 +78,6 @@ YDDIMPHYEX%NKA=1 YDDIMPHYEX%NKU=KKT YDDIMPHYEX%NKB=1+JPVEXT YDDIMPHYEX%NKE=KKT-JPVEXT -YDDIMPHYEX%NKLES=KKT-2*JPVEXT YDDIMPHYEX%NKTB=1+JPVEXT YDDIMPHYEX%NKTE=KKT-JPVEXT ! @@ -103,6 +105,10 @@ YDDIMPHYEX%NLES_TIMES=0 IF (PRESENT(KLES_TIMES)) THEN YDDIMPHYEX%NLES_TIMES = KLES_TIMES END IF +YDDIMPHYEX%NKLES=0 +IF (PRESENT(KLES_K)) THEN + YDDIMPHYEX%NKLES = KLES_K +END IF IF (LLES_MY_MASK) YDDIMPHYEX%NLESMASK = YDDIMPHYEX%NLESMASK + NLES_MASKS_USER IF (LLES_NEB_MASK) YDDIMPHYEX%NLESMASK = YDDIMPHYEX%NLESMASK + 2 IF (LLES_CORE_MASK) YDDIMPHYEX%NLESMASK = YDDIMPHYEX%NLESMASK + 2 diff --git a/src/configure b/src/configure index 0e4feaa00eecfb7b51c4e59c9b8c410dab8e6e0e..659eac8cdff9d046e56ba123acb3a02190bf5323 100755 --- a/src/configure +++ b/src/configure @@ -219,10 +219,13 @@ export MPI_DSM_CPULIST=0-7:allhosts export VER_CDF=${VER_CDF:-CDFAUTO} export MNHENV=${MNHENV:-" module purge -module load cmake/3.18.1 -module load inteloneapi/21.4.0 +module load cmake/3.26.4 +module load inteloneapi/23.1.0 module load mpi/openmpi/4.1.4 export SLURM_CPU_BIND=none + +export DIR_ECCODES_INSTALL=\${CCCWORKDIR}/ECCODES-2.18.0\${XYZM} + "} ;; *AMD*) # Irene AMD core @@ -235,10 +238,13 @@ export SLURM_CPU_BIND=none export VERSION_XYZ="${VERSION_XYZ}-AMD" export MNHENV=${MNHENV:-" module purge -module load cmake/3.18.1 -module load inteloneapi/21.4.0 +module load cmake/3.26.4 +module load inteloneapi/23.1.0 module load mpi/openmpi/4.1.4 export SLURM_CPU_BIND=none + +export DIR_ECCODES_INSTALL=\${CCCWORKDIR}/ECCODES-2.18.0\${XYZM} + # Set some openmpi variable for pb with nb of cores >> 1024 export OMPI_MCA_coll_hcoll_enable=0 export HCOLL_ENABLE_MCAST_ALL=0 @@ -375,8 +381,8 @@ export LIB_GRIBAPI='${GRIB_API_LIB}' export MNHENV=${MNHENV:-" module purge module load prgenv/intel -module switch intel/2021.4.0 -module load openmpi/4.1.1.1 +module switch intel/2023.2.0 +module load openmpi/4.1.4.1 unset CC CXX "} ;;