Changeset 5464


Ignore:
Timestamp:
Jan 2, 2025, 10:16:57 AM (3 days ago)
Author:
fhourdin
Message:

$local -> $local_d + SPLA specific

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/LMDZ_Setup/setup.sh

    r5462 r5464  
    9090#---------------------------------------------------------------------------
    9191
    92   SIM=$(basename "$local")CTL  # name
     92  SIM=$(basename "$local_d")CTL  # name
    9393  phylmd="lmd" #option -p $phylmd for makelmdz
    9494
     
    267267  echo "Installing model"
    268268  cd "$LMDZD"
    269   cp "$local/install_lmdz.sh" .
     269  cp "$local_d/install_lmdz.sh" .
    270270  chmod +x install_lmdz.sh
    271271  local make_j=8
     
    284284  set +o pipefail
    285285  mv install_lmdz.sh install_lmdz.$$.sh
    286   cd "$local"
     286  cd "$local_d"
    287287}
    288288
     
    290290function setup_def() {  # modify various .def in ./DEF (+ xios xml )
    291291#---------------------------------------------------------------------------
    292   cd "$local"
     292  cd "$local_d"
    293293
    294294  # Utilisation des .def_iso pour LMDZ-ISOtopes
     
    310310  ######################################################################
    311311  # Changements dans les fichiers DEF/*def
    312   # (ils vont se repercuter dans les repertoires de simulation $local/$SIM et de run $SIMRUNDIR)
     312  # (ils vont se repercuter dans les repertoires de simulation $local_d/$SIM et de run $SIMRUNDIR)
    313313  ######################################################################
    314314
     
    364364  # COSP : ok_cosp desactive COSP si on a compile avec; il ne l'active pas si on a compile sans
    365365  sed -i'' -e 's/ok_cosp.*.$/ok_cosp='$cosp'/' DEF/config.def
    366   if [[ $cosp = "y" ]]; then \cp -f "$MODEL"/DefLists/cosp*.txt "$local"/DEF/; fi
     366  if [[ $cosp = "y" ]]; then \cp -f "$MODEL"/DefLists/cosp*.txt "$local_d"/DEF/; fi
    367367
    368368  # Sorties LMDZ en fonction de l'option "xios"
     
    399399  ######################################################################
    400400  # Si on tourne avec XIOS, mise a jour des fichiers context et field* dans XMLfilesLMDZ
    401   # (ils vont se repercuter dans les repertoires de simulation $local/$SIM et de run $SIMRUNDIR)
     401  # (ils vont se repercuter dans les repertoires de simulation $local_d/$SIM et de run $SIMRUNDIR)
    402402  ######################################################################
    403403  if [[ $xios = y ]]; then
    404     cp -f "$MODEL"/DefLists/context_lmdz.xml "$local"/DEF/XMLfilesLMDZ/.
    405     cp -f "$MODEL"/DefLists/field_def_lmdz.xml "$local"/DEF/XMLfilesLMDZ/.
    406     if [[ $cosp = y ]]; then cp -f "$MODEL"/DefLists/field_def_cosp1.xml "$local"/DEF/XMLfilesLMDZ/.; fi
     404    cp -f "$MODEL"/DefLists/context_lmdz.xml "$local_d"/DEF/XMLfilesLMDZ/.
     405    cp -f "$MODEL"/DefLists/field_def_lmdz.xml "$local_d"/DEF/XMLfilesLMDZ/.
     406    if [[ $cosp = y ]]; then cp -f "$MODEL"/DefLists/field_def_cosp1.xml "$local_d"/DEF/XMLfilesLMDZ/.; fi
    407407  fi
    408408}
     
    423423      ce0l=${gcm/gcm/ce0l}
    424424
    425       cd "$local"
     425      cd "$local_d"
    426426    fi
    427427  elif [[ $init = 1 ]]; then
     
    433433function setup_simu() {
    434434#---------------------------------------------------------------------------
    435   #SIMRUNTOPDIR="$SIMRUNBASEDIR/$(basename "$local")"
     435  #SIMRUNTOPDIR="$SIMRUNBASEDIR/$(basename "$local_d")"
    436436  SIMRUNTOPDIR="$SIMRUNBASEDIR"
    437437  SIMRUNDIR=$SIMRUNTOPDIR
     
    443443  # Creation du repertoire $SIM s'il n'existe pas deja
    444444  #####################################################################
    445   if [[ ! -d $local/$SIM ]]; then
    446     mkdir "$local/$SIM"
    447     cd "$local"
     445  if [[ ! -d $local_d/$SIM ]]; then
     446    mkdir "$local_d/$SIM"
     447    cd "$local_d"
    448448
    449449    # Edit reb.sh
    450     cp reb.sh "$local/$SIM/reb.sh"; chmod +x "$local/$SIM/reb.sh"
    451     sed -i'' -e "s:^rebuild=.*.$:rebuild=$LMDZD/$LMDZname/modipsl/bin/rebuild:" "$local/$SIM/reb.sh"
    452     enable_platform "$local/$SIM/reb.sh"
     450    cp reb.sh "$local_d/$SIM/reb.sh"; chmod +x "$local_d/$SIM/reb.sh"
     451    sed -i'' -e "s:^rebuild=.*.$:rebuild=$LMDZD/$LMDZname/modipsl/bin/rebuild:" "$local_d/$SIM/reb.sh"
     452    enable_platform "$local_d/$SIM/reb.sh"
    453453
    454454    # Copy .def
    455     cp lmdz_env.sh "$local/$SIM/"
    456     mkdir "$local/$SIM/DEF"; cp DEF/*def DEF/namelis* "$local/$SIM/DEF/"
     455    cp lmdz_env.sh "$local_d/$SIM/"
     456    mkdir "$local_d/$SIM/DEF"; cp DEF/*def DEF/namelis* "$local_d/$SIM/DEF/"
    457457    #Pour XIOS, respectivement COSP, copier aussi les fichiers *xml / *txt
    458     if [[ $cosp = "y" ]]; then cp DEF/cosp*txt "$local/$SIM/DEF/"; fi
     458    if [[ $cosp = "y" ]]; then cp DEF/cosp*txt "$local_d/$SIM/DEF/"; fi
    459459    if [[ $xios = "y" ]]; then
    460        cp DEF/XMLfilesLMDZ/*xml "$local/$SIM/DEF/"
    461        if [[ $veget != 'none' ]]; then cp DEF/XMLfilesOR$veget/*xml "$local/$SIM/DEF/"; fi
     460       cp DEF/XMLfilesLMDZ/*xml "$local_d/$SIM/DEF/"
     461       if [[ $veget != 'none' ]]; then cp DEF/XMLfilesOR$veget/*xml "$local_d/$SIM/DEF/"; fi
    462462    fi
    463     chmod u+w "$local/$SIM"/DEF/*
     463    chmod u+w "$local_d/$SIM"/DEF/*
    464464
    465465    # Gestion du calendrier
     
    482482    cp "$gcm" gcm.e
    483483  fi
    484   cd "$local"/..
     484  cd "$local_d"/..
    485485
    486486  #####################################################################
     
    497497  -e "s/cpus-per-task=.*.$/cpus-per-task=$omp/" \
    498498  -e "s/nthreads=.*./nthreads=$omp/" \
    499   -e "s/MAINDIR=.*.$/MAINDIR=$(basename "$local")/" \
    500   -e "s:STORED=.*.*:STORED=$(dirname "$local"):" \
     499  -e "s/MAINDIR=.*.$/MAINDIR=$(basename "$local_d")/" \
     500  -e "s:STORED=.*.*:STORED=$(dirname "$local_d"):" \
    501501  -e "s:SCRATCHD=.*.*:SCRATCHD=$SIMRUNBASEDIR:" \
    502502  -e "s/stopsim=.*.$/stopsim=$stopsim/" \
     
    506506  -e "s/^climato=.*.$/climato=$climato/" \
    507507  -e "s/^ok_guide=.*.$/ok_guide=$ok_guide/" \
    508   "$local/script_SIMU" >| "$SIMRUNDIR/tmp_$SIM"
     508  "$local_d/script_SIMU" >| "$SIMRUNDIR/tmp_$SIM"
    509509
    510510  enable_platform "$SIMRUNDIR/tmp_$SIM"
     
    581581           mo_=$( increment_month $mo_ )
    582582       done
     583       cd $local_d ; ln -sf $LMDZ_INIT/3DInputData/SPLA_WA/ERA5 GUIDE
    583584  fi
    584585}
     
    587588function run_sim_or_init() {
    588589#----------------------------------------------------------------------
    589   cd "$local"
     590  cd "$local_d"
    590591
    591592  if [[ $init = 1 ]]; then
     
    596597    # Creation du repertoire INIT et mise en place de liens logiques vers les starts
    597598    # en anticipation de leur création :
    598     mkdir "$local/$INIT"; cd "$local/$INIT"
     599    mkdir "$local_d/$INIT"; cd "$local_d/$INIT"
    599600    for an in $mthini $yearini; do for f in start startphy; do ln -s "$f.nc" "$f.$an.nc"; done; done
    600601
    601602    # Creation du repertoire INIT temporaire et rapatriement des fichiers necessaires
    602603    if [[ -d $SIMRUNDIR/$INIT ]]; then mv "$SIMRUNDIR/$INIT" "$SIMRUNDIR/$INIT$$"; fi
    603     mkdir "$SIMRUNDIR/$INIT"; cp -r "$local/DEF" "$SIMRUNDIR/$INIT/"
    604     cd "$SIMRUNDIR/$INIT"; cp DEF/*.def .; cp "$local/lmdz_env.sh" .
     604    mkdir "$SIMRUNDIR/$INIT"; cp -r "$local_d/DEF" "$SIMRUNDIR/$INIT/"
     605    cd "$SIMRUNDIR/$INIT"; cp DEF/*.def .; cp "$local_d/lmdz_env.sh" .
    605606    if [[ $xios = "y" ]]; then
    606607      cp DEF/XMLfilesLMDZ/*xml .
     
    700701# ANCIEN MULTI STEP   interp )
    701702if [[ $aerosols = clim ]]; then
    702   cp $local/interp_aerosols.sh .; chmod +x interp_aerosols.sh
     703  cp $local_d/interp_aerosols.sh .; chmod +x interp_aerosols.sh
    703704  # Les aerosols de l'annee 2000 ont été remplacés par "9999" qui pointe vers un fichier moyen sur 1995-2014
    704705  #for year in 2000 1850; do  ./interp_aerosols.sh \$year; done
     
    708709fi
    709710
    710 for f in sta* gri*nc; do cp \$f $local/$INIT/\$f; done
    711 if [[ $climato = 1 ]]; then cp limit.nc $local/$INIT/limit.nc; fi
    712 mkdir -p $local/$LIMIT
    713 for f in limit*.nc ; do cp \$f $local/$LIMIT/\$f; done
    714 if [ $aerosols = clim ]; then  for f in aerosols[.0-9]*nc; do cp \$f $local/$LIMIT/\$f; done; fi
     711for f in sta* gri*nc; do cp \$f $local_d/$INIT/\$f; done
     712if [[ $climato = 1 ]]; then cp limit.nc $local_d/$INIT/limit.nc; fi
     713mkdir -p $local_d/$LIMIT
     714for f in limit*.nc ; do cp \$f $local_d/$LIMIT/\$f; done
     715if [ $aerosols = clim ]; then  for f in aerosols[.0-9]*nc; do cp \$f $local_d/$LIMIT/\$f; done; fi
    715716#
    716717cd $SIMRUNDIR
     
    753754#---------------------------------------------------------------------------
    754755  if [[ $ok_guide = "y" && $init = 1 ]]; then
    755     cd "$local"
     756    cd "$local_d"
    756757    enable_platform era2gcm_tuto.sh
    757758    echo "Once initialisation is finished, you have to create nudging files"
     
    772773  if [[ ! -f .lmdz_setup_root_dir ]]; then echo "STOP: setup.sh is not located in the root dir ??!!"; exit 1; fi
    773774  # sed root_dir in lmdz_env.sh
    774   sed -i'' "s<root_dir=.*<root_dir=$local<" lmdz_env.sh
     775  sed -i'' "s<root_dir=.*<root_dir=$local_d<" lmdz_env.sh
    775776
    776777  # Set up the appropriate environment
     
    778779}
    779780
    780 local=$(pwd)
     781local_d=$(pwd)
    781782
    782783setup_and_load_lmdz_env
Note: See TracChangeset for help on using the changeset viewer.