1 | #!/bin/ksh |
---|
2 | |
---|
3 | #D- Driver pour ORCHIDEE stomate component |
---|
4 | |
---|
5 | #----------------------------------------------------------------- |
---|
6 | function SBG_Initialize |
---|
7 | { |
---|
8 | IGCM_debug_PushStack "SBG_Initialize" |
---|
9 | |
---|
10 | IGCM_debug_PopStack "SBG_Initialize" |
---|
11 | } |
---|
12 | |
---|
13 | #----------------------------------------------------------------- |
---|
14 | function SBG_Update |
---|
15 | { |
---|
16 | IGCM_debug_PushStack "SBG_Update" |
---|
17 | |
---|
18 | # Output management |
---|
19 | |
---|
20 | # Set default values for stomate output files. |
---|
21 | stomate_enabled=.FALSE. |
---|
22 | stomate_freq=0s |
---|
23 | |
---|
24 | # Read WriteFrequency set in config.card section SBG. |
---|
25 | # Only one choice can be set as WriteFrequency. The same choice will be used for |
---|
26 | # both stomate_history and stomate_ipcc_history files. |
---|
27 | for frequency in ${config_SBG_WriteFrequency} ; do |
---|
28 | case ${frequency} in |
---|
29 | *Y|*y) |
---|
30 | NbYears=$( echo ${frequency} | awk -F '[yY]' '{print $1}' ) |
---|
31 | NbDaysYear=$( IGCM_date_DaysInYear ${year} ) |
---|
32 | stomate_enabled=.TRUE. |
---|
33 | stomate_freq=${NbYears}y ;; |
---|
34 | *M|*m) |
---|
35 | NbMonths=$( echo ${frequency} | awk -F '[mM]' '{print $1}' ) |
---|
36 | stomate_enabled=.TRUE. |
---|
37 | stomate_freq=${NbMonths}mo ;; |
---|
38 | *D|*d) |
---|
39 | NbDays=$( echo ${frequency} | awk -F '[dD]' '{print $1}' ) |
---|
40 | stomate_enabled=.TRUE. |
---|
41 | stomate_freq=${NbDays}d ;; |
---|
42 | *) |
---|
43 | IGCM_debug_Exit "SBG WriteFrequency=${frequency} is invalid. Choose between xY, xM and xD for Stomate." ;; |
---|
44 | esac |
---|
45 | done |
---|
46 | |
---|
47 | # Modify file_def_orchidee.xml |
---|
48 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled ${stomate_enabled} |
---|
49 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq ${stomate_freq} |
---|
50 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled ${stomate_enabled} |
---|
51 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq ${stomate_freq} |
---|
52 | |
---|
53 | |
---|
54 | # Define in orchidee.def if restart file should be used |
---|
55 | if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_SBG_Restart}" = "n" ] ) ; then |
---|
56 | echo "STOMATE : without restart" |
---|
57 | IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_RESTART_FILEIN NONE |
---|
58 | else |
---|
59 | IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_RESTART_FILEIN stomate_rest_in.nc |
---|
60 | fi |
---|
61 | |
---|
62 | IGCM_debug_PopStack "SBG_Update" |
---|
63 | } |
---|
64 | |
---|
65 | #----------------------------------------------------------------- |
---|
66 | function SBG_Finalize |
---|
67 | { |
---|
68 | IGCM_debug_PushStack "SBG_Finalize" |
---|
69 | |
---|
70 | IGCM_debug_PopStack "SBG_Finalize" |
---|
71 | } |
---|