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