Changeset 3023 for trunk/LMDZ.MARS/deftank/pem
- Timestamp:
- Aug 1, 2023, 4:32:24 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/deftank/pem/run_pem1d_1
r2980 r3023 25 25 26 26 # A few parameters that might need be changed depending on your setup: 27 # Path to the arch.env to source 27 # Path to the arch.env to source: 28 28 source ../trunk/LMDZ.COMMON/arch.env 29 # Number of threads to use (must be the same as "#MSUB -c" above)30 export OMP_NUM_THREADS=131 export OMP_STACKSIZE=400M32 29 33 #------------------Modify here the number of PEM call---------------------- 30 #------------------ Modify here the name of PEM exe -------------------- 31 ## fill in the name of executable for PEM: 32 exePEM=pem_29_phymars_seq.e 34 33 35 ## set starting PEM first and last number call: 36 num_PEM_now=1 37 num_PEM_end=20 38 (( num_PEM_previous = $num_PEM_now - 1 )) 34 #------------------ Modify here the name of GCM exe -------------------- 35 ## fill in the name of executable for GCM: 36 exeGCM=testphys1d_29_phymars_para.e 39 37 40 #-----------------Modify here the number of GCM call between each PEM --------- 38 #-------------- Modify here the name of reshape XIOS exe --------------- 39 ## fill in the name of executable for reshape XIOS: 40 exeReshape=reshape_XIOS_output_64x48x29_phymars_seq.e 41 41 42 ## set number of GCM call between each PEM call: 43 nb_GCM_call=2 42 #---------------- Modify here the number of PEM calls ------------------ 43 ## set the number of PEM calls: 44 nPEM=1000 44 45 45 #----------------Here we launch GCM call year by year --------- 46 #---------------- Modify here the number of GCM calls ------------------ 47 ## set the number of GCM calls between each PEM call: 48 nGCM=2 46 49 47 (( num_GCM_now = ($num_PEM_now - 1)* $nb_GCM_call + 1 ))48 (( num_GCM_previous = $num_GCM_now - 1 ))49 (( num_GCM_end = $num_GCM_previous + $nb_GCM_call ))50 50 51 echo "num_GCM_now $num_GCM_now"52 echo "num_GCM_previous $num_GCM_previous"53 echo "num_GCM_end $num_GCM_end"54 51 55 echo "$num_GCM_previous" > num_run 56 57 \cp -f startfi$num_GCM_previous.nc startfi.nc 58 ./testphys1d_29_phymars_seq.e > lrun$num_GCM_now 2>&1 59 \cp -f diagfi.nc diagfi$num_GCM_now.nc 60 \cp -f diagfi.nc data2reshape1.nc 61 \cp -f restartfi.nc startfi${num_GCM_now}.nc 62 \cp -f restartfi.nc startfi.nc 63 64 ./testphys1d_29_phymars_seq.e > lrun$num_GCM_end 2>&1 65 \cp -f diagfi.nc diagfi$num_GCM_end.nc 66 \cp -f diagfi.nc data2reshape2.nc 67 \cp -f restartfi.nc startfi${num_GCM_end}_GCM.nc 68 \cp -f restartfi.nc startfi_evol.nc 69 70 #--------------- We reshape the GCM data from XIOS------------------- 71 72 rm -rf datareshaped1.nc 73 rm -rf datareshaped2.nc 74 75 ./reshape_XIOS_output_32x24x27_phymars_seq.e 76 77 #---------------- We rename files for the PEM call---------------- 78 79 cp datareshaped1.nc data_GCM_Y1.nc 80 echo "y" 81 cp datareshaped2.nc data_GCM_Y2.nc 82 echo "y" 83 84 #--------------- We run the PEM ------------------ 85 86 if [[ -r run.def_PEM ]] ; then 87 cp run.def_PEM run.def 88 echo "y" 52 #--------- Check if files/directories exist to be able to run ---------- 53 echo Starting script to call PEM with GCM! 54 if [ ! -d "profiles" ]; then 55 mkdir profiles 56 else 57 rm profiles/* 89 58 fi 90 if [[ -r diagfi.def_PEM ]] ; then 91 cp diagfi.def_PEM diagfi.def 92 echo "y" 59 if [ ! -d "diagfis" ]; then 60 mkdir diagfis 61 else 62 rm diagfis/* 63 fi 64 if [ ! -d "startfis" ]; then 65 mkdir startfis 66 else 67 rm startfis/* 68 fi 69 if [ ! -r "context_lmdz_physics.xml" ]; then 70 echo File context_lmdz_physics.xml does not exist! 71 exit 0 72 fi 73 if [ ! -r "field_def_physics_mars.xml" ]; then 74 echo File field_def_physics_mars.xml does not exist! 75 exit 0 76 fi 77 if [ ! -r "file_def_physics_mars.xml" ]; then 78 echo File file_def_physics_mars.xml does not exist! 79 exit 0 80 fi 81 if [ ! -r "iodef.xml" ]; then 82 echo File iodef.xml does not exist! 83 exit 0 84 fi 85 if [ ! -r "run_PEM.def" ]; then 86 echo File diagfi_PEM.def does not exist! 87 exit 0 88 fi 89 if [ ! -r "run_GCM.def" ]; then 90 echo File diagfi_GCM.def does not exist! 91 exit 0 92 fi 93 if [ ! -r "run_PEM.def" ]; then 94 echo File diagfi_PEM.def does not exist! 95 exit 0 96 fi 97 if [ ! -r "run_GCM.def" ]; then 98 echo File diagfi_GCM.def does not exist! 99 exit 0 93 100 fi 94 101 95 ./pem_29_phymars_seq.e > PEMrun${num_PEM_now} 2>&1 102 #---------------------------- Initialization --------------------------- 103 iPEM=1 104 ((iGCM = ($iPEM - 1)*$nGCM + 1)) 105 cp startfi.nc startfis/ 106 cp startfi_PEM.nc startfis/ 107 for file in profile_*; do 108 cp $file profiles/${file}_0 109 done 96 110 97 if [[ -r run.def_GCM ]] ; then 98 cp run.def_GCM run.def 99 echo "y" 100 fi 101 if [[ -r diagfi.def_GCM ]] ; then 102 cp diagfi.def_GCM diagfi.def 103 echo "y" 104 fi 111 #---------------------- Main loop to call PEM/GCM ---------------------- 112 while [ $iPEM -le $nPEM ]; do 113 #--- Loop to run GCM year by year 114 cp run_GCM.def run.def 115 cp diagfi_GCM.def diagfi.def 116 for ((i = 1; i <= $nGCM; i++)); do 117 echo Run GCM $iGCM: call $i out of $nGCM... 118 ./$exeGCM > lrun${iGCM} 2>&1 119 mv diagfi.nc diagfis/diagfi${iGCM}.nc 120 cp Xdiurnalave.nc diagfis/Xdiurnalave${iGCM}.nc 121 mv Xdiurnalave.nc data2reshape${i}.nc 122 cp restartfi.nc startfis/startfi${iGCM}.nc 123 mv restartfi.nc startfi.nc 124 for file in profile_out_*; do 125 cp $file profiles/${file/_out/}_${iGCM} 126 mv $file ${file/_out/} 127 done 128 ((iGCM++)) 129 echo Done! 130 done 131 #--- Reshaping GCM data with XIOS 132 echo Reshaping GCM data with XIOS... 133 for i in $(ls datareshaped*); do 134 rm $i 135 done 136 ./$exeReshape 137 for file in datareshaped*; do 138 mv $file ${file/reshaped/_GCM_Y} 139 done 140 echo Done! 141 #--- Running PEM 142 echo Run PEM $iPEM... 143 cp run_PEM.def run.def 144 cp diagfi_PEM.def diagfi.def 145 mv startfi.nc startfi_evol.nc 146 ./$exePEM > mrun${iPEM} 2>&1 147 mv diagfi.nc diagfis/diagfi_PEM${iPEM}.nc 148 cp restartfi_evol.nc startfis/startfi_postPEM${iPEM}.nc 149 mv restartfi_evol.nc startfi.nc 150 cp restartfi_PEM.nc startfis/startfi_PEM${iPEM}.nc 151 mv restartfi_PEM.nc startfi_PEM.nc 152 for file in profile_out_*; do 153 cp $file profiles/${file/_out/}PEM_${iPEM} 154 mv $file ${file/_out/} 155 done 156 mv info_run_PEM.txt info_run_PEM${iPEM}.txt 157 ((iPEM++)) 158 echo Done! 159 done 105 160 106 #--------------- We rename PEM output ------------------ 161 #---------------------- Preparation for relaunch ---------------------- 162 echo Reinitializing starting files... 163 cp startfis/startfi.nc . 164 for file in profiles/*_0; do 165 cp $file ${file/_0/} 166 done 107 167 108 cp restartfi_evol.nc startfi${num_GCM_end}_post_PEM.nc 109 echo "y" 110 cp restartfi_evol.nc startfi${num_GCM_end}.nc 111 echo "y" 112 113 (( num_PEM_next = $num_PEM_now + 1 )) 114 115 if [[ -r diagfi.nc ]] ; then 116 \mv -f diagfi.nc diagfi${num_PEM_now}_PEM.nc 117 fi 118 119 #------------------- Launch the next PEM call------------------ 120 121 # launch job for next month 122 if (( $num_PEM_next <= $num_PEM_end )) ; then 123 cp -f run_pem1d_$num_PEM_now tmp 124 sed -e "s@run_pem1d_${num_PEM_now}@run_pem1d_${num_PEM_next}@" \ 125 -e "s@num_PEM_now=${num_PEM_now}@num_PEM_now=${num_PEM_next}@" tmp > run_pem1d_$num_PEM_next 126 rm tmp 127 128 ccc_msub run_pem1d_$num_PEM_next 129 fi 168 echo Script finished.
Note: See TracChangeset
for help on using the changeset viewer.