source: branches/ORCHIDEE_EXT/ORCHIDEE_OL/TESTSTOMATE/COMP/stomate.driver @ 263

Last change on this file since 263 was 263, checked in by didier.solyga, 13 years ago

Update the jobs FORCESOIL,OOL_SEC, OOL_SEC_STO, SPINUP and TESTSTOMATE. They match now with the corresponding ones from the trunk

File size: 3.4 KB
Line 
1#!/bin/ksh
2
3#D- Driver du script pour STOMATE
4
5function STOMATE_sed
6{
7    IGCM_debug_PushStack "STOMATE_sed"
8   
9    sed -e "s/^${1}\ *=.*/${1}= ${2}/" \
10        stomate.def > stomate.def.tmp
11    RET=$?
12    echo "STOMATE_sed : ${1} ${2}"
13    \mv stomate.def.tmp stomate.def
14   
15    IGCM_debug_PopStack "STOMATE_sed"
16    return $RET
17}
18
19#-----------------------------------------------------------------
20function SBG_Initialize
21{
22    IGCM_debug_PushStack "SBG_Initialize"
23
24    RESOL_SBG=ALL
25   
26    IGCM_debug_PopStack "SBG_Initialize"
27}
28
29#-----------------------------------------------------------------
30function SBG_Update
31{
32    IGCM_debug_PushStack "SBG_Update"
33
34    typeset STOMATE_WRITE_STEP
35
36    case ${config_SBG_WriteFrequency} in
37        *Y|*y) 
38            WriteInYears=$( echo ${config_SBG_WriteFrequency} | awk -F '[yY]' '{print $1}' )
39            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
40            (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears )) ;;
41        1M|1m) 
42            case ${config_UserChoices_PeriodLength} in
43            *Y|*y)
44                STOMATE_WRITE_STEP=-1.
45                ;;
46            *M|*m)
47                STOMATE_WRITE_STEP=-1.
48                ;;
49            *)
50                (( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) ;;
51            esac
52            ;;
53        *M|*m) 
54            WriteInMonths=$( echo ${config_SBG_WriteFrequency} | awk -F '[mM]' '{print $1}' )
55            case ${config_UserChoices_PeriodLength} in
56            *Y|*y)
57                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
58                (( STOMATE_WRITE_STEP = 30 )) ;;
59            *M|*m)
60                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
61                (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInMonths / PeriodLengthInMonths )) ;;
62            *)
63                (( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) ;;
64            esac
65            ;;
66        5D|5d) 
67            (( STOMATE_WRITE_STEP = 5 )) ;;
68        1D|1d) 
69            (( STOMATE_WRITE_STEP = 1 )) ;;
70        *s)
71            WriteInSeconds=$( echo ${config_SBG_WriteFrequency} | awk -F '[s]' '{print $1}' )
72            (( STOMATE_WRITE_STEP = 1 )) ;;
73        *) 
74            IGCM_debug_Exit "SBG_Update " ${config_SBG_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
75            IGCM_debug_Verif_Exit ;;
76    esac
77
78    STOMATE_sed STOMATE_OK_STOMATE y
79    STOMATE_sed STOMATE_OK_CO2 y
80
81    STOMATE_sed STOMATE_HIST_DT ${STOMATE_WRITE_STEP}
82    STOMATE_sed STOMATE_HISTLEVEL ${stomate_UserChoices_stomate_LEVEL}
83    if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_SBG_Restart}" = "n" ] ) ; then
84        echo "STOMATE : without restart"
85    else
86        STOMATE_sed STOMATE_RESTART_FILEIN stomate_rest_in.nc
87    fi
88
89    IGCM_debug_PopStack "SBG_Update"
90}
91
92#-----------------------------------------------------------------
93function SBG_Finalize
94{
95#set -vx
96    IGCM_debug_PushStack "SBG_Finalize"
97
98    typeset NbDaysDone NbYearsDone
99
100#     NbDaysDone=$( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} )
101#     NbYearsDone=$(( NbDaysDone / 360 ))
102   
103# #     echo $NbDaysDone, $NbYearsDone, $(( NbYearsDone % 10 ))
104# #    if [ $(( NbYearsDone % 10 )) = 0 ] ; then
105#     if [ $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateEnd} ) -ge 0 ] ; then
106#       IGCM_sys_Put_Out stomate_Cforcing.nc ${R_OUT_SBG_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_Cforcing.nc
107#       IGCM_sys_Put_Out stomate_forcing.nc  ${R_OUT_SBG_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_forcing.nc
108#       rm -f stomate_Cforcing.nc
109#       rm -f stomate_forcing.nc
110#     fi
111
112    IGCM_debug_PopStack "SBG_Finalize"
113}
Note: See TracBrowser for help on using the repository browser.