source: tags/ORCHIDEE_1_9_5/ORCHIDEE_OL/FLUXNET/Job_Post_FLUXNET @ 8

Last change on this file since 8 was 8, checked in by orchidee, 14 years ago

import first tag equivalent to CVS orchidee_1_9_5 + OOL_1_9_5

File size: 5.5 KB
Line 
1#!/bin/ksh
2
3# $Date: 2010/06/25 18:48:26 $
4# $Author: ssipsl $
5# $Revision: 1.5 $
6# IPSL (2006)
7#  This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC
8
9#D--------------------------------------------------------------------==
10#D--------------------------------------------------------------------==
11#D-
12#D-                      Job to launch FLUXNET spinup simulations
13#D-
14#D--------------------------------------------------------------------==
15#D--------------------------------------------------------------------==
16#D-
17#                       Job inspired from Sönke Zaehle "site_new.def" job
18#                       #################################################
19
20
21
22MODIPSL=::modipsl::
23libIGCM=${MODIPSL}/libIGCM
24
25# All SubJobs in SPINUP in ONE OR MORE YEARS run (must be used with libIGCM branches/AllPostFred).
26
27
28
29#D--------------------------------------------------------------------==
30#D-                   -1. User modification place
31#D--------------------------------------------------------------------==
32
33#D- Increased verbosity (1, 2, 3)
34#Verbosity=3
35
36#D-
37# --------------------------------------------------------------------
38#D- ! Optionnal features /!\ Use with care !
39# --------------------------------------------------------------------
40
41#D- Low level debug : to bypass lib test checks and stack construction
42#D- Default=true
43DEBUG_debug=false
44
45#D- Set DEBUG_sys to false to disable output calls of function
46#D- Default=true
47#DEBUG_sys=false
48
49#D- Turn in dry run mode ? (0,1,2,3)
50#D- Default=0
51#DRYRUN=3
52# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
53# -------------------------------------------------------------------------------------
54# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
55# |          |  Cp/Exe param files |            |  Chmod  |                           |
56# |          |      Qsub           |            |         |                           |
57# -------------------------------------------------------------------------------------
58# |    0     |       yes           |    yes     |  yes    |      yes                  |
59# -------------------------------------------------------------------------------------
60# |    1     |       yes           |    yes     |  yes    |      no                   |
61# -------------------------------------------------------------------------------------
62# |    2     |       yes           |    yes     |  no     |      no                   |
63# -------------------------------------------------------------------------------------
64# |    3     |       yes           |    no      |  no     |      no                   |
65# -------------------------------------------------------------------------------------
66
67
68#D-
69#D--------------------------------------------------------------------==
70#D-                   0. System Environment
71#D-                      - Define variables for Number of processors
72#D-                      - Define MPI variables
73#D-                      - Define batch scheduler variables
74#D-                      - Source IGCM Library
75#D-                      - Get RESOLution in .resol file (temporary)
76#D--------------------------------------------------------------------==
77
78#D--------------------------------------------------------------------==
79
80. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
81        ( ${DEBUG_debug} ) && IGCM_debug_Check
82. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
83       ( ${DEBUG_debug} ) && IGCM_card_Check
84. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
85       ( ${DEBUG_debug} ) && IGCM_date_Check
86#-------
87. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
88
89#set -vx
90R_BC=${R_IN}/BC
91
92. ${SUBMIT_DIR}/fluxnet.ksh
93
94FLUXNET_initialize
95
96
97# Launch ATLAS syncho : we have to wait for the last job !
98
99# ATLAS fix parameters :
100# Atlas Name :
101AtlasCfg=${fluxnet_SPINUP_AtlasCfg}
102#atlas_FLUXNET.cfg
103
104# observation_file
105observation_file_path=${fluxnet_SPINUP_observation_file_path}
106
107# old history file
108reference_file_path=${fluxnet_SPINUP_reference_file_path}
109
110# Modulo for SpinUp years
111Modulo=${fluxnet_SPINUP_Modulo}
112
113ATLAS_ARGS="${AtlasCfg} ${observation_file_path} ${reference_file_path} ${Modulo}"
114
115isite=1
116index=0
117while [ ${isite} -le ${NumSites} ] ; do
118
119    site=${fluxnet_FLUXNET_Sites[$index]}
120    echo $site
121
122    # We test if the END step was moved in SpinUp/SPIN/Output directory.
123    # Then we are sure the last historical SpinUp step has finished (HIST)...
124
125    # Define name of the END SubJob (FIN) in SpinUp
126    if [ ${fluxnet_SPINUP_duree_final} -gt 0 ] ; then
127        BeforeLastJob=${site}${config_UserChoices_JobName}FIN
128    else
129        echo "We must have an \"duree_final\" non zero to get historical run and post-treatment"
130        exit 1
131    fi
132
133    # Wait for the end of the last job :
134    ((isleep=0))
135    while [ ! -d ${R_OUT}/${config_UserChoices_TagName}/${site}${config_UserChoices_JobName}/SPIN/Output/${BeforeLastJob} ] ; do
136        ls -la ${R_OUT}/${config_UserChoices_TagName}/${site}${config_UserChoices_JobName}/SPIN/Output/${BeforeLastJob}
137        sleep 20
138        ((isleep=isleep+1))
139        if [ isleep -gt 200 ] ; then
140            break ;
141        fi
142    done
143
144    TIME_YEAR=${fluxnet_FLUXNET_Sites[ $(( index + ColumnLength )) ]}
145    YEAR=${fluxnet_FLUXNET_Sites[ $(( index + ColumnYear )) ]}
146
147    # Launch post-treatment for SPINUP !
148    echo "****"
149    echo "Launch post-treatment for SPINUP for site ${site} !"
150    nohup ${SUBMIT_DIR}/post_FLUXNET ${MODIPSL} ${site} ${TIME_YEAR} ${YEAR} ${ATLAS_ARGS} > ${SUBMIT_DIR}/out_post_${site} 2>&1 &
151    echo "****"
152
153    (( isite=isite+1 ))
154    (( index=index+NumInfosBySite ))
155done
156
157IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Note: See TracBrowser for help on using the repository browser.