source: CMIP5/rcp45/v3.rcp45.2/COMP/orchidee.driver @ 1276

Last change on this file since 1276 was 1276, checked in by sdipsl, 12 years ago

Register used configuration files for v3.rcp45.2

File size: 3.5 KB
Line 
1#!/bin/ksh
2
3#D- Driver du script pour ORCHIDEE
4
5function ORCHIDEE_sed
6{
7    IGCM_debug_PushStack "ORCHIDEE_sed"
8   
9    sed -e "s/^${1}\ *=.*/${1}= ${2}/" \
10        orchidee.def > orchidee.def.tmp
11    RET=$?
12    echo "ORCHIDEE_sed : ${1} ${2}"
13    \mv orchidee.def.tmp orchidee.def
14   
15    IGCM_debug_PopStack "ORCHIDEE_sed"
16    return $RET
17}
18
19#-----------------------------------------------------------------
20function SRF_Initialize
21{
22    IGCM_debug_PushStack "SRF_Initialize"
23
24    RESOL_SRF=ALL
25
26    for frequency in ${config_SRF_WriteFrequency} ; do
27        case ${frequency} in
28            HF|hf) SRF_ok_hf=y ;;
29        esac
30    done
31
32    IGCM_debug_PopStack "SRF_Initialize"
33}
34
35#-----------------------------------------------------------------
36function SRF_Update
37{
38    IGCM_debug_PushStack "SRF_Update"
39
40    typeset SECHIBA_WRITE_STEP
41
42    SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' ) 
43    case ${SRF_WriteFrequency} in
44        *Y|*y) 
45            WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' )
46            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
47            (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears * 86400 )) ;;
48        1M)
49            case ${config_UserChoices_PeriodLength} in
50            *Y|*y)
51                SECHIBA_WRITE_STEP=-1.
52                ;;
53            *M|*m)
54                SECHIBA_WRITE_STEP=-1.
55                ;;
56            *)
57                (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
58                ;;
59            esac
60            ;;
61        *M|*m) 
62            WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' )
63            case ${config_UserChoices_PeriodLength} in
64            *Y|*y)
65                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
66                (( SECHIBA_WRITE_STEP = PeriodLengthInDays * 86400 / PeriodLengthInYears / 12  ))
67                ;;
68            *M|*m)
69                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
70                (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInMonths  * 86400 / PeriodLengthInMonths  ))
71                ;;
72            *)
73                (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
74                ;;
75            esac
76            ;;
77        5D|5d) 
78            (( SECHIBA_WRITE_STEP = 5 * 86400 )) ;;
79        1D|1d) 
80            (( SECHIBA_WRITE_STEP = 86400 )) ;;
81        *s)
82            WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' )
83            (( SECHIBA_WRITE_STEP = WriteInSeconds )) ;;
84        *) 
85            IGCM_debug_Exit "SRF_Update " ${SRF_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
86            IGCM_debug_Verif_Exit ;;
87    esac
88
89    ORCHIDEE_sed HYDROL_CWRR ${orchidee_UserChoices_NEWHYDROL}
90
91    ORCHIDEE_sed WRITE_STEP ${SECHIBA_WRITE_STEP}
92    ORCHIDEE_sed SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
93
94    # Outputs HF in HISTFILE2 if required
95    [ X${SRF_ok_hf} = Xy ] && ORCHIDEE_sed SECHIBA_HISTFILE2 y
96    ORCHIDEE_sed SECHIBA_HISTLEVEL2 1
97    ORCHIDEE_sed WRITE_STEP2 10800.0
98
99    if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
100        ORCHIDEE_sed SECHIBA_restart_in sechiba_rest_in.nc
101    fi
102
103    [ ${CumulPeriod} -eq 1 ] && ORCHIDEE_sed VEGET_REINIT y
104
105    #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def
106    #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def
107
108    IGCM_debug_PopStack "SRF_Update"
109}
110
111#-----------------------------------------------------------------
112function SRF_Finalize
113{
114    IGCM_debug_PushStack "SRF_Finalize"
115
116    #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def
117
118    echo FINALIZE SRF !!!
119
120    IGCM_debug_PopStack "SRF_Finalize"
121}
Note: See TracBrowser for help on using the repository browser.