From 783f52f19afa64cd627a4d33afb73e13e4426831 Mon Sep 17 00:00:00 2001 From: VIE Benoit <vie@sxphynh> Date: Mon, 30 Jan 2023 16:39:19 +0100 Subject: [PATCH] bugfixes for mesonh compilation --- src/common/aux/modd_nsv.f90 | 9 +++ src/common/micro/lima.F90 | 42 ++++++++---- src/common/micro/lima_sedimentation.F90 | 6 +- src/mesonh/micro/lima_adjust.f90 | 2 +- tools/check_commit_mesonh.sh | 91 +++++++++++-------------- 5 files changed, 81 insertions(+), 69 deletions(-) diff --git a/src/common/aux/modd_nsv.f90 b/src/common/aux/modd_nsv.f90 index ec95d8957..569539c40 100644 --- a/src/common/aux/modd_nsv.f90 +++ b/src/common/aux/modd_nsv.f90 @@ -30,6 +30,7 @@ !! V. Vionnet 07/17 add blowing snow ! P. Wautelet 10/03/2021: add CSVNAMES and CSVNAMES_A to store the name of all the scalar variables ! B. Vie 06/2021: add prognostic supersaturation for LIMA +! A. Costes 12/2021: add Blaze fire model smoke ! !------------------------------------------------------------------------------- ! @@ -145,6 +146,10 @@ INTEGER,DIMENSION(JPMODELMAX)::NSV_FF_A = 0 ! number of ForeFire scalar varia INTEGER,DIMENSION(JPMODELMAX)::NSV_FFBEG_A = 0 ! with indices in the range : INTEGER,DIMENSION(JPMODELMAX)::NSV_FFEND_A = 0 ! NSV_FFBEG_A...NSV_FFEND_A #endif +! Blaze smoke indexes +INTEGER,DIMENSION(JPMODELMAX)::NSV_FIRE_A = 0 ! number of Blaze smoke scalar variables +INTEGER,DIMENSION(JPMODELMAX)::NSV_FIREBEG_A = 0 ! with indices in the range : +INTEGER,DIMENSION(JPMODELMAX)::NSV_FIREEND_A = 0 ! NSV_FIREBEG_A...NSV_FIREEND_A ! INTEGER,DIMENSION(JPMODELMAX)::NSV_SNW_A = 0 ! number of blowing snow scalar INTEGER,DIMENSION(JPMODELMAX)::NSV_SNWBEG_A = 0 ! with indices in the range : @@ -251,6 +256,10 @@ INTEGER :: NSV_FF = 0 ! number of ForeFire scalar variables INTEGER :: NSV_FFBEG = 0 ! with indices in the range : INTEGER :: NSV_FFEND = 0 ! NSV_FFBEG...NSV_FFEND #endif +! Blaze smoke +INTEGER :: NSV_FIRE = 0 ! number of Blaze smoke scalar variables +INTEGER :: NSV_FIREBEG = 0 ! with indices in the range : +INTEGER :: NSV_FIREEND = 0 ! NSV_FIREBEG...NSV_FIREEND ! INTEGER :: NSV_SNW = 0 ! number of blowing snow scalar variables INTEGER :: NSV_SNWBEG = 0 ! with indices in the range : diff --git a/src/common/micro/lima.F90 b/src/common/micro/lima.F90 index 1944e9d42..e90bc6cb0 100644 --- a/src/common/micro/lima.F90 +++ b/src/common/micro/lima.F90 @@ -672,13 +672,20 @@ PINPRS=0. PINPRG=0. PINPRH=0. if ( BUCONF%lbu_enable ) then - if ( BUCONF%lbudget_th ) call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_TH), 'SEDI', zths(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rc .and. nmom_c.ge.1 .and. lsedc ) call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RC), 'SEDI', zrcs(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rr .and. nmom_r.ge.1 ) call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RR), 'SEDI', zrrs(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_ri .and. nmom_i.ge.1 .and. lsedi ) call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RI), 'SEDI', zris(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rs .and. nmom_s.ge.1 ) call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RS), 'SEDI', zrss(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rg .and. nmom_g.ge.1 ) call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RG), 'SEDI', zrgs(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rh .and. nmom_h.ge.1 ) call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RH), 'SEDI', zrhs(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_th ) & + call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_TH), 'SEDI', zths(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rc .and. nmom_c.ge.1 .and. lsedc ) & + call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RC), 'SEDI', zrcs(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rr .and. nmom_r.ge.1 ) & + call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RR), 'SEDI', zrrs(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_ri .and. nmom_i.ge.1 .and. lsedi ) & + call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RI), 'SEDI', zris(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rs .and. nmom_s.ge.1 ) & + call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RS), 'SEDI', zrss(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rg .and. nmom_g.ge.1 ) & + call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RG), 'SEDI', zrgs(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rh .and. nmom_h.ge.1 ) & + call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_RH), 'SEDI', zrhs(:, :, :) * prhodj(:, :, :) ) if ( BUCONF%lbudget_sv ) then if ( lsedc .and. nmom_c.ge.2) & call BUDGET_STORE_INIT_PHY(D, TBUDGETS(NBUDGET_SV1 - 1 + nsv_lima_nc), 'SEDI', zccs(:, :, :) * prhodj(:, :, :) ) @@ -725,13 +732,20 @@ ZTHS(:,:,:) = ZT(:,:,:) / ZEXN(:,:,:) * ZINV_TSTEP ! Call budgets ! if ( BUCONF%lbu_enable ) then - if ( BUCONF%lbudget_th ) call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_TH), 'SEDI', zths(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rc .and. nmom_c.ge.1 .and. lsedc ) call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RC), 'SEDI', zrcs(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rr .and. nmom_r.ge.2 ) call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RR), 'SEDI', zrrs(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_ri .and. nmom_i.ge.1 .and. lsedi ) call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RI), 'SEDI', zris(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rs .and. nmom_s.ge.1 ) call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RS), 'SEDI', zrss(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rg .and. nmom_g.ge.1 ) call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RG), 'SEDI', zrgs(:, :, :) * prhodj(:, :, :) ) - if ( BUCONF%lbudget_rh .and. nmom_h.ge.1 ) call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RH), 'SEDI', zrhs(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_th ) & + call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_TH), 'SEDI', zths(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rc .and. nmom_c.ge.1 .and. lsedc ) & + call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RC), 'SEDI', zrcs(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rr .and. nmom_r.ge.2 ) & + call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RR), 'SEDI', zrrs(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_ri .and. nmom_i.ge.1 .and. lsedi ) & + call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RI), 'SEDI', zris(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rs .and. nmom_s.ge.1 ) & + call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RS), 'SEDI', zrss(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rg .and. nmom_g.ge.1 ) & + call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RG), 'SEDI', zrgs(:, :, :) * prhodj(:, :, :) ) + if ( BUCONF%lbudget_rh .and. nmom_h.ge.1 ) & + call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_RH), 'SEDI', zrhs(:, :, :) * prhodj(:, :, :) ) if ( BUCONF%lbudget_sv ) then if ( lsedc .and. nmom_c.ge.2 ) & call BUDGET_STORE_END_PHY(D, TBUDGETS(NBUDGET_SV1 - 1 + nsv_lima_nc), 'SEDI', zccs(:, :, :) * prhodj(:, :, :) ) diff --git a/src/common/micro/lima_sedimentation.F90 b/src/common/micro/lima_sedimentation.F90 index 22a347365..bbf6b492a 100644 --- a/src/common/micro/lima_sedimentation.F90 +++ b/src/common/micro/lima_sedimentation.F90 @@ -236,10 +236,12 @@ DO JN = 1 , NSPLITSED(KID) END IF ZWSEDR(:,:,1:D%NKT) = UNPACK( ZZW(:),MASK=GSEDIM(:,:,:),FIELD=0.0 ) - ZWSEDR(:,:,D%NKTB:D%NKTE) = MIN( ZWSEDR(:,:,D%NKTB:D%NKTE), PRS(:,:,D%NKTB:D%NKTE) * PRHODREF(:,:,D%NKTB:D%NKTE) / ZW(:,:,D%NKTB:D%NKTE) ) + ZWSEDR(:,:,D%NKTB:D%NKTE) = MIN( ZWSEDR(:,:,D%NKTB:D%NKTE), PRS(:,:,D%NKTB:D%NKTE) & + * PRHODREF(:,:,D%NKTB:D%NKTE) / ZW(:,:,D%NKTB:D%NKTE) ) IF (KMOMENTS==2) THEN ZWSEDC(:,:,1:D%NKT) = UNPACK( ZZX(:),MASK=GSEDIM(:,:,:),FIELD=0.0 ) - ZWSEDC(:,:,D%NKTB:D%NKTE) = MIN( ZWSEDC(:,:,D%NKTB:D%NKTE), PCS(:,:,D%NKTB:D%NKTE) * PRHODREF(:,:,D%NKTB:D%NKTE) / ZW(:,:,D%NKTB:D%NKTE) ) + ZWSEDC(:,:,D%NKTB:D%NKTE) = MIN( ZWSEDC(:,:,D%NKTB:D%NKTE), PCS(:,:,D%NKTB:D%NKTE) & + * PRHODREF(:,:,D%NKTB:D%NKTE) / ZW(:,:,D%NKTB:D%NKTE) ) END IF DO JK = D%NKTB , D%NKTE diff --git a/src/mesonh/micro/lima_adjust.f90 b/src/mesonh/micro/lima_adjust.f90 index b0d00f584..da2ff335a 100644 --- a/src/mesonh/micro/lima_adjust.f90 +++ b/src/mesonh/micro/lima_adjust.f90 @@ -372,7 +372,7 @@ IF ( NMOM_C.GE.2 .AND. NMOD_CCN.GE.1 ) THEN PNAS(:,:,:,:) = PSVS(:,:,:,NSV_LIMA_CCN_ACTI:NSV_LIMA_CCN_ACTI+NMOD_CCN-1) END IF ! -IF ( NOMM_I.GE.2 .AND. NMOD_IFN.GE.1 ) THEN +IF ( NMOM_I.GE.2 .AND. NMOD_IFN.GE.1 ) THEN ALLOCATE( PIFS(SIZE(PRHODJ,1),SIZE(PRHODJ,2),SIZE(PRHODJ,3),NMOD_IFN) ) ALLOCATE( PINS(SIZE(PRHODJ,1),SIZE(PRHODJ,2),SIZE(PRHODJ,3),NMOD_IFN) ) PIFS(:,:,:,:) = PSVS(:,:,:,NSV_LIMA_IFN_FREE:NSV_LIMA_IFN_FREE+NMOD_IFN-1) diff --git a/tools/check_commit_mesonh.sh b/tools/check_commit_mesonh.sh index c8b7fc53d..b31063a2c 100755 --- a/tools/check_commit_mesonh.sh +++ b/tools/check_commit_mesonh.sh @@ -3,10 +3,10 @@ #set -x set -e -#The folowing environment variables can be defined: -# REFDIR: directory in which the reference compilation directory can be found -# TARGZDIR: directory where tar.gz files are searched for -# MNHPACK: directory where tests are build +# Repertoire où Mesonh MNH-V5-5-0 officiel est installe +#REFDIR=$HOME +# Repertoire où MNH-V5-5-0_PHYEX.tar.gz modifie pour accueillir PHYEX se trouve +#TARGZDIR=$HOME availTests="007_16janvier/008_run2, 007_16janvier/008_run2_turb3D, 007_16janvier/008_run2_lredf, COLD_BUBBLE/002_mesonh, ARMLES/RUN, COLD_BUBBLE_3D/002_mesonh,OCEAN_LES/004_run2" @@ -14,7 +14,6 @@ defaultTest="007_16janvier/008_run2" separator='_' #- be carrefull, gmkpack (at least on belenos) has multiple allergies (':', '.', '@') #- seprator must be in sync with prep_code.sh separator -#Notes for v5.5.0 #For the OCEAN_LES/004_run2 case, results obtained are different from those obtained with the original version #of Meso-NH because of new developments and bug correction. The reference version is given by commit e053c59. #In this commit two modifications must be done in turb/mode_tke_eps_sources.f90 to change twice LOCEAN into OOCEAN. @@ -84,7 +83,7 @@ done MNHPACK=${MNHPACK:=$HOME/MesoNH/PHYEX} REFDIR=${REFDIR:=$PHYEXTOOLSDIR/pack/} -TARGZDIR=${TARGZDIR:=/home/rodierq/UBUNTU22/PHYEX} +TARGZDIR=${TARGZDIR:=/home/rodierq} if [ -z "${tests-}" ]; then tests=$defaultTest elif [ $tests == 'ALL' ]; then @@ -104,43 +103,26 @@ if [ -z "${commit-}" ]; then exit 2 fi -#Name, directory and reference for compiling and executing user pack -if echo $commit | grep '/' | grep -v '^tags/' > /dev/null; then - fromdir=$commit - content_mesonh_version=$(scp $commit/src/mesonh/mesonh_version.json /dev/stdout 2>/dev/null || echo "") -else - fromdir='' - if [[ $commit == mesonh${separator}* ]]; then - mesonh_version_file="mesonh_version.json" - else - mesonh_version_file="src/mesonh/mesonh_version.json" - fi - if echo $commit | grep '^tags/' > /dev/null; then - urlcommit=$(echo $commit | cut -d / -f 2-) - else - urlcommit=$commit - fi - content_mesonh_version=$(wget --no-check-certificate https://raw.githubusercontent.com/$PHYEXREPOuser/PHYEX/${urlcommit}/$mesonh_version_file -O - 2>/dev/null || echo "") -fi -refversion=$(content_mesonh_version=$content_mesonh_version python3 -c "import json, os; v=os.environ['content_mesonh_version']; print(json.loads(v if len(v)!=0 else '{}').get('refversion', 'MNH-V5-5-0'))") -if [ $refversion == "MNH-V5-5-0" ]; then - targzsuffix="_PHYEX" -else - targzsuffix="" -fi -tag=$(echo $commit | sed 's/\//'${separator}'/g' | sed 's/:/'${separator}'/g' | sed 's/\./'${separator}'/g') -name=${refversion}-$tag -[ $suppress -eq 1 -a -d $MNHPACK/$name ] && rm -rf $MNHPACK/$name - #Two possibilities are supported for the simulations # - they can be done in the the pack we are currently checking # - they can be done in the reference pack #They are done in the current pack except if the reference pack #already contains a tested simulation #To check this, we use the case 007_16janvier/008_run2_turb3D -run_in_ref=$(ls -d $REFDIR/${refversion}/MY_RUN/KTEST/007_16janvier/008_run2_turb3D_* 2> /dev/null | tail -1 |wc -l) +run_in_ref=$(ls -d $REFDIR/MNH-V5-5-0/MY_RUN/KTEST/007_16janvier/008_run2_turb3D_* 2> /dev/null | tail -1 |wc -l) + +#Name and directory for compiling and executing user pack +fromdir='' +if echo $commit | grep '/' > /dev/null; then + fromdir=$commit + tag=$(echo $commit | sed 's/\//'${separator}'/g' | sed 's/:/'${separator}'/g' | sed 's/\./'${separator}'/g') +else + tag=$commit +fi +name=MNH-V5-5-1-$tag +[ $suppress -eq 1 -a -d $MNHPACK/$name ] && rm -rf $MNHPACK/$name if [ $run_in_ref -eq 1 ]; then - path_user_beg=$REFDIR/${refversion} #pack directory containing the simulation + path_user_beg=$REFDIR/MNH-V5-5-1 #pack directory containing the simulation path_user_end=_$tag #to be appended to the 'run' simulation directory else path_user_beg=$MNHPACK/$name #pack directory containing the simulation @@ -155,9 +137,9 @@ if echo $reference | grep '/' > /dev/null; then else reftag=$reference fi -refname=${refversion}-$reftag +refname=MNH-V5-5-1-$reftag if [ $run_in_ref -eq 1 ]; then - path_ref_beg=$REFDIR/${refversion} + path_ref_beg=$REFDIR/MNH-V5-5-1 if [ "$reference" == "" ]; then path_ref_end= else @@ -166,9 +148,9 @@ if [ $run_in_ref -eq 1 ]; then else path_ref_end= if [ "$reference" == "" ]; then - path_ref_beg=$REFDIR/${refversion} + path_ref_beg=$REFDIR/MNH-V5-5-1 else - path_ref_beg=$MNHPACK/${refversion}-$reftag + path_ref_beg=$MNHPACK/MNH-V5-5-1-$reftag fi fi @@ -182,10 +164,15 @@ if [ $compilation -eq 1 ]; then # Prepare the pack cd $MNHPACK - cp $TARGZDIR/${refversion}${targzsuffix}.tar.gz . - tar xfz ${refversion}${targzsuffix}.tar.gz - rm ${refversion}${targzsuffix}.tar.gz - mv ${refversion} $name +# cp $TARGZDIR/MNH-V5-5-0_PHYEX.tar.gz . +# tar xfz MNH-V5-5-0_PHYEX.tar.gz +# rm MNH-V5-5-0_PHYEX.tar.gz +# mv MNH-V5-5-0 $name + cp $TARGZDIR/MNH-V5-5-1-1abfa259.tar.gz . + tar xfz MNH-V5-5-1-1abfa259.tar.gz + rm MNH-V5-5-1-1abfa259.tar.gz + mv MNH-V5-5-1-1abfa259 $name + cd $name/src rm -rf PHYEX @@ -222,7 +209,7 @@ if [ $compilation -eq 1 ]; then fi cd $MNHPACK/$name/src/PHYEX/turb - # Delete files of ${refversion}/src/MNH and MNH/src/LIB/SURCOUCHE/src with same name + # Delete files of MNH-V5-5-0/src/MNH and MNH/src/LIB/SURCOUCHE/src with same name for rep in turb micro conv aux ; do cd ../$rep for f in *.f90; do @@ -233,7 +220,7 @@ if [ $compilation -eq 1 ]; then done cd .. - # Delete old files of ${refversion}/src/MNH that is now called by mode_... NO /aux NEEDED! + # Delete old files of MNH-V5-5-0/src/MNH that is now called by mode_... NO /aux NEEDED! find turb micro conv -name 'mode_*' > remove_non_mode.sh sed -i 's/turb\/mode_/rm -f MNH\//g' remove_non_mode.sh sed -i 's/micro\/mode_/rm -f MNH\//g' remove_non_mode.sh @@ -277,13 +264,13 @@ if [ $run -ge 1 ]; then case=$(echo $t | cut -d / -f 1) exedir=$(echo $t | cut -d / -f 2) if [ $run_in_ref -eq 1 ]; then - cd $REFDIR/${refversion}/MY_RUN/KTEST/$case/ + cd $REFDIR/MNH-V5-5-1/MY_RUN/KTEST/$case/ [ ! -d ${exedir}_$commit ] && cp -R ${exedir} ${exedir}_$commit - cd $REFDIR/${refversion}/MY_RUN/KTEST/$case/${exedir}_$commit + cd $REFDIR/MNH-V5-5-1/MY_RUN/KTEST/$case/${exedir}_$commit else #If the test case didn't exist in the tar.gz, we copy it from from the reference version rep=$MNHPACK/$name/MY_RUN/KTEST/$case - [ ! -d $rep ] && cp -r $REFDIR/${refversion}/MY_RUN/KTEST/$case $rep + [ ! -d $rep ] && cp -r $REFDIR/MNH-V5-5-1/MY_RUN/KTEST/$case $rep cd $rep #Loop on the directories @@ -294,18 +281,18 @@ if [ $run -ge 1 ]; then if [ $rep == ${exedir} ]; then #this is the case we want to run rm -rf $rep - cp -r $REFDIR/${refversion}/MY_RUN/KTEST/$case/$rep . + cp -r $REFDIR/MNH-V5-5-1/MY_RUN/KTEST/$case/$rep . fi else #This directory might be neede to run the test case, we take the reference version rm -rf $rep - ln -s $REFDIR/${refversion}/MY_RUN/KTEST/$case/$rep + ln -s $REFDIR/MNH-V5-5-1/MY_RUN/KTEST/$case/$rep fi fi done #In case subcase does not exist we create it - [ ! -d ${exedir} ] && cp -r $REFDIR/${refversion}/MY_RUN/KTEST/$case/${exedir} . + [ ! -d ${exedir} ] && cp -r $REFDIR/MNH-V5-5-1/MY_RUN/KTEST/$case/${exedir} . cd ${exedir} fi -- GitLab