tvertical_grid_expansion.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
       ---
       tvertical_grid_expansion.sh (1398B)
       ---
            1 #!/bin/bash
            2 
            3 echo "Vertical grid expansion."
            4 PISM_PATH=$1
            5 MPIEXEC=$2
            6 
            7 files="input-vertical-grid.nc fixed-vertical-grid.nc ok-vertical-grid.nc too-short-vertical-grid_max_thickness.nc"
            8 
            9 short_grid="-Lz 1000 -Mz 11 -z_spacing equal"
           10 tall_grid="-Lz 2000 -Mz 21 -z_spacing equal"
           11 
           12 set -x
           13 set -e
           14 
           15 rm -f $files
           16 
           17 # create an input file
           18 ${PISM_PATH}/pisms -y 0 -o input-vertical-grid.nc ${short_grid}
           19 
           20 # run in two steps: using the short grid and then re-starting with a better one
           21 set +e
           22 ${PISM_PATH}/pismr -i input-vertical-grid.nc -bootstrap ${short_grid} \
           23         -y 3e3 \
           24         -o too-short-vertical-grid.nc
           25 set -e
           26 ${PISM_PATH}/pismr -i too-short-vertical-grid_max_thickness.nc -bootstrap \
           27         -regrid_file too-short-vertical-grid_max_thickness.nc -allow_extrapolation \
           28         ${tall_grid} \
           29         -ye 3e3 \
           30         -o fixed-vertical-grid.nc
           31 
           32 # run using the tall grid right away
           33 ${PISM_PATH}/pismr -i input-vertical-grid.nc -bootstrap \
           34         ${tall_grid} \
           35         -y 3e3 \
           36         -o ok-vertical-grid.nc
           37 
           38 # compare results (use relative tolerance)
           39 $PISM_PATH/nccmp.py -x -v timestamp -r -t 1e-7 fixed-vertical-grid.nc ok-vertical-grid.nc
           40 if [ $? != 0 ];
           41 then
           42     exit 1
           43 fi
           44 
           45 # compare results again (some variables should match exactly)
           46 $PISM_PATH/nccmp.py -v thk,enthalpy fixed-vertical-grid.nc ok-vertical-grid.nc
           47 if [ $? != 0 ];
           48 then
           49     exit 1
           50 fi
           51 
           52 # clean up
           53 rm -f $files; exit 0