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.
AA_job in trunk/CONFIG/GYRE/EXP00 – NEMO

source: trunk/CONFIG/GYRE/EXP00/AA_job @ 102

Last change on this file since 102 was 102, checked in by opalod, 20 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 9.8 KB
Line 
1#@$-r GYRE.1                   # name of job
2#@$-me                        # sends a mail at the end of execution
3#@$-eo                        # merge standard error and output
4                              # in one file
5#@$-o sortie_GYRE.1            # name of the output file (listing)
6#@$-lT 2:00:00                # Max total CPU time
7#@$-lt 1:59:00                # Max CPU time per process
8#@$-lM 2Gb                    # Max memory
9#-Q- sxnec ## NEC
10#-Q- sxnec #@$-jo             # print a short performance analysis
11#-Q- sxnec                    # at the end of the listing
12## Temporary comments
13###-Q- sxnec #@$-c 4            # Max number of simultaneous procs used (here=4)
14###-Q- sxnec #@$-q multi        # Use more than 1 proc
15## End of Temporary comments
16#-Q- fjvpp ## VPP
17#-Q- fjvpp #@$-ko             # Keep the output listing on disk
18#-Q- fjvpp #@$-s /bin/ksh     # Name of the shell used for this script
19#-Q- fjvpp #@$-lP 3           # Number of procs (here=3)
20#
21#
22#
23########################################################################
24##
25##      Script to run the GYRE configuration
26##
27##            Claire Levy
28##
29##      Original Script:
30##           Coupled IPSL experiment Eric MAISONNAVE / Marie-Alice FOUJOLS
31##
32#########################################################################
33##-- print echo of commands before and after shell interpretation
34date
35set -vx
36##
37##
38##-- Name of the experiment
39##--
40CEXPER=GYRE
41# -  Directory for executables
42#
43# ! Attention ! The executables are to be copied from the modipsl/bin
44#               directory
45#
46R_EXE=$WORKDIR/${CEXPER}/Exe
47#
48#
49
50JOB=${CEXPER}
51##-- First day of the experiment
52JOUR_DEBUT_EXP=1  ; MOIS_DEBUT_EXP=1  ; AN_DEBUT_EXP=1
53##--
54##-- Last day of the experiment
55JOUR_FINAL_EXP=31  ; MOIS_FINAL_EXP=12 ; AN_FINAL_EXP=1
56##--
57##-- Duration of the experiment
58JOURS=0; MOIS=0 ; ANS=1
59##
60#########################################################################
61##
62##    1. Unix Variables definition
63##
64#########################################################################
65##
66##-- Get the submisson directory
67echo $QSUB_WORKDIR
68##-- Get the directory controlling the chaining of the jobs
69R_EXPER=${QSUB_WORKDIR}
70##
71##
72MKDIR="mkdir"
73#-Q- fjvpp MKDIR="/usr/X11R6/bin/mkdirhier"
74#
75##--- Variables used by the ocean model
76# ----------------- GYRE --------------
77#
78JOB=$( echo ${CEXPER} | tr '[a-z]' '[A-Z]' )
79#
80#
81#
82#########################################################################
83##
84##    2. Directories definition
85##
86#########################################################################
87# -  Data directory for input/output of the model
88#
89#-Q- sxnec R_DONNEES=${WORKDIR}/EXPER/${CEXPER}
90#-Q- fjvpp R_DONNEES=${WORKDIR}/EXPER/${CEXPER}
91#
92#
93# ----------------- GYRE --------------------
94#
95R_ENTREE_OCE=${R_DONNEES}/Entree/Oce
96R_SORTIE_OCE=${R_DONNEES}/Sortie/Oce
97#
98#
99if [ ! -d ${R_DONNEES} ]; then
100  mkdir -p ${R_ENTREE_OCE}
101  mkdir -p ${R_SORTIE_OCE}
102  mkdir -p ${R_DONNEES}/SortieTest/Oce
103fi
104#
105# -  Get the tarfile containing all the usefull files
106#
107#
108#-- Directory definition for the data storage computer (where the tarfile is)
109#-Q- sxnec R_STOCKAGE="gaya:/u/DODS/pub/reee055/ORCA2_LIM"
110#-Q- fjvpp R_STOCKAGE="/G/nymphea0/dmnfs/"
111#--
112#-- Test if the tarfile is already there before geting it from the data storage
113#--
114#-Q- sxnec Rapatrie () { [ -f $1/$3 ] || ( rcp ${R_STOCKAGE}/$2/$3 $1 ; cd $1; tar xvf $3 ;) }
115#-Q- fjvpp Rapatrie () { [ -f $1/$3 ] || ( cp ${R_STOCKAGE}/$2/$3 $1 ; cd $1; tar xvf $3 ;) }
116
117#
118Rapatrie ${R_ENTREE_OCE} ENTREE Entree_Oce.tar
119Rapatrie ${R_DONNEES}/SortieTest/Oce VERIF SortieTest_Oce.tar
120
121#
122# -  Temporary working directory
123#
124#-Q- sxnec TMP=${TMPDIR}/${CEXPER}
125#-Q- fjvpp TMP=${SCRATCHDIR}/${CEXPER}
126#
127#-- Create this directory if needed
128[ -d ${TMP} ] || ${MKDIR} ${TMP}
129#
130#
131#########################################################################
132##
133##    3. Pre-processing
134##
135#########################################################################
136#
137# =============================================================================
138# Time control
139# =============================================================================
140cd ${R_EXPER}
141##
142##- Create ${JOB}.suivi containing the date of the run going on or the date
143##- of the first waiting job, and ${JOB}.log containing execution log
144##
145if [ ! -f "${JOB}.suivi" ]
146then
147    JOUR_DEB_JOB=${JOUR_DEBUT_EXP} ; MOIS_DEB_JOB=${MOIS_DEBUT_EXP} ; AN_DEB_JOB=${AN_DEBUT_EXP}
148    NUMERO=1
149cat <<EOF >${JOB}.suivi
150$AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB $NUMERO
151EOF
152echo `date` " Begining of Experience : " ${JOB} " in directory :" ${R_EXPER} > ${JOB}.log
153fi
154
155cat ${JOB}.suivi | read AN_DEB_JOB MOIS_DEB_JOB JOUR_DEB_JOB NUMERO
156echo $AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB
157echo "`date` $AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB begin" >> ${JOB}.log
158
159
160
161# ==============================================================================
162# Copy executables
163# ==============================================================================
164if [ -z ${TMP} ]; then
165  echo " The TMP variable is empty !!!"
166  exit
167fi
168cd ${TMP} || exit
169#- Clear working directory
170rm -f *
171
172#- Get executables
173# ----------------- GYRE -----------------------
174cp ${R_EXE}/opa opa.xx
175#
176#
177#-Q- sxnec # ----------------- GYRE -----------------------
178#-Q- sxnec # Reminder for the cpp keys used
179#-Q- sxnec #
180#-Q- sxnec OPT_COMPIL_ORCA=` mcs -p opa.xx | grep key_orca | head -1 `
181#-Q- sxnec #
182#-Q- sxnec echo ${OPT_COMPIL_ORCA}
183#-Q- sxnec #
184#-Q- sxnec #-- Check ocean model resolution
185#-Q- sxnec RESOL_ORCA=` echo ${OPT_COMPIL_ORCA} | sed s/.*key_orca_r// | sed s/-Wp.*// `
186#-Q- sxnec if [ ${RESOL_ORCA} -ne "2" ] ; then
187#-Q- sxnec   echo " Resolution of the executable for the ocean model is not correct : " ${RESOL_ORCA}
188#-Q- sxnec fi
189#
190#-Q- sxnec #-- Ckeck for real and integer size
191#-Q- sxnec #-- in the ocean executable
192#-Q- sxnec IR_ORCA=` echo ${OPT_COMPIL_ORCA} | grep "-ew" `
193#-Q- sxnec if [ -n ${IR_ORCA} ]; then
194#-Q- sxnec   echo 'Taille des reels :   8 '
195#-Q- sxnec   echo 'Taille des entiers : 8 '
196#-Q- sxnec else
197#-Q- sxnec   echo ' ATTENTION: ocean executable has not been compiled in I8R8 '
198#-Q- sxnec   exit
199#-Q- sxnec fi
200
201# ==============================================================================
202# Update the namelist
203# ==============================================================================
204#
205# ----------------- GYRE ---------------------
206#
207#
208# change namelist from fortran 77 to fortran 90
209sed -e /:/d -e s/" \&END"/"\/"/ -e s/" \&"/"\&"/ ${R_ENTREE_OCE}/namelist > namelist
210#
211PAT_NO=$( grep 'no' namelist | grep -v off )
212PAT_CEXPER=$( grep 'cexper' namelist )
213PAT_RESTAR=$( grep 'lrstar' namelist )
214PAT_NRSTAR=$( grep 'nrstdt' namelist )
215PAT_NMSH=$( grep 'nmsh' namelist )
216PAT_NDATE0=$( grep 'ndate0' namelist )
217
218
219if [ ${NUMERO} -eq 1 ]
220then
221#- At the beginning of the experiment:
222#- No check of the date of restart (since there is no restart)
223#- Create the meshmask file (usefull for graphics)
224sed    -e "s/$PAT_CEXPER/       cexper=\"$CEXPER\"/" \
225    -e "s/$PAT_NMSH/         nmsh=1/" \
226    namelist > nam.tmp
227else
228#- Check the date of restart for all the following job submission
229sed    -e "s/$PAT_CEXPER/       cexper=\"$CEXPER\"/" \
230    -e "s/$PAT_RESTAR/       lrstar=.TRUE./" \
231    -e "s/$PAT_NMSH/         nmsh=0/" \
232    -e "s/$PAT_NRSTAR/       nrstdt=1/" \
233    -e "s/$PAT_NDATE0/       ndate0=$DATE_DEB_JOB/" \
234    namelist > nam.tmp
235fi
236
237mv nam.tmp namelist
238
239
240#
241# ==============================================================================
242# Copy input files
243# ==============================================================================
244#
245# ----------------- GYRE ---------------------
246#
247# -  Copy auxilliary files
248#
249#    WARNING: No input data files for the GYRE configuration
250#
251# -  Copy of the restart file
252#
253
254if [ ${NUMERO} -ne 1 ]
255then
256  cp ${R_SORTIE_OCE}/${CEXPER}_${DATE_RESTART}_restart.nc restart.nc
257fi
258
259#
260#
261ls -alF
262#
263#########################################################################
264##
265##    4. Launching the experiment
266##
267#########################################################################
268#
269##-Q- sxnec export F_PROGINF=detail F_FTRACE=yes F_ERRCNT=500
270##-Q- sxnec   mpirun -np 1 -max_np 3 opa.xx
271#-Q- sxnec  opa.xx
272
273#-Q- fjvpp opa.xx -np 1
274
275#-Q- fjvpp ##-- Accounting
276#-Q- fjvpp ja
277
278
279ls -alF
280
281NIT_FINAL=$( cat time.step )
282#
283#########################################################################
284##
285##    5. Post-processing
286##
287#########################################################################
288#
289# ==============================================================================
290# Save output files
291# ==============================================================================#
292i_ERR_SAUV=0
293#
294#
295#
296# ----------------- GYRE ---------------------
297#
298if [ -f date.file ]
299then
300    DATE=$(cat date.file | sed 's/ //g' | sed 's/_output//g' )
301fi
302##  Print the last time step:
303cat time.step
304#
305##-Q- sxnec cp ftrace.out ${R_SORTIE_OCE}/${DATE}.ftrace.out
306##-Q- sxnec cp mon.out ${R_SORTIE_OCE}/${DATE}.mon.out
307#
308# Save ocean output files
309#
310if [ ${NUMERO} -eq 1 ]
311then
312  mv meshmask* ${R_SORTIE_OCE}
313fi
314mv ocean.output ${R_SORTIE_OCE}/${DATE}.oceout
315mv solver.stat ${R_SORTIE_OCE}/${DATE}.solver.stat
316#
317for file_netcdf in *_grid_[TUVW].nc
318   do
319     mv $file_netcdf ${R_SORTIE_OCE}/ || i_ERR_SAUV=1
320   done
321#
322# Save ocean restart file
323mv ${CEXPER}_*_restart.nc ${R_SORTIE_OCE}/${CEXPER}_${DATE_FIN_JOB}_restart.nc
324if [ ! -f ${R_SORTIE_OCE}/${CEXPER}_${DATE_FIN_JOB}_restart.nc ]; then
325  echo " Attention: The backup of the restart file was UNSUCCESSFULL"
326  i_ERR_SAUV=1
327fi
328
329#
330#-
331#- Test on backups
332#-
333if [ ${i_ERR_SAUV} -ne "0" ] ; then
334   echo "Error in at least one of the restarts backups!"
335   exit
336fi
337#
338# Tar all outputs in one tarfile
339cd ${R_SORTIE_OCE}
340 if [ ! -f ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar ]
341then
342    tar cvf ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar .
343else
344    tar rvf ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar .
345fi
346rcp ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar ${R_STOCKAGE}/VERIF/SortieTest_Oce.tar
347cd ${TMP}
Note: See TracBrowser for help on using the repository browser.