source: CONFIG/LMDZOR/branches/LMDZ4OR_v3/AMIP/COMP/orchidee.driver @ 1095

Last change on this file since 1095 was 1095, checked in by jgipsl, 12 years ago

Updated LMDZ4OR_v3 configuration to follow couple config IPSLCM5A.
AMIP directory contains an interannual amip experience close to coupled
IPSLCM5A/historical experience.
LMDZOR directory contains a present climatologic experience close to
couple IPSLCM5A/EXP00 present control.
CREATE contains, as before, the create_etat0_limit run for
climatologic(default) and interannual run.

File size: 4.4 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_PeriodStart
37{
38
39    IGCM_debug_PushStack "SRF_PeriodStart"
40    if [ ${year} -gt 2004 ] ; then
41
42        PFTmap="${R_BC}/SRF/${config_UserChoices_TagName}/ORCHIDEE_PFTmap_2006to2100_AR5_RCP8.5_MESSAGE.nc"
43        if [ ${year} -eq 2005 ] ; then
44            IGCM_sys_Rm -f PFTmap.nc
45        fi
46
47    else
48        PFTmap="${R_BC}/SRF/${config_UserChoices_TagName}/PFTmap_1850to2005_AR5_LUHa.rc2.nc"
49    fi
50
51    BC_SRF_PFTmap=${PFTmap}
52
53    IGCM_debug_PopStack "SRF_PeriodStart"
54
55}
56
57#-----------------------------------------------------------------
58function SRF_Update
59{
60    IGCM_debug_PushStack "SRF_Update"
61
62    typeset SECHIBA_WRITE_STEP
63
64    SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' ) 
65    case ${SRF_WriteFrequency} in
66        *Y|*y) 
67            WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' )
68            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
69            (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears * 86400 )) ;;
70        1M)
71            case ${config_UserChoices_PeriodLength} in
72            *Y|*y)
73                SECHIBA_WRITE_STEP=-1.
74                ;;
75            *M|*m)
76                SECHIBA_WRITE_STEP=-1.
77                ;;
78            *)
79                (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
80                ;;
81            esac
82            ;;
83        *M|*m) 
84            WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' )
85            case ${config_UserChoices_PeriodLength} in
86            *Y|*y)
87                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
88                (( SECHIBA_WRITE_STEP = PeriodLengthInDays * 86400 / PeriodLengthInYears / 12  ))
89                ;;
90            *M|*m)
91                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
92                (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInMonths  * 86400 / PeriodLengthInMonths  ))
93                ;;
94            *)
95                (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
96                ;;
97            esac
98            ;;
99        5D|5d) 
100            (( SECHIBA_WRITE_STEP = 5 * 86400 )) ;;
101        1D|1d) 
102            (( SECHIBA_WRITE_STEP = 86400 )) ;;
103        *s)
104            WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' )
105            (( SECHIBA_WRITE_STEP = WriteInSeconds )) ;;
106        *) 
107            IGCM_debug_Exit "SRF_Update " ${SRF_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
108            IGCM_debug_Verif_Exit ;;
109    esac
110
111    # Dans le cas de test :
112    if [ ${year} -eq 1979 ] ; then
113        ORCHIDEE_sed VEGET_REINIT y
114        ORCHIDEE_sed VEGET_YEAR 131
115    fi
116   
117    # Dans le cas historique :
118    if [ ${year} -eq 2005 ] ; then
119        ORCHIDEE_sed VEGET_REINIT y
120        ORCHIDEE_sed VEGET_YEAR 1
121#       ORCHIDEE_sed VEGET_UPDATE '0Y'
122    fi
123
124#     # Dans le cas sans changement de carte aprÚs 2005
125#     if [ ${year} -gt 2005 ] ; then
126#       ORCHIDEE_sed VEGET_UPDATE '0Y'
127#     fi
128 
129    ORCHIDEE_sed HYDROL_CWRR ${orchidee_UserChoices_NEWHYDROL}
130
131    ORCHIDEE_sed WRITE_STEP ${SECHIBA_WRITE_STEP}
132    ORCHIDEE_sed SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
133
134    # Outputs HF in HISTFILE2 if required
135    [ X${SRF_ok_hf} = Xy ] && ORCHIDEE_sed SECHIBA_HISTFILE2 y
136    ORCHIDEE_sed SECHIBA_HISTLEVEL2 1
137    ORCHIDEE_sed WRITE_STEP2 10800.0
138
139    if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
140        ORCHIDEE_sed SECHIBA_restart_in sechiba_rest_in.nc
141    fi
142
143    #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def
144    #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def
145
146    IGCM_debug_PopStack "SRF_Update"
147}
148
149#-----------------------------------------------------------------
150function SRF_Finalize
151{
152    IGCM_debug_PushStack "SRF_Finalize"
153
154    #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def
155
156    echo FINALIZE SRF !!!
157
158    IGCM_debug_PopStack "SRF_Finalize"
159}
Note: See TracBrowser for help on using the repository browser.