New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
new_sette_rpt.sh in trunk/NEMOGCM/SETTE – NEMO

source: trunk/NEMOGCM/SETTE/new_sette_rpt.sh @ 8839

Last change on this file since 8839 was 8839, checked in by clevy, 6 years ago

take in account AGRIF code corruption test and add nn_fsbc =1 for SAS, ticket #1983

  • Property svn:executable set to *
File size: 11.6 KB
Line 
1#!/bin/bash -f
2#set -vx
3#
4# simple SETTE report generator.
5#
6# This version should be run in the SETTE directory.
7# The machine name will be picked up from the sette.sh script but the location of the
8# validation directory needs to be set here (currently assumed to reside in the ../CONFIG directory)
9#
10#########################################################################################
11######################### Start of function definitions #################################
12##
13
14function restfile() {
15# Rebuild ice restart for SAS CONFIG, and restartability checks. Expects LONG and SHORT run directories.
16# For Stand Alone Surface configuration ocean is not running, just run ice model; so no outputs ocean files.
17# Compares LONG rebuild restart ice file with equivalent entry from the SHORT rebuild restart ice file.
18#
19  vdir=$1
20  nam=$2
21  pass=$3
22#
23  if [ -d $vdir/$nam ]; then
24    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l `
25    dorv=`echo $dorv | sed -e 's:.*/::'`
26    rep1=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -2l | head -1 `
27    rep2=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -1l`
28    cd ${SAS_RESTART_DIR}/LONG
29    #SF add here compilation of rebuild_tools to rebuild restart files, and add comparison of restart files
30    cd ${TOOLS_DIR}
31    ./maketools -n REBUILD_NEMO -m ${mach} > /dev/null 2>&1
32    cd ${TOOLS_DIR}/REBUILD_NEMO
33    #SF echo "REBUILD LONG restart SAS files, without standard output"
34    ./rebuild_nemo -t 4 ../../CONFIG/SAS_ST/LONG/SAS_00000240_restart_ice  $NPROC > /dev/null 2>&1
35    #SF echo "REBUILD SHORT restart SAS files, without standard output"
36    ./rebuild_nemo -t 4 ../../CONFIG/SAS_ST/SHORT/SAS_00000240_restart_ice $NPROC >&-
37    cd ${SAS_RESTART_DIR}/LONG
38    #SF echo "COPY rebuild restart files"
39    cp SAS_00000240_restart_ice.nc $vdir/$nam/$mach/$dorv/LONG/.
40    cp ../SHORT/SAS_00000240_restart_ice.nc $vdir/$nam/$mach/$dorv/SHORT/.
41
42    f1o=$vdir/$nam/$mach/$dorv/LONG/SAS_00000240_restart_ice.nc
43    f2o=$vdir/$nam/$mach/$dorv/SHORT/SAS_00000240_restart_ice.nc
44    if  [ ! -f $f1o ] &&  [ ! -f $f2o ] ; then
45      printf "%-20s %s\n" $nam " REBUILD SAS restart ice DOES NOT exists; incomplete test";
46      return;
47    fi
48    #
49    done_oce=0
50    #
51    if  [  -f $f1o ] && [  -f $f2o ]; then
52      cmp -s $f1o $f2o 
53      #SF  cmp SAS_00000240_restart_ice.nc  ../SHORT/SAS_00000240_restart_ice.nc  > diff_restart.txt
54      if [ $? == 0 ]; then
55        if [ $pass == 0 ]; then
56          printf "%-20s %s %s\n" $nam  " SAS restart files are IDENTICAL :  passed : " $dorv
57        fi
58      else
59        printf "%-20s %s %s\n" $nam  " SAS restart files are DIFFERENT : FAILED : " $dorv 
60        #
61   # Offer view of differences on the second pass
62   #
63        if [ $pass == 1 ]; then
64          echo "BE CAREFUL:  NEED cdo to see differences!!!!! "
65          echo "DO which cdo and replace cdo PATH to the cdo command in SETTE_rpt.sh "
66          echo "IF cdo is not available you need to do difference of netcdf file by hand"
67          echo "<return> to view restart_ice.nc differences"
68          read y
69          cdo -diffv $f1o $f2o
70          done_oce=1
71          #echo "<return> to continue"
72          #read y
73        fi
74      fi
75    fi
76#
77fi
78}
79
80function resttest() { 
81#
82# Restartability checks. Expects LONG and SHORT run directories
83# Compares end of LONG stat files with equivalent entries from the SHORT stat files.
84#
85  vdir=$1
86  nam=$2
87  pass=$3
88#
89  if [ -d $vdir/$nam ]; then
90    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l `
91    dorv=`echo $dorv | sed -e 's:.*/::'`
92    f1o=$vdir/$nam/$mach/$dorv/LONG/ocean.output
93    f1s=$vdir/$nam/$mach/$dorv/LONG/solver.stat
94    f1t=$vdir/$nam/$mach/$dorv/LONG/tracer.stat
95    f2o=$vdir/$nam/$mach/$dorv/SHORT/ocean.output
96    f2s=$vdir/$nam/$mach/$dorv/SHORT/solver.stat
97    f2t=$vdir/$nam/$mach/$dorv/SHORT/tracer.stat
98
99    if  [ ! -f $f1s ] &&  [ ! -f $f1t ] ; then
100      printf "%-20s %s\n" $nam " incomplete test";
101      return;
102    fi
103    if  [ ! -f $f2s ] &&  [ ! -f $f2t ] ; then
104      printf "%-20s %s\n" $nam " incomplete test";
105      return;
106    fi
107#
108    done_oce=0
109
110    if  [  -f $f1s ] && [  -f $f2s ]; then
111      nl=(`wc -l $f2s`)
112      tail -${nl[0]} $f1s > f1.tmp$$
113      cmp -s f1.tmp$$ $f2s
114      if [ $? == 0 ]; then
115        if [ $pass == 0 ]; then
116          printf "%-20s %s %s\n" $nam  " solver.stat restartability  passed : " $dorv
117        fi
118      else
119        printf "%-20s %s %s\n" $nam  " solver.stat restartability  FAILED : " $dorv 
120#
121# Offer view of differences on the second pass
122#
123        if [ $pass == 1 ]; then
124          echo "<return> to view solver.stat differences"
125          read y
126          sdiff f1.tmp$$ $f2s
127          echo "<return> to view ocean.output differences"
128          read y
129          sdiff $f1o $f2o | grep "|"
130          done_oce=1
131          echo "<return> to continue"
132          read y
133        fi
134      fi
135    fi
136#
137# Check tracer.stat files (if they exist)
138#
139    if  [  -f $f1t ] && [  -f $f2t ]; then
140      nl=(`wc -l $f2t`)
141      tail -${nl[0]} $f1t > f1.tmp$$
142      cmp -s f1.tmp$$ $f2t
143      if [ $? == 0 ]; then
144        if [ $pass == 0 ]; then
145          printf "%-20s %s %s\n" $nam  " tracer.stat restartability  passed : " $dorv
146        fi
147      else
148        printf "%-20s %s %s\n" $nam  " tracer.stat restartability  FAILED : " $dorv 
149#
150# Offer view of differences on the second pass
151#
152        if [ $pass == 1 ]; then
153          echo "<return> to view tracer.stat differences"
154          read y
155          sdiff f1.tmp$$ $f2t
156#
157# Only offer ocean.output view if it has not been viewed previously
158#
159          if [ $done_oce == 0 ]; then
160            echo "<return> to view ocean.output differences"
161            read y
162            sdiff $f1o $f2o | grep "|"
163          fi
164          echo "<return> to continue"
165          read y
166        fi
167      fi
168    fi
169    rm f1.tmp$$
170  fi
171}
172function reprotest(){
173#
174# Reproducibility checks. Expects REPRO_N_M and REPRO_I_J run directories
175# Compares end of stat files from each
176#
177  vdir=$1
178  nam=$2
179  pass=$3
180#
181  if [ -d $vdir/$nam ]; then
182    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l `
183    dorv=`echo $dorv | sed -e 's:.*/::'`
184    rep1=`ls -1rt $vdir/$nam/$mach/$dorv/ | grep REPRO | tail -2l | head -1 `
185    rep2=`ls -1rt $vdir/$nam/$mach/$dorv/ | grep REPRO | tail -1l`
186    f1o=$vdir/$nam/$mach/$dorv/$rep1/ocean.output
187    f1s=$vdir/$nam/$mach/$dorv/$rep1/solver.stat
188    f1t=$vdir/$nam/$mach/$dorv/$rep1/tracer.stat
189    f2o=$vdir/$nam/$mach/$dorv/$rep2/ocean.output
190    f2s=$vdir/$nam/$mach/$dorv/$rep2/solver.stat
191    f2t=$vdir/$nam/$mach/$dorv/$rep2/tracer.stat
192
193    if  [ ! -f $f1s ] && [ ! -f $f1t ] ; then
194      printf "%-20s %s\n" $nam " incomplete test";
195      return;
196    fi
197    if  [ ! -f $f2s ] && [ ! -f $f2t ] ; then
198      printf "%-20s %s\n" $nam " incomplete test";
199      return;
200    fi
201#
202    done_oce=0
203
204    if  [ -f $f1s ] && [ -f $f2s ] ; then
205      cmp -s $f1s $f2s
206      if [ $? == 0 ]; then
207        if [ $pass == 0 ]; then 
208          printf "%-20s %s %s\n" $nam  " solver.stat reproducibility passed : " $dorv
209        fi
210      else
211        printf "%-20s %s %s\n" $nam  " solver.stat reproducibility FAILED : " $dorv
212#
213# Offer view of differences on the second pass
214#
215        if [ $pass == 1 ]; then
216          echo "<return> to view solver.stat differences"
217          read y
218          sdiff f1.tmp$$ $f2s
219          echo "<return> to view ocean.output differences"
220          read y
221          sdiff $f1o $f2o | grep "|"
222          done_oce=1
223          echo "<return> to continue"
224          read y
225        fi
226      fi
227    fi
228#
229# Check tracer.stat files (if they exist)
230#
231    if  [ -f $f1t ] && [ -f $f2t ] ; then
232      cmp -s $f1t $f2t
233      if [ $? == 0 ]; then
234        if [ $pass == 0 ]; then           printf "%-20s %s %s\n" $nam  " tracer.stat reproducibility passed : " $dorv
235        fi
236      else
237        printf "%-20s %s %s\n" $nam  " tracer.stat reproducibility  FAILED : " $dorv
238#
239# Offer view of differences on the second pass
240#
241        if [ $pass == 1 ]; then
242          echo "<return> to view tracer.stat differences"
243          read y
244          sdiff $f1t $f2t
245#
246# Only offer ocean.output view if it has not been viewed previously
247#
248          if [ $done_oce == 0 ]; then
249            echo "<return> to view ocean.output differences"
250            read y
251            sdiff $f1o $f2o | grep "|"
252          fi
253          echo "<return> to continue"
254          read y
255        fi
256      fi
257    fi
258  fi
259}
260
261function identictest(){
262#
263#  checks AGRIF does not corrupe results with no AGRIF zoom. Expects ORCA2AGUL/AGRIFNOZ and ORCA2AGUL_NAGR/AGRIFNO  run directories
264# Compares solver.stat files for each
265#
266  vdir=$1
267  dir1=$2
268  dir2=$3
269  pass=$4
270#
271  if [ -d $vdir/$dir1 ] && [ -d $vdir/$dir2 ]; then
272    dorv1=`ls -1rt $vdir/$dir1/$mach/ | tail -1l `
273    dorv1=`echo $dorv1 | sed -e 's:.*/::'`
274    dorv2=`ls -1rt $vdir/$dir2/$mach/ | tail -1l `
275    dorv2=`echo $dorv2 | sed -e 's:.*/::'`
276
277    rep1=`ls -1rt $vdir/$dir1/$mach/$dorv1/ |  tail -2l | head -1 `
278    rep2=`ls -1rt $vdir/$dir2/$mach/$dorv2/ |  tail -1l`
279    f1s=$vdir/$dir1/$mach/$dorv1/$rep1/solver.stat
280    f2s=$vdir/$dir2/$mach/$dorv2/$rep2/solver.stat
281
282    if  [ ! -f $f1s ] && [ ! -f $f2s ] ; then
283      printf "%-20s %s\n" $dir1 $dir2 " incomplete test";
284      return;
285    fi
286#
287    done_oce=0
288
289    if  [ -f $f1s ] && [ -f $f2s ] ; then
290      cmp -s $f1s $f2s
291      if [ $? == 0 ]; then
292        if [ $pass == 0 ]; then
293          printf "%-20s %s %s %s %s\n" $rep1 $rep2  " AGRIF: solver.stat unchanged - test  passed : " $dorv1 $dorv2
294        fi
295      else
296        printf "%-20s %s %s %s %s\n" $rep1 $rep2  " for AGRIF, solver.stat test FAILED : " $dorv1 $dorv2
297#
298# Offer view of differences on the second pass
299#
300        if [ $pass == 1 ]; then
301          echo "<return> to view solver.stat differences"
302          read y
303          sdiff $f1s $f2s
304          done_oce=1
305          echo "<return> to continue"
306          read y
307        fi
308      fi
309    fi
310  else
311    printf "%-20s %s\n" $dir1 $dir2 " incomplete test";
312  fi
313}
314########################### END of function definitions #################################
315##                                                                                     ##
316##    Main script                                                                      ##
317##                                                                                     ##
318#########################################################################################
319#
320  mach=`grep "COMPILER=" ./sette.sh | sed -e 's/COMPILER=//'`
321  NEMO_VALID=`grep "NEMO_VALIDATION_DIR=" ./param.cfg | sed -e 's/NEMO_VALIDATION_DIR=//'`
322# Directory to run the tests
323 SETTE_DIR=$(cd $(dirname "$0"); pwd)
324 MAIN_DIR=$(dirname $SETTE_DIR)
325 CONFIG_DIR0=${MAIN_DIR}/CONFIG
326 TOOLS_DIR=${MAIN_DIR}/TOOLS
327 COMPIL_DIR=${TOOLS_DIR}/COMPILE
328 NPROC=32
329
330  SAS_RESTART_DIR=${CONFIG_DIR0}/SAS_ST
331#
332  if [ ! -d $NEMO_VALID ]; then
333    echo "$NEMO_VALID validation directory not found"
334    exit
335  fi
336#
337
338# The script also needs the date or revision tag. Currently this is taken from the latest sub-directory found in each directory
339
340for pass in  0 1
341do
342#
343 if [ $pass == 1 ]; then echo "---------------2nd pass------------------";fi
344#
345
346# Rebuild and restartability test for SAS
347#
348 for restart_file in WSAS_ST
349 do
350   restfile $NEMO_VALID $restart_file $pass
351 done
352#
353# Restartability test
354#
355 for restart_test in WGYREPIS_ST WORCA2LIM3PIS_ST WORCA2OFFPIS_ST WAMM12_ST WISOMIP_ST WORCA2AGR_ST
356 do
357   resttest $NEMO_VALID $restart_test $pass
358 done
359#
360# Reproducibility tests
361#
362 for repro_test in WGYREPIS_ST WORCA2LIM3PIS_ST WORCA2OFFPIS_ST WAMM12_ST WISOMIP_ST WORCA2_LIM3_OBS_ST WORCA2AGR_ST
363 do
364   reprotest $NEMO_VALID $repro_test $pass
365 done
366
367
368
369# AGRIF special check
370 dir1=WORCA2AGUL_NOZOOM_ST
371 dir2=WORCA2AGUL_NOAGR_ST
372 identictest $NEMO_VALID $dir1 $dir2 $pass 
373
374
375done
376#
377## Additional checks for ORCA2AGUL/FIRST standalone AGRIF test
378## still to be added
379
380
381
382exit
Note: See TracBrowser for help on using the repository browser.