ttest_12.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
---
ttest_12.sh (1115B)
---
1 #!/bin/bash
2
3 set -x
4
5 PISM_PATH=$1
6 MPIEXEC=$2
7
8 # Test name:
9 echo "Test #12: mass conservation within rounding error (SIA moving margin)."
10 # The list of files to delete when done.
11 files="verify-12.nc ice_volume-12.nc"
12
13 rm -f $files
14 GRID="-Mx 31 -My 31 -Mz 31 -y 5000 -ys 1000"
15 OPTS="-test B -max_dt 25 -o_size small"
16 TS_OPTS="-ts_file ice_volume-12.nc -ts_vars ice_volume -ts_times 1000:25:1e4"
17 # run test B
18
19 set -x
20
21 $MPIEXEC -n 2 $PISM_PATH/pismv -test B $GRID $OPTS $TS_OPTS
22
23 set +x
24
25 /usr/bin/env python3 <<EOF
26 from numpy import diff, log10, floor
27 from sys import exit
28 try:
29 from netCDF3 import Dataset
30 except:
31 from netCDF4 import Dataset
32
33 nc = Dataset("ice_volume-12.nc", 'r')
34 volume = nc.variables['ice_volume'][:]
35 volume_max = volume.max()
36 threshold = 10**(floor(log10(volume_max)) - 14) # 14 digits of accuracy
37 diff_max = diff(volume).max()
38
39 if diff_max < threshold:
40 print("diff(volume).max() = %f, threshold = %f" % (diff_max, threshold))
41 exit(0)
42 else:
43 print("diff(volume).max() = %f > %f" % (diff_max, threshold))
44 exit(1)
45 EOF
46
47 if [ $? != 0 ];
48 then
49 exit 1
50 fi
51
52 rm -f $files; exit 0
53