[2963] | 1 | #!/bin/bash |
---|
| 2 | # Partition to run on: |
---|
| 3 | #MSUB -q rome |
---|
| 4 | # project to run on |
---|
| 5 | #MSUB -A gen10391 |
---|
| 6 | # disks to use |
---|
| 7 | #MSUB -m scratch,work,store |
---|
| 8 | # Job name |
---|
| 9 | #MSUB -r run_PEM |
---|
| 10 | # Job standard output: |
---|
| 11 | #MSUB -o run_PEM.%I |
---|
| 12 | # Job standard error: |
---|
| 13 | #MSUB -e run_PEM.%I |
---|
| 14 | # number of OpenMP threads c |
---|
| 15 | #MSUB -c 5 |
---|
| 16 | # number of MPI tasks n |
---|
| 17 | #MSUB -n 24 |
---|
| 18 | # number of nodes to use N |
---|
| 19 | #MSUB -N 1 |
---|
| 20 | # max job run time T (in seconds) |
---|
| 21 | #MSUB -T 86000 |
---|
| 22 | # request exclusive use of the node (128 cores) |
---|
| 23 | #MSUB -x |
---|
| 24 | |
---|
| 25 | # A few parameters that might need be changed depending on your setup: |
---|
| 26 | # Path to the arch.env to source |
---|
| 27 | source ../trunk/LMDZ.COMMON/arch.env |
---|
| 28 | # Number of threads to use (must be the same as "#MSUB -c" above) |
---|
| 29 | export OMP_NUM_THREADS=5 |
---|
| 30 | export OMP_STACKSIZE=400M |
---|
| 31 | |
---|
| 32 | set -xv |
---|
| 33 | ls -al |
---|
| 34 | |
---|
| 35 | #------------------Modify here the number of PEM call---------------------- |
---|
| 36 | |
---|
| 37 | ## set starting PEM first and last number call: |
---|
| 38 | num_PEM_now=1 |
---|
| 39 | num_PEM_end=10 |
---|
| 40 | (( num_PEM_previous = $num_PEM_now - 1 )) |
---|
| 41 | |
---|
| 42 | #-----------------Modify here the number of GCM call between each PEM --------- |
---|
| 43 | |
---|
| 44 | ## set number of GCM call between each PEM call: |
---|
| 45 | nb_GCM_call=2 |
---|
| 46 | |
---|
| 47 | #----------------Here we launch GCM call year by year --------- |
---|
| 48 | |
---|
| 49 | (( num_GCM_now = ($num_PEM_now - 1)* $nb_GCM_call + 1 )) |
---|
| 50 | (( num_GCM_previous = $num_GCM_now - 1 )) |
---|
| 51 | (( num_GCM_end = $num_GCM_previous + $nb_GCM_call )) |
---|
| 52 | echo "$num_GCM_previous" > num_run |
---|
| 53 | |
---|
| 54 | while [ $num_GCM_now -le $num_GCM_end ] |
---|
| 55 | do |
---|
| 56 | sed s/9999/669/ run.def.ref > run.def |
---|
| 57 | ./run0 >> error |
---|
| 58 | ((num_GCM_now++)) |
---|
| 59 | (( num_GCM_previous = $num_GCM_now - 1 )) |
---|
| 60 | echo "$num_GCM_previous" > num_run |
---|
| 61 | done |
---|
| 62 | |
---|
| 63 | #--------------- We reshape the GCM data from XIOS------------------- |
---|
| 64 | |
---|
| 65 | (( num_GCM_previous_previous = $num_GCM_previous - 1 )) |
---|
| 66 | |
---|
| 67 | cp Xdiurnalave${num_GCM_previous_previous}.nc data2reshape1.nc |
---|
| 68 | echo "y" |
---|
| 69 | cp Xdiurnalave${num_GCM_previous}.nc data2reshape2.nc |
---|
| 70 | echo "y" |
---|
| 71 | |
---|
| 72 | rm -rf datareshaped1.nc |
---|
| 73 | rm -rf datareshaped2.nc |
---|
| 74 | |
---|
| 75 | ./reshape_XIOS_output_64x48x54_phymars_seq.e |
---|
| 76 | |
---|
| 77 | #---------------- We rename files for the PEM call---------------- |
---|
| 78 | |
---|
| 79 | cp startfi${num_GCM_previous}.nc startfi_evol.nc |
---|
| 80 | echo "y" |
---|
| 81 | cp startfi${num_GCM_previous}.nc startfi${num_GCM_previous}_GCM.nc |
---|
| 82 | |
---|
| 83 | cp start${num_GCM_previous}.nc start_evol.nc |
---|
| 84 | echo "y" |
---|
| 85 | cp start${num_GCM_previous}.nc start${num_GCM_previous}_GCM.nc |
---|
| 86 | |
---|
| 87 | mv datareshaped1.nc data_GCM_Y1.nc |
---|
| 88 | echo "y" |
---|
| 89 | mv datareshaped2.nc data_GCM_Y2.nc |
---|
| 90 | echo "y" |
---|
| 91 | |
---|
| 92 | #--------------- We run the PEM ------------------ |
---|
| 93 | |
---|
| 94 | if [[ -r run.def_PEM ]] ; then |
---|
| 95 | cp run.def_PEM run.def |
---|
| 96 | echo "y" |
---|
| 97 | fi |
---|
| 98 | if [[ -r diagfi.def_PEM ]] ; then |
---|
| 99 | cp diagfi.def_PEM diagfi.def |
---|
| 100 | echo "y" |
---|
| 101 | fi |
---|
| 102 | |
---|
| 103 | ./pem_64x48x54_phymars_seq.e > PEMrun${num_PEM_now} 2>&1 |
---|
| 104 | |
---|
| 105 | if [[ -r run.def_GCM ]] ; then |
---|
| 106 | cp run.def_GCM run.def |
---|
| 107 | echo "y" |
---|
| 108 | fi |
---|
| 109 | if [[ -r diagfi.def_GCM ]] ; then |
---|
| 110 | cp diagfi.def_GCM diagfi.def |
---|
| 111 | echo "y" |
---|
| 112 | fi |
---|
| 113 | |
---|
| 114 | #--------------- We rename PEM output ------------------ |
---|
| 115 | |
---|
| 116 | cp restartfi_evol.nc startfi${num_GCM_previous}_post_PEM.nc |
---|
| 117 | cp restartfi_evol.nc startfi${num_GCM_previous}.nc |
---|
| 118 | echo "y" |
---|
| 119 | |
---|
| 120 | cp restart_evol.nc start${num_GCM_previous}_post_PEM.nc |
---|
| 121 | cp restart_evol.nc start${num_GCM_previous}.nc |
---|
| 122 | echo "y" |
---|
| 123 | |
---|
| 124 | (( num_PEM_next = $num_PEM_now + 1 )) |
---|
| 125 | |
---|
| 126 | cp restartfi_PEM.nc startfi_PEM${num_PEM_now}.nc |
---|
| 127 | cp restartfi_PEM.nc startfi_PEM.nc |
---|
| 128 | echo "y" |
---|
| 129 | |
---|
| 130 | if [[ -r diagfi.nc ]] ; then |
---|
| 131 | \mv -f diagfi.nc diagfi${num_PEM_now}_PEM.nc |
---|
| 132 | fi |
---|
| 133 | |
---|
| 134 | #------------------- Launch the next PEM call------------------ |
---|
| 135 | |
---|
| 136 | # launch job for next month |
---|
| 137 | if (( $num_PEM_next <= $num_PEM_end )) ; then |
---|
| 138 | cp -f run_pem$num_PEM_now tmp |
---|
| 139 | sed -e "s@run_pem${num_PEM_now}@run_pem${num_PEM_next}@" \ |
---|
| 140 | -e "s@num_PEM_now=${num_PEM_now}@num_PEM_now=${num_PEM_next}@" tmp > run_pem$num_PEM_next |
---|
| 141 | rm tmp |
---|
| 142 | |
---|
| 143 | ccc_msub run_pem$num_PEM_next |
---|
| 144 | fi |
---|