/[MITgcm]/MITgcm_contrib/jmc_script/tst_2+2_cpl
ViewVC logotype

Diff of /MITgcm_contrib/jmc_script/tst_2+2_cpl

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6 by jmc, Mon Sep 14 18:52:21 2009 UTC revision 1.7 by jmc, Sat Dec 26 23:43:22 2009 UTC
# Line 65  else Line 65  else
65   NiAt=0   NiAt=0
66  fi  fi
67    
68  case $# in  #- parse options:
69    1) ;;  CMD='run_cpl_test'
70     *) echo "Usage: `basename $0` flag"  MTH=
71        echo " Check restart of coupled set-up: compare 1 run of 2 x $Nit it long"  argList=$*
72        echo "                       with 2 consecutive runs of $Nit it long each"  for xx in $argList
73        echo " where: flag = 0 -> prepare for 1rst run"  do
74        echo "        flag = 1 -> move res. after 1rst run & prepare for 2nd"   if test $xx = '-mth' ; then MTH=$xx ; shift ; continue ; fi
75        echo "        flag = 2 -> move res. after 2nd  run & prepare for 3rd"   if test -x ${CMD}_$xx ; then CMD="${CMD}_$xx" ; shift ; continue ; fi
76        echo "        flag = 3 -> move res. after 3rd  run"  done
77        echo "        flag = 4 -> compare Ocean results"  
78        echo "        flag = 5 -> compare Atmos results"  if [ $# -ne 1 ]
79        echo "        flag = 6 -> diff pickup files"  then
80        exit ;;     echo "Usage: `basename $0` [opt] flag"
81  esac     echo " Check restart of coupled set-up: compare 1 run of 2 x $Nit it long"
82       echo "                       with 2 consecutive runs of $Nit it long each"
83       echo "opt = -mth : run script '$CMD' with option '-mth'"
84       echo "opt = sufx : run script 'run_cpl_test_{sufx}'"
85       echo " where: flag = 0  -> prepare for 1rst run"
86       echo "        flag = r1 -> do 1rst run and step 1"
87       echo "        flag =  1 -> move res. after 1rst run & prepare for 2nd"
88       echo "        flag = r2 -> do 2nd  run and step 2"
89       echo "        flag =  2 -> move res. after 2nd  run & prepare for 3rd"
90       echo "        flag = r3 -> do 3rd  run and step 3"
91       echo "        flag =  3 -> move res. after 3rd  run"
92       echo "        flag=(r)N+ , N=1,2,3 => do steps (+run) from: (r)N to 3"
93       echo "        flag = 4  -> compare Ocean results"
94       echo "        flag = 5  -> compare Atmos results"
95       echo "        flag = 6  -> diff pickup files"
96       exit
97    fi
98  if test $NiAt = 0 -o $NiOc = 0  if test $NiAt = 0 -o $NiOc = 0
99  then  then
100      echo " needs 2 data files: 'input_ocn/data.tst' & 'input_atm/data.tst'"      echo " needs 2 data files: 'input_ocn/data.tst' & 'input_atm/data.tst'"
101      echo "  (corresponding to 1rst run) to continue"      echo "  (corresponding to 1rst run) to continue"
102    exit    exit
103  fi  fi
104  ksel=$1  arg1=$1
105    xx=`echo $arg1 | sed 's/\+$//'`
106    if test $xx != $arg1
107    then kUp=`echo $xx | sed 's/^r//'` ; arg1=$xx
108    else kUp=9 ; fi
109    xx=`echo $arg1 | sed 's/^r//'`
110    if test $xx != $arg1 ; then doRun=1 ; arg1=$xx ; else doRun=0 ; fi
111    ksel=$arg1
112    
113    CMD="./${CMD} $MTH 3"
114    echo " doRun='$doRun' ; ksel='$ksel' ; kUp='$kUp' ; command='$CMD'"
115    
116  #make sure that local dir & ~jmc/bin is in the path:  #make sure that local dir & ~jmc/bin is in the path:
117  #export PATH=${PATH}:.  #export PATH=${PATH}:.
# Line 97  noc2=`expr $noc0 + $Dbl` Line 123  noc2=`expr $noc0 + $Dbl`
123  noc0c=`printf "%10.10i\n" $noc0`  noc0c=`printf "%10.10i\n" $noc0`
124  noc1c=`printf "%10.10i\n" $noc1`  noc1c=`printf "%10.10i\n" $noc1`
125  noc2c=`printf "%10.10i\n" $noc2`  noc2c=`printf "%10.10i\n" $noc2`
126  echo 'Oce (rank_1):' $noc0  $noc1  $noc2  echo ' Oce (rank_1):' $noc0  $noc1  $noc2
127  echo $noc0c $noc1c $noc2c  echo ' ' $noc0c $noc1c $noc2c
128    
129  Nit=$NiAt  Nit=$NiAt
130  Dbl=`expr $Nit + $Nit`  Dbl=`expr $Nit + $Nit`
# Line 107  nat2=`expr $nat0 + $Dbl` Line 133  nat2=`expr $nat0 + $Dbl`
133  nat0c=`printf "%10.10i\n" $nat0`  nat0c=`printf "%10.10i\n" $nat0`
134  nat1c=`printf "%10.10i\n" $nat1`  nat1c=`printf "%10.10i\n" $nat1`
135  nat2c=`printf "%10.10i\n" $nat2`  nat2c=`printf "%10.10i\n" $nat2`
136  echo 'Atm (rank_2):' $nat0  $nat1  $nat2  echo ' Atm (rank_2):' $nat0  $nat1  $nat2
137  echo $nat0c $nat1c $nat2c  echo ' ' $nat0c $nat1c $nat2c
138    
139  listOc="pickup"  listOc="pickup"
140  listAt="pickup pickup_cpl pickup_ic pickup_land"  listAt="pickup pickup_cpl pickup_ic pickup_land"
# Line 132  then Line 158  then
158   done   done
159   cd ..   cd ..
160  #-- prepare for running Dbl  #-- prepare for running Dbl
161   echo ' prepare for running Dbl:'   echo '=> prepare for running Dbl:'
162   Dbl=`expr $NiOc + $NiOc`   Dbl=`expr $NiOc + $NiOc`
163   sed "1 s/[0-9]*/$Dbl/" input_cpl/data > rank_0/data   sed "1 s/[0-9]*/$Dbl/" input_cpl/data > rank_0/data
164   cp -p input_ocn/data.tst rank_1/data   cp -p input_ocn/data.tst rank_1/data
# Line 141  then Line 167  then
167   egrep 'nIter0|nTimeSteps' rank_?/data   egrep 'nIter0|nTimeSteps' rank_?/data
168  fi  fi
169    
170  #-- after running Dbl:  #-- run & post-process Dbl:
171  if test $ksel = 1  if [ $ksel -eq 1 -o $kUp -le 1 ]
172  then  then
173     echo ' '
174    #-- run coupled test (Dbl):
175     if [ $doRun -eq 1 -o $kUp -lt 1 ]
176     then
177       echo "=> run (Dbl): $CMD"
178       $CMD
179     fi
180    #-- after running Dbl:
181   rm -rf $dir1   rm -rf $dir1
182   mkdir $dir1   mkdir $dir1
183   echo ' ' ; echo 'move STDOUT to' $dir1   echo '=> move STDOUT to' $dir1
184   mv rank_1/STDOUT* $dir1/ocnSTDOUT.2it   mv rank_1/STDOUT* $dir1/ocnSTDOUT.2it
185   mv rank_2/STDOUT* $dir1/atmSTDOUT.2it   mv rank_2/STDOUT* $dir1/atmSTDOUT.2it
186    
# Line 171  then Line 205  then
205   cd ..   cd ..
206    
207  #-- prepare for running 1iA  #-- prepare for running 1iA
208   echo ' prepare for running 1iA:'   echo '=> prepare for running 1iA:'
209   Nit=$NiOc   Nit=$NiOc
210   Dbl=`expr $Nit + $Nit`   Dbl=`expr $Nit + $Nit`
211   sed "1 s/[0-9]*/$Nit/" input_cpl/data > rank_0/data   sed "1 s/[0-9]*/$Nit/" input_cpl/data > rank_0/data
# Line 183  then Line 217  then
217   egrep 'nIter0|nTimeSteps' rank_?/data   egrep 'nIter0|nTimeSteps' rank_?/data
218  fi  fi
219    
220  #-- after running 1iA  #-- run & post-process 1iA:
221  if test $ksel = 2  if [ $ksel -eq 2 -o $kUp -le 2 ]
222  then  then
223     echo ' '
224    #-- run coupled test (1iA):
225     if [ $doRun -eq 1 -o $kUp -lt 2 ]
226     then
227       echo "=> run (1iA): $CMD"
228       $CMD
229     fi
230    #-- after running 1iA
231   rm -rf $dir2   rm -rf $dir2
232   mkdir $dir2   mkdir $dir2
233   echo ' ' ; echo 'move STDOUT to' $dir2   echo '=> move STDOUT to' $dir2
234   mv rank_1/STDOUT* $dir2/ocnSTDOUT.1iA   mv rank_1/STDOUT* $dir2/ocnSTDOUT.1iA
235   mv rank_2/STDOUT* $dir2/atmSTDOUT.1iA   mv rank_2/STDOUT* $dir2/atmSTDOUT.1iA
236    
# Line 213  then Line 255  then
255   cd ..   cd ..
256    
257  #-- prepare for running 1iB  #-- prepare for running 1iB
258   echo ' prepare for running 1iB:'   echo '=> prepare for running 1iB:'
259   cd rank_1   cd rank_1
260   sed "s/^ nIter0=$noc0/ nIter0=$noc1/g" data > data.tmp   sed "s/^ nIter0=$noc0/ nIter0=$noc1/g" data > data.tmp
261   mv -f data.tmp data   mv -f data.tmp data
# Line 227  then Line 269  then
269   egrep 'nIter0|nTimeSteps' rank_?/data   egrep 'nIter0|nTimeSteps' rank_?/data
270  fi  fi
271    
272  #-- after running 1iB  #-- run & post-process 1iB:
273  if test $ksel = 3  if [ $ksel -eq 3 -o $kUp -le 3 ]
274  then  then
275     echo ' '
276    #-- run coupled test (1iB):
277     if [ $doRun -eq 1 -o $kUp -lt 3 ]
278     then
279       echo "=> run (1iB): $CMD"
280       $CMD
281     fi
282    #-- after running 1iB
283   rm -rf $dir3   rm -rf $dir3
284   mkdir $dir3   mkdir $dir3
285   echo ' ' ; echo 'move STDOUT to' $dir3   echo '=> move STDOUT to' $dir3
286   mv rank_1/STDOUT* $dir3/ocnSTDOUT.1iB   mv rank_1/STDOUT* $dir3/ocnSTDOUT.1iB
287   mv rank_2/STDOUT* $dir3/atmSTDOUT.1iB   mv rank_2/STDOUT* $dir3/atmSTDOUT.1iB
288    
# Line 255  then Line 305  then
305   mv pickup*.$nat2c.* ../$dir3/atm   mv pickup*.$nat2c.* ../$dir3/atm
306   rm -f pickup*.$nat1c.*   rm -f pickup*.$nat1c.*
307   cd ..   cd ..
308   echo 'restore std data files'   echo '=> restore std data files'
309   cp -p input_cpl/data rank_0   cp -p input_cpl/data rank_0
310   cp -p input_ocn/data rank_1   cp -p input_ocn/data rank_1
311   cp -p input_atm/data rank_2   cp -p input_atm/data rank_2

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22