source: CONFIG/UNIFORM/v5_dev/LMDZORINCA_v5/BCOV/GENERAL/DRIVER/orchidee.driver @ 2144

Last change on this file since 2144 was 2144, checked in by acosce, 8 years ago

Add diffuco_ok_inca in orchidee.driver

File size: 4.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    ##- Define variable DefSuffix set in orchidee.card
33    ##  This variable is used in orchidee.card to choose
34    ##  parameter file(orchidee.def_DefSuffix).
35    if [ ! X${orchidee_UserChoices_DefSuffix} = X ] ; then
36        DefSuffix=${orchidee_UserChoices_DefSuffix}
37    else
38        DefSuffix=Choi
39    fi
40
41    IGCM_debug_PopStack "SRF_Initialize"
42}
43
44#-----------------------------------------------------------------
45function SRF_Update
46{
47    IGCM_debug_PushStack "SRF_Update"
48
49    typeset SECHIBA_WRITE_STEP
50
51    SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' ) 
52    case ${SRF_WriteFrequency} in
53        *Y|*y) 
54            WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' )
55            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
56            (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears * 86400 )) ;;
57        1M)
58            case ${config_UserChoices_PeriodLength} in
59            *Y|*y)
60                SECHIBA_WRITE_STEP=-1.
61                ;;
62            *M|*m)
63                SECHIBA_WRITE_STEP=-1.
64                ;;
65            *)
66                (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
67                ;;
68            esac
69            ;;
70        *M|*m) 
71            WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' )
72            case ${config_UserChoices_PeriodLength} in
73            *Y|*y)
74                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
75                (( SECHIBA_WRITE_STEP = PeriodLengthInDays * 86400 / PeriodLengthInYears / 12  ))
76                ;;
77            *M|*m)
78                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
79                (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInMonths  * 86400 / PeriodLengthInMonths  ))
80                ;;
81            *)
82                (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 ))
83                ;;
84            esac
85            ;;
86        5D|5d) 
87            (( SECHIBA_WRITE_STEP = 5 * 86400 )) ;;
88        1D|1d) 
89            (( SECHIBA_WRITE_STEP = 86400 )) ;;
90        *s)
91            WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' )
92            (( SECHIBA_WRITE_STEP = WriteInSeconds )) ;;
93        *) 
94            IGCM_debug_Exit "SRF_Update " ${SRF_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
95            IGCM_debug_Verif_Exit ;;
96    esac
97
98    ORCHIDEE_sed WRITE_STEP ${SECHIBA_WRITE_STEP}
99    ORCHIDEE_sed SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL}
100
101    # Outputs HF in HISTFILE2 if required
102    if [ X${SRF_ok_hf} = Xy ] ; then
103        ORCHIDEE_sed SECHIBA_HISTFILE2 y
104    else
105        ORCHIDEE_sed SECHIBA_HISTFILE2 n
106    fi
107    ORCHIDEE_sed SECHIBA_HISTLEVEL2 1
108    ORCHIDEE_sed WRITE_STEP2 10800.0
109
110    if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
111        ORCHIDEE_sed SECHIBA_restart_in sechiba_rest_in.nc
112    else
113        ORCHIDEE_sed SECHIBA_restart_in NONE
114    fi
115
116# Modify in orchidee.def VEGET_UPDATE and LAND_COVER_CHANGE if they are set in orchidee.card section UserChoices
117    if [ ! X${orchidee_UserChoices_VEGET_UPDATE} = X ] ; then
118        ORCHIDEE_sed VEGET_UPDATE   ${orchidee_UserChoices_VEGET_UPDATE}
119    else
120        ORCHIDEE_sed VEGET_UPDATE 0Y
121    fi
122    if [ ! X${orchidee_UserChoices_LAND_COVER_CHANGE} = X ] ; then
123        ORCHIDEE_sed LAND_COVER_CHANGE ${orchidee_UserChoices_LAND_COVER_CHANGE}
124    else
125        ORCHIDEE_sed LAND_COVER_CHANGE n
126    fi
127
128
129# Modify in orchidee.def DIFFUCO_OK_INCA if inca coupling is activate
130    if [ ! X${orchidee_UserChoices_CouplInca} = X ] ; then
131        ORCHIDEE_sed VEGET_UPDATE   ${orchidee_UserChoices_CouplInca}
132    else
133        ORCHIDEE_sed VEGET_UPDATE n
134    fi
135
136
137
138    #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def
139    #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def
140
141
142    IGCM_debug_PopStack "SRF_Update"
143}
144
145#-----------------------------------------------------------------
146function SRF_Finalize
147{
148    IGCM_debug_PushStack "SRF_Finalize"
149
150    #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def
151
152    echo FINALIZE SRF !!!
153
154    IGCM_debug_PopStack "SRF_Finalize"
155}
Note: See TracBrowser for help on using the repository browser.