[2354] | 1 | #!/bin/bash |
---|
| 2 | ###################################################### |
---|
| 3 | # Author : Simona Flavoni for NEMO |
---|
| 4 | # Contact : sflod@locean-ipsl.upmc.fr |
---|
| 5 | # |
---|
| 6 | # Some functions called from makenemo_fcm |
---|
| 7 | # Fadd_keys : add keys in cpp.fcm file |
---|
| 8 | ###################################################### |
---|
| 9 | #set -x |
---|
| 10 | set -o posix |
---|
| 11 | #set -u |
---|
| 12 | #set -e |
---|
| 13 | #+ |
---|
| 14 | # |
---|
| 15 | # ================ |
---|
| 16 | # fcm_job.sh |
---|
| 17 | # ================ |
---|
| 18 | # |
---|
| 19 | # -------------------------- |
---|
| 20 | # Simple job for NEMO tests |
---|
| 21 | # -------------------------- |
---|
| 22 | # |
---|
| 23 | # SYNOPSIS |
---|
| 24 | # ======== |
---|
| 25 | # |
---|
| 26 | # :: |
---|
| 27 | # |
---|
| 28 | # $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC |
---|
| 29 | # |
---|
| 30 | # |
---|
| 31 | # DESCRIPTION |
---|
| 32 | # =========== |
---|
| 33 | # |
---|
| 34 | # |
---|
| 35 | # Simple job for SET TESTS for NEMO (SETTE) |
---|
| 36 | # |
---|
| 37 | # |
---|
| 38 | # EXAMPLES |
---|
| 39 | # ======== |
---|
| 40 | # |
---|
| 41 | # :: |
---|
| 42 | # |
---|
| 43 | # $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC |
---|
| 44 | # |
---|
| 45 | # |
---|
| 46 | # TODO |
---|
| 47 | # ==== |
---|
| 48 | # |
---|
| 49 | # option debug |
---|
| 50 | # |
---|
| 51 | # |
---|
| 52 | # EVOLUTIONS |
---|
| 53 | # ========== |
---|
| 54 | # |
---|
| 55 | # $Id: fcm_job.sh 2158 2010-10-20 17:30:03Z sflod $ |
---|
| 56 | # |
---|
| 57 | # |
---|
| 58 | # |
---|
| 59 | # * creation |
---|
| 60 | # |
---|
| 61 | #- |
---|
| 62 | # |
---|
| 63 | # SET INPUT |
---|
| 64 | #-- get the input tarfile if needed |
---|
| 65 | tar_file=$(sed -ne "1,1p" $1) |
---|
| 66 | if [ "$(cat $1 | grep -c ".tar" )" -ne 0 ] ; then |
---|
| 67 | cp ${FORCING_DIR}/${tar_file} ${INPUT_DIR}/. |
---|
| 68 | ########################################################################################################### |
---|
| 69 | # only for test, when in ORCA2_LIM.tar file will be only one chlorophyll file we will not need this copy |
---|
| 70 | cp ${INPUT_DIR}/chlaseawifs_c1m-99-05_smooth_ORCA.nc ${INPUT_DIR}/chlorophyll.nc |
---|
| 71 | ########################################################################################################### |
---|
| 72 | cd ${INPUT_DIR} ; tar xvf ${INPUT_DIR}/*.tar |
---|
| 73 | fi |
---|
| 74 | |
---|
| 75 | if [ -f ${INPUT_DIR}/namelist_ice_lim2 ] ; then |
---|
| 76 | cp ${INPUT_DIR}/namelist_ice_lim2 ${INPUT_DIR}/namelist_ice |
---|
| 77 | elif [ -f ${INPUT_DIR}/namelist_ice_lim3 ] ; then |
---|
| 78 | cp ${INPUT_DIR}/namelist_ice_lim3 ${INPUT_DIR}/namelist_ice |
---|
| 79 | fi |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "agrif" )" -ne 0 ] ; then |
---|
| 83 | #- Namelist for ocean and ice (agrif fine grid) |
---|
| 84 | cp ${INPUT_DIR}/1_namelist_ice_lim2 ${INPUT_DIR}/1_namelist_ice |
---|
| 85 | fi |
---|
| 86 | ################################################################ |
---|
| 87 | |
---|
| 88 | ################################################################ |
---|
| 89 | # RUN OPA |
---|
| 90 | cd ${INPUT_DIR} |
---|
| 91 | NB_PROC=$2 |
---|
| 92 | if [ ${NB_PROC} == 1 ] ; then |
---|
| 93 | ./opa |
---|
| 94 | else |
---|
| 95 | mpirun -np ${NB_PROC} opa |
---|
| 96 | # example for dedale machine |
---|
| 97 | # mpirun --mca btl self,tcp -np ${NB_PROC} opa |
---|
| 98 | # example for vargas machine |
---|
| 99 | # mpiexec -n ${NB_PROC} opa |
---|
| 100 | fi |
---|
| 101 | ################################################################ |
---|
| 102 | |
---|
| 103 | ################################################################ |
---|
| 104 | ## -- Save output files |
---|
| 105 | |
---|
| 106 | #- Save ocean output files |
---|
| 107 | [ ! -d ${OUTPUT_DIR} ] && mkdir ${OUTPUT_DIR} |
---|
| 108 | [ -f *ocean.output ] && mv *ocean.output ${OUTPUT_DIR}/. |
---|
| 109 | [ -f *solver.stat ] && mv *solver.stat ${OUTPUT_DIR}/. |
---|
| 110 | [ -n "$(ls *_grid_*)" ] && mv *_grid_*.nc ${OUTPUT_DIR}/. |
---|
| 111 | [ -f restart* ] && cp restart* ${OUTPUT_DIR}/. |
---|
| 112 | [ -f ice_evolu ] && mv ice_evolu ${OUTPUT_DIR}/. |
---|
| 113 | [ -n "$(ls *icemod*)" ] && mv *icemod* ${OUTPUT_DIR}/. |
---|
| 114 | #- Save ftrace file |
---|
| 115 | [ -f ftrace.out* ] && cp ftrace.out* ${OUTPUT_DIR}/. |
---|
| 116 | ################################################################ |
---|
| 117 | |
---|