source: trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh @ 247

Last change on this file since 247 was 247, checked in by mmaipsl, 14 years ago

Protect a test.
Add optionnal SmoothFile section (see commit n 8 and ticket n 8) ; merge SmoothFiles? branch.
SmoothFiles? is the new frequency information for all initial map and files get in libIGCM configurations.
It is an optionnal section.

New function IGCM_SmoothModulo to analyse A string of min max and modulo like definition of Scilab vectors.

IGCM_SmoothModulo StringModulo? value

StringModulo? : [min]:[modulo:][max]
# where :
# [] value are optionnals;
# empty max equal infinity
# modulo not given or empty equal 1
# empty string or just ':' equal always.
# return : true(1)/false(0)

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Date Author Revision
File size: 34.3 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil, Martial Mancip
5# Contact: Sebastien.Denvil@ipsl.jussieu.fr Martial.Mancip@ipsl.jussieu.fr
6# $Date$
7# $Author$
8# $Revision$
9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11# History:
12# Modification:
13#
14#**************************************************************
15
16#========================================================================
17function IGCM_comp_Initialize
18{
19    IGCM_debug_PushStack "IGCM_comp_Initialize"
20
21    # Debug Print :
22    echo
23    IGCM_debug_Print 1 "IGCM_comp_Initialize :"
24    echo
25
26    typeset comp compname comptagname CompatibilityTag auxprint card_UserChoices first_option i j
27    for comp in ${config_ListOfComponents[*]} ; do
28        # Debug Print
29        IGCM_debug_Print 1 ${comp}
30        # Define component
31        IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp}
32        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
33        eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
34
35        # Read libIGCM compatibility version in ${compname}.card
36        card=${SUBMIT_DIR}/COMP/${compname}.card
37        IGCM_card_DefineVariableFromOption ${card} Compatibility libIGCM
38        eval CompatibilityTag=\${${compname}_Compatibility_libIGCM} > /dev/null 2>&1   
39
40        if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then
41            IGCM_debug_Exit "${compname}.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ."
42        fi
43
44        # Manage component executable
45        IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card Executable ${comp}
46
47        # Read component Write Frequency in config.card
48        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} WriteFrequency
49        # Debug Print :
50        eval auxprint=\${config_${comp}_WriteFrequency}
51        IGCM_debug_Print 1 "Write frequency for ${compname} : ${auxprint} "
52        #2> /dev/null
53
54        # Debug Print :
55        IGCM_debug_Print 1 "Initialize following component library :"
56        IGCM_debug_Print 1 ${SUBMIT_DIR}/COMP/${compname}.driver
57        IGCM_debug_Print 3 "With tag : ${comptagname}"
58        # Source component library
59        . ${SUBMIT_DIR}/COMP/${compname}.driver
60
61        # Debug Print
62        IGCM_debug_Print 3 "Initialize ${comp} output directory."
63        # Define Dirs   
64        eval R_OUT_${comp}=${R_SAVE}/${comp}
65        eval IGCM_sys_MkdirArchive \${R_OUT_${comp}}
66
67        eval R_OUT_${comp}_O=\${R_OUT_${comp}}/Output
68        eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_O}
69
70        eval R_OUT_${comp}_R=\${R_OUT_${comp}}/Restart
71        eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_R}
72
73        eval R_OUT_${comp}_D=\${R_OUT_${comp}}/Debug
74        eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_D}
75
76        eval R_OUT_${comp}_O_I=\${R_OUT_${comp}_O}/INS
77        eval R_OUT_${comp}_O_H=\${R_OUT_${comp}_O}/HF
78        eval R_OUT_${comp}_O_D=\${R_OUT_${comp}_O}/DA
79        eval R_OUT_${comp}_O_M=\${R_OUT_${comp}_O}/MO
80        eval R_OUT_${comp}_O_Y=\${R_OUT_${comp}_O}/YE
81
82        # Read UserChoices section of component card
83        IGCM_debug_Print 1 "DefineArrayFromSection : ${compname}_UserChoices ${card}"
84        IGCM_card_DefineArrayFromSection ${card} UserChoices
85        eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1
86        if [ X${first_option} != X"Error:" ] ; then
87            eval IGCM_debug_Print 2 "${compname}_UserChoices_Options:" \${${compname}_UserChoices[*]}
88            if [ X${card_UserChoices[0]} != X ] ; then
89                unset card_UserChoices
90            fi
91            eval set +A card_UserChoices -- \${${compname}_UserChoices[*]} > /dev/null 2>&1
92            typeset option
93            for option in ${card_UserChoices[*]} ; do
94                IGCM_card_DefineVariableFromOption ${card} UserChoices ${option}
95                eval IGCM_debug_Print 3 "${compname}_UserChoices_values: ${option} \${card_UserChoices_${option}}"
96            done
97        fi
98
99        # Read and Build Output File stuff
100        IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
101        IGCM_card_DefineArrayFromOption ${card} OutputFiles List
102        ListFilesName=${compname}_OutputFiles_List
103        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
104        #
105        if [ X${FileName0} != X${NULL_STR} ] ; then
106            #
107            #IGCM_debug_Print 1 "Component      : ${compname}"
108            #
109            # INITIALISATION
110            #
111            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
112            i=2
113            #
114            until [ $i -ge $NbFiles ]; do
115                #
116                eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
117                #
118                if [ X${flag_post} != XNONE ] ; then
119                    #
120                    # First of all
121                    #
122                    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
123                    #
124                    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
125                    #
126                    # variable option allready typeset above
127                    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
128                        if [ ${option} = Seasonal ] ; then
129                            FoundSeasonal=true
130                            IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
131                        fi
132                    done
133                    #
134                    if [ ! X${FoundSeasonal} = Xtrue ] ; then
135                        eval ${compname}_${flag_post}_Seasonal=ON
136                    fi
137                    #
138                    if [ $( eval echo \${${compname}_${flag_post}_Seasonal} ) = ON ] ; then
139                        Seasonal=true
140                    fi
141                   
142                    # Dimension = vide si vieille card.
143                    IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars
144                    IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches
145                    if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not found ${flag_post}" ] ; then
146                        # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob.
147                        ListDimension[0]=2D
148                        ListDimension[1]=3D
149                        TimeSeries=false
150                        iLoop=${#ListDimension[*]}
151                        j=0
152                        until [ $j -ge ${iLoop} ]; do
153                            Dimension=${ListDimension[${j}]}
154                            IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars${Dimension}
155                            IGCM_card_DefineVariableFromOption ${card} ${flag_post} ChunckJob${Dimension}
156                            #
157                            # Time series WITHOUT chunk
158                            #
159                            if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
160                                if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then
161                                    IGCM_debug_Print 3 "${Dimension} time series activated for ${flag_post} according to ${card}"
162                                    eval TimeSeries${Dimension}=true
163                                fi
164                            fi
165                            #
166                            # Time series WITH chunk
167                            #
168                            if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
169                                chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} )
170                                if [ ! ${chunck_size} = NONE ] &&  [ ! ${chunck_size} = OFF ] ; then
171                                    IGCM_debug_Print 3 "${Dimension} time series activated with chunck for ${flag_post} according to ${card}"
172                                    eval TimeSeriesChunck${Dimension}=true
173                                    eval set +A CHUNCK${Dimension}_COMP \${CHUNCK${Dimension}_COMP[*]} ${comp}
174                                    eval set +A CHUNCK${Dimension}_FLAG \${CHUNCK${Dimension}_FLAG[*]} ${i}
175                                    eval set +A CHUNCK${Dimension}_SIZE \${CHUNCK${Dimension}_SIZE[*]} ${chunck_size}
176                                fi
177                            fi
178                            (( j=j+1 ))
179                        done
180                    else
181                        ListDimension[0]=""
182                        TimeSeries=true
183                        TimeSeries2D=false
184                        TimeSeries3D=false
185                        TimeSeriesChunck2D=false
186                        TimeSeriesChunck3D=false
187                    fi
188                fi
189                (( i=i+3 ))
190            done
191        fi
192        # Debug Print
193        IGCM_debug_Print 3 "Initialize ${compname} with driver."
194        # INIT component
195        ${comp}_Initialize
196        echo
197    done
198    echo "-----"
199    echo
200    IGCM_debug_Print 1 "DefineArrayFromOption  : ListOfComponents"
201    IGCM_debug_PrintVariables 3 config_ListOfComponents
202
203    IGCM_debug_PopStack "IGCM_comp_Initialize"
204}
205
206#=======================================================================
207function IGCM_comp_PrepareDeletedFiles
208{
209    IGCM_debug_PushStack "IGCM_comp_PrepareDeletedFiles" $@
210   
211    if [ X${2} != X. ] ; then
212        eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${2} ) > /dev/null 2>&1
213    else
214        eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${1} ) > /dev/null 2>&1
215    fi
216
217    IGCM_debug_PopStack "IGCM_comp_PrepareDeletedFiles"
218}
219
220#=======================================================================
221function IGCM_comp_GetInputInitialStateFiles
222{
223    IGCM_debug_PushStack "IGCM_comp_GetInputInitialStateFiles"
224
225    # Debug Print :
226    echo
227    IGCM_debug_Print 1 "IGCM_comp_GetInputInitialStateFiles :"
228    echo
229
230    # Only the first time step need InitialStateFiles
231    # otherwise it's BoundaryConditions
232    if ( ${FirstInitialize} ) ; then
233      typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_
234      typeset file_in_ file_in file_out_ file_out do_init
235      for comp in ${config_ListOfComponents[*]} ; do
236          # Initialize
237          do_init="y"
238          # Do we need to bring initial state file for this component
239          if [ "${config_Restarts_OverRule}" = "y" ] ; then
240              eval do_init="n"
241          else
242              # Read component Restarts parameters
243              IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
244              eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
245              if [ "${do_start}" = "y" ] ; then
246                    do_init="n"
247              else
248                    do_init="y"
249              fi
250          fi
251
252          if [ "${do_init}" = "y" ] ; then
253              # Define component
254              eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
255              eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
256
257              # Debug Print :
258              IGCM_debug_Print 3 "Initialisation files ${compname}"
259
260              card=${SUBMIT_DIR}/COMP/${compname}.card
261
262              IGCM_card_DefineArrayFromOption ${card} InitialStateFiles List
263              ListFilesName=${compname}_InitialStateFiles_List
264
265              eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
266              if [ X${FileName0} != X${NULL_STR} ] ; then
267                  eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
268
269                  (( i=0 ))
270                  until [ $i -ge $NbFiles ]; do
271                      eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
272                      eval file_in=${file_in_}
273                      (( i_ = i+1 ))
274                      eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
275                      eval file_out=${file_out_}
276                     
277                      IGCM_sys_Get ${file_in} ${file_out}
278                      #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
279
280                      (( i=i+2 ))
281                  done
282              fi
283          fi
284      done
285    fi
286    IGCM_debug_PopStack "IGCM_comp_GetInputInitialStateFiles"
287}
288
289#=======================================================================
290# Definition of Smooth modulo function
291# usage :
292# IGCM_SmoothModulo StringModulo value
293#
294# StringModulo : A string of min max and modulo like definition of Scilab vectors.
295# [min]:[modulo:][max]
296# where :
297# [] value are optionnals;
298# empty min equal 1
299# empty max equal infinity
300# modulo not given or empty equal 1
301# empty string or just ':' equal always.
302#
303# value : the value to test with the definition
304#
305# return : true(1)/false(0)
306function IGCM_SmoothModulo
307{
308    IGCM_debug_PushStack "IGCM_SmoothModulo"
309    typeset defVector ModValue
310
311    eval set +A defVector -- $( echo "${1}" | \
312        gawk -F ':' '{print ($1 == "" ? 1 : $1) " " (NF==3 ? ($2 == "" ? 1 : $2) : 1) " " (NF==3 ? ($3 == "" ? -1 : $3) : ($2 == "" ? -1 : $2))}' )
313
314    # Test limits :
315    # ${defVector[0]} <= ${2} <= ${defVector[2]}
316    #                                      or ${defVector[2]} == -1
317    if ( [ ${2} -ge ${defVector[0]} ] && \
318         ( [ ${2} -le ${defVector[2]} ] || \
319           [ ${defVector[2]} -lt 0 ] ) ) ; then
320
321        # Test modulo
322        ModValue=$( expr \( ${2} - ${defVector[0]} \) % ${defVector[1]} )
323        if [ ${ModValue} -eq 0 ] ;  then
324            echo true
325            IGCM_debug_PopStack "IGCM_SmoothModulo"
326            return 1
327        else
328            echo false
329            IGCM_debug_PopStack "IGCM_SmoothModulo"
330            return 0
331        fi
332    else
333        echo false
334        IGCM_debug_PopStack "IGCM_SmoothModulo"
335        return 0
336    fi
337}
338
339#=======================================================================
340function IGCM_comp_GetInputSmoothFiles
341{
342    IGCM_debug_PushStack "IGCM_comp_GetInputSmoothFiles"
343
344    # Debug Print :
345    echo
346    IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles :"
347    echo
348
349    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ i__
350    typeset file_in_ file_in file_out_ file_out ret SmoothDef
351
352    for comp in ${config_ListOfComponents[*]} ; do
353
354        echo "-----"
355        # Define component
356        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
357        eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
358
359        # Debug Print :
360        IGCM_debug_Print 3 "Smooth files ${compname}"
361
362        card=${SUBMIT_DIR}/COMP/${compname}.card
363
364        IGCM_card_DefineArrayFromOption ${card} SmoothFiles List
365        ListFilesName=${compname}_SmoothFiles_List
366        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
367
368        if [ X${FileName0} != X${NULL_STR} ] ; then
369            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
370
371            (( i=0 ))
372            until [ $i -ge $NbFiles ]; do
373
374                eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
375                eval file_in=${file_in_}
376                (( i_ = i+1 ))
377                eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
378                eval file_out=${file_out_}
379
380                # define CumulPeriod definition for this file
381                (( i__ = i+2 ))
382                eval SmoothDef=\${${ListFilesName}[$i__]}
383                IGCM_debug_Print 3 "  ${file_in} ${SmoothDef}"
384                eval ret=$( IGCM_SmoothModulo ${SmoothDef} ${CumulPeriod} )
385                if [ X${ret} = Xtrue ] ; then
386                    IGCM_sys_Get ${file_in} ${file_out}
387
388                    IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
389                fi
390                (( i=i+3 ))
391            done
392        fi
393    done
394   
395    IGCM_debug_PopStack "IGCM_comp_GetInputSmoothFiles"
396}
397
398#=======================================================================
399function IGCM_comp_GetInputBoundaryFiles
400{
401    IGCM_debug_PushStack "IGCM_comp_GetInputBoundaryFiles"
402
403    # Debug Print :
404    echo
405    IGCM_debug_Print 1 "IGCM_comp_GetInputBoundaryFiles :"
406    echo
407
408    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_
409    typeset file_in_ file_in file_out_ file_out
410
411    if [ ${Period} = 1 ]; then
412        ListFixBoundary=" "
413    fi
414
415    for comp in ${config_ListOfComponents[*]} ; do
416
417        echo "-----"
418        # Define component
419        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
420        eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
421
422        # Debug Print :
423        IGCM_debug_Print 3 "Boundary files ${compname}"
424
425        card=${SUBMIT_DIR}/COMP/${compname}.card
426
427        IGCM_card_DefineArrayFromOption ${card} BoundaryFiles List
428        ListFilesName=${compname}_BoundaryFiles_List
429        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
430
431        if [ X${FileName0} != X${NULL_STR} ] ; then
432            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
433
434            (( i=0 ))
435            until [ $i -ge $NbFiles ]; do
436                eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
437                eval file_in=${file_in_}
438                (( i_ = i+1 ))
439                eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
440                eval file_out=${file_out_}
441
442                IGCM_sys_Get ${file_in} ${file_out}
443                IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
444
445                (( i=i+2 ))
446            done
447        fi
448
449        # Get non deleted files
450        if [ ${Period} = 1 ]; then
451
452            IGCM_card_DefineArrayFromOption ${card} BoundaryFiles ListNonDel
453            ListFilesName=${compname}_BoundaryFiles_ListNonDel
454            eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
455           
456            if [ X${FileName0} != X${NULL_STR} ] ; then
457                eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
458               
459                (( i=0 ))
460                until [ $i -ge $NbFiles ]; do
461                    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
462                    eval file_in=${file_in_}
463                    (( i_ = i+1 ))
464                    eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
465                    eval file_out=${file_out_}
466
467                    IGCM_sys_Get ${file_in} ${file_out}
468
469                    if [ X${file_out} != X. ] ; then
470                        ListFixBoundary=${ListFixBoundary}" "${file_out}
471                    else
472                        ListFixBoundary=${ListFixBoundary}" "$( basename ${file_in} )
473                    fi
474
475                    (( i=i+2 ))
476                done
477            fi
478        fi
479    done
480   
481    IGCM_debug_PopStack "IGCM_comp_GetInputBoundaryFiles"
482}
483
484#=======================================================================
485function IGCM_comp_DelFixeBoundaryFiles
486{
487    IGCM_debug_PushStack "IGCM_comp_DelFixeBoundaryFiles"
488
489    # Debug Print :
490    echo
491    IGCM_debug_Print 1 "IGCM_comp_DelFixeBoundaryFiles :"
492    echo
493
494    ls -l ${ListFixBoundary}
495    rm -f ${ListFixBoundary}
496
497    IGCM_debug_PopStack "IGCM_comp_DelFixeBoundaryFiles"
498}
499
500#=======================================================================
501function IGCM_comp_GetInputParametersFiles
502{
503    IGCM_debug_PushStack "IGCM_comp_GetInputParametersFiles"
504
505    # Debug Print :
506    echo
507    IGCM_debug_Print 1 "IGCM_comp_GetInputParametersFiles :"
508    echo
509
510    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ file_in file_out
511    for comp in ${config_ListOfComponents[*]} ; do
512        # Define component
513        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
514        eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
515
516        # Debug Print :
517        IGCM_debug_Print 3 "Parameters ${compname}"
518
519        card=${SUBMIT_DIR}/COMP/${compname}.card       
520
521        IGCM_card_DefineArrayFromOption ${card} ParametersFiles List
522        ListFilesName=${compname}_ParametersFiles_List
523        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
524
525        if [ X${FileName0} != X${NULL_STR} ] ; then
526            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
527
528            (( i=0 ))
529            until [ $i -ge $NbFiles ]; do
530                eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
531                eval file_in=${file_in_}
532                (( i_ = i+1 ))
533                eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
534                eval file_out=${file_out_} 
535
536                IGCM_sys_Cp ${file_in} ${file_out} 
537                IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
538
539                (( i=i+2 ))
540            done
541        fi
542    done
543
544    IGCM_debug_PopStack "IGCM_comp_GetInputParametersFiles"
545}
546
547#=======================================================================
548function IGCM_comp_GetInputRestartFiles
549{
550    IGCM_debug_PushStack "IGCM_comp_GetInputRestartFiles"
551
552    # Debug Print :
553    echo
554    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles :"
555    echo
556
557    typeset Date_tmp Date_r Path_r do_start CompOldName Path_temp
558    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_
559    typeset file_in file_out file_in_ file_out_ file_in_Name
560    typeset -Z4 j4
561
562    for comp in ${config_ListOfComponents[*]} ; do
563        # Define component
564        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
565        eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
566        #
567        card=${SUBMIT_DIR}/COMP/${compname}.card
568        #
569        IGCM_card_DefineArrayFromOption ${card} RestartFiles List
570        ListFilesName=${compname}_RestartFiles_List
571        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
572
573        # Debug Print :
574        IGCM_debug_Print 3 "restart ${compname}"
575
576        if ( ${FirstInitialize} ) ; then
577
578            if [ "${config_Restarts_OverRule}" = "y" ] ; then
579                eval config_${comp}_Restart="y"
580                eval config_${comp}_RestartDate=${config_Restarts_RestartDate}
581                eval config_${comp}_RestartJobName=${config_Restarts_RestartJobName}
582                eval config_${comp}_RestartPath=${config_Restarts_RestartPath}
583                eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
584                eval CompOldName=${comp}
585            else
586                # Read component Restarts parameters
587                IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
588                eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
589
590                if [ "${do_start}" = "y" ] ; then
591                    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartDate
592                    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartJobName
593                    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartPath
594                else
595                    eval config_${comp}_RestartDate=-1
596                    eval config_${comp}_RestartJobName=${NULL_STR}
597                    eval config_${comp}_RestartPath=${NULL_STR}
598                fi
599                IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} OldName
600                eval CompOldName=\${config_${comp}_OldName}
601                if [ X${CompOldName} = X ] ; then
602                    eval CompOldName=${comp}
603                fi
604            fi
605
606            if [ "${do_start}" = "y" ] ; then
607
608                if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
609                    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
610
611                    (( i=1 ))
612                    until [ $i -gt $NbFiles ]; do
613                        eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
614                        eval file_in=${file_in_}
615
616                        (( i_ = i+1 ))
617                        eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
618                        eval file_out=${file_out_}
619                       
620                        eval Date_tmp=\${config_${comp}_RestartDate}
621                        Date_r=$( IGCM_date_ConvertFormatToGregorian ${Date_tmp} )
622                        eval Path_r=\${config_${comp}_RestartPath}/\${config_${comp}_RestartJobName}/${CompOldName}/Restart
623                        eval file_in_Name=\${config_${comp}_RestartJobName}_${Date_r}_${file_in}
624
625                        generic_restart_file_name_in=$( basename ${file_in_Name} .nc )
626                        generic_restart_file_name_out=$( basename ${file_out} .nc )
627                       
628                        eval Path_temp=\${Path_r}/${generic_restart_file_name_in}
629                        nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_temp}_????.nc)
630
631                        if [ ${nb_restart_file} -gt 1 ] ; then
632                            j=0
633                            until [ $j -ge $nb_restart_file ]; do
634                                j4=${j}
635                                eval IGCM_sys_Get ${Path_r}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
636                                #IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
637                                #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1
638                                (( j=j+1 ))
639                            done
640                        else
641                            eval IGCM_sys_Get ${Path_r}/${file_in_Name} ${file_out} 
642                            #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
643                        fi
644               
645                        (( i=i+3 ))
646                    done
647                else
648                    if [ X${FileName0} != XNONE ] ; then
649                        IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}."
650                    else
651                        IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}."
652                    fi
653                fi
654            fi
655        elif [ ${Period} -eq 1 ] ; then
656            # if not FirstInitialize and first loop of this job
657
658            # Restore Restarts files
659            #-----------------------
660            if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
661                eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
662
663                (( i=1 ))
664                until [ $i -gt $NbFiles ]; do
665                    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
666                    eval file_in=${file_in_}
667                    (( i_ = i+1 ))
668                    eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
669                    eval file_out=${file_out_}
670                   
671                    file_in_Name=${run_Configuration_OldPrefix}_${file_in}
672
673                    generic_restart_file_name_in=$( basename ${file_in_Name} .nc )
674                    generic_restart_file_name_out=$( basename ${file_out} .nc )
675
676                    eval Path_temp=\${R_OUT_${comp}_R}/${generic_restart_file_name_in}
677                    nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_temp}_????.nc)
678
679                    if [ ${nb_restart_file} -gt 1 ] ; then
680                        j=0
681                        until [ $j -ge $nb_restart_file ]; do
682                            j4=${j}
683                            eval IGCM_sys_Get \${R_OUT_${comp}_R}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
684                            #IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
685                            #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1
686
687                            (( j=j+1 ))
688                        done
689                    else
690                        eval IGCM_sys_Get \${R_OUT_${comp}_R}/${file_in_Name} ${file_out}
691                        #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
692                    fi
693
694                    (( i=i+3 ))
695                done
696            else
697                if [ X${FileName0} != XNONE ] ; then
698                    IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}."
699                else
700                    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}."
701                fi
702            fi
703        fi
704    done
705    IGCM_sys_Chmod u+rw *
706
707    IGCM_debug_PopStack "IGCM_comp_GetInputRestartFiles"
708}
709
710#=======================================================================
711function IGCM_comp_Update
712{
713    IGCM_debug_PushStack "IGCM_comp_Update"
714
715    # Debug Print :
716    echo
717    IGCM_debug_Print 1 "IGCM_comp_Update :"
718    echo
719
720    typeset ExeNameIn ExeNameOut
721    typeset comp compname comptagname
722    for comp in ${config_ListOfComponents[*]} ; do
723        # Define component
724        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
725        eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
726
727        # Copy executable for this component
728        eval ExeNameIn=\${config_Executable_${comp}[0]}
729        eval ExeNameOut=\${config_Executable_${comp}[1]}
730
731        # If missing executable then stop!
732        #if [ ! X${ExeNameIn} = X ] && [ ! -f ${R_EXE}/${ExeNameIn} ] ; then
733        #    IGCM_debug_Exit "IGCM_comp_Update missing executable ${ExeNameIn}"
734        #fi
735
736        if [ ${Period} -eq 1 ] && [ -f ${R_EXE}/${ExeNameIn} ] ; then
737            eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut}
738            if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then
739                eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut}
740            fi
741        elif [ -f ${R_EXE}/${ExeNameIn} ] && [ ! -f ${RUN_DIR}/${ExeNameOut} ] ; then
742            eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut}
743            if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then
744                eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut}
745            fi
746        fi
747
748        # Debug Print
749        IGCM_debug_Print 3 "Update ${compname} Parameter Files."
750        # UPDATE component
751        ${comp}_Update
752
753    done
754
755    IGCM_debug_PopStack "IGCM_comp_Update"
756}
757
758#=======================================================================
759function IGCM_comp_Finalize
760{
761    IGCM_debug_PushStack "IGCM_comp_Finalize"
762
763    # Debug Print :
764    echo
765    IGCM_debug_Print 1 "IGCM_comp_Finalize :"
766    echo
767
768    typeset ListTextName TextName0
769    typeset comp compname comptagname card ListFilesName FileName0 NbFiles SaveOnArchive
770    typeset i i_ file_in file_in_ file_out file_out_ file_outin file_outin_ generic_file_name nb_rebuild_file
771    typeset -Z4 j4
772    for comp in ${config_ListOfComponents[*]} ; do
773        # Define component
774        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
775        eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
776
777        # Debug Print
778        IGCM_debug_Print 1 "Finalize ${compname} component."
779        # FINALIZE component
780        ${comp}_Finalize
781
782        card=${SUBMIT_DIR}/COMP/${compname}.card       
783
784        # Save Restarts files
785        #--------------------
786        IGCM_card_DefineArrayFromOption ${card} RestartFiles List
787        ListFilesName=${compname}_RestartFiles_List
788        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
789       
790        if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
791            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
792           
793            (( i=0 ))
794            until [ $i -ge $NbFiles ]; do
795                eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
796                eval file_in=${file_in_}
797
798                (( i_ = i+1 ))
799                eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
800                eval file_out=${file_out_}
801
802                (( i_ = i+2 ))
803                eval file_outin_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
804                eval file_outin=${file_outin_}
805
806                generic_restart_file_name_in=$(    basename ${file_in} .nc )
807                generic_restart_file_name_out=$(   basename ${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} .nc )
808                generic_restart_file_name_outin=$( basename ${file_outin} .nc )
809                       
810                nb_restart_file=$( ls ${generic_restart_file_name_in}_????.nc 2>/dev/null | wc -l ) 
811                if [ ${nb_restart_file} -gt 1 ] ; then
812                    j=0
813                    until [ $j -ge $nb_restart_file ]; do
814                        j4=${j}
815                        eval IGCM_sys_Put_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
816                        [ ! ${file_in} = ${file_outin} ] && IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc
817                        #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_in}_${j4}.nc" > /dev/null 2>&1
818                        (( j=j+1 ))
819                    done
820                else
821                    eval IGCM_sys_Put_Rest ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
822                    [ ! ${file_in} = ${file_outin} ] && IGCM_sys_Mv ${file_in} ${file_outin}
823                    #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
824                fi
825
826                (( i=i+3 ))
827            done
828        else
829            if [ X${FileName0} != XNONE ] ; then
830                IGCM_debug_Exit "IGCM_comp_Finalize : No file in restart list for ${compname}."
831            else
832                IGCM_debug_Print 1 "IGCM_comp_Finalize : NONE specified in Restart List ${compname}."
833            fi
834        fi
835
836        # Save Output files
837        #------------------
838        IGCM_card_DefineArrayFromOption ${card} OutputFiles List
839        ListFilesName=${compname}_OutputFiles_List
840        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
841
842        if [ X${FileName0} != X${NULL_STR} ] ; then
843            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
844
845            (( i=0 ))
846            until [ $i -ge $NbFiles ]; do
847                SaveOnArchive=true
848                eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
849                eval file_in=${file_in_}
850                (( i_ = i+1 ))
851                eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
852                eval file_out=${file_out_}
853                (( i_ = i+2 ))
854                eval flag_post=\${${ListFilesName}[$i_]} > /dev/null 2>&1
855                #
856                generic_file_name=$( basename ${file_in} .nc )
857                nb_rebuild_file=$( ls | grep "^${generic_file_name}[_0-9]*.nc" | wc -l )
858                #
859                if ( [ ${nb_rebuild_file} -eq 1 ] && [ -f ${generic_file_name}_0000.nc ] ) ; then
860                    IGCM_debug_Print 2 "Parallelism with 1 process. Rebuilding ${file_in} not needed"
861                    IGCM_sys_Mv ${generic_file_name}_0000.nc ${file_in}
862                elif [ ${nb_rebuild_file} -gt 1 ] ; then
863                    IGCM_debug_Print 2 "Parallelism detected rebuilding ${file_in} is needed"
864                    if ( [ X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ X${config_Post_RebuildFrequency} = XNONE ] ) ; then
865                        IGCM_debug_Print 2 "Rebuilding ${file_in} online"
866                        IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc
867                    else
868                        IGCM_debug_Print 2 "Preparing offline rebuild for ${file_in}"
869                        [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
870                        IGCM_sys_Mv ${generic_file_name}_????.nc ${RUN_DIR}/REBUILD_${PeriodDateBegin}
871
872                        # Prepare headers for the shell dedicated to offline rebuild
873                        if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
874                            if [ $DRYRUN -le 1 ]; then
875                            echo \#!/bin/ksh                                           > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
876                            echo function IGCM_FlushRebuild                           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
877                            echo {                                                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
878                            echo IGCM_debug_PushStack "IGCM_FlushRebuild"             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
879                            echo echo                                                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
880                            echo IGCM_debug_Print 1 "IGCM_FlushRebuild"               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
881                            echo echo                                                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
882                            fi
883                        fi
884                        # Prepare the shell dedicated to offline rebuild
885                        if [ $DRYRUN -le 1 ]; then
886                            echo IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
887                            echo IGCM_debug_Verif_Exit                                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
888                        fi
889                        #
890                        # Load Patch we need to apply and apply
891                        if [ $DRYRUN -le 1 ]; then
892                            if [ X$( eval echo \${${compname}_${flag_post}_Patches[0]} ) !=  X${NULL_STR} ]; then
893                                for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
894                                    echo . ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
895                                    echo IGCM_${Patch} ${file_in}                         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
896                                done
897                            fi
898                        fi
899                        #
900                        if [ $DRYRUN -le 1 ]; then
901                            echo IGCM_sys_Put_Out ${file_in} ${file_out}                  >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
902                            echo IGCM_debug_Verif_Exit                                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
903                            echo IGCM_sys_Rm ${generic_file_name}_*.nc                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
904                        fi
905                        SaveOnArchive=false
906                    fi
907                fi
908                #
909                if [ ${SaveOnArchive} = true ] ; then
910                    #
911                    # If we need to apply a patch we use TMP DIRECTORY before ARCHIVING if asynchronous rebuild is on
912                    #
913                    if ( [ ! X$( eval echo \${${compname}_${flag_post}_Patches[0]} ) =  X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = X ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
914                        if [ -f ${file_in} ] ; then
915                            IGCM_sys_Mv ${file_in} ${RUN_DIR}/REBUILD_${PeriodDateBegin}
916                            eval FileToBeDeleted[${#FileToBeDeleted[@]}]=REBUILD_${PeriodDateBegin}/${file_in} > /dev/null 2>&1
917                            #
918                            if [ $DRYRUN -le 1 ]; then
919                                for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
920                                    echo . ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
921                                    echo IGCM_${Patch} ${file_in}                             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
922                                done
923                                #
924                                echo IGCM_sys_Put_Out ${file_in} ${file_out}                  >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
925                                echo IGCM_debug_Verif_Exit                                    >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
926                                #
927                            fi
928                        fi
929                    else
930                        IGCM_sys_Put_Out ${file_in} ${file_out}
931                        [ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
932                        if [ ${nb_rebuild_file} -gt 1 ] ; then
933                            for DelFile in $( ls | grep "${generic_file_name}[_0-9]*.nc" ) ; do
934                                eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${DelFile} > /dev/null 2>&1
935                            done
936                        fi
937                    fi
938                fi
939                (( i=i+3 ))
940            done
941        fi
942
943        # Save Output Text files of models
944        #---------------------------------
945       
946        IGCM_card_DefineArrayFromOption ${card} OutputText List
947        ListTextName=${compname}_OutputText_List
948       
949        eval TextName0=\${${ListTextName}[0]} > /dev/null 2>&1
950        if [ X${TextName0} != X${NULL_STR} ] ; then
951            eval NbFiles=\${#${ListTextName}[@]} > /dev/null 2>&1
952
953            (( i=0 ))
954            until [ $i -eq $NbFiles ]; do
955                eval file_in=\${${ListTextName}[$i]} > /dev/null 2>&1
956                (( i=i+1 ))
957
958                nb_text_file=$( ls ${file_in}* 2>/dev/null | wc -l )
959                if [ ${nb_text_file} -gt 1 ] ; then
960                    list_file=$( ls ${file_in}* )
961                    for file in ${list_file}
962                      do
963                      eval IGCM_sys_Put_Out ${file} \${R_OUT_${comp}_D}/${PREFIX}_${file}
964                      eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1
965                    done
966                else
967                    if ( [ -f ${file_in}_0000 ] || [ -f ${file_in}0 ] ) ; then
968                        eval IGCM_sys_Mv ${file_in}* ${file_in}
969                    fi
970                    eval IGCM_sys_Put_Out ${file_in} \${R_OUT_${comp}_D}/${PREFIX}_${file_in}
971                    [ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
972                fi
973            done
974        fi
975    done
976
977    IGCM_debug_PopStack "IGCM_comp_Finalize"
978}
Note: See TracBrowser for help on using the repository browser.