URI: 
       tpsg_3d.sh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
  HTML git clone git://src.adamsgaard.dk/pism
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
       tpsg_3d.sh (5208B)
       ---
            1 #!/bin/bash
            2 
            3 # Copyright (C) 2011, 2012, 2014, 2018 Andy Aschwanden and Ed Bueler
            4 
            5 set -e # exit on error
            6 
            7 echo "# PISM Storglaciaren 3d Model"
            8 
            9 if [ -n "${SCRIPTNAME:+1}" ] ; then
           10   echo "[SCRIPTNAME=$SCRIPTNAME (already set)]"
           11   echo ""
           12 else
           13   SCRIPTNAME="#(psg_3d.sh)"
           14 fi
           15 
           16 NN=2  # default number of processors
           17 if [ $# -gt 0 ] ; then  # if user says "psg_flowline.sh 8" then NN = 8
           18   NN="$1"
           19 fi
           20 
           21 echo "$SCRIPTNAME              NN = $NN"
           22 
           23 # set MPIDO if using different MPI execution command, for example:
           24 #  $ export PISM_MPIDO="aprun -n "
           25 if [ -n "${PISM_MPIDO:+1}" ] ; then  # check if env var is already set
           26   echo "$SCRIPTNAME      PISM_MPIDO = $PISM_MPIDO  (already set)"
           27 else
           28   PISM_MPIDO="mpiexec -n "
           29   echo "$SCRIPTNAME      PISM_MPIDO = $PISM_MPIDO"
           30 fi
           31 
           32 # check if env var PISM_DO was set (i.e. PISM_DO=echo for a 'dry' run)
           33 if [ -n "${PISM_DO:+1}" ] ; then  # check if env var DO is already set
           34   echo "$SCRIPTNAME         PISM_DO = $PISM_DO  (already set)"
           35 else
           36   PISM_DO=""
           37 fi
           38 
           39 # prefix to pism (not to executables)
           40 if [ -n "${PISM_PREFIX:+1}" ] ; then  # check if env var is already set
           41   echo "$SCRIPTNAME     PISM_PREFIX = $PISM_PREFIX  (already set)"
           42 else
           43   PISM_PREFIX=""    # just a guess
           44   echo "$SCRIPTNAME     PISM_PREFIX = $PISM_PREFIX"
           45 fi
           46 
           47 # set PISM_EXEC if using different executables, for example:
           48 #  $ export PISM_EXEC="pismr -energy cold"
           49 if [ -n "${PISM_EXEC:+1}" ] ; then  # check if env var is already set
           50   echo "$SCRIPTNAME       PISM_EXEC = $PISM_EXEC  (already set)"
           51 else
           52   PISM_EXEC="pismr"
           53   echo "$SCRIPTNAME       PISM_EXEC = $PISM_EXEC"
           54 fi
           55 
           56 echo
           57 
           58 PCONFIG=psg_config.nc
           59 
           60 # cat prefix and exec together
           61 PISM="${PISM_PREFIX}${PISM_EXEC} -config_override $PCONFIG"
           62 
           63 
           64 DATANAME=storglaciaren_3d.nc
           65 PISM_DATANAME=pism_$DATANAME
           66 INNAME=$PISM_DATANAME
           67 
           68 EB="-sia_e 0.3"
           69 PARAMS="-plastic_phi 40"
           70 FULLPHYS="-stress_balance ssa+sia -thk_eff $PARAMS"
           71 COUPLER="-surface given" # FIXME  should be using PSElevation as in flowline example
           72 COUPLER_FORCING="-surface given,forcing -surface_given_file $PISM_DATANAME"
           73 
           74 # 40 m grid
           75 GRID="-Mx 94 -My 51 -Mz 151 -Mbz 1 -Lz 300 -z_spacing equal"
           76 GS=40
           77 SKIP=200
           78 
           79 # 20 m grid
           80 #GRID="-Mx 186 -My 101 -Mz 301 -Mbz 1 -Lz 300 -z_spacing equal"
           81 #GS=20
           82 #SKIP=500
           83 
           84 # 10 m grid
           85 #GRID="-Mx 371 -My 201 -Mz 301 -Mbz 1 -Lz 300 -z_spacing equal"
           86 #GS=10
           87 #SKIP=500
           88 
           89 # bootstrap and do smoothing run
           90 OUTNAME=psg_3d_${GS}m_pre1.nc
           91 echo
           92 echo "$SCRIPTNAME  bootstrapping plus short smoothing run for 1 a"
           93 cmd="$PISM_MPIDO $NN $PISM -skip -skip_max $SKIP -bootstrap -i $INNAME $GRID \
           94   $COUPLER -y 1 -o $OUTNAME"
           95 $PISM_DO $cmd
           96 
           97 # FIXME:  reasonable to run SIA somewhat longer to equilibrium to establish stable thermodynamical state before any attempt to invert surface velocities; this is the start of it
           98 # FIXME:  also reasonable to use hybrid model with ad hoc specification of basal yield stress
           99 INNAME=$OUTNAME
          100 #incSTEADYNAME=inc_psg_3d_${GS}m_Tsteady.nc  # FIXME: missing a field because of bug
          101 STEADYNAME=psg_3d_${GS}m_steady.nc
          102 echo
          103 echo "$SCRIPTNAME  running toward thermodynamical steady state"
          104 cmd="$PISM_MPIDO $NN $PISM -i $INNAME \
          105   $COUPLER -y 500 -no_mass -o $STEADYNAME"
          106 $PISM_DO $cmd
          107 
          108 echo
          109 echo "$SCRIPTNAME  done"
          110 
          111 # We use the force-to-thickness mechanism to infer the mass balance
          112 
          113 STARTYEAR=0
          114 RUNLENGTH=100
          115 ENDTIME=$(($STARTYEAR + $RUNLENGTH))
          116 INNAME=$OUTNAME
          117 OUTNAME=ssa_ftt_${RUNLENGTH}a.nc
          118 OUTNAMEFULL=$PREFIX${GS}m_$OUTNAME
          119 TSNAME=ts_${OUTNAME}
          120 EXNAME=ex_${OUTNAME}
          121 TSSTEP=yearly
          122 EXSTEP=yearly
          123 EXVARS="usurf,taud_mag,topg,tauc,taud,beta,mask,thk,temppabase,tempicethk_basal,velbase_mag,velsurf_mag,climatic_mass_balance,tillphi"
          124 
          125 echo
          126 echo "$SCRIPTNAME  SSA run with force-to-thickness for $RUNLENGTH years on ${GS}m grid"
          127 cmd="$PISM_MPIDO $NN $PISM $EB -skip -skip_max $SKIP -bootstrap -i $INNAME $GRID \
          128      -regrid_file $INNAME $COUPLER_FORCING $FULLPHYS \
          129      -surface.force_to_thickness_file $PISM_DATANAME \
          130      -ts_file $TSNAME -ts_times $TSSTEP \
          131      -extra_file $EXNAME -extra_times $EXSTEP -extra_vars $EXVARS \
          132      -ys $STARTYEAR -y $RUNLENGTH -o_size big -o $OUTNAMEFULL"
          133 $PISM_DO $cmd
          134 echo
          135 
          136 COUPLER_ELEV="-surface elevation,forcing -surface.force_to_thickness_file $PISM_DATANAME -ice_surface_temp -6,0,1395,1400 -climatic_mass_balance -3,2.5,1200,1450,1615 -climatic_mass_balance_limits -3,2 "
          137 
          138 PARAMS="-pseudo_plastic -pseudo_plastic_q 0.5 -pseudo_plastic_uthreshold 5.0 -yield_stress mohr_coulomb -topg_to_phi 10,40,1000,1500 -sia_e 0.1"
          139 #PETSCSTUFF="-ssafd_ksp_type gmres -ssafd_ksp_norm_type unpreconditioned -ssafd_ksp_pc_side right -ssafd_pc_type asm -ssafd_sub_pc_type lu"
          140 FULLPHYS="-stress_balance ssa+sia $PARAMS"
          141 
          142 STARTYEAR=0
          143 RUNLENGTH=100
          144 ENDTIME=$(($STARTYEAR + $RUNLENGTH))
          145 INNAME=$OUTNAMEFULL
          146 OUTNAME=ssa_${RUNLENGTH}a.nc
          147 OUTNAMEFULL=$PREFIX${GS}m_$OUTNAME
          148 TSNAME=ts_${OUTNAMEFULL}
          149 EXNAME=ex_${OUTNAMEFULL}
          150 
          151 echo
          152 echo "$SCRIPTNAME  SSA run with elevation-dependent mass balance for $RUNLENGTH years on ${GS}m grid"
          153 cmd="$PISM_MPIDO $NN $PISM $EB -skip -skip_max $SKIP -i $INNAME $COUPLER_ELEV $FULLPHYS \
          154      -ts_file $TSNAME -ts_times $TSSTEP \
          155      -extra_file $EXNAME -extra_vars $EXVARS -extra_times $EXSTEP \
          156      -ys $STARTYEAR -y $RUNLENGTH -o_size medium -o $OUTNAMEFULL"
          157 $PISM_DO $cmd
          158 echo