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.
fcm_job.sh in trunk/NEMOGCM/SETTE – NEMO

source: trunk/NEMOGCM/SETTE/fcm_job.sh @ 2585

Last change on this file since 2585 was 2585, checked in by flavoni, 12 years ago

forcing gunzip to overwrite files in SETTE, see ticket #796

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.3 KB
Line 
1#####################################################
2# Author : Simona Flavoni for NEMO
3# Contact : sflod@locean-ipsl.upmc.fr
4#
5# Some scripts called by sette.sh
6# fcm_job.sh   : simple job to run NEMO with fcm
7######################################################
8#set -x
9set -o posix
10#set -u
11#set -e
12#+
13#
14# ================
15# fcm_job.sh
16# ================
17#
18# --------------------------
19# Simple job for NEMO tests
20# --------------------------
21#
22# SYNOPSIS
23# ========
24#
25# ::
26#
27#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC
28#
29#
30# DESCRIPTION
31# ===========
32#
33#
34# Simple job for SET TESTS for NEMO (SETTE)
35#
36#
37# EXAMPLES
38# ========
39#
40# ::
41#
42#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME       NUMBER_PROC
43#
44#  run a job of config GYRE with 1 processor
45#  $ ./fcm_job.sh input_GYRE.cfg                     1
46#
47#  run a job of config ORCA2_LIM_PISCES with 8 processors
48#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg         8
49#
50#
51# TODO
52# ====
53#
54# option debug
55#
56#
57# EVOLUTIONS
58# ==========
59#
60# $Id$
61#
62#
63#
64#   * creation
65#
66#-
67#
68
69usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS"
70usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8"
71
72
73minargcount=2
74        if [ ${#} -lt ${minargcount} ]
75        then
76                echo "not enought arguments for fcm_job.sh script"
77                echo "control number of argument of fcm_job.sh in sette.sh"
78                echo "${usage}"
79        exit 1
80        fi
81        unset minargcount
82   if [  -f ${SETTE_DIR}/output.sette ] ; then
83           echo "file output already present. Append comments"
84           echo "`ls ${SETTE_DIR}/output.sette`"
85   else
86           echo "file output not present"
87           touch ${SETTE_DIR}/output.sette
88           echo "`ls ${SETTE_DIR}/output.sette`"
89   fi
90       
91echo "date: `date`" >> ${SETTE_DIR}/output.sette
92echo "" >> ${SETTE_DIR}/output.sette
93echo "running config: ${NEW_CONF}" >> ${SETTE_DIR}/output.sette
94echo "" >> ${SETTE_DIR}/output.sette
95echo "list of cpp_keys: " >> ${SETTE_DIR}/output.sette
96echo "`more ../CONFIG/${NEW_CONF}/cpp_${NEW_CONF}.fcm`" >> ${SETTE_DIR}/output.sette
97echo "" >> ${SETTE_DIR}/output.sette
98echo "executing script : fcm_job $@" >> ${SETTE_DIR}/output.sette
99echo "            " >> ${SETTE_DIR}/output.sette
100
101################################################################
102# SET INPUT
103# get the input tarfile if needed
104tar_file=$(sed -ne "1,1p" $1)
105if [ "$(cat $1 | grep -c ".tar" )" -ne 0 ] ; then
106   echo "looking for tar file" >> ${SETTE_DIR}/output.sette
107   echo "            " >> ${SETTE_DIR}/output.sette
108   cp ${FORCING_DIR}/${tar_file} ${INPUT_DIR}/.
109   cd ${INPUT_DIR} ; tar xvof ${INPUT_DIR}/*.tar ; gunzip -f *gz
110fi
111
112if [ -f ${INPUT_DIR}/namelist_ice_lim2 ] ; then
113   echo "choosing for namelist ice " >> ${SETTE_DIR}/output.sette
114   echo "            " >> ${SETTE_DIR}/output.sette
115   cp ${INPUT_DIR}/namelist_ice_lim2 ${INPUT_DIR}/namelist_ice
116elif  [ -f ${INPUT_DIR}/namelist_ice_lim3 ] ; then
117   cp ${INPUT_DIR}/namelist_ice_lim3 ${INPUT_DIR}/namelist_ice
118fi
119
120
121if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "agrif" )" -ne 0 ] ; then
122   #- Namelist for ocean and ice (agrif fine grid)
123      echo "choosing for namelist for AGRIF" >> ${SETTE_DIR}/output.sette
124      echo "            " >> ${SETTE_DIR}/output.sette
125   cp ${INPUT_DIR}/1_namelist_ice_lim2 ${INPUT_DIR}/1_namelist_ice
126fi
127################################################################
128
129################################################################
130# RUN OPA
131cd ${INPUT_DIR}
132NB_PROC=$2
133if [ ! -r ${INPUT_DIR}/opa ]
134    then
135    echo "executable opa does not exist"
136    exit 1
137fi
138if [ ${NB_PROC} == 1 ] ; then
139    echo "running opa" >> ${SETTE_DIR}/output.sette
140    echo "            " >> ${SETTE_DIR}/output.sette
141    ./opa
142else
143    echo "running opa in MPI" >> ${SETTE_DIR}/output.sette
144    echo "            " >> ${SETTE_DIR}/output.sette
145# example for brodie (NEC SX8) machine
146#  mpirun -np ${NB_PROC} opa
147# example for dedale machine
148#  mpirun --mca btl self,tcp -np ${NB_PROC} opa
149# example for vargas (IBM Power6) machine
150    mpiexec -n ${NB_PROC} opa
151fi
152################################################################
153# SMALL DEBUG
154# echo "control that time.step exists
155if [ ! -r ${INPUT_DIR}/time.step ]
156    then
157    echo "file time.step does not exist"   >> ${SETTE_DIR}/output.sette
158    echo "some problems during execution of model"  >> ${SETTE_DIR}/output.sette
159    exit 1
160else
161    echo "file time.step exists"  >> ${SETTE_DIR}/output.sette
162    echo "ok model run"   >> ${SETTE_DIR}/output.sette
163fi
164################################################################
165
166################################################################
167
168################################################################
169# SAVE OUTPUT, DEBUG & RESTART FILES
170echo "saving ocean & ice output, debug & restart files" >> ${SETTE_DIR}/output.sette
171echo "            " >> ${SETTE_DIR}/output.sette
172[ ! -d ${OUTPUT_DIR} ] && mkdir ${OUTPUT_DIR}
173[ -f *ocean.output ] && mv *ocean.output ${OUTPUT_DIR}/.
174[ -f *solver.stat ] && mv *solver.stat ${OUTPUT_DIR}/.
175[ -n "$(ls *_grid_*)" ] && mv *_grid_*.nc ${OUTPUT_DIR}/.
176[ -n "$(ls *restart*)" ] && cp *restart*.nc ${OUTPUT_DIR}/.
177[ -f ice_evolu ] && mv ice_evolu ${OUTPUT_DIR}/.
178[ -n "$(ls *icemod*)" ] && mv *icemod* ${OUTPUT_DIR}/.
179#- Save ftrace file
180[ -f ftrace.out* ] && cp ftrace.out* ${OUTPUT_DIR}/.
181################################################################
182
Note: See TracBrowser for help on using the repository browser.