Changeset 3579


Ignore:
Timestamp:
Jan 15, 2025, 1:50:20 PM (2 weeks ago)
Author:
jbclement
Message:

PEM:
Improvement of the Bash script tools in the deftank with an automatic error detection which ends the script with a message.
JBC

Location:
trunk/LMDZ.COMMON/libf/evolution
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/changelog.txt

    r3571 r3579  
    537537- Renaming of variables and subroutines to make everything clearer. In particular, the suffixes: '_avg' = average, '_start' = PCM start file, '_dev' = deviation, '_ini' or '0' = initial, '_dyn' = dynamical grid, '_timeseries' = daily average of last PCM year.
    538538- Cosmetic cleanings for readability.
     539
     540== 15/01/2025 == JBC
     541Improvement of the Bash script tools in the deftank with an automatic error detection which ends the script with a message.
  • trunk/LMDZ.COMMON/libf/evolution/deftank/PCMrun.job

    r3556 r3579  
    1313#SBATCH --time=10:00:00
    1414
    15 # A few parameters that might need to be changed depending on your setup
     15########################################################################
     16# Modify here the parameters depending on your setup
     17####################################################
    1618# Path to the arch.env to source:
    1719source ../trunk/LMDZ.COMMON/arch.env
  • trunk/LMDZ.COMMON/libf/evolution/deftank/PEMrun.job

    r3495 r3579  
    1313#SBATCH --mem=29000M
    1414
     15########################################################################
     16# Modify here the parameters depending on your setup
     17####################################################
    1518# A few parameters that might need to be changed depending on your setup
    1619# Path to the arch.env to source:
  • trunk/LMDZ.COMMON/libf/evolution/deftank/README

    r3556 r3579  
    3434
    3535# obl_ecc_lsp.asc
    36   File describing orbital parameters for Mars from Laskar data. It contains the Earth year and the corresponding obliquity, eccentricity and Ls of perihelion.
     36  File describing orbital parameters for Mars from Laskar's data. It contains the Earth year and the corresponding obliquity, eccentricity and Ls of perihelion.
    3737
    3838# modify_startfi_orbit.sh:
     
    4949
    5050# clean.sh:
    51   Bash script file to clean the folder after a PEM simulation.
     51  Bash script file to clean the folder after a PEM simulation and reset the initial starting files to prepare a new simulation.
    5252
    5353# multiple_exec.sh:
    54   Bash script to execute multiple scripts in subdirectories, useful to launch multiple simulations at once.
     54  Bash script file to execute multiple scripts in subdirectories. It is useful to launch multiple simulations at once.
    5555
    5656# visu_layering.py:
  • trunk/LMDZ.COMMON/libf/evolution/deftank/clean.sh

    r3428 r3579  
    22#########################################################
    33### Script to clean the folder after a PEM simulation ###
     4### and reset the initial starting files to prepare a ###
     5### new simulation                                    ###
    46#########################################################
     7# There is no argument, you can just execute it.
     8################################################
    59
    610echo "Cleaning..."
  • trunk/LMDZ.COMMON/libf/evolution/deftank/concat_diagpem.sh

    r3214 r3579  
    33### Script to concatenate "diagpem.nc" outputs into one file ###
    44################################################################
     5set -e
     6trap 'echo -e "\033[31mError: an issue occurred in the script on line $LINENO! Please review the command and try again.\033[0m"' ERR
    57
     8################################################################
     9# Modify here the parameters for the script
     10###########################################
    611# Output file name
    712output_file="diagpem_concat.nc"
     
    2025files=($directory/diagpem*.nc)
    2126output_file=($directory/$output_file)
     27################################################################
    2228
    2329
    24 ################################################################
    2530# Checking if everything is ok
    2631if [ ! -d "$directory" ]; then
  • trunk/LMDZ.COMMON/libf/evolution/deftank/inipem_orbit.sh

    r3351 r3579  
    44### according to the date set in the file "run_PEM.def"            ###
    55######################################################################
     6set -e
     7trap 'echo -e "\033[31mError: an issue occurred in the script on line $LINENO! Please review the command and try again.\033[0m"' ERR
    68
     9######################################################################
     10# Modify here the parameters for the script
     11###########################################
    712# Name of the file to be modified
    813name_file="startfi.nc"
     
    1015# Name of the file containing the orbital data
    1116orb_data="obl_ecc_lsp.asc"
     17######################################################################
    1218
    1319
    14 ######################################################################
    1520# Check if files necessary for the script exist
    1621if [ ! -f "$orb_data" ]; then
  • trunk/LMDZ.COMMON/libf/evolution/deftank/launchPEM.sh

    r3556 r3579  
    88#     It will ask for parameters to know the starting point that you want to.
    99########################################################################
     10set -e
     11trap 'echo -e "\033[31mError: an issue occurred in the script on line $LINENO! Please review the command and try again.\033[0m"' ERR
    1012
    1113
  • trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh

    r3556 r3579  
    1010
    1111    date
    12     echo "Successful end of the launching script for the PEM simulation."
     12    echo "Success: the launching script for the PEM simulation completed normally!"
    1313    exit 0
    1414}
     
    2020
    2121    date
    22     echo "End with error of the launching script for the PEM."
     22    echo "Error: an issue occured in the launching script for the PEM simulation!"
    2323    exit 1
    2424}
  • trunk/LMDZ.COMMON/libf/evolution/deftank/modify_startfi_orbit.sh

    r3210 r3579  
    33### Script to modify the orbital parameters of a file "startfi.nc" ###
    44######################################################################
     5set -e
     6trap 'echo -e "\033[31mError: an issue occurred in the script on line $LINENO! Please review the command and try again.\033[0m"' ERR
    57
     8######################################################################
     9# Modify here the parameters for the script
     10###########################################
    611# Name of the file
    7 name_file="startfi.nc"
     12name_file = "startfi.nc"
    813
    914# New values for the orbital parameters
     
    1217new_Lsp=251.06881714
    1318new_iniLs=0.
     19######################################################################
    1420
    1521
    16 ######################################################################
    1722# Calculate modified values
    1823if [ ! -f "$name_file" ]; then
  • trunk/LMDZ.COMMON/libf/evolution/deftank/modify_startfi_var.sh

    r3210 r3579  
    33### Script to modify the value of a variable in a file "startfi.nc" ###
    44#######################################################################
     5set -e
     6trap 'echo -e "\033[31mError: an issue occurred in the script on line $LINENO! Please review the command and try again.\033[0m"' ERR
    57
     8#######################################################################
     9# Modify here the parameters for the script
     10###########################################
    611# Name of the file
    712name_file="startfi.nc"
     
    1217# New value for the variable
    1318new_var=8.
     19#######################################################################
    1420
    1521
    16 #######################################################################
    1722# Update the netCDF file
    1823ncap2 -O -s "$var_name=$new_var" \
  • trunk/LMDZ.COMMON/libf/evolution/deftank/multiple_exec.sh

    r3456 r3579  
    33### Script to execute multiple scripts in subdirectories ###
    44############################################################
     5set -e
     6trap 'echo -e "\033[31mError: an issue occurred in the script on line $LINENO! Please review the command and try again.\033[0m"' ERR
    57
     8############################################################
     9# Modify here the parameters for the script
     10###########################################
    611# Name of the file to execute in all subdirectories
    712script_name="launchPEM.sh"
     
    1217# Name of the template directory to skip
    1318tempdir_name="Template"
     19############################################################
     20
    1421
    1522# Traverse all subdirectories, excluding the template
  • trunk/LMDZ.COMMON/libf/evolution/reshape_XIOS_output.F90

    r3214 r3579  
    1111!=======================================================================
    1212use netcdf
     13use version_info_mod, only: print_version_info
    1314
    1415implicit none
     
    2324character(1)                          :: str
    2425character(30)                         :: name_, namevar
     26character(100)                        :: arg ! To read command-line arguments
    2527integer                               :: xtype_var, len_, len_1, len_2, len_lat, len_lon, len_time, len_soil
    2628integer                               :: dimid_lon, dimid_lat, dimid_time, dimid_soil, dimid_2, numdims, numatts, numyear
    2729logical                               :: yes
     30
     31
     32if (command_argument_count() > 0) then ! Get the number of command-line arguments
     33    call get_command_argument(1,arg) ! Read the argument given to the program
     34    select case (trim(adjustl(arg)))
     35        case('version')
     36            call print_version_info()
     37            stop
     38        case default
     39            error stop 'The argument given to the program is unknown!'
     40    end select
     41endif
    2842
    2943do numyear = 1,2
Note: See TracChangeset for help on using the changeset viewer.