source: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/stomate.driver @ 2300

Last change on this file since 2300 was 2300, checked in by aclsce, 7 years ago
  • Added possibility to use XIOS as output library for LMDZ and ORCHIDEE as IPSLCM6_rc0 component.
File size: 6.6 KB
Line 
1#!/bin/ksh
2
3#D- Driver du script pour ORCHIDEE
4
5#-----------------------------------------------------------------
6function SBG_Initialize
7{
8    IGCM_debug_PushStack "SBG_Initialize"
9
10    RESOL_SBG=ALL
11   
12    IGCM_debug_PopStack "SBG_Initialize"
13}
14
15#-----------------------------------------------------------------
16function SBG_Update
17{
18    IGCM_debug_PushStack "SBG_Update"
19
20    typeset STOMATE_WRITE_STEP
21
22    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
23        ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .FALSE.
24        ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .FALSE.
25    fi   
26    case ${config_SBG_WriteFrequency} in
27        *Y|*y) 
28            WriteInYears=$( echo ${config_SBG_WriteFrequency} | awk -F '[yY]' '{print $1}' )
29            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
30            (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears )) 
31            if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
32                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE.
33                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq ${WriteInYears}y
34                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history
35                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE.
36                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq ${WriteInYears}y
37                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history
38
39            fi
40            ;;
41        1M|1m) 
42            if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
43                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE.
44                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq 1mo
45                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history
46                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE.
47                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq 1mo
48                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history
49            fi
50            case ${config_UserChoices_PeriodLength} in
51            *Y|*y)
52                STOMATE_WRITE_STEP=-1.
53                ;;
54            *M|*m)
55                STOMATE_WRITE_STEP=-1.
56                ;;
57            *)
58                (( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) ;;
59            esac
60            ;;
61        *M|*m) 
62            WriteInMonths=$( echo ${config_SBG_WriteFrequency} | awk -F '[mM]' '{print $1}' )
63            if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
64                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE.
65                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq ${WriteInMonths}mo
66                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history
67                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE.
68                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq ${WriteInMonths}mo
69                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history
70            fi
71            case ${config_UserChoices_PeriodLength} in
72            *Y|*y)
73                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
74                (( STOMATE_WRITE_STEP = 30 ))
75                ;;
76            *M|*m)
77                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
78                (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInMonths / PeriodLengthInMonths ))
79                ;;
80            *)
81                (( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) 
82                if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
83                    ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE.
84                    ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq ${STOMATE_WRITE_STEP}s
85                    ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history
86                    ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE.
87                    ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq ${STOMATE_WRITE_STEP}s
88                    ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history
89                fi
90                ;;
91            esac
92            ;;
93        5D|5d) 
94            (( STOMATE_WRITE_STEP = 5 ))
95            if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
96                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE.
97                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq 5d
98                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history
99                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE.
100                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq 5d
101                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history
102            fi
103            ;;
104        1D|1d) 
105            (( STOMATE_WRITE_STEP = 1 )) 
106            if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
107                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 enabled .TRUE.
108                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 output_freq 1d
109                ORCHIDEE_sed_xml file_def_orchidee.xml stomate1 name stomate_history
110                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE.
111                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq 1d
112                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history
113            fi
114            ;;
115        *s)
116            WriteInSeconds=$( echo ${config_SBG_WriteFrequency} | awk -F '[s]' '{print $1}' )
117            if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
118                ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 enabled .TRUE.
119                ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 output_freq ${WriteInSeconds}s
120                ORCHIDEE_sed_xml file_def_orchidee.xml sechiba1 name sechiba_history
121                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 enabled .TRUE.
122                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 output_freq ${WriteInSeconds}s
123                ORCHIDEE_sed_xml file_def_orchidee.xml stomate2 name stomate_ipcc_history
124            fi
125            (( STOMATE_WRITE_STEP = 1 )) ;;
126        *) 
127            IGCM_debug_Exit "SBG_Update " ${config_SBG_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
128            IGCM_debug_Verif_Exit ;;
129    esac
130
131    ORCHIDEE_sed STOMATE_OK_STOMATE y
132
133#Use of XIOS library only
134
135    if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then
136        (( STOMATE_WRITE_STEP = 0 ))
137    fi
138
139    ORCHIDEE_sed STOMATE_HIST_DT ${STOMATE_WRITE_STEP}
140    ORCHIDEE_sed STOMATE_HISTLEVEL ${stomate_UserChoices_stomate_LEVEL}
141
142    if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_SBG_Restart}" = "n" ] ) ; then
143        echo "STOMATE : without restart"
144        ORCHIDEE_sed STOMATE_RESTART_FILEIN NONE
145    else
146        ORCHIDEE_sed STOMATE_RESTART_FILEIN stomate_rest_in.nc
147    fi
148
149    IGCM_debug_PopStack "SBG_Update"
150}
151
152#-----------------------------------------------------------------
153function SBG_Finalize
154{
155#set -vx
156    IGCM_debug_PushStack "SBG_Finalize"
157
158    if [ $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${year}1230 ) -ge 0 ] ; then
159        IGCM_sys_Put_Out stomate_Cforcing.nc ${R_OUT_SBG_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_Cforcing.nc
160        IGCM_sys_Put_Out stomate_forcing.nc  ${R_OUT_SBG_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_forcing.nc
161#       rm -f stomate_Cforcing.nc
162#       rm -f stomate_forcing.nc
163    fi
164
165    IGCM_debug_PopStack "SBG_Finalize"
166}
Note: See TracBrowser for help on using the repository browser.