Alpine3D

Alpine3D Svn Source Tree

Root/trunk/tests/simple/run_simple.sh

  • Property svn:executable set to *
1#!/bin/bash
2#This runs a very simple Alpine3D simulation (reduced DEM compared to Stillberg) and
3#compares the results with a reference dataset
4
5# Print a special line to prevent CTest from truncating the test output
6printf "CTEST_FULL_OUTPUT (line required by CTest to avoid output truncation)\n\n"
7
8rm -f output/5_*; rm -f output/grids/20*; rm -f output/snowfiles/*
9
10#setup the simulation
11BEGIN="2014-10-01T01:00"
12END="2014-12-31T00:00"
13PROG_ROOTDIR=../../bin
14export DYLD_FALLBACK_LIBRARY_PATH=${PROG_ROOTDIR}:${DYLD_FALLBACK_LIBRARY_PATH}#for osX
15export LD_LIBRARY_PATH=${PROG_ROOTDIR}:${LD_LIBRARY_PATH}#for Linux
16
17#now run the simulation
18date
19../../bin/alpine3d --iofile=./io.ini --enable-eb --np-ebalance=2 --np-snowpack=2 --startdate=${BEGIN} --enddate=${END} > stdouterr.log 2>&1
20ret=$?
21date
22if [ "$ret" -eq "0" ]; then
23echo "Done Alpine3D Simulation"
24else
25echo "fail : Alpine3D did not complete properly! Return code=$ret"
26fi
27
28#stop here when re-generating the reference files
29#exit
30
31#Compare the results with the reference data
32PREC="1e-3"
33rm -f output_ref/5_2_dischma.met
34bunzip2 -k output_ref/5_2_dischma.met.bz2
35#sed -i '11d' output_ref/5_2_dischma.met; sed -i '11d' output/5_2_dischma.met
36numdiff -s', \t\n' -r ${PREC} --speed-large-files output_ref/5_2_dischma.met output/5_2_dischma.met | grep "+++"
37rm -f output_ref/5_2_dischma.met
38
39rm -f output_ref/5_2_dischma.pro
40bunzip2 -k output_ref/5_2_dischma.pro.bz2
41#sed -i '10d' output_ref/5_2_dischma.pro; sed -i '10d' output/5_2_dischma.pro
42numdiff -s', \t\n' -r ${PREC} --speed-large-files output_ref/5_2_dischma.pro output/5_2_dischma.pro | grep "+++"
43rm -f output_ref/5_2_dischma.pro
44
45rm -f output_ref/5_2_dischma_meteo.smet
46bunzip2 -k output_ref/5_2_dischma_meteo.smet.bz2
47sed -i '16,17d' output_ref/5_2_dischma_meteo.smet; sed -i '16,17d' output/5_2_dischma_meteo.smet
48numdiff -s', \t\n' -r ${PREC} --speed-large-files output_ref/5_2_dischma_meteo.smet output/5_2_dischma_meteo.smet | grep "+++"
49rm -f output_ref/5_2_dischma_meteo.smet
50
51for fichier in $(ls output_ref/grids/2014*); do
52name=$(basename ${fichier})
53numdiff -s', \t\n' -r ${PREC} --speed-large-files output_ref/grids/${name} output/grids/${name} | grep "+++"
54done
55
56#cleanup, but keep the POI and one timestep of grids for further testing
57rm -f output/snowfiles/*
58ls output/grids/2014* | grep -v "201412231200" | xargs -i rm {}

Archive Download this file

Revision: HEAD