tpsg_flowline.sh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch) (HTM) git clone git://src.adamsgaard.dk/pism (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- tpsg_flowline.sh (5938B) --- 1 #!/bin/bash 2 3 # Copyright (C) 2010-2015, 2018 Andy Aschwanden 4 5 6 if [ -n "${SCRIPTNAME:+1}" ] ; then 7 echo "[SCRIPTNAME=$SCRIPTNAME (already set)]" 8 echo "" 9 else 10 SCRIPTNAME="#(psg_flowline.sh)" 11 fi 12 13 echo 14 echo "# ==================================================================================" 15 echo "# PISM Storglaciaren Flow Line Model" 16 echo "# ==================================================================================" 17 echo 18 19 set -e # exit on error 20 21 NN=2 # default number of processors 22 if [ $# -gt 0 ] ; then # if user says "psg_flowline.sh 8" then NN = 8 23 NN="$1" 24 fi 25 26 echo "$SCRIPTNAME NN = $NN" 27 28 # set MPIDO if using different MPI execution command, for example: 29 # $ export PISM_MPIDO="aprun -n " 30 if [ -n "${PISM_MPIDO:+1}" ] ; then # check if env var is already set 31 echo "$SCRIPTNAME PISM_MPIDO = $PISM_MPIDO (already set)" 32 else 33 PISM_MPIDO="mpiexec -n " 34 echo "$SCRIPTNAME PISM_MPIDO = $PISM_MPIDO" 35 fi 36 37 # check if env var PISM_DO was set (i.e. PISM_DO=echo for a 'dry' run) 38 if [ -n "${PISM_DO:+1}" ] ; then # check if env var DO is already set 39 echo "$SCRIPTNAME PISM_DO = $PISM_DO (already set)" 40 else 41 PISM_DO="" 42 fi 43 44 # prefix to pism (not to executables) 45 if [ -n "${PISM_BIN:+1}" ] ; then # check if env var is already set 46 echo "$SCRIPTNAME PISM_BIN = $PISM_BIN (already set)" 47 else 48 PISM_BIN="" # just a guess 49 echo "$SCRIPTNAME PISM_BIN = $PISM_BIN" 50 fi 51 52 # set PISM_EXEC if using different executables, for example: 53 # $ export PISM_EXEC="pismr -energy cold" 54 if [ -n "${PISM_EXEC:+1}" ] ; then # check if env var is already set 55 echo "$SCRIPTNAME PISM_EXEC = $PISM_EXEC (already set)" 56 else 57 PISM_EXEC="pismr" 58 echo "$SCRIPTNAME PISM_EXEC = $PISM_EXEC" 59 fi 60 61 echo 62 63 PCONFIG=psg_config.nc 64 65 # cat prefix and exec together 66 PISM="${PISM_BIN}${PISM_EXEC} -config_override $PCONFIG -o_order zyx" 67 68 69 DATANAME=storglaciaren_flowline.nc 70 PISM_DATANAME=pism_$DATANAME 71 INNAME=$PISM_DATANAME 72 73 # coupler settings 74 COUPLER="-surface given -surface_given_file $PISM_DATANAME" 75 COUPLER_FORCING="-surface given,forcing -surface_given_file $PISM_DATANAME" 76 77 # force-to-thickness 78 FTALPHA=0.05 79 80 # grid parameters 81 FINEGRID="-periodicity y -Mx 792 -My 3 -Mz 201 -Lz 300 -z_spacing equal" # 5 m grid 82 FS=5 83 FINESKIP=5000 84 COARSEGRID="-periodicity y -Mx 114 -My 3 -Mz 101 -Lz 500 -z_spacing equal" # 35 m grid 85 CS=35 86 COARSESKIP=1000 87 88 GRID=$COARSEGRID 89 SKIP=$COARSESKIP 90 GS=$CS 91 echo "" 92 if [ $# -gt 1 ] ; then 93 if [ $2 -eq "2" ] ; then # if user says "psg_flowline.sh N 1" then use 5m grid: 94 echo "$SCRIPTNAME grid: ALL RUNS ON $FS m" 95 echo "$SCRIPTNAME WARNING: VERY LARGE COMPUTATIONAL TIME" 96 GRID=$FINEGRID 97 SKIP=$FINESKIP 98 GS=$FS 99 fi 100 else 101 echo "$SCRIPTNAME grid: ALL RUNS ON $CS m" 102 fi 103 echo "" 104 105 106 107 EB="-sia_e 0.3" 108 109 #PARAMS="-pseudo_plastic -pseudo_plastic_q 0.75 -pseudo_plastic_uthreshold 10.0 -yield_stress mohr_coulomb -plastic_phi 40.0" 110 PARAMS="-pseudo_plastic -pseudo_plastic_q 0.25 -pseudo_plastic_uthreshold 100.0 -yield_stress mohr_coulomb -plastic_phi 40.0" 111 112 PETSCSTUFF="-ssafd_ksp_type gmres -ssafd_ksp_norm_type unpreconditioned -ssafd_ksp_pc_side right -ssafd_pc_type asm -ssafd_sub_pc_type lu" 113 114 115 FULLPHYS="-stress_balance ssa+sia $PARAMS $PETSCSTUFF" 116 117 SMOOTHRUNLENGTH=1 118 NOMASSRUNLENGTH=500 119 120 STEP=1 121 122 EXVARS="enthalpybase,temppabase,tempicethk,bmelt,tillwat,usurf,velsurf_mag,mask,hardav,thk" # add mask, so that check_stationarity.py ignores ice-free areas. 123 124 PREFIX=psg_flowline_ 125 126 # bootstrap and do smoothing run to 1 year 127 OUTNAME=$PREFIX${GS}m_pre$SMOOTHRUNLENGTH.nc 128 echo 129 echo "$SCRIPTNAME bootstrapping plus short smoothing run for ${SMOOTHRUNLENGTH}a" 130 cmd="$PISM_MPIDO $NN $PISM $EB -skip -skip_max $SKIP -i $INNAME -bootstrap $GRID \ 131 $COUPLER -y ${SMOOTHRUNLENGTH} -o $OUTNAME" 132 $PISM_DO $cmd 133 134 # run with -no_mass (no surface change) 135 INNAME=$OUTNAME 136 OUTNAME=$PREFIX${GS}m_steady.nc 137 EXNAME=ex_${OUTNAME} 138 EXTIMES=0:25:${NOMASSRUNLENGTH} 139 echo 140 echo "$SCRIPTNAME -no_mass (no surface change) sia run to achieve approximate enthalpy equilibrium, for ${NOMASSRUNLENGTH}a" 141 cmd="$PISM_MPIDO $NN $PISM $EB -i $INNAME $COUPLER \ 142 -no_mass -y ${NOMASSRUNLENGTH} \ 143 -extra_file $EXNAME -extra_vars $EXVARS -extra_times $EXTIMES -o $OUTNAME" 144 $PISM_DO $cmd 145 146 147 # use the force-to-thickness mechanism to infer the mass balance 148 STARTYEAR=0 149 RUNLENGTH=10 150 ENDTIME=$(($STARTYEAR + $RUNLENGTH)) 151 INNAME=$OUTNAME 152 OUTNAME=ssa_ftt_${RUNLENGTH}a.nc 153 OUTNAMEFULL=$PREFIX${GS}m_$OUTNAME 154 TSNAME=ts_${OUTNAME} 155 TSTIMES=$STARTYEAR:$STEP:$ENDTIME 156 157 # create the force-to-thickness mask 158 ncap2 -O -s "ftt_mask = 0*mask+1" $INNAME $INNAME 159 160 echo 161 echo "$SCRIPTNAME SSA run with force-to-thickness for $RUNLENGTH years on ${GS}m grid" 162 cmd="$PISM_MPIDO $NN $PISM -bootstrap $GRID -i $INNAME -regrid_file $INNAME $EB -skip -skip_max $SKIP $COUPLER_FORCING $FULLPHYS\ 163 -force_to_thickness_file $INNAME -force_to_thickness_alpha $FTALPHA \ 164 -ts_file $TSNAME -ts_times $TSTIMES \ 165 -ys $STARTYEAR -y $RUNLENGTH -o_size big -o $OUTNAMEFULL" 166 $PISM_DO $cmd 167 echo 168 $PISM_DO flowline.py -c -o $OUTNAME $OUTNAMEFULL 169 170 171 COUPLER_ELEV="-surface elevation -ice_surface_temp -6,0,1395,1400 -climatic_mass_balance -3,2.5,1200,1450,1615 -climatic_mass_balance_limits -3,0" 172 173 STARTYEAR=0 174 RUNLENGTH=25 175 ENDTIME=$(($STARTYEAR + $RUNLENGTH)) 176 INNAME=$OUTNAMEFULL 177 OUTNAME=ssa_${RUNLENGTH}a.nc 178 OUTNAMEFULL=$PREFIX${GS}m_$OUTNAME 179 TSNAME=ts_${OUTNAMEFULL} 180 EXNAME=ex_${OUTNAMEFULL} 181 TSTIMES=$STARTYEAR:$STEP:$ENDTIME 182 EXTIMES=$STARTYEAR:$STEP:$ENDTIME 183 184 echo 185 echo "$SCRIPTNAME SSA run with elevation-dependent mass balance for $RUNLENGTH years on ${GS}m grid" 186 cmd="$PISM_MPIDO $NN $PISM $EB -skip -skip_max $SKIP -i $INNAME $COUPLER_ELEV $FULLPHYS \ 187 -ts_file $TSNAME -ts_times $TSTIMES \ 188 -extra_file $EXNAME -extra_vars $EXVARS -extra_times $EXTIMES \ 189 -ys $STARTYEAR -y $RUNLENGTH -o_size big -o $OUTNAMEFULL" 190 $PISM_DO $cmd 191 echo 192 $PISM_DO flowline.py -c -o $OUTNAME $OUTNAMEFULL