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.
job_GYRE_LOBSTER.ksh in trunk/NVTK/INSTALL/JOBS – NEMO

source: trunk/NVTK/INSTALL/JOBS/job_GYRE_LOBSTER.ksh @ 1143

Last change on this file since 1143 was 1143, checked in by ctlod, 16 years ago

trunk: correct passive tracers restart files name in NVTK job job_GYRE_LOBSTER.ksh, see ticket: #221

File size: 9.0 KB
Line 
1set -xv
2
3CONF=GYRE_LOBSTER
4# Variables changed by lance_batch.ksh script
5RUN=xxx
6NB_PROCS=xxx
7LAUNCH=xxx
8LEXE=xxx
9CPERF=xxx
10D_INPUT=xxx
11D_GET=xxx
12REF_TAG=xxx
13TSYMB=xxx
14
15# Variables changed by ins_valid.ksh script
16MAINDIR=/Users/ctlod/WORK/AZE
17WORK=/Users/ctlod/WORK/AZE/modipsl/config
18REF_OD=/Volumes/FENUA/ORCA2_LIM_nemo_v2_IO
19
20# Arguments
21# type = 'long' or '1_short' or '2_short'
22type=$1
23
24case ${type} in
25        'long' ) 
26             DIROUT='LONG'
27             ITERATIONS=360 ;;
28             
29        '1_short' ) 
30             DIROUT='1_SHORT'
31             ITERATIONS=180 ;;
32             
33        '2_short' ) 
34             DIROUT='2_SHORT'
35             ITERATIONS=180 ;;
36
37        'gtime' ) 
38             DIROUT='GTIME'
39             ITERATIONS=4320 ;;
40esac
41
42# Working directory
43cd ${TMPDIR}
44#-T- osxxlf cd ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/RUN
45#-T- osxxlf zback=$?
46#-T- osxxlf if [ ${zback} = 0 ] ; then rm -rf namelist* *.nc memory* solver.stat ocean.output* mpp.output* mono.output* ; fi
47
48##############################################################
49##############################################################
50##############################################################
51###             Input files
52##############################################################
53##############################################################
54##############################################################
55# Ocean namelist
56cp ${MAINDIR}/modipsl/config/${CONF}/EXP00/namelist .
57
58# namelist modifications
59PAT_NIT000=$( grep 'nit000      =' namelist )
60PAT_NITEND=$( grep 'nitend      =' namelist )
61PAT_NSTOCK=$( grep 'nstock      =' namelist )
62PAT_NWRITE=$( grep 'nwrite      =' namelist )
63PAT_NRSTDT=$( grep 'nrstdt      =' namelist )
64PAT_NBITCM=$( grep 'nbit_cmp   ='   namelist )
65PAT_NSOLVV=$( grep 'nsolv       =' namelist )
66PAT_RESTAR=$( grep 'ln_rstart   =' namelist )
67PAT_RESMLD=$( grep 'ln_trdmld_restart =' namelist )
68
69sed    -e "s%$PAT_RESTAR%   ln_rstart   =  .false.%" \
70-e "s%$PAT_NIT000%   nit000     =     1%" \
71-e "s%$PAT_NITEND%   nitend     =     ${ITERATIONS}%" \
72-e "s%$PAT_NSTOCK%   nstock     =     ${ITERATIONS}%" \
73-e "s%$PAT_NWRITE%   nwrite     =     75%" \
74-e "s%$PAT_NRSTDT%   nrstdt     =     0%" \
75-e "s%$PAT_NBITCM%   nbit_cmp =     1%" \
76-e "s%$PAT_NSOLVV%   nsolv     =      2%" \
77-e "s%$PAT_RESMLD%   ln_trdmld_restart =  .false.%" \
78namelist > nam.tmp
79
80mv nam.tmp namelist
81
82# Biogeochemistry namelists
83cp ${MAINDIR}/modipsl/config/${CONF}/EXP00/namelist_top namelist_top_f90
84cp ${MAINDIR}/modipsl/config/${CONF}/EXP00/namelist_lobster namelist_lobster_f90
85
86# namelist modifications
87PAT_TRC=$( grep 'nwritetrc   =' namelist_top_f90 )
88PAT_TRD=$( grep 'nwritetrd  ='  namelist_top_f90 )
89
90sed    -e "s/$PAT_TRC/   nwritetrc   = ${ITERATIONS},/" \
91-e "s/$PAT_TRD/   nwritetrd  = ${ITERATIONS},/" \
92namelist_top_f90 > nam.tmp
93
94mv nam.tmp namelist_top
95
96PAT_ADD=$( grep 'nwritedia    =' namelist_lobster_f90 )
97sed    -e "s/$PAT_ADD/   nwritedia    = ${ITERATIONS},/" namelist_lobster_f90 > nam.tmp
98mv nam.tmp namelist_lobster
99
100# Analytical forcing
101
102# Get restarts files if needed
103if [ $type = '2_short' ]
104then
105    if [ ${RUN} = 'mon' -o ${RUN} = 'omp' ] ; then
106        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/*_restart.nc restart.nc
107        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/*_restart_mld.nc restart_mld.nc
108        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/*_restart_trc.nc restart_trc.nc
109    fi
110
111    if [ ${RUN} = 'mpi' ] ; then
112        typeset -Z4 i=0
113        while [ $i -lt $NB_PROCS ]
114        do
115           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/*_restart_${i}.nc restart_${i}.nc
116           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/*_restart_mld_${i}.nc restart_mld_${i}.nc
117           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/*_restart_trc_${i}.nc restart_trc_${i}.nc
118           let i=$i+1
119        done
120    fi
121
122    # Ocean namelist modifications
123    PAT_NIT000=$( grep 'nit000     =' namelist )
124    PAT_NITEND=$( grep 'nitend     =' namelist )
125    PAT_NRSTDT=$( grep 'nrstdt     =' namelist )
126    PAT_RESTAR=$( grep 'ln_rstart   =' namelist )
127    PAT_RESMLD=$( grep 'ln_trdmld_restart =' namelist )
128    ORCA_NIT000=$(( $ITERATIONS + 1 ))
129    ORCA_NITEND=$(( $ITERATIONS*2 ))
130   
131    sed    -e "s/$PAT_RESTAR/   ln_rstart   =  .true./" \
132    -e "s/$PAT_NIT000/   nit000     =     $ORCA_NIT000/" \
133    -e "s/$PAT_NITEND/   nitend     =     $ORCA_NITEND/" \
134    -e "s/$PAT_NRSTDT/   nrstdt     =     2/" \
135    -e "s/$PAT_RESMLD/   ln_trdmld_restart =  .true./" \
136    namelist > nam.tmp
137   
138    mv nam.tmp namelist
139
140    # Biogeochemistry namelist modifications
141    PAT_RESTAR=$( grep '   lrsttr      = ' namelist_top )
142   
143    sed    -e "s/$PAT_RESTAR/   lrsttr      = .true.,/" namelist_top > nam.tmp
144   
145    mv nam.tmp namelist_top
146
147fi
148
149##############################################################
150##############################################################
151##############################################################
152###             Launch run
153##############################################################
154##############################################################
155##############################################################
156
157cp ${WORK}/NEMO_VALID/W${CONF}/opa_${CONF}_${RUN} opa_${CONF}_${RUN}
158cp ${WORK}/NEMO_VALID/W${CONF}/opa_${CONF}_memo opa_${CONF}_memo
159chmod 777 opa_${CONF}_${RUN}
160chmod 777 opa_${CONF}_memo
161
162#
163# Profiling & Executable memory size
164####################################
165touch memory_size.txt
166
167case ${RUN} in
168        'mon' ) 
169#-T- sx8brodie export F_PROGINF=detail
170#-T- sx8brodie echo "Stack memory: $( (size opa_${CONF}_${RUN}) )"    >> memory_size.txt
171#-T- sx8brodie echo "Static memory: $( (size opa_${CONF}_memo) )"   >> memory_size.txt  ;;
172#-T- aix     ;;
173#-T- ax_mono echo "Stack memory: $( (size opa_${CONF}_memo) )"    >> memory_size.txt
174#-T- ax_mono echo "Static memory: $( (size opa_${CONF}_${RUN}) )"   >> memory_size.txt ;;
175#-T- osxxlf echo "Stack memory: $( (size opa_${CONF}_memo) )"    >> memory_size.txt
176#-T- osxxlf echo "Static memory: $( (size opa_${CONF}_${RUN}) )"   >> memory_size.txt ;;
177        'mpi' ) 
178#-T- sx8brodie export MPIPROGINF=detail ;;
179#-T- aix     ;;
180#-T- ax_mono ;;
181#-T- osxxlf  ;;
182        'omp' ) 
183#-T- sx8brodie export F_PROGINF=detail
184#-T- sx8brodie export OMP_NUM_THREADS=${NB_PROCS} ;;
185#-T- aix     ;;
186#-T- ax_mono ;;
187#-T- osxxlf  ;;
188esac
189#
190# >>>>>> EXECUTION < < < <
191##########################
192
193case ${RUN} in
194        'mon' | 'omp' ) 
195              ${CPERF} ./opa_${CONF}_${RUN} ;;
196        'mpi' ) 
197#-T- sx8brodie              ${CPERF} ${LEXE} ./opa_${CONF}_${RUN} ;;
198#-T- aix              ${CPERF} ${LEXE} ./opa_${CONF}_${RUN} ;;
199#-T- osxxlf   mpd&
200#-T- osxxlf   sleep 5
201#-T- osxxlf   ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}
202#-T- osxxlf   mpdallexit ;;
203esac
204
205ls -l
206#
207
208##############################################################
209##############################################################
210##############################################################
211###             Save output files
212##############################################################
213##############################################################
214##############################################################
215case ${RUN} in
216   'mon' | 'omp' )
217               liste_files=' *abort* memory* namelist* perfs* solver.stat ocean.output layout* GYRE* restart* mono*' ;;
218   'mpi' )
219               liste_files=' *abort* namelist* solver.stat perfs* ocean.output* layout* GYRE* restart* mpp*' ;;
220esac
221
222# Ensure that all files saved are coming from the current run
223ind=1
224for k in $liste_files
225do
226   echo $k > temp
227   var=$( ( awk '{printf("%-.4s", varin ) } ' varin=$k temp ) )
228   if [ ${ind} = 1 -a ${var} = 'perf' ] ; then
229       kc='perf*'
230       rm -f ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${kc}
231       ind=0
232   fi
233   cp $k ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/$k
234done
235
236##############################################################
237##############################################################
238##############################################################
239###             Retrieve some reference run files
240##############################################################
241##############################################################
242##############################################################
243if [ ${REF_TAG} ]
244then
245   STORE_DATA=${REF_OD}/${CONF}/${REF_TAG}/${RUN}/${DIROUT}
246   LFILES="solver.stat memory_size.txt ocean.output ${RUN}${CONF}_err"
247   for ref_file in ${LFILES}
248   do
249       ${D_GET} ${STORE_DATA}/${TSYMB}${ref_file} ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/REF/${ref_file}
250   done
251fi
252
253##############################################################
254##############################################################
255##############################################################
256###             Launch restart job
257##############################################################
258##############################################################
259##############################################################
260if [ $type = '1_short' ] ; then
261    cd ${WORK}/NEMO_VALID/W${CONF}/${RUN}/2_SHORT
262    ${LAUNCH}job_${RUN}_2_short.ksh
263fi
Note: See TracBrowser for help on using the repository browser.