source: CMIP5/esmFixClim1/esmFixClim12/COMP/orchidee.driver @ 1176

Last change on this file since 1176 was 1176, checked in by aclsce, 12 years ago

Added esmFixClim12 configuration

File size: 3.6 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   ## CO2 forcing for the current year
90    IPCC_CO2=`grep Annee_${year} CMIP_CO2_1850_2050.txt | awk -F= '{print $2}'`
91    echo IPCC_CO2=${IPCC_CO2}
92
93    ORCHIDEE_sed ATM_CO2 ${IPCC_CO2} 
94
95    ORCHIDEE_sed HYDROL_CWRR ${orchidee_UserChoices_NEWHYDROL}
96
97    ORCHIDEE_sed WRITE_STEP ${SECHIBA_WRITE_STEP}
98    ORCHIDEE_sed SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
99
100    # Outputs HF in HISTFILE2 if required
101    [ X${SRF_ok_hf} = Xy ] && ORCHIDEE_sed SECHIBA_HISTFILE2 y
102    ORCHIDEE_sed SECHIBA_HISTLEVEL2 1
103    ORCHIDEE_sed WRITE_STEP2 10800.0
104
105    if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
106        ORCHIDEE_sed SECHIBA_restart_in sechiba_rest_in.nc
107    fi
108
109    #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def
110    #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def
111
112    IGCM_debug_PopStack "SRF_Update"
113}
114
115#-----------------------------------------------------------------
116function SRF_Finalize
117{
118    IGCM_debug_PushStack "SRF_Finalize"
119
120    #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def
121
122    echo FINALIZE SRF !!!
123
124    IGCM_debug_PopStack "SRF_Finalize"
125}
Note: See TracBrowser for help on using the repository browser.