source: CONFIG/IPSLCM/IPSLCM5/branches/IPSLCM5_WORK/EXPBIOS/COMP/orchidee.driver @ 738

Last change on this file since 738 was 738, checked in by mafoipsl, 15 years ago

Commit again to keep history : Adapt EXPBIOS.
EXPBIOS is a new configuration to activate BIO-CHEMICAL processes (STOMATE) with Land Use 1860 map.

See test in http://dods.extra.cea.fr/data/p86manci/IPSLCM5/CM5STO/

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