Ignore:
Timestamp:
Dec 20, 2024, 5:26:29 PM (36 hours ago)
Author:
fhourdin
Message:

Automatic installation of SPLA version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/LMDZ_Setup/setup.sh

    r5432 r5438  
    44
    55set -eu
    6 set -vx
    7 
    8 # EXPERT-LEVEL CHOICES, only available in setup.sh, not in main.sh :
    9 ####################################################################
    10 function define_expert_options() {
    11   # optim: either "" or "-debug" to compile in debug mode (slower but better diagnosis of segfaults)
     6
     7#---------------------------------------------------------------------------
     8function define_expert_options() { # Expert-level choices
     9#---------------------------------------------------------------------------
     10
     11  # optim: either "" or "-debug" to compile in debug mode
     12  #       (slower but better diagnosis of segfaults)
    1213  optim=""
    1314
    14   # "n" or "y". If testmode="y", then simulations run for a single day per period.
     15  # "n" or "y". If testmode="y", then simulations run for a single day
     16  # per period.
    1517  # NOTE: you must set mthend accordingly !
    1618  testmode="n"
     
    1921  rad="rrtm"
    2022
    21   #   !!! STRONG recommendation : experiments with DIFFERENT Orchidee or aerosol options should be performed in DIFFERENT LMDZ_Setup folders
     23  #   !!! STRONG recommendation : experiments with DIFFERENT Orchidee or
     24  #   aerosol options should be performed in DIFFERENT LMDZ_Setup folders
    2225  #   !!! (especially as they may need different initial files)
    2326
    24   # AEROSOLS : "n" (=no) / "clim" (=average 1995-2014) / "spla" (interactive dust and sea salt)
    25   # (WARNING : if you first run the scripts with aerosols=n, then you want to change to =clim ,
    26   #   you'll need to remove the INIT and LIMIT folders that have been created, then run main.sh with init=1
    27   #   in order to re-run the initialisation job, which downloads the aerosol files and interpolates them)
     27  # AEROSOLS : "n" (=no)/"clim" (=average 1995-2014) / "spla" (interactive)
     28  # (WARNING : if you first run the scripts with aerosols=n, then you want
     29  # to change to =clim, you must remove the INIT and LIMIT folders and
     30  # rerun main.sh with init=1 in order to create aerosol files
     31
    2832  aerosols="clim"
    2933
    3034  # SURFACE/VEGETATION SCHEME
    31   # - "none" (bucket scheme) / "CMIP6" (orchidee version used in CMIP exercise) / "7983" (orch2.2) / "7994" (trunk)
    32   # If you need other orch versions, and also require XIOS, you'll need to create the appropriate files in DEF/XMLfilesOR...
     35  # - "none" : bucket scheme
     36  #   CMIP6 : orchidee CMIP6 version
     37  #   7983/7994 : orchidee svn release 7983 (orch2.2) and 7994 (last tested)
     38  #   If you need other orch versions, and also require XIOS, you'll need
     39  #                    to create the appropriate files in DEF/XMLfilesOR...
    3340  veget="CMIP6"
    3441
    3542  # New snow scheme INLANDSIS! "y" / "n"
    36   # This flag activates INLANDSIS compilation; not yet done : treatment of specific restart and def file
     43  # Activates INLANDSIS compilation
     44  #  to be done : treatment of specific restart and def file
    3745  inlandsis="n"
    3846
     
    4048  netcdf=0
    4149
    42   # --->>> ALSO PAY ATTENTION TO OUTPUT files, frequency, level -------------
    43   #   With IOIPSL : Choose your config.def among the versions available in DEF,
     50  # --->>> ALSO PAY ATTENTION TO OUTPUT files, frequency, level ------------
     51  #   With IOIPSL : Choose your config.def among versions available in DEF,
    4452  #     copy it as config.def (the copy is done automatically for "iso"),
    4553  #     edit it and set up output files, frequencies and levels.
    46   #     NB : For aerosols=spla, output level minimum 4 is required to output the specific variables.
    47   #          For aerosols=n, the corresponding flags will automatically be set to "n".
     54  #     NB : For aerosols=spla, output level minimum 4 is required to outpu
     55  #     the specific variables.
     56  #     For aerosols=n, aerosol flags will automatically be set to "n".
    4857  #   With XIOS : adjust DEF/XMLfiles*/file*xml
    4958}
    5059
    51 # /!\ DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING /!\
    52 
    53 
    54 function enable_platform() {  # In job scripts, sed platform-specific headers
     60
     61#---------------------------------------------------------------------------
     62function enable_platform() {  # Sed platform-specific headers
     63#---------------------------------------------------------------------------
    5564  local file="$1"
    5665  local platform
     
    6675}
    6776
    68 function load_install_lib() {
    69   # Fetch and source install_lmdz.sh to get `myget`
     77#---------------------------------------------------------------------------
     78function load_install_lib() { #Fetch and source install_lmdz.sh to get myget
     79#---------------------------------------------------------------------------
    7080  if [[ ! -f "install_lmdz.sh" ]]; then
    7181    wget --no-cache "http://svn.lmd.jussieu.fr/LMDZ/BOL/script_install/install_lmdz.sh"
     
    7686}
    7787
    78 function set_default_params() {
    79   # Default value of script parameters
     88#---------------------------------------------------------------------------
     89function set_default_params() { # Default value of script parameters
     90#---------------------------------------------------------------------------
     91
    8092  SIM=$(basename "$local")CTL  # name
    8193  phylmd="lmd" #option -p $phylmd for makelmdz
     
    104116}
    105117
     118#---------------------------------------------------------------------------
    106119function read_cmdline_args() {
     120#---------------------------------------------------------------------------
    107121  while (($# > 0)); do
    108122    case $1 in
     
    181195  # Choix du nombre de processeurs
    182196  # NOTES :
    183   # omp=8 by default (for Jean-Zay must be a divisor of 40 procs/node), but we need
    184   # omp=1 for SPLA (only MPI parallelisation)
    185   #   omp=2 for veget=CMIP6+XIOS beacause of a bug in ORCHIDEE/src_xml/xios_orchidee.f90
     197  # omp=8 by default (for Jean-Zay must be a divisor of 40 procs/node)
     198  # omp=1 : required for SPLA (omp parallelism not ready)
     199  # omp=2 for veget=CMIP6+XIOS beacause of a bug in ORCHIDEE/src_xml/xios_orchidee.f90
    186200  ######################################################################
    187201  (( mpi = ( jm + 1 ) / 2 ))
     
    204218}
    205219
     220#---------------------------------------------------------------------------
    206221function ensure_correct_option_combinations() {
    207222  # AVOID COMBINATIONS OF OPTIONS THAT DON'T WORK in user choices
     223#---------------------------------------------------------------------------
    208224  if [[ $ok_guide = y && $climato = 1 ]]; then
    209225     echo "STOP: Running nudged simulations with climatological SSTs is not planned. Change <climato> to <0> or modify the setup (experts)"; exit 1
     
    218234  # (Temporary) Constraints for aerosols=spla :
    219235  # --> resolution 128x88x79 and rad=rrtm
    220   if [[ $aerosols = "spla" && ${im}x${jm} != "128x88" ]]; then
    221     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'
     236  if [[ $aerosols = "spla" && ( ${im}x${jm} != "128x88" || $freq != mo ) ]]; then
     237    echo 'STOP: For now, <aerosols=spla> requires <resol=128x88x79>,'
     238    echo 'and uses the zoomed grid from gcm.def_zNAfrica_BiJe,'
     239    echo 'for which forcing & initial files are available'
    222240    echo "Right now resol=<$resol>"
     241    echo 'Should be run in monthly mode'
    223242    exit 1
    224243  fi
     
    229248}
    230249
     250#---------------------------------------------------------------------------
    231251function install_model() {
     252#---------------------------------------------------------------------------
    232253  mkdir -p "$LMDZD"
    233254
     
    265286}
    266287
    267 function setup_def() {  # modify various .def in ./DEF (+ xios xml as needed)
     288#---------------------------------------------------------------------------
     289function setup_def() {  # modify various .def in ./DEF (+ xios xml )
     290#---------------------------------------------------------------------------
    268291  cd "$local"
    269292
     
    304327  # TEMPORAIREMENT pour spla on force l'utilisation de gcm.def_zNAfrica_BiJe (avec resolution 128x88x79)
    305328  #----------------------------------------------------------------------
    306   if [[ $aerosols = "spla" ]]; then cp DEF/gcm.def_zNAfrica_BiJe DEF/gcm.def; fi
     329  if [[ $aerosols = "spla" ]]; then
     330      cp DEF/gcm.def_zNAfrica_BiJe DEF/gcm.def; fi
    307331
    308332  # Inscription du choix ok_guide dans DEF/guide.def
     
    323347  sed -i'' -e 's/VEGET=.*.$/VEGET='$VEGET'/' DEF/config.def
    324348
    325   if [[ $aerosols = "n" ]]; then
    326     # set flag_aerosols=0 and flags ok_ade&co=n
    327     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
    328   fi
     349  ok_cdnc=y ; ok_ade=y ; ok_aie=y ; ok_alw=y
     350  case $aerosols in
     351    clim) flag_aerosol=6 ;;
     352    spla) flag_aerosol=1 ;;
     353    n)    flag_aerosol=0 ; ok_cdnc=n ; ok_ade=n ; ok_aie=n ; ok_alw=n ;;
     354    *)    echo Option aerosols=$aerosols not available ; exit 1
     355  esac
     356  sed -i'' -e 's/^ok_cdnc=.*.$/ok_cdnc='$ok_cdnc'/' \
     357           -e 's/^ok_ade=.*.$/ok_ade='$ok_ade'/' \
     358           -e 's/^ok_aie=.*.$/ok_aie='$ok_aie'/' \
     359           -e 's/^ok_alw=.*.$/ok_alw='$ok_alw'/' \
     360           -e 's/^flag_aerosol=.*.$/flag_aerosol='$flag_aerosol'/' DEF/config.def
     361  pwd
    329362
    330363  # COSP : ok_cosp desactive COSP si on a compile avec; il ne l'active pas si on a compile sans
     
    374407}
    375408
     409#---------------------------------------------------------------------------
    376410function setup_ce0l() { # Verification de l'existance de l'état initial, compilation eventuelle pour sa creation
     411#---------------------------------------------------------------------------
    377412  if [[ ! -d $INIT ]]; then
    378413    if [[ $init = 0 ]]; then
     
    394429}
    395430
     431#---------------------------------------------------------------------------
    396432function setup_simu() {
     433#---------------------------------------------------------------------------
    397434  #SIMRUNTOPDIR="$SIMRUNBASEDIR/$(basename "$local")"
    398435  SIMRUNTOPDIR="$SIMRUNBASEDIR"
     
    488525
    489526  # Files for aerosols and chemistry
    490   if [[ $aerosols = "clim" ]]; then get_input_files wget_pub AerChem ; fi
     527  if [[ $aerosols = "clim" ]]; then
     528       get_input_files wget_pub AerChem ; fi
    491529
    492530  # Files for SPLA
    493   if [[ $aerosols = "spla" ]]; then get_input_files wget_pub SPLA_WA/emissions ; fi
     531  if [[ $aerosols = "spla" ]]; then
     532       get_input_files wget_pub SPLA_WA/emissions
     533       for mo_ in $( seq $mthini $mthend ) ; do
     534           for var in u10m v10m u v ; do
     535               yr__=$( echo $mo_ | cut -c 1-4 )
     536               mo__=$( echo $mo_ | cut -c 5-6 )
     537               echo wget_pub 3DInputData/SPLA_WA/ERA5/$yr__/$mo__ $var.nc
     538               wget_pub 3DInputData/SPLA_WA/ERA5/$yr__/$mo__ $var.nc
     539           done
     540       done
     541  fi
    494542}
    495543
     
    639687...eod
    640688    enable_platform tmp
    641     echo "###############################################################################"
     689    echo "#################################################################"
    642690    #echo "Submitting initialisation job <$SUBMITCMD tmp> from $(pwd)"
    643691    echo "Submitting initialisation job <submitcmd tmp> from $(pwd)"
     
    645693    #$SUBMITCMD tmp
    646694    submitcmd tmp
    647     echo "###############################################################################"
     695    echo "#################################################################"
    648696
    649697  else #case [ $init != 1 ]
    650698     cd "$SIMRUNDIR"
    651      echo "###############################################################################"
     699     echo "################################################################"
    652700     echo "Submitting job tmp_$SIM"
    653701     #echo "$SUBMITCMD tmp_$SIM"
     
    655703     echo "submitcmd tmp_$SIM"
    656704     submitcmd "tmp_$SIM"
    657      echo '###############################################################################'
    658   fi
    659 }
    660 
     705     echo '################################################################'
     706  fi
     707}
     708
     709#---------------------------------------------------------------------------
    661710function message_post_submit() {
     711#---------------------------------------------------------------------------
    662712  if [[ $ok_guide = "y" && $init = 1 ]]; then
    663713    cd "$local"
     
    675725}
    676726
     727#---------------------------------------------------------------------------
    677728function setup_and_load_lmdz_env() {
     729#---------------------------------------------------------------------------
    678730  if [[ ! -f .lmdz_setup_root_dir ]]; then echo "STOP: setup.sh is not located in the root dir ??!!"; exit 1; fi
    679731  # sed root_dir in lmdz_env.sh
Note: See TracChangeset for help on using the changeset viewer.