source: tags/libIGCM_v1_3/libIGCM_post/libIGCM_post.ksh @ 174

Last change on this file since 174 was 174, checked in by mmaipsl, 15 years ago

Add RESOL_BIOS (BIOgeochemistry for Surface) to libIGCM_v1_3 tag for use with STOMATE component.

  • 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: 26.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    #==================================
169    # Define variable ${config_Post_${post_freq}}
170    # who contains frequency for specific post-treatment
171    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post
172
173    for option in ${config_Post[*]} ; do
174        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option}
175    done
176
177    # READ TIME SERIES OR SEASONAL FREQUENCY
178    # AND TURN ON THE FLAG WHEN MODULO IS ZERO
179    for post_freq in TimeSeriesFrequency SeasonalFrequency ; do
180        #
181        # Initialize
182        #
183        eval ${post_freq}=false
184        #
185        # Extract frequency from previously defined variable
186        #
187        config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} )
188        #
189        # Offset for Seasonal Average starting period
190        #
191        if [ ${post_freq} = SeasonalFrequency ] ; then
192            if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
193                PeriodOffset=0
194            else
195                PeriodOffset=${config_Post_SeasonalFrequencyOffset}
196            fi
197        else
198            PeriodOffset=0
199        fi
200        #
201        if ( [ X${config_Post_post_freq} = X${NULL_STR} ] || [ X${config_Post_post_freq} = XNONE ] ) ; then
202            #
203            continue
204            #
205        fi
206        #
207        # For each componant select determine which files need post-processing
208        #
209        for comp in ${config_ListOfComponents[*]} ; do
210            #
211            #echo "-----"
212            eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
213            ListFilesName=${compname}_OutputFiles_List
214            eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
215            #
216            if [ X${FileName0} != X${NULL_STR} ] ; then
217                #
218                #IGCM_debug_Print 1 "Component      : ${compname}"
219                #
220                # INITIALISATION
221                #
222                eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
223                typeset i=0
224                #
225                until [ $i -eq $NbFiles ]; do
226                    #
227                    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
228                    eval file_in=${file_in_}
229                    let $(( i_ = i+2 ))
230                    eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
231                    eval flag_post=${flag_post_}
232                    #
233                    if [ X${flag_post} != XNONE ] ; then
234                    #
235                        case ${config_Post_post_freq} in
236                            *y|*Y)
237                                PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" )
238                                #
239                                case ${config_UserChoices_PeriodLength} in
240                                    *Y|*y)
241                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" )
242                                        if [ ${PeriodPost} -le ${PeriodYear} ] ; then
243                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodYear} ) -eq 0 ] ;  then
244                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
245                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true
246                                            fi
247                                        else
248                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
249                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
250                                        fi ;;
251                                    *M|*m)
252                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
253                                        if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then
254                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then
255                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && eval ${post_freq}=true
256                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && POST=true
257                                            fi
258                                        else
259                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
260                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
261                                        fi ;;
262                                    *D|*d)
263                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
264                                        NbDays=$( IGCM_date_DaysInYear ${year} )
265                                        if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then
266                                            if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then
267                                                if [ $( expr $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) % \
268                                                     $(( ${NbDays} * ${PeriodYear} / ${PeriodPost} )) ) -eq 0 ] ; then
269                                                    [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] && eval ${post_freq}=true
270                                                    [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] POST=true
271                                                fi
272                                            else
273                                                IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
274                                                IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
275                                            fi
276                                        else
277#                                           if [ ${PeriodYear} -eq 1 ] ; then
278#                                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
279#                                               PostEndJul=${year}${NbDays}
280#                                                #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}"
281#                                               #echo PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
282#                                               if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then
283#                                                   eval ${post_freq}=true
284#                                                   POST=true
285#                                               fi
286#                                           else
287                                            IGCM_debug_Print 3 "For ${post_freq} with leap calendar, for ${comp} and ${file_in} :"
288                                            IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y."
289                                            IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment."
290#                                           fi
291                                        fi;;
292                                esac ;;
293                            *M|*m)
294                                PeriodMonth=$( echo ${config_Post_post_freq} | sed -e "s/[mM]//" )
295                                case ${config_UserChoices_PeriodLength} in
296                                    *Y|*y)
297                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
298                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
299                                    *M|*m)
300                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
301                                        if [ ${PeriodPost} -le ${PeriodMonth} ] ; then
302                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) % ${PeriodMonth}  ) -eq 0 ] ;  then
303                                                [ $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
304                                                [ $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) -ne 0 ] && POST=true
305                                            fi
306                                        else
307                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
308                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
309                                        fi;;
310                                    *D|*d)
311                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
312                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
313                                esac ;;
314                            *D|*d)
315                                PeriodDay=$( echo ${config_Post_post_freq} | sed -e "s/[dD]//" )
316                                case ${config_UserChoices_PeriodLength} in
317                                    *Y|*y)
318                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
319                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
320                                    *M|*m)
321                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
322                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
323                                    *D|*d)
324                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
325                                        if [ ${PeriodPost} -le ${PeriodDay} ] ; then
326                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodDay}  ) -eq 0 ] ;  then
327                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
328                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true
329                                            fi
330                                        else
331                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
332                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
333                                        fi;;
334                                esac ;;
335                            NONE|none)
336                                ;;
337                            *)
338                                IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card"
339                                ;;
340                        esac
341                    fi
342                    let $(( i=i+3 ))
343                done
344            fi
345        done
346    done
347    #
348    if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \
349         [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]        && \
350         [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
351        TimeSeriesFrequency=true
352        POST=true
353    fi
354
355    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \
356         [ ! X${config_Post_RebuildFrequency} = XNONE ]        && \
357         [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
358        RebuildFrequency=true
359        POST=true
360    fi
361
362    #
363    IGCM_debug_Print 1 "POST-TREATEMENT flag value : ${POST}"
364    #
365    IGCM_post_Submit
366
367    IGCM_debug_PopStack "IGCM_post_Initialize"
368}
369
370function IGCM_post_Submit
371{
372    IGCM_debug_PushStack "IGCM_post_Submit"
373
374    POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
375
376    if [ ${POST} = true ]; then
377        echo
378        IGCM_debug_Print 1 "IGCM_post_Submit :"
379        echo
380        IGCM_debug_Print 1 "POST_DIR = ${POST_DIR}"
381    fi
382
383    #============ TIME SERIES POST-TREATMENT ===========#
384    if [ ${TimeSeriesFrequency} = true ] ; then
385
386        IGCM_debug_Print 2 "TIME SERIES POST-TREATMENT :"
387        echo
388        #
389        typeset listVarEnv
390        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF,RESOL_BIOS"
391
392        if [ ${RebuildFrequency} = true ] ; then
393            #
394            echo export DEBUG_debug=${DEBUG_debug}     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
395            echo export MODIPSL=${MODIPSL}             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
396            echo export libIGCM_SX=${libIGCM}          >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
397            echo export libIGCM=${libIGCM_POST}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
398            echo export SUBMIT_DIR=${SUBMIT_DIR}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
399            echo export POST_DIR=${POST_DIR}           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
400            echo export MASTER=${MASTER}               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
401            echo export DateBegin=${DateBegin}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
402            echo export PeriodDateEnd=${PeriodDateEnd} >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
403            echo export StandAlone=false               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
404            echo export RESOL_ATM=${RESOL_ATM}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
405            echo export RESOL_OCE=${RESOL_OCE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
406            echo export RESOL_ICE=${RESOL_ICE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
407            echo export RESOL_SRF=${RESOL_SRF}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
408            echo export RESOL_BIOS=${RESOL_BIOS}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
409            echo export listVarEnv=${listVarEnv}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
410            echo IGCM_sys_MkdirWork ${POST_DIR}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
411            echo IGCM_debug_Verif_Exit                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
412            echo IGCM_sys_QsubPost create_ts           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
413            #
414        else
415            #
416            IGCM_sys_RshPost <<-EOF
417            export DEBUG_debug=${DEBUG_debug}
418            export MODIPSL=${MODIPSL}
419            export libIGCM_SX=${libIGCM}
420            export libIGCM=${libIGCM_POST}
421            export SUBMIT_DIR=${SUBMIT_DIR}
422            export POST_DIR=${POST_DIR}
423            export MASTER=${MASTER}
424            export DateBegin=${DateBegin}
425            export PeriodDateEnd=${PeriodDateEnd}
426            export StandAlone=false
427            export RESOL_ATM=${RESOL_ATM}
428            export RESOL_OCE=${RESOL_OCE}
429            export RESOL_ICE=${RESOL_ICE}
430            export RESOL_SRF=${RESOL_SRF}
431            export RESOL_BIOS=${RESOL_BIOS}
432            export listVarEnv=${listVarEnv}
433            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
434            . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
435            IGCM_sys_MkdirWork ${POST_DIR}
436            IGCM_debug_Verif_Exit
437            IGCM_sys_QsubPost create_ts
438EOF
439            #
440        fi
441    fi
442
443    #=============  SEASONAL POST-TREATMENT ============#
444    if [ ${SeasonalFrequency} = true ] ; then
445        #
446        IGCM_debug_Print 2 "SEASONNAL POST-TREATMENT :"
447        echo
448        #
449        typeset listVarEnv
450        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
451
452        if [ ${RebuildFrequency} = true ] ; then
453            #
454            echo export DEBUG_debug=${DEBUG_debug}     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
455            echo export MODIPSL=${MODIPSL}             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
456            echo export libIGCM_SX=${libIGCM}          >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
457            echo export libIGCM=${libIGCM_POST}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
458            echo export SUBMIT_DIR=${SUBMIT_DIR}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
459            echo export POST_DIR=${POST_DIR}           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
460            echo export MASTER=${MASTER}               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
461            echo export DateBegin=${DateBegin}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
462            echo export PeriodDateEnd=${PeriodDateEnd} >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
463            echo export StandAlone=false               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
464            echo export RESOL_ATM=${RESOL_ATM}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
465            echo export RESOL_OCE=${RESOL_OCE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
466            echo export RESOL_ICE=${RESOL_ICE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
467            echo export RESOL_SRF=${RESOL_SRF}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
468            echo export RESOL_BIOS=${RESOL_BIOS}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
469            echo export listVarEnv=${listVarEnv}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
470            echo IGCM_sys_MkdirWork ${POST_DIR}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
471            echo IGCM_debug_Verif_Exit                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
472            echo IGCM_sys_QsubPost create_se           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
473            #
474        else
475            #
476            IGCM_sys_RshPost <<-EOF
477            export DEBUG_debug=${DEBUG_debug}
478            export MODIPSL=${MODIPSL}
479            export libIGCM_SX=${libIGCM}
480            export libIGCM=${libIGCM_POST}
481            export SUBMIT_DIR=${SUBMIT_DIR}
482            export POST_DIR=${POST_DIR}
483            export MASTER=${MASTER}
484            export DateBegin=${DateBegin}
485            export PeriodDateEnd=${PeriodDateEnd}
486            export StandAlone=false
487            export RESOL_ATM=${RESOL_ATM}
488            export RESOL_OCE=${RESOL_OCE}
489            export RESOL_ICE=${RESOL_ICE}
490            export RESOL_SRF=${RESOL_SRF}
491            export RESOL_BIOS=${RESOL_BIOS}
492            export listVarEnv=${listVarEnv}
493            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
494            . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
495            IGCM_sys_MkdirWork ${POST_DIR}
496            IGCM_debug_Verif_Exit
497            IGCM_sys_QsubPost create_se
498EOF
499        #
500        fi
501    fi
502
503    #============== REBUILD POST-TREATMENT =============#
504
505    if ( [ ${config_Post_RebuildFromArchive} = true ] && [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
506        IGCM_sys_Put_Dir REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
507    fi
508    #
509    if [ ${RebuildFrequency} = true ] ; then
510        #
511        if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then
512        #
513        IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM ARCHIVE:"
514        echo
515        #
516        typeset listVarEnv
517        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,RESOL_BIOS"
518        IGCM_sys_RshPost <<-EOF
519        export DEBUG_debug=${DEBUG_debug}
520        export MODIPSL=${MODIPSL}
521        export libIGCM_SX=${libIGCM}
522        export libIGCM=${libIGCM_POST}
523        export SUBMIT_DIR=${SUBMIT_DIR}
524        export RebuildFromArchive=${config_Post_RebuildFromArchive}
525        export REBUILD_DIR=${REBUILD_DIR}
526        export POST_DIR=${POST_DIR}
527        export MASTER=${MASTER}
528        export DateBegin=${DateBegin}
529        export PeriodDateBegin=${PeriodDateBegin}
530        export PeriodDateEnd=${PeriodDateEnd}
531        export NbRebuildDir=${NbRebuildDir}
532        export StandAlone=false
533        export RESOL_ATM=${RESOL_ATM}
534        export RESOL_OCE=${RESOL_OCE}
535        export RESOL_ICE=${RESOL_ICE}
536        export RESOL_SRF=${RESOL_SRF}
537        export RESOL_BIOS=${RESOL_BIOS}
538        export listVarEnv=${listVarEnv}
539        . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
540        . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
541        IGCM_sys_MkdirWork ${POST_DIR}
542        IGCM_debug_Verif_Exit
543        IGCM_sys_QsubPost rebuild_fromArchive
544EOF
545
546        else 
547        #
548        IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM WORKDIR :"
549        echo
550        IGCM_debug_Print 2 "NOT FULLY SUPPORTED"
551        IGCM_debug_Print 2 "EXIT NOW TO AVOID BIG PROBLEM"
552        IGCM_debug_Print 2 "Contact libIGCM developpers"
553        #
554        IGCM_debug_Exit "FATAL ERROR IN REBUILD CONFIGURATION"
555        IGCM_debug_Verif_Exit
556        #
557
558#        typeset listVarEnv
559#        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"
560#        export DEBUG_debug=${DEBUG_debug}
561#        export MODIPSL=${MODIPSL}
562#        export libIGCM_SX=${libIGCM}
563#        export libIGCM=${libIGCM}
564#        export SUBMIT_DIR=${SUBMIT_DIR}
565#        export RebuildFromArchive=${config_Post_RebuildFromArchive}
566#        export REBUILD_DIR=${REBUILD_DIR}
567#        export POST_DIR=${libIGCM}
568#        export DateBegin=${DateBegin}
569#        export PeriodDateBegin=${PeriodDateBegin}
570#        export PeriodDateEnd=${PeriodDateEnd}
571#        export NbRebuildDir=${NbRebuildDir}
572#        export StandAlone=false
573#        export RESOL_ATM=${RESOL_ATM}
574#        export RESOL_OCE=${RESOL_OCE}
575#        export RESOL_ICE=${RESOL_ICE}
576#        export RESOL_SRF=${RESOL_SRF}
577#        export listVarEnv=${listVarEnv}
578#        IGCM_sys_Qsub rebuild_fromWorkdir ${libIGCM}
579
580        fi
581    fi
582
583    IGCM_debug_PopStack "IGCM_post_Submit"
584}
Note: See TracBrowser for help on using the repository browser.