source: lmdz_wrf/trunk/tools/preparing_runs.bash @ 545

Last change on this file since 545 was 536, checked in by lfita, 9 years ago

Fixing file names to be propertly remove

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2## e.g. # preparing_runs.bash /homedata/lfita/etudes/WRFdynamicoSENS/Lothar /homedata/lfita/DATA/WRF/WRFV3.6.1/gfortran/dmpar/WRFV3 /home/lfita/etudes/WRF4L/camelot-ng /homedata/lfita/etudes/WRFdynamicoSENS/Lothar/metgrid mp1:pbl1:pbl2:rad1 /homedata/lfita/etudes/WRFdynamicoSENS/Lothar/control gfortran
3if test $1 = '-h'; then
4  echo "******************************************"
5  echo "*** Shell to prepare a set of WRF runs ***"
6  echo "******************************************"
7  echo "preparing_runs.bash [workfold] [WRFfold] [WRF4L] [metgrid] [explabs] [namelist] [compilation]"
8  echo "  [workfold]: working folder"
9  echo "  [WRFfold]:folder with WRF compilation (down to WRFV3)"
10  echo "  [WRF4L]: Folder with WRF PBS scripts"
11  echo "  [metgrid]: folder with the 'met_em' files"
12  echo "  [explabs]: ':', list of labels for the experiments"
13  echo "  [infold]: folder of reference (with namelist.input, tslist, lidarlist, ...)"
14  echo "  [compilation]: which kind of compilation (gfortran/ifort)"
15else
16  workfold=$1
17  WRFfold=$2
18  WRF4L=$3
19  metgrid=$4
20  folders=$5
21  infold=$6
22  compilation=$7
23
24#######    #######
25## MAIN
26    #######
27  rootsh=`pwd`
28
29  folds=`echo ${folders} | tr ':' ' '`
30
31  if test ! -d ${workfold}; then
32    echo ${errmsg}
33    echo "  folder: '"${workfold}"' does not exist !!"
34    exit
35  fi
36
37  if test ! -d ${WRF4L}; then
38    echo ${errmsg}
39    echo "  folder: '"${WRF4L}"' does not exist !!"
40    exit
41  fi
42
43  if test ! -d ${infold}; then
44    echo ${errmsg}
45    echo "  folder: '"${infold}"' does not exist !!"
46    exit
47  fi
48
49  for fold in ${folds}; do
50    echo ${fold}
51    odir=${workfold}/${fold}
52
53    rm -rf ${odir} >& /dev/null
54    mkdir -p ${odir}
55    if test $? -ne 0; then
56      echo ${errmsg}
57      echo "  creation of folder'"${odir}"' failed !!"
58      exit
59    fi
60    cd ${odir}
61    ln -s ${WRFfold}/run/* ./
62    rm namelist.input
63
64    cp ${infold}/namelist.input ./
65    cp ${infold}/tslist ./ >& /dev/null
66    cp ${infold}/lidarlist ./ >& /dev/null
67    ln -s ${metgrid}/met_em* ./
68    if test ${compilation} = 'gfortran'; then
69      cp ${WRF4L}/run_real.pbs ./
70      cp ${WRF4L}/run_wrf.pbs ./
71    elif test ${compilation} = 'ifort'; then
72      cp ${WRF4L}/run_real-intel.pbs ./
73      cp ${WRF4L}/run_wrf-intel.pbs ./
74    fi
75  done
76fi
77
Note: See TracBrowser for help on using the repository browser.