source: CMIP5/rcp45/v3.rcp45.1/COMP/orchidee.driver @ 1360

Last change on this file since 1360 was 1360, checked in by sdipsl, 11 years ago

Update config for rcp45 extension to 2300.
Update config for rcp45 regarding variables to be in sync with latest svn variables list.

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    [ ${year} -ge 2100 ] ORCHIDEE_sed VEGET_UPDATE 0Y
105
106    #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def
107    #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def
108
109    IGCM_debug_PopStack "SRF_Update"
110}
111
112#-----------------------------------------------------------------
113function SRF_Finalize
114{
115    IGCM_debug_PushStack "SRF_Finalize"
116
117    #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def
118
119    echo FINALIZE SRF !!!
120
121    IGCM_debug_PopStack "SRF_Finalize"
122}
Note: See TracBrowser for help on using the repository browser.