#!/bin/tcsh #PBS -l walltime=05:30:00 #PBS -l vmem=1000MB #PBS -l nodes=1:ppn=12 setenv OMP_NUM_THREADS 12 # # Purpose # ------- # Runs the CSIRO Mk3L climate system model for x years, in stand-alone # atmosphere mode, coupled to CABLE. No need to resubmit on shine-cl. # # Usage # ----- # compile_coal ! compile model and utilities used in this script # setup_coal ! copy necessary files into the working directory # qsub run_coal1 # should be submitted from working run directory created by setup # # Note # ---- # *** Remember to check cable_mk3l.nml for output frequency *** # *** modify input to the ensure it is setup to run for one year # real year to use in determining fossil fuel emissions set Realyr = 1850 # Duration of the run, in years (*** user must specify here ***) set LASTYR = 00157 set LASTYR = 00160 set LASTYR = 00251 # Set the stack sizes limit stacksize unlimited setenv KMP_STACKSIZE 16M # Set names of directories set TMP_DIR = /data/flush/mat236/coal_1/run1x_1 set TMP_DIR = $cwd set OUT_DIR = $TMP_DIR/archive # For transient CO2 simulation ( Q.Zhang 23/05/2011) set CO2_DIR = $TMP_DIR/cmip5co2 # Change to the run directory cd $TMP_DIR mkdir -p $OUT_DIR # Set model year number - $year may have leading zeroes, whereas $yr will not set year = `cat year` set yr = `expr $year + 0` set last = `expr $LASTYR + 0` set loop = 1 # Loop through the required number of years while (($yr <= $last) && ($loop <= 5)) # use wall-time 5:30:00 set yy = `expr $year + 1850 - 1` # cp -f $CO2_DIR/co2_data_$yy co2_data.18l echo "CO2 data for ATM $yy year." # Run the model ./model < input | tee output echo "Finished running $yr year." # Check that the run was OK set MESSAGE = `tail output | grep termination` if ("$MESSAGE" != '') then echo "Year $yr terminated normally." else echo "Abnormal termination of run." echo "Mk3L run stopped - abnormal termination." exit endif # sum emission first ./annual.sh -9 -9 1 mv annual_991.nc annual.nc @ yy = {$yr} + {$Realyr} - 1 # model spinup in the 1850 conditions (Q.Zhang 11/07/2011) # @ yy = {$Realyr} ./atmCO2conc -c $yy cat co2.txt >> co2_hist.txt set conc = `awk ' {print $1 } ' < co2.txt ` ./radint -c $conc # (Q.Zhang 15Jul2011) use prescribed [co2] for spinup # ./radint -c 280 cp co2_data $OUT_DIR/co2_data.{$year}ppm.18l mv co2_data co2_data.18l # Archive results cp restart_out.nc $OUT_DIR/restart_out_${year}.nc cp cnppool_csiro_end.txt cnppool_csiro_start.txt mv cnppool_csiro_end.txt $OUT_DIR/cnppool_csiro_${year}.txt cp rest.end $OUT_DIR/rest.end_${year} cp orest.nc $OUT_DIR/orest_${year}.nc cp oflux.nc $OUT_DIR/oflux_${year}.nc cp rest.end rest.start mv out_cable.nc $OUT_DIR/out_cable_${year}.nc mv output $OUT_DIR/output_${year} mv log_cable.txt $OUT_DIR/log_cable_${year}.txt ./seasonal.sh -9 -9 1 mv seasonal_991.nc $OUT_DIR/seasonal_${year}.nc # mv annual.nc $OUT_DIR/annual_${year}.nc mv fort.40 $OUT_DIR/ff.${year} # Start another year set yr1 = `expr $year + 1` set nextYr = $yr1 if ($yr1 <= 9999) set nextYr = 0$yr1 if ($yr1 <= 999) set nextYr = 00$yr1 if ($yr1 <= 99) set nextYr = 000$yr1 if ($yr1 <= 9) set nextYr = 0000$yr1 /bin/rm year echo $nextYr > year set year = `cat year` set yr = `expr $year + 0` set loop2 = `expr $loop + 1` set loop = $loop2 end # Submit another run if necessary if ($yr <= $last) then # rm fort.3? qq run_coal set errstat = $? @ n = 1 while (($errstat != 0) && ($n <= 15)) echo "qsub error - trying again in 60 seconds..." sleep 60 qq run_coal set errstat = $? @ n ++ end endif