source: trunk/libIGCM/libIGCM_post/libIGCM_post.ksh @ 105

Last change on this file since 105 was 105, checked in by sdipsl, 15 years ago

MAF : Add daily frequency possibility for asynchronous rebuild.

  • 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: 24.7 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil
5# Contact: Sebastien.Denvil@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#=======================================================================
17
18function IGCM_post_Configure
19{
20    IGCM_debug_PushStack "IGCM_post_Configure"
21
22    # Debug Print :
23    echo
24    IGCM_debug_Print 1 "IGCM_post_Configure :"
25    echo
26
27    typeset NbDays PeriodEndJul PostEndJul PeriodPost
28    RebuildFrequency=false
29
30    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
31
32        IGCM_debug_Print 1 "Asynchronous rebuild has been activated."
33        echo
34
35        case ${config_Post_RebuildFrequency} in
36            *y|*Y)
37                PeriodYear=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[yY]//" )
38                case ${config_UserChoices_PeriodLength} in
39                    *Y|*y)
40                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" )
41                        if [ ${PeriodPost} -le ${PeriodYear} ] ; then
42                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodYear}  ) -eq 0 ] ;  then
43                                RebuildFrequency=true
44                                NbRebuildDir=$( expr ${PeriodYear} / ${PeriodPost} )
45                            fi
46                        else
47                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
48                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
49                        fi ;;
50                    *M|*m)
51                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
52                        if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then
53                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then
54                                RebuildFrequency=true
55                                NbRebuildDir=$( expr $(( 12 * ${PeriodYear} )) / ${PeriodPost} )
56                            fi
57                        else
58                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
59                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
60                        fi ;;
61                    *D|*d)
62                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
63                        NbDays=$( IGCM_date_DaysInYear ${year} )
64                        if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then
65                            if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then
66                                if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${PeriodPost} \) ) ) -eq 0 ] ; then
67                                    RebuildFrequency=true
68                                    NbRebuildDir=$( expr $(( ${NbDays} * ${PeriodYear} )) / ${PeriodPost} )
69                                fi
70                            else
71                                IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
72                                IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
73                            fi
74                        else
75#                           if [ ${PeriodYear} -eq 1 ] ; then
76#                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
77#                               PostEndJul=${year}${NbDays}
78#                               #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}"
79#                               #echo "PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
80#                               if [ ${PostEndJul} -eq ${PeriodEndJul} ] ; then
81#                                   RebuildFrequency=true
82#                                   NbRebuildDir=$( expr ${NbDays} / ${PeriodPost} )
83#                               fi
84#                           else
85                            IGCM_debug_Print 3 "For RebuildFrequency with leap calendar:"
86                            IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y."
87                            IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment."
88#                           fi
89                        fi;;
90                esac ;;
91            *M|*m)
92                PeriodMonth=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[mM]//" )
93                case ${config_UserChoices_PeriodLength} in
94                    *Y|*y)
95                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
96                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
97                    *M|*m)
98                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
99                        if [ ${PeriodPost} -le ${PeriodMonth} ] ; then
100                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodMonth}  ) -eq 0 ] ;  then
101                                RebuildFrequency=true
102                                NbRebuildDir=$( expr ${PeriodMonth} / ${PeriodPost} )
103                            fi
104                        else
105                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
106                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
107                        fi ;;
108                    *D|*d)
109                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
110                        IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" ;;
111                esac
112                ;;
113            *D|*d)
114                PeriodDay=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[dD]//" )
115                case ${config_UserChoices_PeriodLength} in
116                    *Y|*y)
117                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
118                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
119                    *M|*m)
120                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
121                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
122                    *D|*d)
123                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
124                        if [ ${PeriodPost} -le ${PeriodDay} ] ; then
125                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodDay}  ) -eq 0 ] ;  then
126                                RebuildFrequency=true
127                                NbRebuildDir=$( expr ${PeriodDay} / ${PeriodPost} )
128                            fi
129                        else
130                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
131                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
132                        fi ;;
133
134                esac
135                ;;
136            NONE|none)
137                ;;
138            *)
139                IGCM_debug_Print 3 "KeyWord not allowed for RebuildFrequency in config.card"
140                ;;
141        esac
142    else
143        #
144        IGCM_debug_Print 1 "Asynchronous rebuild has not been activated"
145        IGCM_debug_Print 1 "Proceed with standard post-treatment pathway"
146        echo
147        #
148    fi
149
150    IGCM_debug_Print 1 "RebuildFrequency flag value : ${RebuildFrequency}"
151    IGCM_post_Initialize
152
153    IGCM_debug_PopStack "IGCM_post_Configure"
154}
155
156function IGCM_post_Initialize
157{
158    IGCM_debug_PushStack "IGCM_post_Initialize"
159
160    # Debug Print :
161    echo
162    IGCM_debug_Print 1 "IGCM_post_Initialize :"
163    echo
164
165    typeset POST NbDays PeriodEndJul PostEndJul LengthDays
166    POST=false
167
168    # READ TIME SERIES OR SEASONAL FREQUENCY
169    # AND TURN ON THE FLAG WHEN MODULO IS ZERO
170    for post_freq in TimeSeriesFrequency SeasonalFrequency ; do
171        #
172        # Initialize
173        #
174        eval ${post_freq}=false
175        #
176        # Define the variable ${config_Post_${post_freq}}
177        # who contains frequency for specific post-treatment
178        #
179        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${post_freq}
180        #
181        # Extract frequency from above variable
182        #
183        config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} )
184        #
185        if ( [ X${config_Post_post_freq} = X${NULL_STR} ] || [ X${config_Post_post_freq} = XNONE ] ) ; then
186            #
187            continue
188            #
189        fi
190        #
191        # For each componant select determine which files need post-processing
192        #
193        for comp in ${config_ListOfComponents[*]} ; do
194            #
195            #echo "-----"
196            eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
197            ListFilesName=${compname}_OutputFiles_List
198            eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
199            #
200            if [ X${FileName0} != X${NULL_STR} ] ; then
201                #
202                #IGCM_debug_Print 1 "Component      : ${compname}"
203                #
204                # INITIALISATION
205                #
206                eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
207                typeset i=0
208                #
209                until [ $i -eq $NbFiles ]; do
210                    #
211                    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
212                    eval file_in=${file_in_}
213                    let $(( i_ = i+2 ))
214                    eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
215                    eval flag_post=${flag_post_}
216                    #
217                    if [ X${flag_post} != XNONE ] ; then
218                    #
219                        case ${config_Post_post_freq} in
220                            *y|*Y)
221                                PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" )
222                                case ${config_UserChoices_PeriodLength} in
223                                    *Y|*y)
224                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" )
225                                        if [ ${PeriodPost} -le ${PeriodYear} ] ; then
226                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodYear}  ) -eq 0 ] ;  then
227                                                eval ${post_freq}=true
228                                                POST=true
229                                            fi
230                                        else
231                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
232                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
233                                        fi ;;
234                                    *M|*m)
235                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
236                                        if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then
237                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then
238                                                eval ${post_freq}=true
239                                                POST=true
240                                            fi
241                                        else
242                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
243                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
244                                        fi ;;
245                                    *D|*d)
246                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
247                                        NbDays=$( IGCM_date_DaysInYear ${year} )
248                                        if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then
249                                            if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then
250                                                if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${PeriodPost} \) ) ) -eq 0 ] ; then
251                                                    eval ${post_freq}=true
252                                                    POST=true
253                                                fi
254                                            else
255                                                IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
256                                                IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
257                                            fi
258                                        else
259#                                           if [ ${PeriodYear} -eq 1 ] ; then
260#                                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
261#                                               PostEndJul=${year}${NbDays}
262#                                                #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}"
263#                                               #echo PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
264#                                               if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then
265#                                                   eval ${post_freq}=true
266#                                                   POST=true
267#                                               fi
268#                                           else
269                                            IGCM_debug_Print 3 "For ${post_freq} with leap calendar, for ${comp} and ${file_in} :"
270                                            IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y."
271                                            IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment."
272#                                           fi
273                                        fi;;
274                                esac ;;
275                            *M|*m)
276                                PeriodMonth=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[mM]//" )
277                                case ${config_UserChoices_PeriodLength} in
278                                    *Y|*y)
279                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
280                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
281                                    *M|*m)
282                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
283                                        if [ ${PeriodPost} -le ${PeriodMonth} ] ; then
284                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodMonth}  ) -eq 0 ] ;  then
285                                                eval ${post_freq}=true
286                                                POST=true
287                                            fi
288                                        else
289                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
290                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
291                                        fi;;
292                                    *D|*d)
293                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
294                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
295                                esac ;;
296                            *D|*d)
297                                PeriodDay=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[dD]//" )
298                                case ${config_UserChoices_PeriodLength} in
299                                    *Y|*y)
300                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
301                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
302                                    *M|*m)
303                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
304                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
305                                    *D|*d)
306                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
307                                        if [ ${PeriodPost} -le ${PeriodDay} ] ; then
308                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodDay}  ) -eq 0 ] ;  then
309                                                eval ${post_freq}=true
310                                                POST=true
311                                            fi
312                                        else
313                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
314                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
315                                        fi;;
316                                esac ;;
317                            NONE|none)
318                                ;;
319                            *)
320                                IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card"
321                                ;;
322                        esac
323                    fi
324                    let $(( i=i+3 ))
325                done
326            fi
327        done
328    done
329    #
330    if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \
331         [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]        && \
332         [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
333        TimeSeriesFrequency=true
334        POST=true
335    fi
336
337    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \
338         [ ! X${config_Post_RebuildFrequency} = XNONE ]        && \
339         [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
340        RebuildFrequency=true
341        POST=true
342    fi
343
344    #
345    IGCM_debug_Print 1 "POST-TREATEMENT flag value : ${POST}"
346    #
347    IGCM_post_Submit
348
349    IGCM_debug_PopStack "IGCM_post_Initialize"
350}
351
352function IGCM_post_Submit
353{
354    IGCM_debug_PushStack "IGCM_post_Submit"
355
356    POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
357
358    if [ ${POST} = true ]; then
359        echo
360        IGCM_debug_Print 1 "IGCM_post_Submit :"
361        echo
362        IGCM_debug_Print 1 "POST_DIR = ${POST_DIR}"
363    fi
364
365    #============ TIME SERIES POST-TREATMENT ===========#
366    if [ ${TimeSeriesFrequency} = true ] ; then
367
368        IGCM_debug_Print 2 "TIME SERIES POST-TREATMENT :"
369        echo
370        #
371        typeset listVarEnv
372        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
373
374        if [ ${RebuildFrequency} = true ] ; then
375            #
376            echo export DEBUG_debug=${DEBUG_debug}     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
377            echo export MODIPSL=${MODIPSL}             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
378            echo export libIGCM_SX=${libIGCM}          >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
379            echo export libIGCM=${libIGCM_POST}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
380            echo export SUBMIT_DIR=${SUBMIT_DIR}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
381            echo export POST_DIR=${POST_DIR}           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
382            echo export MASTER=${MASTER}               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
383            echo export DateBegin=${DateBegin}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
384            echo export PeriodDateEnd=${PeriodDateEnd} >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
385            echo export StandAlone=false               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
386            echo export RESOL_ATM=${RESOL_ATM}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
387            echo export RESOL_OCE=${RESOL_OCE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
388            echo export RESOL_ICE=${RESOL_ICE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
389            echo export RESOL_SRF=${RESOL_SRF}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
390            echo export listVarEnv=${listVarEnv}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
391            echo IGCM_sys_MkdirWork ${POST_DIR}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
392            echo IGCM_debug_Verif_Exit                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
393            echo IGCM_sys_QsubPost create_ts           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
394            #
395        else
396            #
397            IGCM_sys_RshPost <<-EOF
398            export DEBUG_debug=${DEBUG_debug}
399            export MODIPSL=${MODIPSL}
400            export libIGCM_SX=${libIGCM}
401            export libIGCM=${libIGCM_POST}
402            export SUBMIT_DIR=${SUBMIT_DIR}
403            export POST_DIR=${POST_DIR}
404            export MASTER=${MASTER}
405            export DateBegin=${DateBegin}
406            export PeriodDateEnd=${PeriodDateEnd}
407            export StandAlone=false
408            export RESOL_ATM=${RESOL_ATM}
409            export RESOL_OCE=${RESOL_OCE}
410            export RESOL_ICE=${RESOL_ICE}
411            export RESOL_SRF=${RESOL_SRF}
412            export listVarEnv=${listVarEnv}
413            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
414            . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
415            IGCM_sys_MkdirWork ${POST_DIR}
416            IGCM_debug_Verif_Exit
417            IGCM_sys_QsubPost create_ts
418EOF
419            #
420        fi
421    fi
422
423    #=============  SEASONAL POST-TREATMENT ============#
424    if [ ${SeasonalFrequency} = true ] ; then
425        #
426        IGCM_debug_Print 2 "SEASONNAL POST-TREATMENT :"
427        echo
428        #
429        typeset listVarEnv
430        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
431
432        if [ ${RebuildFrequency} = true ] ; then
433            #
434            echo export DEBUG_debug=${DEBUG_debug}     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
435            echo export MODIPSL=${MODIPSL}             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
436            echo export libIGCM_SX=${libIGCM}          >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
437            echo export libIGCM=${libIGCM_POST}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
438            echo export SUBMIT_DIR=${SUBMIT_DIR}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
439            echo export POST_DIR=${POST_DIR}           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
440            echo export MASTER=${MASTER}               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
441            echo export DateBegin=${DateBegin}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
442            echo export PeriodDateEnd=${PeriodDateEnd} >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
443            echo export StandAlone=false               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
444            echo export RESOL_ATM=${RESOL_ATM}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
445            echo export RESOL_OCE=${RESOL_OCE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
446            echo export RESOL_ICE=${RESOL_ICE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
447            echo export RESOL_SRF=${RESOL_SRF}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
448            echo export listVarEnv=${listVarEnv}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
449            echo IGCM_sys_MkdirWork ${POST_DIR}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
450            echo IGCM_debug_Verif_Exit                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
451            echo IGCM_sys_QsubPost create_se           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
452            #
453        else
454            #
455            IGCM_sys_RshPost <<-EOF
456            export DEBUG_debug=${DEBUG_debug}
457            export MODIPSL=${MODIPSL}
458            export libIGCM_SX=${libIGCM}
459            export libIGCM=${libIGCM_POST}
460            export SUBMIT_DIR=${SUBMIT_DIR}
461            export POST_DIR=${POST_DIR}
462            export MASTER=${MASTER}
463            export DateBegin=${DateBegin}
464            export PeriodDateEnd=${PeriodDateEnd}
465            export StandAlone=false
466            export RESOL_ATM=${RESOL_ATM}
467            export RESOL_OCE=${RESOL_OCE}
468            export RESOL_ICE=${RESOL_ICE}
469            export RESOL_SRF=${RESOL_SRF}
470            export listVarEnv=${listVarEnv}
471            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
472            . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
473            IGCM_sys_MkdirWork ${POST_DIR}
474            IGCM_debug_Verif_Exit
475            IGCM_sys_QsubPost create_se
476EOF
477        #
478        fi
479    fi
480
481    #============== REBUILD POST-TREATMENT =============#
482
483    if ( [ ${config_Post_RebuildFromArchive} = true ] && [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
484        IGCM_sys_Put_Dir REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
485    fi
486    #
487    if [ ${RebuildFrequency} = true ] ; then
488        #
489        if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then
490        #
491        IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM ARCHIVE:"
492        echo
493        #
494        typeset listVarEnv
495        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,RebuildFromArchive,POST_DIR,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
496        IGCM_sys_RshPost <<-EOF
497        export DEBUG_debug=${DEBUG_debug}
498        export MODIPSL=${MODIPSL}
499        export libIGCM_SX=${libIGCM}
500        export libIGCM=${libIGCM_POST}
501        export SUBMIT_DIR=${SUBMIT_DIR}
502        export RebuildFromArchive=${config_Post_RebuildFromArchive}
503        export REBUILD_DIR=${REBUILD_DIR}
504        export POST_DIR=${POST_DIR}
505        export MASTER=${MASTER}
506        export DateBegin=${DateBegin}
507        export PeriodDateBegin=${PeriodDateBegin}
508        export PeriodDateEnd=${PeriodDateEnd}
509        export NbRebuildDir=${NbRebuildDir}
510        export StandAlone=false
511        export RESOL_ATM=${RESOL_ATM}
512        export RESOL_OCE=${RESOL_OCE}
513        export RESOL_ICE=${RESOL_ICE}
514        export RESOL_SRF=${RESOL_SRF}
515        export listVarEnv=${listVarEnv}
516        . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
517        . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
518        IGCM_sys_MkdirWork ${POST_DIR}
519        IGCM_debug_Verif_Exit
520        IGCM_sys_QsubPost rebuild
521EOF
522        else 
523        #
524        IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM WORKDIR :"
525        echo
526        #
527        typeset listVarEnv
528        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,RebuildFromArchive,POST_DIR,MASTER,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
529        export DEBUG_debug=${DEBUG_debug}
530        export MODIPSL=${MODIPSL}
531        export libIGCM_SX=${libIGCM}
532        export libIGCM=${libIGCM}
533        export SUBMIT_DIR=${SUBMIT_DIR}
534        export RebuildFromArchive=${config_Post_RebuildFromArchive}
535        export REBUILD_DIR=${REBUILD_DIR}
536        export POST_DIR=${libIGCM}
537        export DateBegin=${DateBegin}
538        export PeriodDateBegin=${PeriodDateBegin}
539        export PeriodDateEnd=${PeriodDateEnd}
540        export NbRebuildDir=${NbRebuildDir}
541        export StandAlone=false
542        export RESOL_ATM=${RESOL_ATM}
543        export RESOL_OCE=${RESOL_OCE}
544        export RESOL_ICE=${RESOL_ICE}
545        export RESOL_SRF=${RESOL_SRF}
546        export listVarEnv=${listVarEnv}
547        IGCM_sys_Qsub rebuildtmp.job ${libIGCM}
548        fi
549    fi
550
551    IGCM_debug_PopStack "IGCM_post_Submit"
552}
Note: See TracBrowser for help on using the repository browser.