source: CONFIG/IPSLCM/IPSLCM5A/historical/COMP/orchidee.driver @ 1038

Last change on this file since 1038 was 1038, checked in by mmaipsl, 13 years ago

Change WRITE_STEP for SECHIBA and STOMATE to -1 (real monthly mean) if asked write frequency is "1M".

File size: 3.2 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    IGCM_debug_PopStack "SRF_Initialize"
27}
28
29#-----------------------------------------------------------------
30function SRF_Update
31{
32    IGCM_debug_PushStack "SRF_Update"
33
34    typeset SECHIBA_WRITE_STEP
35
36    SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' ) 
37    case ${SRF_WriteFrequency} in
38        *Y|*y) 
39            WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' )
40            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
41            (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears * 86400 )) ;;
42        1M)
43            case ${config_UserChoices_PeriodLength} in
44            *Y|*y)
45                SECHIBA_WRITE_STEP=-1.
46                ;;
47            *M|*m)
48                SECHIBA_WRITE_STEP=-1.
49                ;;
50            *)
51                (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
52                ;;
53            esac
54            ;;
55        *M|*m) 
56            WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' )
57            case ${config_UserChoices_PeriodLength} in
58            *Y|*y)
59                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
60                (( SECHIBA_WRITE_STEP = PeriodLengthInDays * 86400 / PeriodLengthInYears / 12  ))
61                ;;
62            *M|*m)
63                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
64                (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInMonths  * 86400 / PeriodLengthInMonths  ))
65                ;;
66            *)
67                (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
68                ;;
69            esac
70            ;;
71        5D|5d) 
72            (( SECHIBA_WRITE_STEP = 5 * 86400 )) ;;
73        1D|1d) 
74            (( SECHIBA_WRITE_STEP = 86400 )) ;;
75        *s)
76            WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' )
77            (( SECHIBA_WRITE_STEP = WriteInSeconds )) ;;
78        *) 
79            IGCM_debug_Exit "SRF_Update " ${SRF_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
80            IGCM_debug_Verif_Exit ;;
81    esac
82
83    ORCHIDEE_sed HYDROL_CWRR ${orchidee_UserChoices_NEWHYDROL}
84
85    ORCHIDEE_sed WRITE_STEP ${SECHIBA_WRITE_STEP}
86    ORCHIDEE_sed SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
87
88    ORCHIDEE_sed SECHIBA_HISTFILE2 y
89    ORCHIDEE_sed SECHIBA_HISTLEVEL2 1
90    ORCHIDEE_sed WRITE_STEP2 10800.0
91
92    if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
93        ORCHIDEE_sed SECHIBA_restart_in sechiba_rest_in.nc
94    fi
95
96    #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def
97    #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def
98
99    IGCM_debug_PopStack "SRF_Update"
100}
101
102#-----------------------------------------------------------------
103function SRF_Finalize
104{
105    IGCM_debug_PushStack "SRF_Finalize"
106
107    #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def
108
109    echo FINALIZE SRF !!!
110
111    IGCM_debug_PopStack "SRF_Finalize"
112}
Note: See TracBrowser for help on using the repository browser.