Changeset 5415
- Timestamp:
- Dec 17, 2024, 2:02:51 PM (4 weeks ago)
- Location:
- BOL/LMDZ_Setup
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
BOL/LMDZ_Setup/DEF/guide.def
r4615 r5415 1 1 # le guidage se fait en fractions de jour (si on veut guider à 6h : 6/24=0.25) 2 ok_guide= n2 ok_guide=y 3 3 guide_u=y 4 4 guide_v=y 5 guide_T= y5 guide_T=n 6 6 guide_P=n 7 7 guide_Q=n 8 tau_min_u=0. 059 tau_max_u= 0.2510 tau_min_v=0. 0511 tau_max_v= 0.258 tau_min_u=0.25 9 tau_max_u=2 10 tau_min_v=0.25 11 tau_max_v=2 12 12 tau_min_T=0.5 13 13 tau_max_T=1e7 … … 16 16 tau_min_P=0.5 17 17 tau_max_P=0.5 18 -
BOL/LMDZ_Setup/era2gcm_tuto.sh
r4751 r5415 1 1 #!/bin/bash 2 2 3 . lmdz_env.sh 4 3 5 #----------------------------------------------------------------------------- 4 6 # 5 7 # Script for interpolating monthly ERA* files to the LMDZ grid; 6 # it creates the folder structure required by the tutorial_prodscripts8 # it creates the folder structure required by the LMDZ_Setup scripts 7 9 # 8 10 # NB: for "cleanest" guiding, the 1st step of the next month should be added at the end of each month. … … 12 14 # 13 15 #----------------------------------------------------------------------------- 14 # Requires : netcdf, ferret, nco 15 #----------------------------------------------------------------------------- 16 module load netcdf/4.7.2-mpi-cuda ferret nco cdo16 # Requires : netcdf, ferret, nco, cdo 17 #----------------------------------------------------------------------------- 18 #@JZ module load netcdf/4.7.2-mpi-cuda ferret nco cdo 17 19 # 18 20 # Check&modify section "User choices", then run the script with ./era2gcm.sh 19 21 #----------------------------------------------------------------------------- 20 22 # ATTENTION : VERIFIEZ 21 # --> l'acc es (repositoire ou telechargement) a la reanalyse ERA souhaitee (variable ANA_DIR)23 # --> l'accès (repositoire ou telechargement) a la réanalyse ERA souhaitée (variable ANA_DIR) 22 24 # Contact pour demander acces aux fichiers sur Jean-Zay : 23 25 # Sophie Bouffiès-Cloché, IPSL : Sophie.Bouffies-Cloche@ipsl.fr … … 34 36 # 35 37 # Guidage en vent(u&v) et/ou temperature, humidite 36 guide_uv= y37 guide_t= n38 guide_q= n38 guide_uv="y" 39 guide_t="n" 40 guide_q="n" 39 41 # 40 42 # Choix des fichiers de guidage ("rea"nalyses) : ERA5, ERAI, OPERA 41 rea= ERA543 rea="ERA5" 42 44 #------------------------------------------------ 45 46 #@JZ ERA5_PATH="/gpfsstore/rech/psl/rpsl376/ergon/ERA5/" 47 #@JZ ERAI_PATH="/gpfsstore/rech/psl/rpsl376/ergon/ERAI/" 48 #@ADS ERA5_PATH="/lus/work/CT1/cad15221/abarral/ERA_TMP/" # /!\ temp for test only ! 49 #@ADS ERAI_PATH="" # /!\ temp for tests only! 50 #@ADS echo "/!\ Nudging files are not available on Adastra for now !"; exit 1 # comment this line for tests 51 #@ADS SCRATCH=$SCRATCHDIR 52 53 set -u # raise error if path if unset on machine 54 echo "Paths: $ERA5_PATH $ERAI_PATH $SCRATCH" 55 set +u 43 56 44 57 GRID_DIR=./INIT … … 49 62 #L'utilisateur a maintenant des choix a faire en plus de mth* : type de guidage, et "rea" 50 63 # Alors c'est plus facile d'editer&modifier le script, puis lancer avec ./era2gcm.sh, que de donner tous les params 64 # TODO check w/ Adriana if we can remove those and put them as inline args (above) 51 65 while (($# > 0)) 52 66 do … … 59 73 "-mthini") mth_i=$2 ; shift ; shift ;; 60 74 "-mthend") mth_f=$2 ; shift ; shift ;; 61 *) $0 -h ; exit 75 *) $0 -h ; exit 1 62 76 esac 63 77 done 64 #--Fin du bloc ka examiner --------------------------------------------78 #--Fin du bloc a examiner -------------------------------------------- 65 79 66 80 tmin=1 … … 69 83 GRID_FI=${GRID_DIR}/${resol} 70 84 if [ ! -f "$GRID_FI" ] ; then 71 echo Le fichier $GRID_DIR/$resol est necessaire 72 echo creer le fichier $GRID_FI avec grilles_gcm_netcdf.e 73 exit 85 echo "Le fichier $GRID_DIR/$resol est nécessaire; créer le fichier $GRID_FI avec grilles_gcm_netcdf.e" 86 exit 1 74 87 fi 75 88 mth=$mth_i … … 77 90 78 91 ##################################################################### 79 while (( $mth <= $mth_f )) ; do80 ##################################################################### 81 echo mth $mth82 mois= `echo $mth | cut -c 5-`83 an= `echo $mth | cut -c -4`92 while (( mth <= mth_f )) ; do 93 ##################################################################### 94 echo "mth $mth" 95 mois=$(echo "$mth" | cut -c 5-) 96 an=$(echo "$mth" | cut -c -4) 84 97 ndays=( 31 28 31 30 31 30 31 31 30 31 30 31 ) 85 98 months=( jan feb mar apr may jun jul aug sep oct nov dec ) 86 if [ $(( $an % 4 )) = 0 ] ; then ndays[1]=29 ; fi99 if [ $(( an % 4 )) = 0 ] ; then ndays[1]=29 ; fi 87 100 imois=$(( ${mois#0} - 1 )) 88 101 month=${months[$imois]} 89 102 nday=${ndays[$imois]} 90 tmax=$(( $nday * 4 )) 91 echo PARAMETRES CALENDAIRES $imois $month $nday $tmax 92 93 94 iip1=`ncdump -h $GRID_FI | grep lonu | head -1 | awk ' { print $3 } '` 95 jjm=`ncdump -h $GRID_FI | grep latv | head -1 | awk ' { print $3 } '` 96 (( jjp1 = $jjm + 1 )) 97 (( iim = $iip1 - 1 )) 103 tmax=$(( nday * 4 )) 104 echo "PARAMETRES CALENDAIRES $imois $month $nday $tmax" 105 106 107 iip1=$(ncdump -h "$GRID_FI" | grep lonu | head -1 | awk ' { print $3 } ') 108 jjm=$(ncdump -h "$GRID_FI" | grep latv | head -1 | awk ' { print $3 } ') 109 (( jjp1 = jjm + 1 )) 98 110 # \rm t2.nc ua.nc va.nc sst.nc u.nc v.nc T.nc ts.nc 99 111 … … 108 120 # Lien avec les fichiers netcdf contenant les d0 ECMWF 109 121 ##################################################################### 110 echo -------- liens de telechargement a actualiser ----122 echo "-------- liens de telechargement a actualiser ----" 111 123 if [ "$rea" = "ERA5" ] ; then 112 if [ $an -ge 2022] ; then113 ANA_DIR= '/gpfsstore/rech/psl/rpsl376/ergon/ERA5/NETCDF/GLOBAL_025/hourly'124 if [[ $an -ge 2022 ]] ; then 125 ANA_DIR="$ERA5_PATH/NETCDF/GLOBAL_025/hourly" 114 126 suf="ap1e5.GLOBAL_025" 115 127 else 116 ANA_DIR= '/gpfsstore/rech/psl/rpsl376/ergon/ERA5/NETCDF/GLOBAL_025/4xdaily'128 ANA_DIR="$ERA5_PATH/NETCDF/GLOBAL_025/4xdaily" 117 129 suf="aphe5.GLOBAL_025" 118 130 fi 119 131 elif [ "$rea" = "ERAI" ] ; then 120 #ANA_DIR='http://prodn.idris.fr/thredds/dodsC/ipsl_private/rpsl376/ERAI/NETCDF/GLOBAL_1125/4xdaily' 121 ANA_DIR='/gpfsstore/rech/psl/rpsl376/ergon/ERAI/NETCDF/GLOBAL_1125/4xdaily' 122 #/gpfsstore/rech/psl/rpsl376/ergon/ERAI/NETCDF/GLOBAL_075/4xdaily/AN_PL/2006/u.200601.aphei.GLOBAL_075.nc 132 ANA_DIR="$ERAI_PATH/NETCDF/GLOBAL_1125/4xdaily" 123 133 suf="aphei.GLOBAL_1125" 124 else #OPERA125 #ANA_DIR='http://prodn.idris.fr/thredds/dodsC/ipsl_private/rpsl376/OPERA/NETCDF/4xdaily'126 ANA_DIR='/gpfsstore/rech/psl/rpsl376/ergon/OPERA/NETCDF/4xdaily'127 suf="aph.GLOBAL_1125"128 134 fi 129 135 … … 200 206 if [ "$guide_uv" = "y" ] ; then 201 207 202 cat <<eod>| tmp_uv.jnl 208 209 cat << eod >| tmp_uv.jnl 203 210 ! NB : Augmenter la memoire (plus de 512) peut faire planter 204 211 set memory/size=512 … … 237 244 if [ "$guide_t" = "y" ] ; then 238 245 239 cat << eod>| tmp_t.jnl246 cat << eod >| tmp_t.jnl 240 247 set memory/size=512 241 248 … … 261 268 if [ "$guide_q" = "y" ] ; then 262 269 263 cat << eod>| tmp_q.jnl270 cat << eod >| tmp_q.jnl 264 271 set memory/size=512 265 272 … … 273 280 eod 274 281 275 ferret -nojnl << eod282 ferret -nojnl << eod 276 283 go tmp_q.jnl 277 284 quit -
BOL/LMDZ_Setup/interp_aerosols.sh
r4615 r5415 6 6 7 7 year=$1 8 echo Dans interp_aerosols.sh year= $year8 echo "Dans interp_aerosols.sh year= $year" 9 9 10 10 # Extraction d'un fichier de grille physique a partir de grilles_gcm.nc … … 12 12 13 13 \rm -rf tmp*nc 14 if [ 0 = 0 ]; then15 imp1=`ncdump -h grilles_gcm.nc | grep lonv | head -1 | awk ' { print $3 } '` 16 echo $imp1 17 (( imm1 = $imp1 - 2 ))18 echo $imm1 19 ncks -d lonv,0,$imm1grilles_gcm.nc -v phis -O grille_phys.nc20 ncrename -v lonv,lon -v latu,lat -d lonv,lon -d latu,lat -O grille_phys.nc21 ncap2 -s "lon=-360.+lon" grille_phys.nc -O tmp.nc22 \mv -f tmp.nc grille_phys.nc23 #exit 14 if [[ 0 = 0 ]]; then 15 imp1=$(ncdump -h grilles_gcm.nc | grep lonv | head -1 | awk ' { print $3 } ') 16 echo "$imp1" 17 (( imm1 = imp1 - 2 )) 18 echo "$imm1" 19 ncks -d "lonv,0,$imm1" grilles_gcm.nc -v phis -O grille_phys.nc 20 ncrename -v lonv,lon -v latu,lat -d lonv,lon -d latu,lat -O grille_phys.nc 21 ncap2 -s "lon=-360.+lon" grille_phys.nc -O tmp.nc 22 \mv -f tmp.nc grille_phys.nc 23 #exit 1 24 24 fi 25 25 … … 28 28 29 29 orig=aerosols${year}_from_inca.nc 30 ln -s $LMDZ_Init/$orig30 ln -s "$LMDZ_INIT/$orig" . 31 31 32 32 33 # Interpol lation horizontale sur la grille cible33 # Interpolation horizontale sur la grille cible 34 34 # ---------------------------------------------- 35 35 36 36 # Un cdo direct ne marche pas. Il faut donner la liste des variables ... 37 vars="" ; for var in `ncdump -h $orig | grep float | sed -e 's/^.*.float //' | cut -d'(' -f1 | sed -e 's/ ;//' -e /lat/d -e /lon/d` ; do vars="$vars,$var" ; done 37 vars="" 38 for var in $(ncdump -h "$orig" | grep float | sed -e 's/^.*.float //' | cut -d'(' -f1 | sed -e 's/;//' -e /lat/d -e /lon/d); do 39 vars="$vars,$var" 40 done 38 41 39 echo cdo remapcon,grille_phys.nc -selvar$vars $origtmp.nc40 cdo remapcon,grille_phys.nc -selvar$vars $origtmp.nc42 echo cdo remapcon,grille_phys.nc "-selvar$vars" "$orig" tmp.nc 43 cdo remapcon,grille_phys.nc "-selvar$vars" "$orig" tmp.nc 41 44 #ncks -v ps,ap,b,presnivs $orig -A tmp.nc 42 nccopy -k classic tmp.nc aerosols.${year}.nc45 nccopy -k classic tmp.nc "aerosols.$year.nc" -
BOL/LMDZ_Setup/lmdz_env.sh
r4944 r5415 1 #!/bin/bash 2 ######################################################## 3 # This file loads the required modules and sets the paths for simulations 4 # To modify the paths: 5 # 1) In the <set_env> function, find the section corresponding to your machine 6 # 2) Modify the variables, which are documented in the *) section of <set_env> 7 # See the end of <set_env> for the explanation of each 8 ######################################################## 1 9 2 ############################################################## 3 # Gestion des modules 4 ############################################################## 10 # <root_dir> will be set by sed by setup.sh here 11 root_dir=/home/abarral/PycharmProjects/installLMDZ/LMDZ_Setup 5 12 6 hostname=jean-zay-pp2 7 echo lmdz_env $hostname 0:3 ${hostname:0:3} 13 function get_hostname { 14 if grep -q "Adastra" /etc/motd; then 15 hostname="adastra" 16 elif which idrquota &> /dev/null; then 17 hostname="jean-zay" 18 else 19 hostname=$(hostname) 20 fi 21 } 8 22 9 case ${hostname:0:5} in 23 function set_env { # Platform-specific 24 case ${hostname:0:5} in 25 jean-) 26 module purge 27 compilo=19.0.4 # available 2013.0, 2017.2 28 module load intel-compilers/$compilo 29 #module load intel-mpi/$compilo 30 module load intel-mkl/$compilo 31 module load hdf5/1.10.5-mpi 32 module load netcdf/4.7.2-mpi 33 module load netcdf-fortran/4.5.2-mpi 34 module load subversion/1.9.7 35 #Pour module gcc, voir : https://trac.lmd.jussieu.fr/LMDZ/wiki/PortageJeanZay 36 #module load gcc/6.5.0 37 module load nco 38 module load cdo 39 # Imputation de la consommation sur le groupe (projet) actif par defaut, 40 # idrproj indique le groupe (projet) actif par defaut 41 # idrproj -d newproj redefinit "newproj" en tant que projet actif, 42 # alors $STORE, $WORK etc vont designer les espaces de "newproj") 43 account="lmd" # $(idrproj | grep active | awk '{ print $1}') doesn't work on compute nodes 44 ARCH="X64_JEANZAY_PBIOIPSL" 45 SIMRUNBASEDIR="$SCRATCH/" 46 LMDZD="$root_dir/LMDZD" 47 LMDZ_INIT="$root_dir/LMDZ_Init" 48 NB_MPI_MAX=2000 49 NB_OMP_MAX=20 50 NB_CORE_PER_NODE_MAX=0 51 MPICMD="srun -n" 52 RUNBASHCMD="srun -A $account@cpu --label -n 1 -c" 53 SUBMITCMD="sbatch -A $account@cpu" 54 ;; 55 spiri) 56 module purge 57 module load subversion/1.13.0 58 module load gcc/11.2.0 59 module load openmpi/4.0.7 60 module load cdo/2.3.0 10 61 11 jean-) ARCH=X64_JEANZAY 12 module purge 13 compilo=19.0.4 # available 2013.0, 2017.2 14 module load intel-compilers/$compilo 15 #module load intel-mpi/$compilo 16 module load intel-mkl/$compilo 17 module load hdf5/1.10.5-mpi 18 module load netcdf/4.7.2-mpi 19 module load netcdf-fortran/4.5.2-mpi 20 module load subversion/1.9.7 21 #Pour module gcc, voir : https://trac.lmd.jussieu.fr/LMDZ/wiki/PortageJeanZay 22 #module load gcc/6.5.0 23 module load nco 24 module load cdo 25 # Imputation de la consommation sur le groupe (projet) actif par defaut, 26 # idrproj indique le groupe (projet) actif par defaut 27 # idrproj -d newproj redefinit "newproj" en tant que projet actif, 28 # alors $STORE, $WORK etc vont designer les espaces de "newproj") 29 groupe=`idrproj | grep active | awk '{ print $1}'` 30 submit="sbatch -A ${groupe}@cpu " 31 run="srun --label " 32 # Espaces suivants definis par defaut en fonction du groupe actif, 33 # par exemple : SCRATCHD=$SCRATCH is /gpfsstore/rech/$groupe/$login 34 # * On peut aussi ne pas installer les scripts a la racine de STORE, 35 # mais dans STORED=$STORE/your_folder 36 STORED=$STORE 37 SCRATCHD=$SCRATCH 38 LMDZD=$WORK 39 nb_mpi_max=2000 40 nb_omp_max=20 41 #LMDZ_Init sur le $STORE du $groupe 42 LMDZ_Init=$STORE/LMDZ_Init ;; 43 *) ARCH= 44 submit=". " 45 run="mpirun -np " 46 SCRATCHD=~/TMP/SCRATCH 47 STORED=~/TMP/ 48 LMDZD=~/TMP 49 nb_mpi_max=2 50 nb_omp_max=2 51 LMDZ_Init=~/LMDZ/LMDZ_Init 52 esac 62 ARCH="X64_MESOIPSL-GNU" 63 SIMRUNBASEDIR="$SCRATCH/" 64 LMDZD="$root_dir/LMDZD" 65 LMDZ_INIT="$HOME/LMDZ_Init" 66 NB_MPI_MAX=5 67 NB_OMP_MAX=1 68 NB_CORE_PER_NODE_MAX=0 69 N_HYPERTHREADING=1 70 MPICMD="mpirun -np" # on spirit, we can't run MPI using srun from within sbatch 71 RUNBASHCMD="bash" 72 SUBMITCMD="sbatch" 73 ;; 74 adast) 75 module purge 76 module load PrgEnv-gnu # we need to load the env because lmdz links some shared libraries 77 module load gcc/13.2.0 # required, see https://dci.dci-gitlab.cines.fr/webextranet/user_support/index.html#prgenv-and-compilers 78 export CRAY_CPU_TARGET=x86-64 # to suppress warnings during Cmake netcdf95 build 79 export FI_CXI_RX_MATCH_MODE=hybrid # 09/24 otherwise we get random SIGABRT e.g. "libfabric:2490616:1725895288::cxi:core:cxip_ux_onload_cb():2657<warn> c1456: RXC (0x5130:21) PtlTE 84:[Fatal] LE resources not recovered during flow control. FI_CXI_RX_MATCH_MODE=[hybrid|software] is required" 53 80 81 function cdo { # cdo is available as a spack cmd which requires a specific, incompatible env 82 unset cdo 83 module purge 84 module load develop GCC-CPU-4.0.0 cdo/2.4.2-omp-mpi 85 cdo "$@" 86 set_env 87 } 54 88 55 echo LMDZ_Init dans lmdz_env $LMDZ_Init 89 function ferret { 90 unset ferret 91 module purge 92 module load GCC-CPU-3.1.0 93 module load ferret 94 ferret "$@" 95 set_env 96 } 97 98 account=$(/usr/sbin/my_project.py -l 2>&1 | head -1 | cut -d " " -f 3- | cut -c 5-) 99 ARCH="X64_ADASTRA-GNU" 100 SIMRUNBASEDIR="$SCRATCHDIR/" 101 LMDZD="$root_dir/LMDZD" 102 LMDZ_INIT="$WORKDIR/LMDZ_Init" 103 NB_MPI_MAX=2000 104 NB_OMP_MAX=200 105 NB_CORE_PER_NODE_MAX=192 106 N_HYPERTHREADING=1 # Adastra has SMT=2 enabled, but we found no actual performance improvement for the latlon model. Maybe useful for Dynamico ? 107 MPICMD="srun -n" 108 # RUNBASHCMD="srun --label --account=$account --constraint=GENOA --ntasks-per-node=1 -n 1 --time=00:15:00 -c" 109 RUNBASHCMD="bash" # On Adastra the docs says we can use login nodes for compilation 110 SUBMITCMD="env $(env | grep -E "SLURM_|SBATCH_|SRUN_" | cut -d= -f1 | awk '{print "-u " $0}' | tr '\n' ' ' ) sbatch --constraint=GENOA --account=$account" # we need to remove the existing SLURM variables otherwise they may be unexpectedly inherited by the submitted script 111 ;; 112 *) echo "WARNING: RUNNING THIS SCRIPT ON A LOCAL COMPUTER IS DISCOURAGED (lackluster cpus and memory)" 113 ARCH="local-gfortran-parallel" # The arch file to use 114 SIMRUNBASEDIR="/tmp/SCRATCH/" # Where the simulations will be executed ($SIMRUNBASEDIR/LMDZ_Setup/...) 115 LMDZD="$root_dir/LMDZD" # Where the sources will be downloaded and compiled 116 LMDZ_INIT="$HOME/LMDZ_Init" # Where to store shared files used for initialisation. Should be outside the LMDZ_Setup dir since it's shared between several LMDZ_Setup. 117 NB_MPI_MAX=2 # Max number of MPI cores (only for running simulations) 118 NB_OMP_MAX=2 # Max number of OMP threads (only for running simulations) 119 NB_CORE_PER_NODE_MAX=0 # Max number of cores per node (real cores, not hyperthreading - only for running simulations, cluster-specific) 120 N_HYPERTHREADING=1 # How many hyperthreading threads per physical core 121 MPICMD="mpirun -np" # command to run an mpi executable, as $MPICMD <nprocs> <script> 122 RUNBASHCMD="bash" # command to run a bash job, as $runbashcmd (nthreads) <script> [nthreads only supplied if =/="bash"] 123 SUBMITCMD="." # command to sumbit a job, as $submitcmd <script> 124 ;; 125 esac 126 } 127 128 get_hostname 129 echo "Setting up lmdz_env on $hostname" 130 set_env 131 132 if [[ ! (-d $root_dir && -f $root_dir/.lmdz_setup_root_dir && -f $root_dir/lmdz_env.sh) ]]; then 133 echo "STOP: root_dir $root_dir not found, either you are running on an unsupported cluster, or the initialisation failed midway"; exit 1 134 fi -
BOL/LMDZ_Setup/main.sh
r5410 r5415 1 1 #!/bin/bash 2 2 3 set -eu 4 3 5 ##################################################################### 4 # This script manages the call to setup.sh5 #6 6 # Authors : 7 7 # F. Hourdin, frederic.hourdin@lmd.ipsl.fr 8 8 # Modified A. Sima, adriana.sima@lmd.ipsl.fr 9 # Rewritten 2024 A. Barral 9 10 # 10 # Some options can only be changed directly in lmdz_env.sh or setup.sh 11 # --> In setup.sh : 12 # * Orchidee version, to be defined through "veget" option 13 # default : OR-CMIP6 14 # * Aerosol forcing, to be defined through "aerosols" option : 15 # n (no, default) / clim (an2000)/ spla (interactive dust and sea salt) 16 # !!! STRONG recommendation : experiments with DIFFERENT Orchidee or aerosol options 17 # !!! should be performed in DIFFERENT TEST_PROD folders 18 # !!! (especially as they may need different initial files) 19 # * Use or not of the RRTM radiation code : rrtm=true/false 20 # * Compiling options : debug, use or not of the fcm makefile 11 # This is the main user script of LMDZ_Setup. It defines basic options for the simulations, and runs setup.sh. 12 # Settings such as model and simulation paths are set in lmdz_env.sh. You must modify it to set the current LMDZ_Setup path as <root_dir>. 13 # Expert options are set directly in setup.sh via <define_expert_options>. 21 14 # 22 # --> In lmdz_env.sh : 23 # * Model & configuration setup 24 # If you install the present tutorial_prod package in $STORE/your_folder instead of $STORE 25 # modify STORED variable accordingly 26 # The model will be installed in $LMDZD directory defined in lmdz_env.sh 27 # Default : LMDZD=$WORK ; can be changed in LMDZD=$WORK/Your_directory 28 # To use a model already installed (and compiled), by you or someone else (check the acces!): 29 # set LMDZD=path_to_model_to_use 30 # You'll also need to (re)define "LMDZname" accordingly, in setup.sh 15 # Some expert options in setup.sh : 16 # * Orchidee version, through the "veget" option 17 # * Aerosol forcing, through the "aerosols" option 18 # * Radiation code, through the "rad" option 19 # * Compilation options (debug, netcdf) 31 20 ##################################################################### 32 21 … … 36 25 37 26 # Version of the tar file on https://lmdz.lmd.jussieu.fr/pub/src 38 # Last "testing" version, thoroughly checked by the LMDZ team : contains LMDZ rev 534139 version="20241 121.trunk" #!! DON'T CHANGE IT WITHOUT CHECKING WITH LMDZ TEAM !!40 svn="" #!! DON'T CHANGE IT WITHOUT CHECKING WITH LMDZ TEAM !! 41 # CONTACT LMDZ Team : 42 43 27 # Last "testing" version, thoroughly checked by the LMDZ team : contains LMDZ rev 4729 (2023-10-22) 28 version="20241018.trunk" #!! DON'T CHANGE IT WITHOUT CHECKING WITH LMDZ TEAM !! 29 svn="" #!! DON'T CHANGE IT WITHOUT CHECKING WITH LMDZ TEAM !! 30 # CONTACT LMDZ Team : 31 # email: poihl@listes.lmd.ipsl.fr 32 # Mattermost: https://mattermost.lmd.ipsl.fr/lmdz/channels/installation-et-tutoriels 44 33 45 #-----------------------------------------------------------46 34 # Grid number of points IMxJMxLM 47 #----------------------------------------------------------- 48 resol=144x142x79 35 resol="144x142x79" 49 36 50 #----------------------------------------------------------- 51 # To install the model : -install 52 #----------------------------------------------------------- 53 install="" 54 install=-install 55 56 #----------------------------------------------------------- 57 # Using XIOS for IOs 58 #----------------------------------------------------------- 59 xios="-xios" 37 ## Using XIOS for IOs: "-xios" (enabled) / "" (disabled) 60 38 xios="" 61 39 62 #----------------------------------------------------------- 63 # Using or not the Cosp simulator 64 #----------------------------------------------------------- 65 #cosp="-cosp" 40 # Using or not the Cosp simulator: "-cosp" (enabled) / "" (disabled) 66 41 cosp="" 67 echo $xios $cosp68 42 69 #----------------------------------------------------------- 70 # Choice of physics (default : "lmd" for "phylmd" ) 71 # Examples : lmd_phys="new" to compile with phynew instead of phylmd, 72 # lmd_phys="lmdiso" to run with Isotopes 73 #----------------------------------------------------------- 43 # Choice of physics: "lmd" (phylmd) / "new" (phynew) / "lmdiso" (isotopes) 74 44 lmd_phys="lmd" 75 45 … … 78 48 #=========================================================== 79 49 80 #-----------------------------------------------------------81 50 # Initial state and Boundary conditions 82 #----------------------------------------------------------- 51 # init= 1: to create a new start in INIT 52 # 0: to read start files in INIT 53 # SIM: to read start files from previous simulation SIM0, /!\ SIM0 must be in the same folder as the new SIM 54 # (limit.nc and aerosols forcing are put in ./LIMIT) 55 init=1 83 56 84 # init= 1: to create a new start in INT 85 # 0: to read start files in INIT 86 # SIM: to read start files from previous simulation SIM0 87 # limit.nc and aerosols forcing are put in ./LIMIT 88 init=1 89 #init=SIM0 # SIM0 must be in the same folder as the new SIM 90 91 #----------------------------------------------------------- 92 # climato=1 : Climatological SSTs with 360-day calendar 57 # climato=1 : Climatological SSTs with 360-day calendar 93 58 # =0 : interannual SSTs with true (ie gregorian) calendar 94 #-----------------------------------------------------------95 59 climato=1 96 60 97 #-----------------------------------------------------------98 61 # Nudging: Can only be activated with climato=0 and freq=mo 99 #----------------------------------------------------------- 100 nudging="-nudging" 62 # "-nudging" (enabled) / "" (disabled) 101 63 nudging="" 102 64 #If using nudging, then check DEF/guide.def : … … 104 66 # - You may want to check/customize the nudging parameters 105 67 106 #-----------------------------------------------------------107 68 # Length of elementary simulations yr (year) or mo (month) 108 #----------------------------------------------------------- 109 freq=yr 69 freq="yr" 110 70 111 #-----------------------------------------------------------112 71 # Initial/final month for simulation 113 #-----------------------------------------------------------114 72 # If $init=1, the INIT file will be called start.200001.nc, 115 73 # but the data correspond in fact to another day. … … 121 79 # Output files, frequencies, levels 122 80 # If you use IOIPSL (option xios=""), you may want to choose and customize DEF/config.def. 123 # A few versions are available as DEF/config.def_* 81 # A few versions are available as DEF/config.def_*; config.def is a copy of config.def_default 124 82 # See phys_out_filekeys, phys_out_filelevels, phys_out_filetimesteps, and supplementary variables 125 83 # If you use XIOS (option xios="-xios"), check/modify DEF/XMLfiles*/file*xml … … 128 86 # Grid characteristics (regular, zoomed) 129 87 # You may want to choose and customize DEF/gcm.def 130 # A few versions are available as DEF/gcm.def_* 88 # A few versions are available as DEF/gcm.def_*; 131 89 # The default, for regular grid 144x142x79, corresponds to _iperiod7 132 90 # (Expert : TEMPORARILY : setup.sh forces use of gcm.def_zNAfrica_BiJe for aerosols=spla) … … 140 98 # NOTE : automatically choosing DEF/PHYS/physiq.def_NPiso for isotopes 141 99 physics="NPv6.3" 142 if [ $lmd_phys = "lmdiso" ] ; then physics="NPiso"; fi100 if [[ $lmd_phys = "lmdiso" ]]; then physics="NPiso"; fi 143 101 144 for phys in $physics ; do 145 deffile=DEF/PHYS/physiq.def_${phys} 146 if [ -f $deffile ] ; then 102 if [[ $(echo "$physics" |wc -w) -gt 1 && $init = 1 ]]; then echo "!=!=! TO LOOP OVER MULTIPLE physics [$physics], YOU NEED init =/= 1 AND start* + limit* files ALREADY AVAILABLE IN THIS FOLDER !=!=!"; exit 1; fi 103 104 for phys in $physics; do 105 deffile="DEF/PHYS/physiq.def_$phys" 106 if [[ -f $deffile ]]; then 147 107 cp -p $deffile DEF/physiq.def 148 108 149 109 # name of simulation : can be changed to user's convenience 150 # (Default : name=$phys to loop on different physics)151 name= ${phys}110 # (Default: name=$phys to loop on different physics) 111 name="$phys" 152 112 153 113 # launching setup.sh with the options defined in this main.sh. 154 # Remember : some other options are only available in lmdz_env.sh and setup.sh. 155 ./setup.sh -v "$version" $svn -d $resol $install $cosp $xios -init $init -climato $climato $nudging -f $freq -mthini $mthini -mthend $mthend -p $lmd_phys -name $name 156 157 nphys=`echo "$physics" |wc -w` ; if [ $nphys -gt 1 -a $init = 1 ] ; then echo "!=!=! TO LOOP OVER MULTIPLE "physics", YOU NEED init /= 1 AND start* + limit* files ALREADY AVAILABLE IN THIS FOLDER !=!=!" ; exit ; fi 158 159 else # wrong "{phys}" name in "physics" list 160 echo File $deffile inexistent 161 exit 162 fi 163 114 # Remember: some other options are only available in lmdz_env.sh and setup.sh. 115 # shellcheck disable=SC2086 116 ./setup.sh -v "$version" -d "$resol" -mthini "$mthini" -mthend "$mthend" -init "$init" -climato "$climato" -f "$freq" -p "$lmd_phys" -name "$name" $cosp $xios $nudging -r "$svn" 117 else 118 echo "File $deffile inexistent"; exit 1 119 fi 164 120 done 165 121 -
BOL/LMDZ_Setup/reb.sh
r4615 r5415 5 5 ym=$1 6 6 SIMUDIR=$2 7 SIM=`basename $SIMUDIR` 8 shift 2 7 SIM=$(basename "$SIMUDIR"); shift 2 9 8 types="$*" 10 PUT= mv9 PUT="mv" 11 10 rebuild=/gpfswork/rech/groupe/rgroupe027/LMDZ20191008.trunkOR3013/modipsl/bin/rebuild 12 local= `pwd`11 local=$(pwd) 13 12 13 . lmdz_env.sh 14 14 15 echo type $type16 echo ym $ym17 echo SIM $SIM18 echo SIMUDIR $SIMUDIR15 echo "type $type" 16 echo "ym $ym" 17 echo "SIM $SIM" 18 echo "SIMUDIR $SIMUDIR" 19 19 20 for type in $types ; do 20 for type in $types; do 21 job=$SIM$type 21 22 22 job=$SIM$type 23 cat <<eod >| "$job" 24 #!/bin/bash 25 ## Headers managed by sed 26 #@JZ#JeanZay 27 #@JZ#SBATCH --job-name=Seq # nom du job 28 #@JZ#SBATCH --nodes=1 # nombre de noeuds 29 #@JZ#SBATCH --ntasks-per-node=1 # nombre de taches MPI par noeud 30 #@JZ#SBATCH --time=00:59:00 # temps d execution maximum demande (HH:MM:SS) 31 #@JZ#SBATCH --output=post${type}%j.out # nom du fichier de sortie 32 #@JZ#SBATCH --error=post${type}%j.out # nom du fichier d'erreur (ici en commun avec la sortie) 33 #@SP#Spirit 34 #@SP#SBATCH --job-name=Seq 35 #@SP#SBATCH --nodes=1 36 #@SP#SBATCH --ntasks-per-node=1 37 #@SP#SBATCH --time=00:59:00 38 #@SP#SBATCH --output=post${type}%j.out 39 #@SP#SBATCH --error=post${type}%j.out 40 #@ADS#Adastra 41 #@ADS#SBATCH --job-name=Seq 42 #@ADS#SBATCH --nodes=1 43 #@ADS#SBATCH --ntasks-per-node=1 44 #@ADS#SBATCH --time=00:59:00 45 #@ADS#SBATCH --output=post${type}%j.out 46 #@ADS#SBATCH --error=post${type}%j.out 23 47 24 cat <<eod>| $job25 #!/bin/bash26 #SBATCH --job-name=Seq # nom du job27 #SBATCH -A groupe@cpu28 #SBATCH --nodes=1 # nombre de noeuds29 #SBATCH --ntasks-per-node=1 # nombre de taches MPI par noeud30 #SBATCH --time=00:30:00 # temps d execution maximum demande (HH:MM:SS)31 #SBATCH --output=post${type}%j.out # nom du fichier de sortie32 #SBATCH --error=post${type}%j.out # nom du fichier d'erreur (ici en commun avec la sortie)33 34 48 # on se place dans le repertoire de soumission 35 49 cd $local … … 39 53 40 54 ulimit -s unlimited 41 if [ -f ${type}_0000.nc ]; then42 43 44 echo ${type}_0000.nc absent45 46 if [ -f $type.$ym.nc ] ; then 47 48 \rm -f ${type}_[0-9][0-9][0-9][0-9].nc49 50 echo La reconstruction de $type.$ym.nc a echoue51 55 if [[ -f ${type}_0000.nc ]]; then 56 $rebuild -o ${type}.$ym.nc ${type}_[0-9][0-9][0-9][0-9].nc 57 else 58 echo "${type}_0000.nc absent" 59 fi 60 if [[ -f $type.$ym.nc ]]; then 61 ${PUT} $type.$ym.nc ${SIMUDIR}/$type.$ym.nc 62 rm -f ${type}_[0-9][0-9][0-9][0-9].nc 63 else 64 echo "La reconstruction de $type.$ym.nc a echoué" 65 fi 52 66 eod 53 67 54 echo Submitting the rebuild job $job 55 sbatch $job 56 68 echo "Submitting the rebuild job $job using <$SUBMITCMD \"$job\">" 69 $SUBMITCMD "$job" 57 70 done -
BOL/LMDZ_Setup/script_SIMU
r4990 r5415 1 1 #!/bin/bash 2 # 3 #SBATCH --job-name=NOM_SIMU # nom du job 4 #SBATCH -A groupe@cpu 5 #SBATCH --ntasks=8 # Nombre de processus MPI ; reecrit par $mpi calcule par setup.sh 6 #SBATCH --cpus-per-task=8 # Nombre de threads OpenMP ; reecrit par $omp defini dans setup.sh 7 # de Slurm "multithread" fait bien reference a l'hyperthreading. 8 #SBATCH --hint=nomultithread # 1 thread par coeur physique (pas d'hyperthreading) 9 #SBATCH --time=00:30:00 # Temps d execution maximum demande (HH:MM:SS) 10 #SBATCH --output=outNOM_SIMU%j # Nom du fichier de sortie 11 #SBATCH --error=outNOM_SIMU%j # Nom du fichier d'erreur (ici commun avec la sortie) 12 # 13 # To submit to test queue ; "time" (above) must be max 30 min 14 # #SBATCH --qos=qos_cpu-dev 15 16 set -ex 2 ## Headers managed by sed 3 #@JZ#JeanZay 4 #@JZ#SBATCH --job-name=NOM_SIMU # nom du job 5 #@JZ# Nombre de processus MPI : 6 #@JZ#SBATCH --ntasks=8 7 #@JZ##### number of MPI processes per node : 40(procs/node on Jean-Zay) / cpus-per-task (ex : =5 for 8 OMP) 8 #@JZ####SBATCH --ntasks-per-node=5 # if specified, also add "#SBATCH --nodes= ..." with nodes=ntasks/(ntasks-per-node) 9 #@JZ# nombre de threads OpenMP 10 #@JZ#SBATCH --cpus-per-task=8 11 #@JZ# de Slurm "multithread" fait bien reference a l'hyperthreading. 12 #@JZ#SBATCH --hint=nomultithread # 1 thread par coeur physique (pas d'hyperthreading) 13 #@JZ#SBATCH --time=00:30:00 # Temps d execution maximum demande (HH:MM:SS) 14 #@JZ#SBATCH --output=outNOM_SIMU%j # Nom du fichier de sortie 15 #@JZ#SBATCH --error=outNOM_SIMU%j # Nom du fichier d'erreur (ici commun avec la sortie) 16 #@JZ# To submit to test queue ; "time" (above) must be max 30 min 17 #@JZ#TESTQ#SBATCH --qos=qos_cpu-dev 18 #@SP#Spirit 19 #@SP#SBATCH --job-name=NOM_SIMU 20 #@SP#SBATCH --ntasks=8 21 #@SP#SBATCH --cpus-per-task=8 22 #@SP#SBATCH --time=00:30:00 23 #@SP#SBATCH --output=outNOM_SIMU%j 24 #@SP#SBATCH --error=outNOM_SIMU%j 25 #@ADS#Adastra 26 #@ADS#SBATCH --job-name=NOM_SIMU 27 #@ADS#SBATCH --ntasks=8 28 #@ADS#SBATCH --cpus-per-task=8 29 #@ADS#SBATCH --ntasks-per-node=8 30 #@ADS#SBATCH --time=00:30:00 31 #@ADS#SBATCH --output=outNOM_SIMU%j 32 #@ADS#SBATCH --error=outNOM_SIMU%j 33 #@ADS#SBATCH --exclusive 34 35 set -eux 17 36 18 37 # Number of MPI processes : 19 38 ntasks=8 20 21 # For Jean-Zay (replacing the next 3 lines, commented out) 22 export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK 23 ## number of OpenMP threads 24 ##nthreads=8 25 ##export OMP_NUM_THREADS=$nthreads 26 39 # number of OpenMP threads 40 nthreads=8 41 export OMP_NUM_THREADS=$nthreads 42 #@JZ#export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK # For Jean-Zay (replacing the next 3 lines, commented out) 27 43 # private memory for each thread 28 44 export OMP_STACKSIZE=800M 29 # Binding 30 export OMP_PLACES=cores 45 46 47 #@JZ#export OMP_PLACES=cores # "binding" present in old script_SIMU, but terribly reduces performance on Spirit... 48 ulimit -s unlimited 49 #@SP ulimit -Ss 8192 31 50 32 51 simul=NOM_SIMU 33 ulimit -s unlimited34 52 35 53 reseau_local=0 36 54 #veget=y 37 55 veget=CMIP6 38 if [ $veget = NONE ] ; then VEGET=n ; else VEGET=y ; fi56 if [[ $veget = "none" ]] ; then VEGET=n ; else VEGET=y ; fi 39 57 40 58 isotopes=n … … 46 64 ok_guide=y # y/n guidage ou non 47 65 climato=1 48 orchidee_rev=500449 66 50 67 echo '##############################################################' … … 61 78 # Repertoires de travail 62 79 WWORKD=$SCRATCHD/$SIMU_dir$$ 80 if [[ -d $WWORKD ]]; then # useful when running on local computer, where jobs aren't submitted 81 rm -rf "$WWORKD" 82 fi 63 83 mkdir -p $WWORKD 64 84 cd $WWORKD 65 85 SCRIPTDIR=$SCRATCHD/$MAINDIR 66 86 67 cp $STORED/$MAINDIR/lmdz_env.sh . ; . lmdz_env.sh 87 cp "$STORED/$MAINDIR/lmdz_env.sh" .; . lmdz_env.sh 88 cp "$STORED/$MAINDIR/slurm_set_cpu_binding.sh" . 89 68 90 ERADIR=$STORED/$MAINDIR/GUIDE 69 91 if [ "$aerosols" = "spla" ] ; then ERA10mDIR=$STORED/$MAINDIR/ERA10m ; fi … … 128 150 if [ "$climato" = "0" ] ; then calend=gregorian ; else calend=earth_360d ; fi 129 151 bisextile=0 130 if [ $(( $year % 4 )) = 0 -a $calend = gregorian] ; then bisextile=1 ; fi152 if [[ $(( year % 4 )) = 0 && $calend = gregorian ]] ; then bisextile=1 ; fi 131 153 if [ $paran = 0 ] ; then 132 154 if [ "$calend" = "gregorian" ] ; then … … 206 228 fi 207 229 208 ## Ca doit etre la meme liste de fichiers rapatriee par setup.sh dans $LMDZ_I nit/SPLA_Init230 ## Ca doit etre la meme liste de fichiers rapatriee par setup.sh dans $LMDZ_INIT/SPLA_Init 209 231 ## et interpolee (setup.sh aussi) dans $SPLADIR 210 232 if [ $aerosols = spla ] ; then … … 239 261 set +e ; for t in stomate sechiba ; do cp $SIMUDIR/start_$t.$ym.nc ${t}_rest_in.nc ; done ; set -e 240 262 if [ "`grep RIVER_ROUTING orchidee.def |grep -i y`" ] ; then 241 set +e ; ln -s $LMDZ_I nit/routing_simple.nc . ; ln -s $LMDZ_Init/routing.nc .263 set +e ; ln -s $LMDZ_INIT/routing_simple.nc . ; ln -s $LMDZ_INIT/routing.nc . 242 264 cp $SIMUDIR/start_routing.$ym.nc routing_start.nc ; set -e 243 265 fi … … 251 273 if [ ! -f sechiba_rest_in.nc ] ; then 252 274 echo '#########################################################' 253 echo Autoinitialisation d orchidee au besoin275 echo "Autoinitialisation d'orchidee au besoin" 254 276 echo '#########################################################' 255 get="ln -s $LMDZ_I nit/"277 get="ln -s $LMDZ_INIT/" 256 278 for file in cartepente2d_15min.nc \ 257 279 lai2D.nc soils_param.nc soil_bulk_and_ph.nc alb_bg_modisopt_2D_ESA_v2.nc reftemp.nc ; do ${get}$file ; done … … 268 290 269 291 if [ $veget = 7994 ] ; then 270 get="ln -s $LMDZ_I nit/"292 get="ln -s $LMDZ_INIT/" 271 293 for file in ndep_nhx.nc ndep_noy.nc nfert_cropland.nc nfert_pasture.nc nmanure_cropland.nc nmanure_pasture.nc bnf.nc ; do ${get}$file ; done 272 294 fi … … 285 307 if [ -f u.nc ] ; then 286 308 echo PROBLEME D EFFACEMENT DES FICHIERS DE REANALYSES 287 exit 309 exit 1 288 310 fi 289 311 for var in u v T hur ; do $GET $ERADIR/$year/$month/$var.nc $var.nc ; done … … 301 323 echo '##################################################################' 302 324 303 time $run ./gcm.e > listing 325 #@ADS if 1; then 326 time $MPICMD $ntasks ./gcm.e > listing 327 #@ADS else 328 #@ADS srun --cpu-bind=none --mem-bind=none -- ./slurm_set_cpu_binding.sh ./gcm.e > listing 329 #@ADS fi 330 304 331 if [ ! -f restartphy.nc ] ; then 305 332 echo PROBLEME PAS DE FICHIER RESTARTPHY … … 375 402 if [ $num -le 250 ] ; then 376 403 sed -e 's/^simul=.*.$/simul='$simul_new'/' -e 's/^\# @ job_nam.*.=.*.$/\# @ job_name = '$simul_new'/' tmp_$simul >| tmp_$simul_new 377 sbatchtmp_$simul_new404 $SUBMITCMD tmp_$simul_new 378 405 fi 379 406 fi … … 389 416 390 417 cd $SCRIPTDIR 391 sbatchtmp_$simul418 $SUBMITCMD tmp_$simul -
BOL/LMDZ_Setup/setup.sh
r5028 r5415 1 1 #!/bin/bash 2 3 #set -vx 4 5 ##################################################################### 6 # This script sets up and launches a (series of) simulation(s). 2 # This script sets up and launches a (series of) simulation(s). 3 # RECOMMENDATION: use main.sh to drive it (do not run it directly) 4 5 set -eu 6 7 # EXPERT-LEVEL CHOICES, only available in setup.sh, not in main.sh : 8 #################################################################### 9 function define_expert_options() { 10 # optim: either "" or "-debug" to compile in debug mode (slower but better diagnosis of segfaults) 11 optim="" 12 13 # "n" or "y". If testmode="y", then simulations run for a single day per period. 14 # NOTE: you must set mthend accordingly ! 15 testmode="n" 16 17 # Radiative code: "oldrad" / "rrtm" / "ecrad" 18 rad="rrtm" 19 20 # !!! STRONG recommendation : experiments with DIFFERENT Orchidee or aerosol options should be performed in DIFFERENT LMDZ_Setup folders 21 # !!! (especially as they may need different initial files) 22 23 # AEROSOLS : "n" (=no) / "clim" (=average 1995-2014) / "spla" (interactive dust and sea salt) 24 # (WARNING : if you first run the scripts with aerosols=n, then you want to change to =clim , 25 # you'll need to remove the INIT and LIMIT folders that have been created, then run main.sh with init=1 26 # in order to re-run the initialisation job, which downloads the aerosol files and interpolates them) 27 aerosols="clim" 28 29 # SURFACE/VEGETATION SCHEME 30 # - "none" (bucket scheme) / "CMIP6" (orchidee version used in CMIP exercise) / "7983" (orch2.2) / "7994" (trunk) 31 # If you need other orch versions, and also require XIOS, you'll need to create the appropriate files in DEF/XMLfilesOR... 32 veget="CMIP6" 33 34 # New snow scheme INLANDSIS! "y" / "n" 35 # This flag activates INLANDSIS compilation; not yet done : treatment of specific restart and def file 36 inlandsis="n" 37 38 # netcdf: 0 (use existing library) / 1 (recompile netcdf, slow) 39 netcdf=0 40 41 # --->>> ALSO PAY ATTENTION TO OUTPUT files, frequency, level ------------- 42 # With IOIPSL : Choose your config.def among the versions available in DEF, 43 # copy it as config.def (the copy is done automatically for "iso"), 44 # edit it and set up output files, frequencies and levels. 45 # NB : For aerosols=spla, output level minimum 4 is required to output the specific variables. 46 # For aerosols=n, the corresponding flags will automatically be set to "n". 47 # With XIOS : adjust DEF/XMLfiles*/file*xml 48 } 49 50 # /!\ DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING /!\ 51 52 function enable_platform() { # In job scripts, sed platform-specific headers 53 local file="$1" 54 local platform 55 56 case ${hostname:0:5} in 57 jean-) platform="JZ";; 58 spiri) platform="SP";; 59 adast) platform="ADS";; 60 *) echo "Warning: $hostname is not a known job platform (ignore if running locally)"; return 0;; 61 esac 62 63 sed -i'' -e "s/^#@$platform//" "$file" 64 } 65 66 function load_install_lib() { 67 # Fetch and source install_lmdz.sh to get `myget` 68 if [[ ! -f "install_lmdz.sh" ]]; then 69 wget --no-cache "http://svn.lmd.jussieu.fr/LMDZ/BOL/script_install/install_lmdz.sh" 70 fi 71 # shellcheck disable=SC1090 72 source <(sed 's/function \(.*\) {/function installlmdz_\1 {/g' install_lmdz.sh) # source with a namespace for functions 73 function myget { installlmdz_myget "$@"; } 74 } 75 76 function set_default_params() { 77 # Default value of script parameters 78 SIM=$(basename "$local")CTL # name 79 phylmd="lmd" #option -p $phylmd for makelmdz 80 81 cosp="n" # COSP 82 xios="n" #XIOS 83 84 # Nudging : 85 ok_guide="n" 86 # With nudging, use real calendar (climato=0) and monthly integrations 87 climato=1 88 freq="mo" # frequence mensuelle mo ou annuelle yr 89 90 # NB : the run stops in the BEGINNING of mthend (test "next=stopsim") 91 mthini=200001 92 mthend=200501 93 resol="144x142x79" 94 95 version="20230412.trunk" 96 svn="" 97 98 init=1 99 100 LIMIT="LIMIT" 101 102 case $rad in 103 oldrad) iflag_rrtm=0; NSW=2;; 104 rrtm) iflag_rrtm=1; NSW=6;; 105 ecrad) iflag_rrtm=2; NSW=6;; 106 esac 107 } 108 109 function read_cmdline_args() { 110 while (($# > 0)); do 111 case $1 in 112 "-h") cat <<........fin 113 setup.sh can be launched/driven by main.sh; some options can only be specified in setup.sh (ex: veget, aerosols). 114 setup.sh [-v version] [-r svn_release] [-init INIT] [-d 96x95x79] [-f mo] [-nudging] 115 -v "version" like 20150828.trunk; see https://lmdz.lmd.jussieu.fr/Distrib/LISMOI.trunk (default <$version>) 116 -r "svn_release" either the svn release number or "last" (default <$svn>) 117 -d IMxJMxLM to run in resolution IM x JM x LM (default <$resol>) 118 -install pour installer et compiler le modele 119 -f mo/yr pour tourner en mensuel ou annuel (default <$freq>) 120 "INIT" 1: creates INIT and LIMIT 121 0: reads from INIT and LIMIT 122 SIMU: reads from preexisting simulation SIMU and LIMIT (default <$init>) 123 -nudging to run with nudging. Nudging files must be created independently 124 -p the physics to use (default <$phylmd>) 125 -name install folder name (default <$SIM>) 126 Other options available (see "options" section in the script) 127 ........fin 128 exit;; 129 "-v") version="$2"; shift; shift;; 130 "-r") svn=$2; shift; shift;; 131 "-d") resol=$2; shift; shift;; 132 "-f") freq=$2; shift; shift;; 133 "-p") phylmd=$2; shift; shift;; 134 "-name") SIM=$2; shift; shift;; 135 "-cosp") cosp=y; shift;; 136 "-xios") xios=y; shift;; 137 "-init") init=$2; shift; shift;; 138 "-nudging") ok_guide=y; shift;; 139 "-climato") climato=$2; shift; shift;; 140 "-mthini") mthini=$2; shift; shift;; 141 "-mthend") mthend=$2; shift; shift;; 142 *) echo "unexpected $1"; $0 -h; exit 143 esac 144 done 145 146 # Initialisation 147 if [[ $init = 1 || $init = 0 ]]; then 148 INIT="INIT" 149 else 150 INIT=$init 151 fi 152 153 yearini=$(echo "$mthini" | cut -c-4) 154 if [[ $freq = yr ]]; then stopsim=$(echo "$mthend" | cut -c-4); else stopsim=$mthend; fi 155 156 if [[ -d $SIM ]]; then 157 echo "La simulation $SIM existe deja. Il est conseillé d'arrêter et de vérifier." 158 echo "Si vous êtes sûr de vous, vous pouvez la prolonger. Voulez vous la prolonger ? (y/n)" 159 read -r ans 160 if [[ $ans != y ]]; then exit 1; fi 161 fi 162 163 ###################################################################### 164 # Choix du nombre de processeurs 165 # NOTES : 166 # omp=8 by default (for Jean-Zay must be a divisor of 40 procs/node), but we need 167 # omp=1 for SPLA (only MPI parallelisation) 168 # omp=2 for veget=CMIP6+XIOS beacause of a bug in ORCHIDEE/src_xml/xios_orchidee.f90 169 ###################################################################### 170 jm=$(echo "$resol" | cut -dx -f2) 171 (( mpi = ( jm + 1 ) / 2 )) 172 omp=8 173 if [[ $aerosols = "spla" ]]; then omp=1; fi 174 if [[ $veget = "CMIP6" && $xios = "y" ]]; then omp=2; fi 175 if [[ $mpi -gt $NB_MPI_MAX ]]; then mpi=$NB_MPI_MAX; fi 176 if [[ $omp -gt $NB_OMP_MAX ]]; then omp=$NB_OMP_MAX; fi 177 178 # Compute how many mpi per node (required e.g. for Adastra) 179 mpi_per_node=0 180 if [[ $NB_CORE_PER_NODE_MAX -gt 0 ]]; then 181 local N_omp_mt=1 182 if [[ $omp -gt 1 ]]; then (( N_omp_mt = omp / N_HYPERTHREADING )); fi # take into account hyperthreading 183 (( mpi_per_node = NB_CORE_PER_NODE_MAX / N_omp_mt )) 184 if [[ mpi_per_node -gt mpi ]]; then mpi_per_node=$mpi; fi 185 fi 186 187 echo "Total MPI=$mpi (PER NODE=$mpi_per_node), OMP=$omp" 188 } 189 190 function ensure_correct_option_combinations() { 191 # AVOID COMBINATIONS OF OPTIONS THAT DON'T WORK in user choices 192 if [[ $ok_guide = y && $climato = 1 ]]; then 193 echo "STOP: Running nudged simulations with climatological SSTs is not planned. Change <climato> to <0> or modify the setup (experts)"; exit 1 194 fi 195 196 if [[ $climato = 0 && $freq = "yr" ]]; then 197 echo "STOP: Running simulations with interannual SSTs is possible only month by month and a true calendar." 198 echo "Change <climato> to <1> or <freq> to <mo> or modify setup.sh (experts)"; exit 1 199 fi 200 201 202 # (Temporary) Constraints for aerosols=spla : 203 # --> resolution 128x88x79 and rad=rrtm 204 if [[ $aerosols = "spla" && $resol != "128x88x79" ]]; then 205 echo 'STOP: For now, <aerosols=spla> requires <resol=128x88x79>, and uses the zoomed grid from gcm.def_zNAfrica_BiJe, for which forcing & initial files are available' 206 echo "Right now resol=<$resol>" 207 exit 1 208 fi 209 210 if [[ $rad = "ecrad" && $phylmd != "lmd" ]]; then 211 echo "<rad=ecrad> is only supported for <phy=phylmd> here" # (Amaury) I added this check because we fetch ecrad data from libf/phylmd/ecrad/data only. 212 fi 213 } 214 215 function install_model() { 216 mkdir -p "$LMDZD" 217 218 local ins_xios ins_cosp ins_aero ins_inlandsis 219 if [[ $xios = "y" ]]; then ins_xios="-xios"; else ins_xios=""; fi 220 if [[ $cosp = "y" ]]; then ins_cosp="-cosp v1"; else ins_cosp=""; fi 221 if [[ $aerosols = "spla" ]]; then ins_aero="-spla"; else ins_aero=""; fi 222 if [[ $inlandsis = "y" ]]; then ins_inlandsis="-inlandsis"; else ins_inlandsis=""; fi 223 if [[ -n $svn ]]; then svnopt="-r $svn"; else svnopt=""; fi 224 225 version_name=LMDZ$(echo "$version" | sed -e 's/-v//g' -e 's/-unstable//' -e 's/-r/r/' -e 's/ //g') 226 LMDZname="${version_name}${svn}OR$veget${ins_xios}" 227 MODEL="$LMDZD/$LMDZname/modipsl/modeles/LMDZ" 228 229 if [[ -d $MODEL ]]; then echo "Found existing install at MODEL=$MODEL"; fi 230 echo "Installing model" 231 cd "$LMDZD" 232 cp "$local/install_lmdz.sh" . 233 chmod +x install_lmdz.sh 234 local make_j=8 235 # We launch using $MPICMD, except if it's using mpirun (no srun equivalent for bash script) => if supported, the compilation runs in a cluster job 236 jobcmd="\"$RUNBASHCMD $make_j\"" 237 if [[ ${hostname:0:5} = "jean-" ]]; then jobcmd="\"$RUNBASHCMD $make_j --partition=compil\""; fi # On JeanZay: compile on the <compil> partition 238 if [[ $(echo "$RUNBASHCMD" | cut -c -4) = "bash" ]]; then 239 jobcmd="bash" 240 fi 241 echo "./install_lmdz.sh -noclean $optim -v $version $svnopt -d $resol -rad $rad -bench 0 -parallel mpi_omp $ins_cosp $ins_xios $ins_aero $ins_inlandsis -name $LMDZname -veget $veget -netcdf $netcdf -arch $ARCH -make_j $make_j -jobcmd $jobcmd" >> install_lmdz_options.$$.sh 242 chmod +x install_lmdz_options.$$.sh 243 echo "Running install_lmdz_options.$$.sh" 244 set -o pipefail 245 gcm=$MODEL/$(./install_lmdz_options.$$.sh | tee /dev/tty | tail -n 1 | sed -n "s:.* executable is \(.*\.e\).*:\1:p") 246 set +o pipefail 247 mv install_lmdz.sh install_lmdz.$$.sh 248 cd "$local" 249 } 250 251 function setup_def() { # modify various .def in ./DEF (+ xios xml as needed) 252 cd "$local" 253 254 # Utilisation des .def_iso pour LMDZ-ISOtopes 255 if [[ $phylmd = "lmdiso" ]]; then 256 for file_iso in $(ls DEF | grep _iso); do 257 cp DEF/"$file_iso" DEF/"${file_iso%%_iso}" 258 done 259 fi 260 261 ###################################################################### 262 # Choix de la grille verticale 263 ###################################################################### 264 lm=$(echo "$resol" | cut -dx -f3) 265 if [ ! -f "DEF/L$lm.def" ]; then 266 echo "STOP: Résolution verticale non prévue - créer un fichier DEF/L$lm.def"; exit 1 267 else 268 sed -i'' -e "s/INCLUDEDEF=L.*.def/INCLUDEDEF=L$lm.def/" DEF/run.def 269 fi 270 271 ###################################################################### 272 # Changements dans les fichiers DEF/*def 273 # (ils vont se repercuter dans les repertoires de simulation $local/$SIM et de run $SIMRUNDIR) 274 ###################################################################### 275 276 # Choix du fichier tracer.def coherent avec l'option "aerosols" 277 # NOTE : Le nouveau tracer.def_nospla par defaut n'inclut pas Rn-Pb; 278 # si on les veut, il faut utiliser ci-dessous; a la place, tracer_RN_PB.def 279 #--------------------------------------------------------------------- 280 # NB : Les traceurs absents de start* files sont initialises=0 dans le code 281 if [[ $aerosols = "spla" ]]; then 282 # nouveau tracer.def (remplace "traceur.def") 283 cp DEF/tracer.def_spla DEF/tracer.def 284 elif [[ $phylmd = "lmdiso" ]]; then 285 # déjà copié si 'y' 286 cp DEF/tracer.def_nospla DEF/tracer.def 287 fi 288 289 # TEMPORAIREMENT pour spla on force l'utilisation de gcm.def_zNAfrica_BiJe (avec resolution 128x88x79) 290 #---------------------------------------------------------------------- 291 if [[ $aerosols = "spla" ]]; then cp DEF/gcm.def_zNAfrica_BiJe DEF/gcm.def; fi 292 293 # Inscription du choix ok_guide dans DEF/guide.def 294 #--------------------------------------------------------------------- 295 sed -i'' -e 's/ok_guide=.*.$/ok_guide='$ok_guide'/' DEF/guide.def 296 297 # Inscription du type de calendrier (qui est fonction de $climato) dans DEF/run.def 298 #--------------------------------------------------------------------- 299 # NB Contrairement a ce qui est ecrit dans les fichiers run.def standard, 300 # dans ce tutorial le choix earth_365d n'est pas disponible, et earth_366d s'appelle gregorian 301 if [[ $climato = 0 ]]; then calend="gregorian"; else calend="earth_360d"; fi 302 sed -i'' -e 's/calend=.*.$/calend='$calend'/' DEF/run.def 303 304 # Changements dans config.def (pre-choisi, et regle pour output si utilisation avec IOIPSL) 305 # cf options veget, aerosols, cosp, xios 306 #--------------------------------------------------------------------- 307 if [[ $veget = "none" ]]; then VEGET="n"; else VEGET="y"; fi 308 sed -i'' -e 's/VEGET=.*.$/VEGET='$VEGET'/' DEF/config.def 309 310 if [[ $aerosols = "n" ]]; then 311 # set flag_aerosols=0 and flags ok_ade&co=n 312 sed -i'' -e 's/^ok_cdnc=.*.$/ok_cdnc=n/' -e 's/^ok_ade=.*.$/ok_ade=n/' -e 's/^ok_aie=.*.$/ok_aie=n/' -e 's/^ok_alw=.*.$/ok_alw=n/' -e 's/^flag_aerosol=.*.$/flag_aerosol=0/' DEF/config.def 313 fi 314 315 # COSP : ok_cosp desactive COSP si on a compile avec; il ne l'active pas si on a compile sans 316 sed -i'' -e 's/ok_cosp.*.$/ok_cosp='$cosp'/' DEF/config.def 317 if [[ $cosp = "y" ]]; then \cp -f "$MODEL"/DefLists/cosp*.txt "$local"/DEF/; fi 318 319 # Sorties LMDZ en fonction de l'option "xios" 320 sed -i'' -e 's/ok_all_xml=.*.$/ok_all_xml='$xios'/' DEF/config.def 321 322 # Ajuster physiq.def en fonction de radiative code (default: values for rad=rrtm) 323 # Pour isotopes=y , mettre iflag_ice_thermo=0 au lieu de 1 324 #--------------------------------------------------------------------- 325 sed -i'' -e "s/iflag_rrtm=.*.$/iflag_rrtm=$iflag_rrtm/" -e "s/NSW=.*.$/NSW=$NSW/" DEF/physiq.def 326 sed -i"" -e "s:directory_name.*$:directory_name=\"$MODEL/libf/phylmd/ecrad/data\",:" DEF/namelist_ecrad 327 328 if [[ $phylmd = "lmdiso" ]]; then iflag_ice_thermo=0; else iflag_ice_thermo=1; fi 329 sed -i -e 's/iflag_ice_thermo=.*.$/iflag_ice_thermo='$iflag_ice_thermo'/' DEF/physiq.def 330 331 # Choix de orchidee.def en fonction de orchidee_rev; modification pour xios 332 # NOTE separate orchidee_pft.def file for ORCHIDEE trunk post-CMIP6 333 #--------------------------------------------------------------------- 334 orchidee_def=orchidee.def_6.1 335 orchidee_pft_def="" 336 if [[ $veget = "7983" ]]; then 337 orchidee_def=orchidee.def_6.2work 338 elif [[ $veget = "7994" ]]; then 339 orchidee_def=orchidee.def_6.4work 340 orchidee_pft_def=orchidee_pft.def_6.4work 341 if ! grep "INCLUDEDEF=orchidee_pft.def" DEF/run.def; then 342 sed -i'' -e 's/INCLUDEDEF=orchidee.def/INCLUDEDEF=orchidee.def\nINCLUDEDEF=orchidee_pft.def/' DEF/run.def; fi 343 fi 344 cp -f DEF/$orchidee_def DEF/orchidee.def 345 if [[ $orchidee_pft_def != "" ]]; then cp -f DEF/$orchidee_pft_def DEF/orchidee_pft.def; fi 346 347 # Only for veget=CMIP6 it is still possible to use IOIPSL; newer versions of orchidee.def have XIOS_ORCHIDEE_OK = y 348 sed -i'' -e 's/XIOS_ORCHIDEE_OK =.*.$/XIOS_ORCHIDEE_OK = '$xios'/' DEF/orchidee.def 349 350 ###################################################################### 351 # Si on tourne avec XIOS, mise a jour des fichiers context et field* dans XMLfilesLMDZ 352 # (ils vont se repercuter dans les repertoires de simulation $local/$SIM et de run $SIMRUNDIR) 353 ###################################################################### 354 if [[ $xios = y ]]; then 355 cp -f "$MODEL"/DefLists/context_lmdz.xml "$local"/DEF/XMLfilesLMDZ/. 356 cp -f "$MODEL"/DefLists/field_def_lmdz.xml "$local"/DEF/XMLfilesLMDZ/. 357 if [[ $cosp = y ]]; then cp -f "$MODEL"/DefLists/field_def_cosp1.xml "$local"/DEF/XMLfilesLMDZ/.; fi 358 fi 359 } 360 361 function setup_ce0l() { # Verification de l'existance de l'état initial, compilation eventuelle pour sa creation 362 if [[ ! -d $INIT ]]; then 363 if [[ $init = 0 ]]; then 364 echo "STOP: Récuperer les repertoires $INIT ou lancer avec option -init"; exit 1 365 else 366 # Compile ce0l 367 cd "$MODEL" 368 sed -e 's/gcm$/ce0l/' compile.sh > compile_ce0l.sh; chmod +x compile_ce0l.sh 369 echo "Compiling ce0l" 370 if ! ./compile_ce0l.sh &> ce0l.log; then echo "STOP: ce0l compilation failed, see $MODEL/ce0l.log"; exit 1; fi 371 echo "Compiled ce0l" 372 ce0l=${gcm/gcm/ce0l} 373 374 cd "$local" 375 fi 376 elif [[ $init = 1 ]]; then 377 echo "STOP: Vous essayez d initialiser le modele mais $INIT existe deja"; exit 1 378 fi 379 } 380 381 function setup_simu() { 382 SIMRUNTOPDIR="$SIMRUNBASEDIR/$(basename "$local")" 383 SIMRUNDIR=$SIMRUNTOPDIR 384 mkdir -p "$SIMRUNDIR" 385 cd "$SIMRUNDIR" 386 echo "La simulation s'exécutera sur $SIMRUNDIR" 387 388 ##################################################################### 389 # Creation du repertoire $SIM s'il n'existe pas deja 390 ##################################################################### 391 if [[ ! -d $local/$SIM ]]; then 392 mkdir "$local/$SIM" 393 cd "$local" 394 395 # Edit reb.sh 396 cp reb.sh "$local/$SIM/reb.sh"; chmod +x "$local/$SIM/reb.sh" 397 sed -i'' -e "s:^rebuild=.*.$:rebuild=$LMDZD/$LMDZname/modipsl/bin/rebuild:" "$local/$SIM/reb.sh" 398 enable_platform "$local/$SIM/reb.sh" 399 400 # Copy .def 401 cp lmdz_env.sh "$local/$SIM/" 402 mkdir "$local/$SIM/DEF"; cp DEF/*def DEF/namelis* "$local/$SIM/DEF/" 403 #Pour XIOS, respectivement COSP, copier aussi les fichiers *xml / *txt 404 if [[ $cosp = "y" ]]; then cp DEF/cosp*txt "$local/$SIM/DEF/"; fi 405 if [[ $xios = "y" ]]; then 406 cp DEF/XMLfilesLMDZ/*xml "$local/$SIM/DEF/" 407 if [[ $veget != 'none' ]]; then cp DEF/XMLfilesOR$veget/*xml "$local/$SIM/DEF/"; fi 408 fi 409 chmod u+w "$local/$SIM"/DEF/* 410 411 # Gestion du calendrier 412 ####################### 413 cd "$SIM" 414 sed -i'' -e "s/anneeref=.*.$/anneeref=$yearini/" DEF/run.def 415 if [[ $freq = "yr" ]]; then date=$yearini; else date=$mthini; fi 416 echo "$date a faire" >| etat 417 418 # Recuperation des fichiers : executable initiaux et forcages 419 ############################################################# 420 echo "date: $date" 421 for f in start startphy; do 422 inf=../$INIT/$f.$date.nc 423 if [[ -f $inf || $init = 1 ]]; then ln -s "$inf" ./; else echo "STOP: $inf missing"; exit ; fi; 424 done 425 for f in sechiba stomate; do 426 if [[ -f ../$INIT/start_$f.$date.nc ]]; then ln -sf "../$INIT/start_$f.$date.nc" .; fi 427 done 428 cp "$gcm" gcm.e 429 fi 430 cd "$local"/.. 431 432 ##################################################################### 433 echo "Modification du script de lancement" 434 ##################################################################### 435 local cput 436 if [[ $freq = "yr" ]]; then cput="04:00:00"; else cput="01:00:00"; fi 437 local isotopes="n" 438 if [[ $phylmd = "lmdiso" ]]; then isotopes="y"; fi 439 sed -e "s/NOM_SIMU/$SIM/" \ 440 -e "s/time=.*.$/time=$cput/" \ 441 -e "s/ntasks=.*.$/ntasks=$mpi/" \ 442 -e "s/ntasks-per-node=.*.$/ntasks-per-node=$mpi_per_node/" \ 443 -e "s/cpus-per-task=.*.$/cpus-per-task=$omp/" \ 444 -e "s/nthreads=.*./nthreads=$omp/" \ 445 -e "s/MAINDIR=.*.$/MAINDIR=$(basename "$local")/" \ 446 -e "s:STORED=.*.*:STORED=$(dirname "$local"):" \ 447 -e "s:SCRATCHD=.*.*:SCRATCHD=$SIMRUNBASEDIR:" \ 448 -e "s/stopsim=.*.$/stopsim=$stopsim/" \ 449 -e "s/^veget=.*.$/veget=$veget/" \ 450 -e "s/^aerosols=.*.$/aerosols=$aerosols/" \ 451 -e "s/^isotopes=.*.$/isotopes=$isotopes/" \ 452 -e "s/^climato=.*.$/climato=$climato/" \ 453 -e "s/^ok_guide=.*.$/ok_guide=$ok_guide/" \ 454 "$local/script_SIMU" >| "$SIMRUNDIR/tmp_$SIM" 455 456 enable_platform "$SIMRUNDIR/tmp_$SIM" 457 458 if [[ $testmode = "y" ]]; then 459 sed -i'' -e "s/time=.*.$/time=00:10:00/" -e "s/#nday=1/nday=1/" -e "s/#@TESTQ//" "$SIMRUNTOPDIR/tmp_$SIM" 460 fi 461 } 462 463 function fetch_simu_init_files() { 464 ##################################################################### 465 echo "Recuperation eventuelle de certains fichiers sur $LMDZ_INIT" 466 ##################################################################### 467 mkdir -p "$LMDZ_INIT" 468 469 #------------------------------------------------------------------- 470 # Fichiers ORCHIDEE 471 #------------------------------------------------------------------- 472 get="myget 3DInputData/Orchidee/" 473 cd "$LMDZ_INIT"; 474 for file in "PFTmap_IPCC_2000.nc" "cartepente2d_15min.nc" "routing.nc" "routing_simple.nc" "lai2D.nc" "soils_param.nc" "woodharvest_2000.nc" "PFTmap_15PFT.v1_2000.nc"; do 475 if [[ ! -f $file ]]; then ${get}$file; fi 476 done 477 cd - > /dev/null 478 # Additionnal files needed for ORCHIDEE trunk post-CMIP6 479 if [[ $veget = 7994 && ! -f $LMDZ_INIT/soil_bulk_and_ph.nc ]]; then 480 cd "$LMDZ_INIT" 481 ${get}soil_bulk_and_ph.nc; ${get}NITROGEN_for_ORtrunk.tar 482 tar -xvf NITROGEN_for_ORtrunk.tar; cd - > /dev/null 483 fi 484 #------------------------------------------------------------------- 485 # Fichiers aerosols/chimie 486 #------------------------------------------------------------------- 487 if [[ $aerosols = "clim" ]]; then 488 get="myget 3DInputData/AerChem/" 489 #liste_get="aerosols1850_from_inca.nc aerosols2000_from_inca.nc" 490 #aerosols9999_from_inca.nc est un lien vers aerosols1995_2014_ensavg_from_inca.nc 491 cd "$LMDZ_INIT" 492 for file in "aerosols1850_from_inca.nc" "aerosols9999_from_inca.nc"; do 493 if [[ ! -f $file ]]; then ${get}$file; fi 494 done 495 cd - > /dev/null 496 fi 497 # For SPLA 498 #------------------- 499 # Dans ${LMDZ_INIT} on cree folder SPLA_Init et dedans le INITIAL 500 # Pour l'instant on copie là-dedans de chez Binta les fichiers a la res zoomNaf; 501 # plus tard on y recupererea des fichiers a haute resolution reguliere depuis http:/LMDZ, 502 # a regrider ensuite par un script interp_fichiers_spla.sh (comme pour aerosols="clim") 503 # Les fichiers (regrides, sauf SOILSPEC.data utilise tel quel) seront mis dans $MAINDIR/INPUT_SPLA (equivalent de INPUT_DUST) 504 # The Path below is for JEANZAY. See with the team how to adapt to your cluster. 505 if [[ $aerosols = "spla" ]]; then 506 mkdir -p "${LMDZ_INIT}/SPLA_Init"; mkdir -p "$LMDZ_INIT/SPLA_Init/INITIAL" 507 get="cp -p /gpfsstore/rech/gzi/rgzi027/ergon/BIBIAERO/INPUTS_DUST/INITIAL/" 508 liste_get="wth.dat cly.dat donnees_lisa.nc SOILSPEC.data \ 509 carbon_emissions.nc sulphur_emissions_antro.nc \ 510 sulphur_emissions_nat.nc sulphur_emissions_volc.nc" 511 512 cd "$LMDZ_INIT/SPLA_Init/INITIAL" 513 for file in $liste_get; do 514 if [[ ! -f $file ]]; then ${get}$file .; fi 515 done 516 cd - > /dev/null 517 ### 518 #Cas particulier des fichiers mensuels dust.nc :A DECIDER : 519 #C'est entre le cas des aerosols.clim= 1 seul fichier, annuel, 520 # et le cas des vents guidage, pré-interpolés avec era2gcm pour toute la periode, dans MAINDIR/GUIDE. 521 # On pourrait (a)demander de precalculer dust.nc aussi, dans MAINDIR/INPUT_SPLA - avec un script à adapter de Jeronimo. Rien a mettre dans SPLA_Init alors. 522 # Ou (b) fournir dans SPLA_Init les 12 mois d'un dust.nc climato (an 2006 pour nous ici) à la res EC, et faire juste le regrid vers MAINDIR/INPUT_SPLA 523 #ICI pour l'instant je copie les fichiers de chez Binta (repositoire==http...) dans LMDZ_INIT/SPLA_Init, avec test sur mois 01 524 525 if [[ ! -d ${LMDZ_INIT}/SPLA_Init/PERIOD0001 ]]; then 526 if [[ ${hostname:0:5} != "jean-" ]]; then echo "PERIOD001 (aerosols=spla) IS ONLY AVAILABLE ON JEANZAY FOR NOW, CONTACT SUPPORT"; exit 1; fi 527 cp -pr /gpfsstore/rech/gzi/rgzi027/ergon/BIBIAERO/INPUTS_DUST/PERIOD* "$LMDZ_INIT/SPLA_Init/."; 528 fi 529 #A la fin on doit avoir dans SPLA_Init les fichiers initiaux dans INITIAL plus les repertoires PERIOD00MM contenant dust.nc 530 #Cela doit se retrouver dans script_SIMU qui les copie dans le repertoire de run sur $SCRATCH 531 fi 532 #------------------------------------------------------------------- 533 # Fichiers Init 534 #------------------------------------------------------------------- 535 get="myget 3DInputData/Init/" 536 liste_get="alb_bg_modisopt_2D_ESA_v2.nc reftemp.nc" 537 cd "$LMDZ_INIT" 538 for file in $liste_get; do 539 if [[ ! -f $LMDZ_INIT/$file ]]; then ${get}$file; fi 540 done 541 cd - > /dev/null 542 } 543 544 function run_sim_or_init() { 545 cd "$local" 546 547 if [[ $init = 1 ]]; then 548 ##################################################################### 549 echo "Creation de l etat initial" 550 ##################################################################### 551 552 # Creation du repertoire INIT et mise en place de liens logiques vers les starts 553 # en anticipation de leur création : 554 mkdir "$local/$INIT"; cd "$local/$INIT" 555 for an in $mthini $yearini; do for f in start startphy; do ln -s "$f.nc" "$f.$an.nc"; done; done 556 557 # Creation du repertoire INIT temporaire et rapatriement des fichiers necessaires 558 if [[ -d $SIMRUNDIR/$INIT ]]; then mv "$SIMRUNDIR/$INIT" "$SIMRUNDIR/$INIT$$"; fi 559 mkdir "$SIMRUNDIR/$INIT"; cp -r "$local/DEF" "$SIMRUNDIR/$INIT/" 560 cd "$SIMRUNDIR/$INIT"; cp DEF/*.def .; cp "$local/lmdz_env.sh" . 561 if [[ $xios = "y" ]]; then 562 cp DEF/XMLfilesLMDZ/*xml . 563 if [[ $veget != 'none' ]]; then cp DEF/XMLfilesOR$veget/*xml .; fi 564 fi 565 sed -e "s/anneeref=.*.$/anneeref=$yearini/" DEF/run.def >| run.def 566 567 #------------------------------------------------------------------- 568 # Fichiers Limit 569 #------------------------------------------------------------------- 570 local yrs suf 571 if [[ $climato = 0 ]]; then 572 # calend est choisi plus haut dans "Changements dans les fichiers DEF/*def" et ecrit dans $MAINDIR/DEF/run.def 573 yrini=$(echo "$mthini" | cut -c-4) 574 yrend=$(echo "$mthend" | cut -c-4) 575 yrs=""; yr=$yrini 576 while [[ $yr -le $yrend ]]; do yrs="$yrs $yr"; (( yr = yr + 1 )); done 577 suf="360x180_" 578 else 579 yrs=2000 580 suf="1x1_clim" 581 fi 582 583 get="myget 3DInputData/Limit/" 584 liste_get="Albedo.nc Relief.nc Rugos.nc landiceref.nc" 585 for yr in $yrs; do 586 if [[ $climato = 0 ]]; then sufyr=$suf$yr; else sufyr=$suf; fi 587 liste_get="$liste_get amipbc_sic_$sufyr.nc amipbc_sst_$sufyr.nc" 588 done 589 echo LISTEGET "$liste_get" 590 for file in $liste_get; do 591 cd "$LMDZ_INIT" 592 if [[ ! -f $LMDZ_INIT/$file ]]; then ${get}$file; fi 593 cd - > /dev/null 594 ln -s "$LMDZ_INIT/$file" . 595 done 596 #------------------------------------------------------------------- 597 # ECDYN 598 #------------------------------------------------------------------- 599 get="myget 3DInputData/Init/" 600 if [[ ! -f $LMDZ_INIT/ECDYN.nc ]]; then cd "$LMDZ_INIT"; ${get}ECDYN.nc; cd - > /dev/null; fi 601 ln -s "$LMDZ_INIT"/ECDYN.nc . 602 ln -sf ECDYN.nc ECPHY.nc 603 604 # Creation du script d'initialisation 605 cat << ...eod >| tmp 606 #!/bin/bash 607 #@JZ#JeanZay 608 #@JZ#SBATCH --job-name=Init # nom du job 609 #@JZ#SBATCH --ntasks=1 # Nombre de processus MPI 610 #@JZ#SBATCH --cpus-per-task=1 # nombre de threads OpenMP 611 #@JZ# /!\ Attention, la ligne suivante est trompeuse mais dans le vocabulaire 612 #@JZ# de Slurm "multithread" fait bien référence à l'hyperthreading. 613 #@JZ#SBATCH --hint=nomultithread # 1 thread par coeur physique (pas d'hyperthreading) 614 #@JZ#SBATCH --time=00:10:00 # Temps d'exécution maximum demandé (HH:MM:SS) 615 #@JZ#SBATCH --output=Init%j.out # Nom du fichier de sortie 616 #@JZ#SBATCH --error=Init%j.out # Nom du fichier d'erreur (ici commun avec la sortie) 617 #@JZ# To submit to dev queue; "time" (above) must be max 2h 618 #@JZ#TESTQ#SBATCH --qos=qos_cpu-dev 619 #@SP#Spirit 620 #@SP#SBATCH --job-name=Init 621 #@SP#SBATCH --ntasks=1 622 #@SP#SBATCH --cpus-per-task=1 623 #@SP#SBATCH --hint=nomultithread 624 #@SP#SBATCH --time=00:10:00 625 #@SP#SBATCH --output=Init%j.out 626 #@SP#SBATCH --error=Init%j.out 627 #@ADS#Adastra 628 #@ADS#SBATCH --job-name=Init 629 #@ADS#SBATCH --ntasks=1 630 #@ADS#SBATCH --cpus-per-task=1 631 #@ADS#SBATCH --nodes=1 632 #@ADS#SBATCH --hint=nomultithread 633 #@ADS#SBATCH --time=00:10:00 634 #@ADS#SBATCH --output=Init%j.out 635 #@ADS#SBATCH --error=Init%j.out 636 637 set -eu 638 639 # ANCIEN MULTI STEP case \${LOADL_STEP_NAME} in 640 641 # ANCIEN MULTI STEP init ) 642 643 if [ ! -f lmdz_env.sh ]; then echo "manque fichier lmdz_env.sh"; ls; exit 1; fi 644 . lmdz_env.sh 645 ulimit -s unlimited 646 cd $SIMRUNDIR/$INIT 647 echo "Executable : $ce0l" 648 for yr in $yrs; do 649 if [ $climato = 0 ]; then sufyr=$suf\$yr; else sufyr=$suf; fi 650 ln -sf amipbc_sic_\$sufyr.nc amipbc_sic_1x1.nc 651 ln -sf amipbc_sst_\$sufyr.nc amipbc_sst_1x1.nc 652 sed -e 's/anneeref=.*.$/anneeref='\$yr'/' DEF/run.def >| run.def 653 echo Starting initialisation 654 OMP_NUM_THREADS=1 $MPICMD 1 $ce0l # ce0l requires MPI=OMP=1 655 if [ $climato = 0 ]; then mv limit.nc limit.\$yr.nc; fi 656 done 657 # ANCIEN MULTI STEP ;; 658 659 # ANCIEN MULTI STEP interp ) 660 if [[ $aerosols = clim ]]; then 661 cp $local/interp_aerosols.sh .; chmod +x interp_aerosols.sh 662 # Les aerosols de l'annee 2000 ont été remplacés par "9999" qui pointe vers un fichier moyen sur 1995-2014 663 #for year in 2000 1850; do ./interp_aerosols.sh \$year; done 664 #mv aerosols.2000.nc aerosols.clim.nc; mv aerosols.1850.nc aerosols.nat.nc 665 for year in 9999 1850; do ./interp_aerosols.sh \$year; done 666 mv aerosols.9999.nc aerosols.clim.nc; mv aerosols.1850.nc aerosols.nat.nc 667 fi 668 669 # AS : S'il etait possible d'automatiser l'interpolation de l'input SPLA, ce serait a lancer ici 670 #en attendant, on passe au paragraphe suivant où on copie les fichiers à la res ZoomNaf depuis $LMDZ_INIT/SPLA_Init 671 #if [ $aerosols = spla ]; then 672 #cp $local/futur script interp_aerosols_SPLA.sh .; chmod +x interp_aerosols_SPLA.sh 673 #for file in...; do ./interp_aerosols_SPLA.sh \$year; done 674 #etc etc etc ... 675 #fi 676 677 # Copy initial and forcing files in $local/$INIT and $local/$LIMIT; also in $local/INPUT_SPLA if $aerosols=spla 678 for f in sta* gri*nc; do cp \$f $local/$INIT/\$f; done 679 if [[ $climato = 1 ]]; then cp limit.nc $local/$INIT/limit.nc; fi 680 mkdir -p $local/$LIMIT 681 for f in limit*.nc ; do cp \$f $local/$LIMIT/\$f; done 682 if [ $aerosols = clim ]; then for f in aerosols[.0-9]*nc; do cp \$f $local/$LIMIT/\$f; done; fi 7 683 # 8 # RECOMMENDATION: use main.sh to drive it (do not run it directly) 9 # 10 ##################################################################### 11 # 12 # EXPERT-LEVEL CHOICES, only available in setup.sh, not in main.sh : 13 ##################################################################### 14 15 #NOTE : $optim is part of $LMDZname (see definition of LMDZname below), 16 # so that running with "-debug" needs to (re)install the model (install=-install in main.sh) 17 # If you have already installed the model, and only want to recompile the gcm in debug mode, 18 # add "-debug" to the compilation options in the compile.sh script created in the present folder, and run it (./compile.sh gcm) 19 # ALTERNATIVELY : you can remove $optim in the definition of "LMDZname" below 20 optim="" 21 #optim="-debug" 22 23 #NOTE : "testmode=y" is for running in test mode : 24 # the simulation job "tmp_$SIM" (created on $SCRATCHDIR) is automatically changed for a short run, 25 # and submitted to the Jean-Zay "test" queue : 26 # a/ time=00:10:00 (run time limit = 10 min ; for test queue, it must be 30 min maximum) 27 # b/ nday=1 (this line, forcing nday to 1 day, is "hidden" in script_SIMU, by default it is commented out) 28 # c/ #SBATCH --qos=qos_cpu-dev (this line is in script_SIMU, by default it is commented out) 29 #If you want to change "time", or "nday", but still run in "test" mode, modify the "if [ $debug = 1 ]...; fi" further below. 30 testmode=n 31 32 # --->>> Radiative code : run with "oldrad" or "rrtm" or "ecrad" (default : rrtm) 33 # NOTE : For LMDZ rev before 4185 included, if you change this choice and you want to recompile, 34 # modify compile.sh and run it in the present folder ($local) : ./compile.sh gcm 35 # with the appropriate compiling option (see $opt_rrtm below) 36 rad=rrtm 37 38 # --->>> AEROSOLS : n (=no) / clim (=average 1995-2014) / spla (interactive dust and sea salt) 39 # (ATTENTION : if you first run the scripts with aerosols=n, then you want to change to =clim , 40 # you'll need to remove the INIT and LIMIT folders that have been created, then run main.sh with init=1 41 # in order to re-run the initialisation job, which downloads the aerosol files and interpolates them) 42 aerosols=clim 43 44 # --->>> SURFACE/VEGETATION SCHEME (as in install_lmdz.sh ; LF) 45 # It is controlled by the single variable "veget" which can have the following values 46 # - NONE: bucket scheme (default) 47 # - CMIP6: orchidee version used in CMIP exercise, rev 5661 48 # - number: orchidee version number : only rev 7983 on branch _2_2, and 7994 on trunk, are available 49 # !!! ATTENTION : both ORCHIDEE branch 2_2 and recent TRUNK REQUIRE XIOS !!!! 50 veget=CMIP6 51 #AS : If you have installed the model with a given "veget" option, and you want to change it : 52 # --> RECOMMENDED : re-install the model from scratch, using main.sh with "-install" option in it 53 # (even better : start in a new TEST_PROD folder) 54 # --> EXPERT : If you want to keep your previous installation, and not go through the install_lmdz.sh routine, 55 # you will need to (a) install the proper version of ORCHIDEE in the modipsl/modeles directory, and 56 # (b) set the "veget" options (opt_veget, orchidee_rev, suforch) to their proper values 57 # in the file $LMDZD/modipsl/modeles/surface_env 58 # (NB : no need to initialise these vars here: 59 # surface_env is either (re)created when (re)installing the model (run with install=-install), 60 # or it already exists (install=""). 61 62 # --->>> New snow scheme INLANDSIS (y/n) 63 # (this flag activates INLANDSIS compilation ; 64 # not yet done : treatment of specific restart and def file) 65 inlandsis=n 66 67 ## --->>> Isotopes : compile and run with/without (y/n) : is now dependent on phylmd (=lmd_phys from main.sh), see below 68 ##isotopes=n 69 70 # --->>> COMPILATION options : fcm, debug 71 fcm=-nofcm 72 fcm="" 73 74 # --->>> ALSO PAY ATTENTION TO OUTPUT files, frequency, level ------------- 75 # With IOIPSL : Choose your config.def among the versions available in DEF, 76 # copy it as config.def (the copy is done automatically for "iso"), 77 # edit it and set up output files, frequencies and levels. 78 # NB : For aerosols=spla, output level minimum 4 is required to output the specific variables. 79 # For aerosols=n, the corresponding flags will automatically be set to "n". 80 # With XIOS : adjust DEF/XMLfiles*/file*xml 81 # 82 #### END EXPERT-LEVEL CHOICES ######################################### 83 84 # Set up the appropriate environment 85 #------------------------------------ 86 sed -i -e 's/hostname=.*.$/hostname='`hostname`'/' lmdz_env.sh 87 . lmdz_env.sh 88 module list 89 90 # Pour les post-traitements 91 sed -i'' -e 's/groupe@cpu/'$groupe'@cpu/' seasonal.sh 92 local=`pwd` 93 94 ############################################################## 95 96 # A function to fetch files either locally or on the internet 97 function myget { #1st and only argument should be file name 98 # Path on local computer where to look for the datafile 99 if [ -f /u/lmdz/WWW/LMDZ/pub/$1 ] ; then 100 \cp -f -p /u/lmdz/WWW/LMDZ/pub/$1 . 101 elif [ -f ~/LMDZ/pub/$1 ] ; then 102 \cp -f -p ~/LMDZ/pub/$1 . 103 else 104 wget -nv https://lmdz.lmd.jussieu.fr/pub/$1 105 #dir=~/LMDZ/pub/`dirname $1` ; mkdir -p $dir ; cp -r `basename $1` $dir 106 fi 107 } 108 109 ############################################################## 110 # Choices : name, nudging, calendar ... 111 ############################################################## 112 SIM=`basename \`pwd\``CTL 113 phylmd=lmd #option -p $phylmd for makelmdz 114 115 # COSP 116 cosp=n 117 118 #XIOS 119 xios=n 120 121 # Nudging : 122 ok_guide=n 123 # With nudging, use real calendar (climato=0) and monthly integrations 124 climato=1 125 freq=mo # frequence mensuelle mo ou annuelle yr 126 127 # NB : the run stops in the BEGINNING of mthend (test "next=stopsim") 128 mthini=200001 129 mthend=200501 130 resol=144x142x79 131 132 version=20230412.trunk 133 svn="" 134 135 install=0 136 init=1 137 138 LIMIT=LIMIT 139 140 141 ############################################################## 142 # options 143 ############################################################## 144 145 while (($# > 0)) 146 do 147 case $1 in 148 "-h") cat <<........fin 149 setup.sh can be launched/driven by main.sh; some options can only be specified in setup.sh (ex: veget, aerosols). 150 setup.sh [-v version] [-r svn_release] [-init INIT] [-d 96x95x79] [-f mo] [-nudging] 151 "version" like 20150828.trunk ; see https://lmdz.lmd.jussieu.fr/Distrib/LISMOI.trunk 152 "svn_release" either the svn release number or "last" 153 -d IMxJMxLM to run in resolution IM x JM x LM 154 -install pour installer et compiler le modele 155 -f mo/yr pour tourner en mensuel ou annuel 156 "INIT" 1: creates INIT and LIMIT 157 0: reads from INIT and LIMIT 158 SIMU: reads from preexisting simulation SIMU and LIMIT 159 -nudging to run with nudging. Nudging files must be created independently 160 Other options available (see "options" section in the script) 161 ........fin 162 exit ;; 163 "-v") version="$2" ; shift ; shift ;; 164 "-r") svn=$2 ; shift ; shift ;; 165 "-d") resol=$2 ; shift ; shift ;; 166 "-f") freq=$2 ; shift ; shift ;; 167 "-p") phylmd=$2 ; shift ; shift ;; 168 "-install") install=1 ; shift ;; 169 "-name") SIM=$2 ; shift ; shift ;; 170 "-cosp") cosp=y ; shift ;; 171 "-xios") xios=y ; shift ;; 172 "-init") init=$2 ; shift ; shift ;; 173 "-nudging") ok_guide=y ; shift ;; 174 "-climato") climato=$2 ; shift ; shift ;; 175 "-mthini") mthini=$2 ; shift ; shift ;; 176 "-mthend") mthend=$2 ; shift ; shift ;; 177 *) $0 -h ; exit 178 esac 179 done 180 181 # --->>> Isotopes : ompile and run with isotopes if lmdz_phys="lmdiso" in main.sh 182 if [ $phylmd = "lmdiso" ] ; then isotopes=y ; else isotopes=n ; fi 183 184 # Three options for initialisation 185 # 1: Create INIT 186 # 0: Take from INIT 187 # DIR : Take from DIR 188 if [ $init = 1 -o $init = 0 ] ; then 189 INIT=INIT 190 else 191 INIT=$init 684 if [ $aerosols = spla ]; then 685 #mkdir -p $local/INPUT_SPLA; pour l'instant on copie $LMDZ_INIT/SPLA_Init en block 686 if [ ! -d $local/INPUT_SPLA ]; then cp -pr $LMDZ_INIT/SPLA_Init $local/INPUT_SPLA; fi 192 687 fi 193 194 yearini=`echo $mthini | cut -c-4` 195 if [ $freq = yr ] ; then stopsim=`echo $mthend | cut -c-4` ; else stopsim=$mthend ; fi 196 197 if [ "$svn" = "" ] ; then svnopt="" ; else svnopt="-r $svn" ; fi 198 199 if [ -d $SIM ] ; then 200 echo La simulation $SIM existe deja 201 echo Il est preferable d arreter et de verifier. 202 echo Si vous etes sur de vous, vous pouvez la prolonger 203 echo Voulez vous la prolonger '? (y/o)' 204 read ans 205 if [ $ans != y -a $ans != o ] ; then 206 exit 207 fi 208 fi 209 210 # AVOID COMBINATIONS OF OPTIONS THAT DON'T WORK in user choices 211 #------------------------------------------------------- 212 213 if [ $ok_guide = y -a $climato = 1 ] ; then 214 echo "================================================================" 215 echo Running nudged simulations with climatological SSTs 216 echo is not planned. Change climato to 0 or modify the setup \(experts\) 217 echo "================================================================" 218 exit 219 fi 220 221 if [ $climato = 0 -a $freq = yr ] ; then 222 echo "================================================================" 223 echo running simulations with interannual SSTs is possible only 224 echo month by month and a true calendar. 225 echo Change climato to 1 or freq to mo or modify setup.sh \(experts\) 226 echo "================================================================" 227 exit 228 fi 229 230 # STOP if trying to use ORCHIDEE_2_2 or ORCHIDEE trunk post-CMIP6 without XIOS : 231 if [ $veget != "NONE" -a $veget != "CMIP6" -a $xios = "n" ] ; then echo "STOP : For this ORCHIDEE rev you need XIOS : change "xios" option in main.sh" ; exit ; fi 232 233 # STOP if trying to use both ORCHIDEE and Isotopes : 234 if [ $isotopes = "y" -a $veget != "NONE" ] ; then echo "STOP : You cannot run LMDZ with ORCHIDEE and ISOtopes at the same time ; either change "veget" option to NONE, or isotopes to "n" in setup.sh" ; exit ; fi 235 236 # STOP if trying to use both SPLA and Isotopes : 237 if [ $isotopes = "y" -a $aerosols = "spla" ] ; then echo "STOP : You cannot run LMDZ with Isotopes and aerosols=spla at the same time ; change "aerosols" option to "n" or "clim" in setup.sh " ; exit ; fi 238 239 # (Temporary) STOP if trying to use Isotopes with XIOS : 240 if [ $isotopes = "y" -a $xios = "y" ] ; then echo "STOP : Isotopes cannont yet be run with XIOS ; change xios option in main.sh" ; exit ; fi 241 242 # (Temporary) Constraints for aerosols=spla : 243 # --> resolution 128x88x79 and rad=rrtm 244 if [ $aerosols = spla -a $resol != 128x88x79 ] ; then 245 echo 'For now, aerosols=spla requiers resol=128x88x79, and uses the zoomed grid from gcm.def_zNAfrica_BiJe, for which forcing & initial files are available' 246 echo Actual aerosols and resol is $aerosols, $resol 247 exit 248 fi 249 if [ ${aerosols} = "spla" -a ${rad} != "rrtm" ] ; then echo "STOP : For the time being, aerosols=spla requires rad=rrtm" ; exit ; fi 250 251 252 # INSTALLATION OPTIONS depending on the user choices 253 #------------------------------------------------------- 254 255 if [ $cosp = y ] ; then ins_cosp="-cosp v1" ; else ins_cosp="" ; fi 256 257 if [ $xios = y ] ; then ins_xios="-xios" ; else ins_xios="" ; fi 258 259 ######################################################################## 260 # Recuperation ou compilation du GCM 261 ######################################################################## 262 263 if [ ! -d $LMDZD ] ; then mkdir -p $LMDZD ; fi 264 version_name=LMDZ`echo $version | sed -e 's/-v//g' -e 's/-unstable//' -e 's/-r/r/' -e 's/ //g'` 265 LMDZname=${version_name}${svn}${optim}OR${veget}${ins_xios} 266 MODEL=$LMDZD/$LMDZname/modipsl/modeles/LMDZ 267 268 if [ $install = 1 ] ; then 269 if [ -d $MODEL ] ; then 270 echo $MODEL 271 echo "Vous essayez d installer une version deja presente" 272 exit 273 else 274 echo On installe le modele 275 cd $LMDZD 276 echo wget https://lmdz.lmd.jussieu.fr/pub/install_lmdz.sh 277 \rm -f install_lmdz.sh 278 wget --no-cache https://lmdz.lmd.jussieu.fr/pub/install_lmdz.sh 279 # Si la ligne ci-dessus "wget https://lmdz.lmd..." ne marche pas pour "certificat expired", utiliser : 280 #wget https://web.lmd.jussieu.fr/~lmdz/pub/install_lmdz.sh 281 chmod +x install_lmdz.sh 282 echo "./install_lmdz.sh $fcm $optim -v $version $svnopt -d $resol -rad $rad -bench 0 -parallel mpi_omp $ins_cosp $ins_xios -name $LMDZname -env_file $local/lmdz_env.sh -veget $veget" >> $local/install_lmdz_options.$$ 283 ./install_lmdz.sh $fcm $optim -v $version $svnopt -d $resol -rad $rad -bench 0 -parallel mpi_omp $ins_cosp $ins_xios -name $LMDZname -env_file $local/lmdz_env.sh -veget $veget 284 mv install_lmdz.sh install_lmdz.$$ 285 if grep "Not Found" $LMDZname/get.log >/dev/null ; then echo "version=$version is NOT A TESTING VERSION, Ask LMDZ Team" ; exit ; fi 286 cd $local 287 fi 288 else 289 if [ ! -d $MODEL ] ; then 290 echo Le model $MODEL n est pas installe 291 echo relancer avec install=1 si vous voulez l installer automatiquement 292 exit 293 fi 294 fi 295 296 # Determine svn revision number, which will determine compilation options, executable names etc 297 # If svn not available, will use the svn writen in $MODEL/Readm*md 298 # For old version it assumes that it is before 4185 (the version 299 # for which the test was introduced 300 mysvn=`svnversion $MODEL | egrep -o "[0-9]+" 2>/dev/null` 301 if [ "$mysvn" = "" ] ; then mysvn=`grep 'Revision: [0-9]' $LMDZD/$LMDZname/Read*.md | awk ' { print $2 } ' 2>/dev/null` ; fi 302 if [ "$mysvn" = "" ] ; then mysvn=4190 ; fi 303 echo mysvn $mysvn 304 305 # For mysvn >= 4532, "module load netcdf95" must be added in lmdz_env.sh for Jean-Zay if it's not there; 306 # lmdz_env.sh must be sourced again, and copied again as $MODEL/arch/arch-X64_JEANZAY.env 307 # (first copy is done by install_lmdz.sh launched with option "-env lmdz_env.sh" ) 308 if [ ${hostname:0:5} = "jean-" -a $mysvn -ge 4532 -a ! "`grep netcdf95 lmdz_env.sh`" ] ; then 309 cp -p lmdz_env.sh lmdz_env.orig 310 sed -i'' -e 's/module load nco/module load netcdf95\n module load nco/' lmdz_env.sh 311 cp -p lmdz_env.sh $MODEL/arch/arch-X64_JEANZAY.env 312 . lmdz_env.sh 313 fi 314 315 # COMPILATION OPTIONS depending on the user choices and LMDZ revision number $mysvn 316 #------------------------------------------------------- 317 if [ "$ARCH" = "" ] ; then arch= ; else arch="-arch $ARCH" ; fi 318 319 if [ $cosp = y ] ; then opt_cosp="-cosp true" ; else opt_cosp="" ; fi 320 # makelmdz* uses "opt_cosp", and for v1 (default) needs "-cosp true/false" 321 # When cosp v2 will be validated, we'll have opt_cosp=ins_cosp="-cosp v2" 322 # (option cosp2 in makelmdz* to be ignored ; it is a transitory version from v1 to v2) 323 324 if [ $xios = y ] ; then opt_xios="-io xios" ; else opt_xios="" ; fi 325 326 case $rad in 327 oldrad) iflag_rrtm=0 ; NSW=2 ; opt_rad="" ;; 328 rrtm) iflag_rrtm=1 ; NSW=6 ; if [ $mysvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;; 329 ecrad) iflag_rrtm=2 ; NSW=6 ; opt_rad="-rad ecrad" ;; 330 *) echo Only oldrad rrtm ecrad for rad option ; exit 331 esac 332 if [ "$rad" = "ecrad" -a ! -d ecrad_data ] ; then 333 cd $local ; wget https://lmdz.lmd.jussieu.fr/pub/3DInputData/ecrad/ecrad_data.tar ; tar xvf ecrad_data.tar ; cd - 334 fi 335 if [ "$rad" = "ecrad" -a "$aerosols" != "n" -a "$mysvn" -lt 4489 ] ; then echo Les aerosols tropospheriques ne sont pas pris en charge par ecrad avant LMDZ rev 4489, ici rev est $mysvn ; exit ; fi 336 337 338 # Aerosols : also define the associated suffix in gcm name 339 if [ $aerosols = spla ] ; then 340 opt_aer=' -dust true ' ; sufaer='_spla' 341 else 342 opt_aer="" ; sufaer='' 343 fi 344 345 if [ $inlandsis = y ] ; then 346 opt_inlandsis="-inlandsis true" 347 else 348 opt_inlandsis="" 349 fi 350 351 # Isotopes : also define the associated suffix in gcm name 352 if [ $isotopes = y ] ; then 353 opt_isotopes="-isotopes true" ; sufiso="_iso" 354 else 355 opt_isotopes="" ; sufiso="" 356 fi 357 358 # Source the surface_env file created by install_lmdz.sh, to get the "veget"-related variables 359 #-------------------------------------------------------------------------------------- 360 # surface_env is produced by install_lmdz in $MODEL=$LMDZD/$LMDZname/modipsl/modeles 361 # Every model installation will have an unique orchidee_rev, 362 # to be changed by hand if a new Orchidee rev is installed by hand in modipsl/models 363 . $LMDZD/$LMDZname/modipsl/modeles/surface_env 364 echo LMDZname $LMDZD/$LMDZname/modipsl/modeles/surface_env 365 echo veget=$veget 366 echo opt_veget=$opt_veget 367 echo orchidee_rev=$orchidee_rev 368 echo suforch=$suforch 369 370 371 ####################################################################### 372 # Compilation du modele 373 ####################################################################### 374 # The gcm name defined below is used to check if the executable exists 375 # It is also used when compiling without fcm : the output of makelmdz is gcm.e, and is renamed as $gcm 376 # 377 # NOTE : Some compilation options do not appear in the gcm name (xios, cosp, ...). 378 # (Also : LMDZ rev before 4185 included, did not contain radiative-code suffix; starting r4186, it includes oldrad/rrtm/ecrad ) 379 # So if you change those options and you want to recompile, 380 # setup.sh will not detect the change when testing if [ ! -f $gcm ], 381 # You'll need to modify and run the compile.sh script created in the present folder, and run it (./compile.sh gcm) 382 383 # compile_opt_iso is used for gcm only ; ce0l cannot be compiled with isotopes yet (phylmd instead of phylmdiso is required) 384 if [ $isotopes = y ] ; then 385 compile_opt_iso="$optim -p $phylmd $opt_cosp $opt_xios $opt_rad $arch -d $resol $opt_veget $opt_aer $opt_inlandsis $opt_isotopes -mem -parallel mpi_omp" 386 if [ $mysvn -le 4185 ] ; then 387 suffix_iso=_${resol}_phy${phylmd}_para_mem${suforch}${sufaer}${sufiso} 388 else 389 suffix_iso=_${resol}_phy${phylmd}_${rad}_para_mem${suforch}${sufaer}${sufiso} 688 cd $SIMRUNDIR 689 ...eod 690 if [[ $ok_guide != "y" ]]; then # Running first simulation automatically except for nudging 691 cat << ...eod >> tmp 692 echo "Submitting job tmp_$SIM" 693 echo "\$SUBMITCMD tmp_$SIM" 694 \$SUBMITCMD tmp_$SIM 695 ...eod 390 696 fi 391 phylmd="lmd" 392 fi 393 394 # compile_opt is used for gcm if isotopes=n, and for ce0l always 395 compile_opt="$optim -p $phylmd $opt_cosp $opt_xios $opt_rad $arch -d $resol $opt_veget $opt_aer $opt_inlandsis -mem -parallel mpi_omp" 396 397 if [ $mysvn -le 4185 ] ; then suffix=_${resol}_phy${phylmd}_para_mem${suforch}${sufaer} ; 398 else suffix=_${resol}_phy${phylmd}_${rad}_para_mem${suforch}${sufaer} ; fi 399 400 # use an intermediate variable to use either suffix or suffix_iso 401 strsuffix=suffix${sufiso} 402 gcm=$MODEL/bin/gcm${!strsuffix}.e 403 404 echo $mysvn 405 echo $gcm 406 407 if [ ! -f $gcm ] ; then 408 echo Le model $gcm n existe pas 409 echo il va se compiler automatiquement sur $MODEL 410 sleep 10 411 412 if [ "$fcm" = "-nofcm" ] ; then 413 compile="./makelmdz $compile_opt \$1 ; mkdir -p bin ; \mv -f \${prog}.e $gcm" 414 compile_iso="./makelmdz $compile_opt_iso \$1 ; mkdir -p bin ; \mv -f \${prog}.e $gcm" 415 else 416 # makelmdz_fcm directly produces executable named $gcm, depending on the compilation options 417 compile="./makelmdz_fcm $compile_opt -j 2 \$1" 418 compile_iso="./makelmdz_fcm $compile_opt_iso -j 2 \$1" 419 fi 420 421 #NB on est dans $local, qui est $STORE/$MAINDIR 422 echo $compile${sufiso} 423 424 #create compile.sh ; 425 # if isotopes = y , it will still be used for compiling ce0l 426 cat <<...eod>| compile.sh 427 cd $MODEL 428 prog=\$1 429 ${compile} 697 cat << ...eod >> tmp 698 # ANCIEN MULTI STEP esac 430 699 ...eod 431 pwd 432 ls -l compile.sh 433 chmod +x compile.sh 434 435 #create compile_iso.sh for compiling gcm_ _iso.e 436 if [ $isotopes = y ] ; then 437 cat <<...eod>| compile_iso.sh 438 cd $MODEL 439 prog=\$1 440 ${compile_iso} 441 ...eod 442 pwd 443 ls -l compile_iso.sh 444 chmod +x compile_iso.sh 445 fi 446 447 echo Compilation de LMDZ, suivre avancement dans lmdz.log 448 ./compile${sufiso}.sh gcm > lmdz.log 2>&1 449 450 if [ ! -f $gcm ] ; then echo la compilation a echoue ; exit ; fi 451 cd $local 452 fi 453 454 455 ###################################################################### 456 # Choix du nombre de processeurs 457 # NOTES : 458 # omp=8 by default (for Jean-Zay must be a divisor of 40 procs/node), but we need 459 # omp=1 for SPLA (only MPI parallelisation) 460 # omp=2 for veget=CMIP6 beacause of a bug in ORCHIDEE/src_xml/xios_orchidee.f90 461 ###################################################################### 462 jm=`echo $resol | cut -dx -f2` 463 (( mpi = ( $jm + 1 ) / 2 )) 464 omp=8 465 if [ $aerosols = spla ] ; then omp=1 ; fi 466 if [ $veget = CMIP6 -a $xios = y ] ; then omp=2 ; fi 467 if [ $mpi -gt $nb_mpi_max ] ; then mpi=$nb_mpi_max ; fi 468 if [ $omp -gt $nb_omp_max ] ; then omp=$nb_omp_max ; fi 469 470 ###################################################################### 471 # Utilisation des .def_iso pour LMDZ-ISOtopes 472 ###################################################################### 473 if [ $isotopes = y ] ; then 474 for file_iso in $( ls DEF | grep _iso) 475 do 476 cp DEF/$file_iso DEF/${file_iso%%_iso} 477 done 478 fi 479 480 ###################################################################### 481 # Choix de la grille verticale 482 ###################################################################### 483 if [ ! -d DEF ] ; then echo Recuperer un repertoire DEF ; exit ; fi 484 lm=`echo $resol | cut -dx -f3` 485 if [ ! -f DEF/L$lm.def ] ; then echo resolution verticale non prevue 486 echo creer un fichier DEF/L$lm.def 487 exit 488 else 489 sed -i -e 's/INCLUDEDEF=L.*.def/INCLUDEDEF=L'$lm'.def/' DEF/run.def 490 fi 491 492 ###################################################################### 493 # Changements dans les fichiers DEF/*def 494 # (ils vont se repercuter dans les repertoires de simulation $local/$SIM et de run $WRK) 495 ###################################################################### 496 497 # Choix du fichier traceur.def coherent avec l'option "aerosols" 498 # NOTE : Le nouveau tracer.def_nospla par defaut n'inclut pas Rn-Pb ; 499 # si on les veut, il faut utiliser ci-dessous; a la place, tracer_RN_PB.def 500 #--------------------------------------------------------------------- 501 # NB : Les traceurs absents de start* files sont initialises=0 dans le code 502 if [ $aerosols = spla ] ; then 503 # nouveau tracer.def (remplace "traceur.def") 504 cp DEF/tracer.def_spla DEF/tracer.def 505 elif [ $isotopes = n ] ; then 506 # déjà copié si 'y' 507 cp DEF/tracer.def_nospla DEF/tracer.def 508 fi 509 510 # TEMPORAIREMENT pour spla on force l'utilisation de gcm.def_zNAfrica_BiJe (avec resolution 128x88x79) 511 #---------------------------------------------------------------------- 512 if [ $aerosols = spla ] ; then cp DEF/gcm.def_zNAfrica_BiJe DEF/gcm.def ; fi 513 514 # Inscription du choix ok_guide dans DEF/guide.def 515 #--------------------------------------------------------------------- 516 sed -i -e 's/ok_guide=.*.$/ok_guide='$ok_guide'/' DEF/guide.def 517 518 # Inscription du type de calendrier (qui est fonction de $climato) dans DEF/run.def 519 #--------------------------------------------------------------------- 520 # NB Contrairement a ce qui est ecrit dans les fichiers run.def standard, 521 # dans ce tutorial le choix earth_365d n'est pas disponible, et earth_366d s'appelle gregorian 522 if [ $climato = 0 ] ; then calend=gregorian ; else calend=earth_360d ; fi 523 sed -i -e 's/calend=.*.$/calend='$calend'/' DEF/run.def 524 525 # Changements dans config.def (pre-choisi, et regle pour output si utilisation avec IOIPSL) 526 # cf options veget, aerosols, cosp, xios 527 #--------------------------------------------------------------------- 528 if [ $veget = NONE ] ; then VEGET=n ; else VEGET=y ; fi 529 sed -i -e 's/VEGET=.*.$/VEGET='$VEGET'/' DEF/config.def 530 531 if [ $aerosols = n ] ; then 532 # set flag_aerosols=0 and flags ok_ade&co=n 533 sed -i'' -e 's/^ok_cdnc=.*.$/ok_cdnc=n/' -e 's/^ok_ade=.*.$/ok_ade=n/' -e 's/^ok_aie=.*.$/ok_aie=n/' -e 's/^ok_alw=.*.$/ok_alw=n/' -e 's/^flag_aerosol=.*.$/flag_aerosol=0/' DEF/config.def 534 fi 535 536 # COSP : ok_cosp desactive COSP si on a compile avec; il ne l'active pas si on a compile sans 537 sed -i -e 's/ok_cosp.*.$/ok_cosp='$cosp'/' DEF/config.def 538 if [ $cosp = y ] ; then \cp -f $MODEL/DefLists/cosp*.txt $local/DEF/ ; fi 539 540 # Sorties LMDZ en fonction de l'option "xios" 541 sed -i'' -e 's/ok_all_xml=.*.$/ok_all_xml='$xios'/' DEF/config.def 542 543 # Ajuster physiq.def en fonction de radiative code (default: values for rad=rrtm) 544 # Pour isotopes=y , mettre iflag_ice_thermo=0 au lieu de 1 545 #--------------------------------------------------------------------- 546 sed -i'' -e 's/iflag_rrtm=.*.$/iflag_rrtm='$iflag_rrtm'/' -e 's/NSW=.*.$/NSW='$NSW'/' DEF/physiq.def 547 pwd 548 sed -i'' -e 's:directory_name.*$:directory_name="'$local'/ecrad_data",:' DEF/namelist_ecrad 549 550 if [ $isotopes = y ] ; then iflag_ice_thermo=0 ; else iflag_ice_thermo=1 ; fi 551 sed -i -e 's/iflag_ice_thermo=.*.$/iflag_ice_thermo='$iflag_ice_thermo'/' DEF/physiq.def 552 553 # Choix de orchidee.def en fonction de orchidee_rev ; modification pour xios 554 # NOTE separate orchidee_pft.def file for ORCHIDEE trunk post-CMIP6 555 #--------------------------------------------------------------------- 556 orchidee_def=orchidee.def_6.1 557 orchidee_pft_def="" 558 if [ $veget = "7983" ] ; then 559 orchidee_def=orchidee.def_6.2work 560 elif [ $veget = "7994" ] ; then 561 orchidee_def=orchidee.def_6.4work 562 orchidee_pft_def=orchidee_pft.def_6.4work 563 if [ ! grep "INCLUDEDEF=orchidee_pft.def" DEF/run.def ] ; then 564 sed -i'' -e 's/INCLUDEDEF=orchidee.def/INCLUDEDEF=orchidee.def\nINCLUDEDEF=orchidee_pft.def/' DEF/run.def ; fi 565 fi 566 \cp -f DEF/$orchidee_def DEF/orchidee.def 567 if [ "$orchidee_pft_def" != "" ] ; then \cp -f DEF/$orchidee_pft_def DEF/orchidee_pft.def ; fi 568 569 # Only for veget=CMIP6 it is still possible to use IOIPSL ; newer versions of orchidee.def have XIOS_ORCHIDEE_OK = y 570 sed -i'' -e 's/XIOS_ORCHIDEE_OK =.*.$/XIOS_ORCHIDEE_OK = '$xios'/' DEF/orchidee.def 571 572 573 ###################################################################### 574 # Si on tourne avec XIOS, mise a jour des fichiers context et field* dans XMLfilesLMDZ 575 # (ils vont se repercuter dans les repertoires de simulation $local/$SIM et de run $WRK) 576 ###################################################################### 577 if [ $xios = y ] ; then 578 \cp -f $MODEL/DefLists/context_lmdz.xml $local/DEF/XMLfilesLMDZ/. 579 \cp -f $MODEL/DefLists/field_def_lmdz.xml $local/DEF/XMLfilesLMDZ/. 580 if [ $cosp = y ] ; then \cp -f $MODEL/DefLists/field_def_cosp1.xml $local/DEF/XMLfilesLMDZ/. ; fi 581 fi 582 583 584 ###################################################################### 585 # Verification de l'existance de l'etat initial et compilation eventuelle 586 # pour sa creation 587 ###################################################################### 588 if [ ! -d $INIT ] ; then 589 if [ $init = 0 ] ; then 590 echo Recuperer les repertoires $INIT ou lancer avec option -init ; exit 591 else 592 ce0l=$MODEL/bin/ce0l${suffix}.e 593 echo $ce0l 594 595 # Test if $ce0l exists (it may be the case if you use a model configuration already installed and compiled) 596 if [ ! -f $ce0l ] ; then 597 echo L executable $ce0l n existe pas 598 echo il va se compiler automatiquement sur $MODEL 599 sleep 10 600 601 $local/compile.sh ce0l 602 fi 603 604 if [ ! -f $ce0l ] ; then echo la compilation de $ce0l a echoue ; exit ; fi 605 606 cd $local 607 fi 608 elif [ $init = 1 ] ; then 609 echo Vous essayez d initialiser le modele mais $INIT existe deja 610 exit 611 fi 612 613 MAINDIR=`basename \`pwd\`` 614 615 ###################################################################### 616 # On cree sur le SCRATCHD un repertoire de travail avec le meme 617 # nom que le repertoire local 618 ###################################################################### 619 . ./lmdz_env.sh 620 WRK=$SCRATCHD/$MAINDIR 621 mkdir -p $WRK 622 cd $WRK 623 echo La simulation s executera sur $SCRATCHD/$MAINDIR 624 625 ##################################################################### 626 # Creation du repertoire $SIM s'il n'existe pas deja 627 ##################################################################### 628 629 if [ ! -d $local/$SIM ] ; then 630 mkdir $local/$SIM 631 cd $local 632 sed -e 's:^rebuild=.*.$:rebuild='$LMDZD/$LMDZname/modipsl/bin/rebuild':' -e 's/groupe@cpu/'$groupe'@cpu/' reb.sh >| $local/$SIM/reb.sh ; chmod +x $local/$SIM/reb.sh 633 cp lmdz_env.sh $local/$SIM/ 634 mkdir $local/$SIM/DEF ; cp DEF/*def DEF/namelis* $local/$SIM/DEF/ 635 #Pour XIOS, respectivement COSP, copier aussi les fichiers *xml / *txt 636 if [ $cosp = y ] ; then cp DEF/cosp*txt $local/$SIM/DEF/ ; fi 637 if [ $xios = y ] ; then 638 cp DEF/XMLfilesLMDZ/*xml $local/$SIM/DEF/ 639 if [ $veget != 'NONE' ] ; then cp DEF/XMLfilesOR$veget/*xml $local/$SIM/DEF/ ; fi 640 fi 641 chmod u+w $local/$SIM/DEF/* 642 643 # Gestion du calendrier 644 ####################### 645 sed -e 's/anneeref=.*.$/anneeref='$yearini'/' \ 646 DEF/run.def >| $local/$SIM/DEF/run.def 647 cd $SIM 648 if [ "$freq" = "yr" ] ; then date=$yearini ; else date=$mthini ; fi 649 echo $date a faire >| etat 650 651 # Recuperation des fichiers : executable initiaux et forcages 652 ############################################################# 653 echo $date 654 for f in start startphy ; do inf=../$INIT/$f.$date.nc ; if [ -f $inf -o $init = 1 ] ; then ln -s $inf ./ ; else echo $inf inexistant ; exit ; fi ; done 655 for f in sechiba stomate ; do if [ -f ../$INIT/start_$f.$date.nc ] ; then ln -sf ../$INIT/start_$f.$date.nc . ; fi ; done 656 cp $gcm gcm.e 657 fi # fin de " if [ ! -d $local/$SIM ]" 658 cd $local/.. 659 660 # Choix du "time limit" pour le job 661 ################################### 662 if [ "$freq" = "yr" ] ; then cput=04:00:00 ; else cput=01:00:00 ; fi 663 664 ##################################################################### 665 echo Modification du script de lancement 666 ###################################################################/$S 667 sed -e 's/stopsim=.*.$/stopsim='$stopsim'/' -e 's/^veget=.*.$/veget='$veget'/' -e 's/orchidee_rev=.*.$/orchidee_rev='$orchidee_rev'/' -e 's/^aerosols=.*.$/aerosols='$aerosols'/' -e 's/^isotopes=.*.$/isotopes='$isotopes'/' -e 's/NOM_SIMU/'$SIM'/' -e 's/time=.*.$/time='$cput'/' -e 's/MAINDIR=.*.$/MAINDIR='$MAINDIR'/' -e 's:STORED=.*.*:STORED='$STORED':' -e 's:SCRATCHD=.*.*:SCRATCHD='$SCRATCHD':' -e 's/ntasks=.*.$/ntasks='$mpi'/' -e 's/cpus-per-task=.*.$/cpus-per-task='$omp'/' -e 's/nthreads=.*./nthreads='$omp'/' -e 's/^climato=.*.$/climato='$climato'/' -e 's/^ok_guide=.*.$/ok_guide='$ok_guide'/' -e 's/groupe@cpu/'$groupe'@cpu/' $local/script_SIMU >| $WRK/tmp_$SIM 668 669 if [ "$testmode" = "y" ] ; then 670 sed -i -e 's/time=.*.$/time=00:30:00/' -e 's/#nday=1/nday=1/' -e 's/#[[:space:]]#SBATCH[[:space:]]--qos=qos_cpu-dev/#SBATCH --qos=qos_cpu-dev/' $WRK/tmp_$SIM 671 fi 672 673 if [ $climato = 0 ] ; then 674 # calend est choisi plus haut dans "Changements dans les fichiers DEF/*def" et ecrit dans $MAINDIR/DEF/run.def 675 yrini=`echo $mthini | cut -c-4` 676 yrend=`echo $mthend | cut -c-4` 677 yrs="" ; yr=$yrini ; while [ $yr -le $yrend ] ; do yrs="$yrs $yr" ; (( yr = $yr + 1 )) ; done 678 suf=360x180_ 679 else 680 yrs=2000 681 suf=1x1_clim 682 fi 683 684 685 ##################################################################### 686 echo Recuperation eventuelle de certains fichiers sur LMDZ_Init 687 ##################################################################### 688 689 if [ ! -d $LMDZ_Init ] ; then mkdir $LMDZ_Init ; fi 690 691 #------------------------------------------------------------------- 692 # Fichiers ORCHIDEE 693 #------------------------------------------------------------------- 694 get="myget 3DInputData/Orchidee/" 695 liste_get="PFTmap_IPCC_2000.nc cartepente2d_15min.nc " 696 liste_get+="routing.nc routing_simple.nc lai2D.nc soils_param.nc " 697 liste_get+="woodharvest_2000.nc PFTmap_15PFT.v1_2000.nc" 698 for file in $liste_get ; do 699 if [ ! -f $LMDZ_Init/$file ] ; then cd $LMDZ_Init ; ${get}$file ; cd - ; fi 700 done 701 # Additionnal files needed for ORCHIDEE trunk post-CMIP6 702 if [ $veget = 7994 -a ! -f $LMDZ_Init/soil_bulk_and_ph.nc ] ; then 703 cd $LMDZ_Init 704 ${get}soil_bulk_and_ph.nc ; ${get}NITROGEN_for_ORtrunk.tar 705 tar -xvf NITROGEN_for_ORtrunk.tar ; cd - 706 fi 707 #------------------------------------------------------------------- 708 # Fichiers aerosols/chimie 709 #------------------------------------------------------------------- 710 if [ $aerosols = clim ] ; then 711 get="myget 3DInputData/AerChem/" 712 #liste_get="aerosols1850_from_inca.nc aerosols2000_from_inca.nc" 713 #aerosols9999_from_inca.nc est un lien vers aerosols1995_2014_ensavg_from_inca.nc 714 liste_get="aerosols1850_from_inca.nc aerosols9999_from_inca.nc" 715 for file in $liste_get ; do 716 if [ ! -f $LMDZ_Init/$file ] ; then cd $LMDZ_Init ; ${get}$file ; cd - ; fi 717 done 718 fi 719 720 # For SPLA 721 #------------------- 722 # Dans ${LMDZ_Init} on cree folder SPLA_Init et dedans le INITIAL 723 # Pour l'instant on copie là-dedans de chez Binta les fichiers a la res zoomNaf; 724 # plus tard on y recupererea des fichiers a haute resolution reguliere depuis http:/LMDZ, 725 # a regrider ensuite par un script interp_fichiers_spla.sh (comme pour aerosols="clim") 726 # Les fichiers (regrides, sauf SOILSPEC.data utilise tel quel) seront mis dans $MAINDIR/INPUT_SPLA (equivalent de INPUT_DUST) 727 if [ $aerosols = spla ] ; then 728 if [ ! -d ${LMDZ_Init}/SPLA_Init ] ; then mkdir ${LMDZ_Init}/SPLA_Init ; mkdir $LMDZ_Init/SPLA_Init/INITIAL ; fi 729 get="cp -p /gpfsstore/rech/gzi/rgzi027/ergon/BIBIAERO/INPUTS_DUST/INITIAL/" 730 liste_get="wth.dat cly.dat donnees_lisa.nc SOILSPEC.data \ 731 carbon_emissions.nc sulphur_emissions_antro.nc \ 732 sulphur_emissions_nat.nc sulphur_emissions_volc.nc" 733 734 for file in $liste_get ; do 735 if [ ! -f $LMDZ_Init/SPLA_Init/INITIAL/$file ] ; then cd $LMDZ_Init/SPLA_Init/INITIAL ; ${get}$file . ; cd - ; fi 736 done 737 ### 738 #Cas particulier des fichiers mensuels dust.nc :A DECIDER : 739 #C'est entre le cas des aerosols.clim= 1 seul fichier, annuel, 740 # et le cas des vents guidage, pré-interpolés avec era2gcm pour toute la periode, dans MAINDIR/GUIDE. 741 # On pourrait (a)demander de precalculer dust.nc aussi, dans MAINDIR/INPUT_SPLA - avec un script à adapter de Jeronimo. Rien a mettre dans SPLA_Init alors. 742 # Ou (b) fournir dans SPLA_Init les 12 mois d'un dust.nc climato (an 2006 pour nous ici) à la res EC, et faire juste le regrid vers MAINDIR/INPUT_SPLA 743 #ICI pour l'instant je copie les fichiers de chez Binta (repositoire==http...) dans LMDZ_Init/SPLA_Init, avec test sur mois 01 744 745 if [ ! -d ${LMDZ_Init}/SPLA_Init/PERIOD0001 ] ; then cp -pr /gpfsstore/rech/gzi/rgzi027/ergon/BIBIAERO/INPUTS_DUST/PERIOD* $LMDZ_Init/SPLA_Init/. ; fi 746 747 #A la fin on doit avoir dans SPLA_Init les fichiers initiaux dans INITIAL plus les repertoires PERIOD00MM contenant dust.nc 748 #Cela doit se retrouver dans script_SIMU qui les copie dans le repertoire de run sur $SCRATCH 749 750 fi #$aerosols = spla 751 752 753 #------------------------------------------------------------------- 754 # Fichiers Init 755 #------------------------------------------------------------------- 756 get="myget 3DInputData/Init/" 757 liste_get="alb_bg_modisopt_2D_ESA_v2.nc reftemp.nc" 758 for file in $liste_get ; do 759 if [ ! -f $LMDZ_Init/$file ] ; then cd $LMDZ_Init ; ${get}$file ; cd - ; fi 760 done 761 762 cd $local 763 764 765 766 if [ $init = 1 ] ; then 767 ##################################################################### 768 echo Creation de l etat initial 769 ##################################################################### 770 771 # Creation du repertoire INIT et mise en place de liens logiques vers les starts 772 # en anticipation de leur création : 773 mkdir $local/$INIT ; cd $local/$INIT 774 for an in $mthini $yearini ; do for f in start startphy ; do ln -s $f.nc $f.$an.nc ; done ; done 775 776 # Creation du repertoire INIT temporaire et rapatriement des fichiers necessaires 777 if [ -d $WRK/$INIT ] ; then mv $WRK/$INIT $WRK/$INIT$$ ; fi 778 mkdir $WRK/$INIT ; cp -r $local/DEF $WRK/$INIT/ 779 cd $WRK/$INIT ; cp DEF/*.def . ; cp $local/lmdz_env.sh . 780 if [ $xios = y ] ; then 781 cp DEF/XMLfilesLMDZ/*xml . 782 if [ $veget != 'NONE' ] ; then cp DEF/XMLfilesOR$veget/*xml . ; fi 783 fi 784 sed -e 's/anneeref=.*.$/anneeref='$yearini'/' DEF/run.def >| run.def 785 786 #------------------------------------------------------------------- 787 # Fichiers Limit 788 #------------------------------------------------------------------- 789 get="myget 3DInputData/Limit/" 790 liste_get="Albedo.nc Relief.nc Rugos.nc landiceref.nc" 791 for yr in $yrs ; do 792 if [ $climato = 0 ] ; then sufyr=$suf$yr ; else sufyr=$suf ; fi 793 liste_get="$liste_get amipbc_sic_$sufyr.nc amipbc_sst_$sufyr.nc" 794 done 795 echo LISTEGET $liste_get 796 for file in $liste_get ; do 797 if [ ! -f $LMDZ_Init/$file ] ; then cd $LMDZ_Init ; ${get}$file ; cd - ; fi 798 ln -s $LMDZ_Init/$file 799 done 800 #------------------------------------------------------------------- 801 # ECDYN 802 #------------------------------------------------------------------- 803 get="myget 3DInputData/Init/" 804 if [ ! -f $LMDZ_Init/ECDYN.nc ] ; then cd $LMDZ_Init ; ${get}ECDYN.nc ; cd - ; fi 805 ln -s $LMDZ_Init/ECDYN.nc 806 ln -sf ECDYN.nc ECPHY.nc 807 808 809 # Creation du script d'initialisation 810 cat <<...eod>| tmp 811 #!/bin/bash 812 813 #SBATCH --job-name=Init # nom du job 814 #SBATCH -A "$groupe"@cpu 815 #SBATCH --ntasks=1 # Nombre de processus MPI 816 #SBATCH --cpus-per-task=1 # nombre de threads OpenMP 817 # /!\ Attention, la ligne suivante est trompeuse mais dans le vocabulaire 818 # de Slurm "multithread" fait bien référence à l'hyperthreading. 819 #SBATCH --hint=nomultithread # 1 thread par coeur physique (pas d'hyperthreading) 820 #SBATCH --time=00:10:00 # Temps d’exécution maximum demandé (HH:MM:SS) 821 #SBATCH --output=Init%j.out # Nom du fichier de sortie 822 #SBATCH --error=Init%j.out # Nom du fichier d'erreur (ici commun avec la sortie) 823 # To submit to dev queue ; "time" (above) must be max 2h 824 # #SBATCH --qos=qos_cpu-dev 825 826 # ANCIEN MULTI STEP case \${LOADL_STEP_NAME} in 827 828 # ANCIEN MULTI STEP init ) 829 830 if [ ! -f lmdz_env.sh ] ; then echo manque fichier lmdz_env.sh ; ls ; exit ; fi 831 . lmdz_env.sh 832 ulimit -s unlimited 833 export OMP_STACKSIZE=800M 834 export OMP_NUM_THREADS=1 835 cd $WRK/$INIT 836 echo Executable : $ce0l 837 for yr in $yrs ; do 838 if [ $climato = 0 ] ; then sufyr=$suf\$yr ; else sufyr=$suf ; fi 839 ln -sf amipbc_sic_\$sufyr.nc amipbc_sic_1x1.nc 840 ln -sf amipbc_sst_\$sufyr.nc amipbc_sst_1x1.nc 841 sed -e 's/anneeref=.*.$/anneeref='\$yr'/' DEF/run.def >| run.def 842 echo Starting initialisation 843 $run $ce0l 844 if [ $climato = 0 ] ; then mv limit.nc limit.\$yr.nc ; fi 845 done 846 # ANCIEN MULTI STEP ;; 847 848 # ANCIEN MULTI STEP interp ) 849 if [ $aerosols = clim ] ; then 850 cp $local/interp_aerosols.sh . ; chmod +x interp_aerosols.sh 851 # Les aerosols de l'annee 2000 ont ete remplaces par "9999" qui pointe vers un fichier moyen sur 1995-2014 852 #for year in 2000 1850 ; do ./interp_aerosols.sh \$year ; done 853 #mv aerosols.2000.nc aerosols.clim.nc ; mv aerosols.1850.nc aerosols.nat.nc 854 for year in 9999 1850 ; do ./interp_aerosols.sh \$year ; done 855 mv aerosols.9999.nc aerosols.clim.nc ; mv aerosols.1850.nc aerosols.nat.nc 856 fi 857 858 # AS : S'il etait possible d'automatiser l'interpolation de l'input SPLA, ce serait a lancer ici 859 #en attendant, on passe au paragraphe suivant où on copie les fichiers à la res ZoomNaf depuis $LMDZ_Init/SPLA_Init 860 #if [ $aerosols = spla ] ; then 861 #cp $local/futur script interp_aerosols_SPLA.sh . ; chmod +x interp_aerosols_SPLA.sh 862 #for file in... ; do ./interp_aerosols_SPLA.sh \$year ; done 863 #etc etc etc ... 864 #fi 865 866 # Copy initial and forcing files in $local/$INIT and $local/$LIMIT; also in $local/INPUT_SPLA if $aerosols=spla 867 for f in sta* limit.nc gri*nc ; do cp \$f $local/$INIT/\$f ; done 868 mkdir -p $local/$LIMIT 869 for f in limit*.nc ; do cp \$f $local/$LIMIT/\$f ; done 870 if [ $aerosols = clim ] ; then for f in aerosols[.0-9]*nc ; do cp \$f $local/$LIMIT/\$f ; done ; fi 871 # 872 if [ $aerosols = spla ] ; then 873 #mkdir -p $local/INPUT_SPLA ; pour l'instant on copie $LMDZ_Init/SPLA_Init en block 874 if [ ! -d $local/INPUT_SPLA ] ; then cp -pr $LMDZ_Init/SPLA_Init $local/INPUT_SPLA ; fi 875 fi 876 cd $WRK 877 ...eod 878 if [ $ok_guide != y ] ; then # Running first simulation automatically except for nudging 879 cat <<...eod>> tmp 880 # unset "tmp" job options before submitting tmp_$SIM ; 881 # otherwise, "--cpus-per-task" is "inherited" by tmp_$SIM regardless of the value in his own header 882 bash -c 'unset \$(env | egrep "SLURM_|SBATCH_|SRUN_"| cut -d= -f1) ; $submit tmp_$SIM' 883 ...eod 884 fi 885 cat <<...eod>> tmp 886 # ANCIEN MULTI STEP esac 887 ...eod 888 889 echo '###############################################################################' 890 echo Submitting initialisation job 891 pwd 892 $submit tmp 893 echo '###############################################################################' 894 895 else 896 #case [ $init != 1 ] 897 898 cd $WRK 899 echo '###############################################################################' 900 echo Submitting job tmp_$SIM 901 echo $submit tmp_$SIM 902 $submit tmp_$SIM 903 echo '###############################################################################' 904 fi 905 906 907 if [ $ok_guide = y -a $init = 1 ] ; then 908 echo Once initialisation is finished, you have to create nudging files 909 echo Edit era2gcm.sh and set the desired parameters in section "User choices" 910 echo Make sure you have acces to the chosen ERA files, and the required modules are load 911 echo Then run : ./era2gcm.sh 912 if [ "$aerosols" = "spla" ] ; then 913 echo Your aerosol choice is "spla", so you need ERA 10m-winds interpolated on LMDZ grid 914 echo Use script era2gcm_uv10m.sh 915 fi 916 else 917 echo Si tout se passe bien, vous avez initialise et lance automatiquement 918 echo la simulation. 919 echo Si vous voulez modifier les caracteristiques du job, comme le temps 920 echo max ou le nombre de proc, il se trouve sur 921 echo $SCRATCHD/$MAINDIR/tmp_$SIM 922 fi 923 924 ############################################################################### 925 # At the end, print on screen the compilation command, and also in a "compile.sh" script 926 927 echo "To recompile the model :" 928 echo "run the compile${sufiso}.sh script created in the present folder: ./compile${sufiso}.sh gcm " 700 enable_platform tmp 701 echo "###############################################################################" 702 echo "Submitting initialisation job <$SUBMITCMD tmp> from $(pwd)" 703 chmod +x tmp 704 $SUBMITCMD tmp 705 echo "###############################################################################" 706 707 else #case [ $init != 1 ] 708 cd "$SIMRUNDIR" 709 echo "###############################################################################" 710 echo "Submitting job tmp_$SIM" 711 echo "$SUBMITCMD tmp_$SIM" 712 $SUBMITCMD "tmp_$SIM" 713 echo '###############################################################################' 714 fi 715 } 716 717 function message_post_submit() { 718 if [[ $ok_guide = "y" && $init = 1 ]]; then 719 cd "$local" 720 enable_platform era2gcm_tuto.sh 721 echo "Once initialisation is finished, you have to create nudging files" 722 echo "Edit era2gcm_tuto.sh and set the desired parameters in section <User choices>" 723 echo "Make sure you have acces to the chosen ERA files, and the required modules are loaded, then run : ./era2gcm_tuto.sh" 724 if [[ $aerosols = "spla" ]]; then 725 echo "Your aerosol choice is <spla>, so you need ERA 10m-winds interpolated on LMDZ grid. Use script era2gcm_uv10m.sh" 726 fi 727 else 728 echo "Si tout se passe bien, vous avez initialisé et lancé automatiquement la simulation." 729 echo "Le job qui a été lancé se trouve sur $SIMRUNTOPDIR/tmp_$SIM" 730 fi 731 } 732 733 function setup_and_load_lmdz_env() { 734 if [[ ! -f .lmdz_setup_root_dir ]]; then echo "STOP: setup.sh is not located in the root dir ??!!"; exit 1; fi 735 # sed root_dir in lmdz_env.sh 736 sed -i'' "s<root_dir=.*<root_dir=$local<" lmdz_env.sh 737 738 # Set up the appropriate environment 739 source lmdz_env.sh 740 } 741 742 local=$(pwd) 743 744 setup_and_load_lmdz_env 745 load_install_lib 746 define_expert_options 747 set_default_params 748 read_cmdline_args "$@" 749 ensure_correct_option_combinations 750 install_model 751 setup_def 752 setup_ce0l 753 setup_simu 754 fetch_simu_init_files 755 run_sim_or_init 756 message_post_submit
Note: See TracChangeset
for help on using the changeset viewer.