1 | #!/bin/ksh |
---|
2 | |
---|
3 | #D- Driver du script pour ORCHIDEE |
---|
4 | |
---|
5 | function 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 | #----------------------------------------------------------------- |
---|
20 | function SRF_Initialize |
---|
21 | { |
---|
22 | IGCM_debug_PushStack "SRF_Initialize" |
---|
23 | |
---|
24 | RESOL_SRF=ALL |
---|
25 | |
---|
26 | IGCM_debug_PopStack "SRF_Initialize" |
---|
27 | } |
---|
28 | |
---|
29 | #----------------------------------------------------------------- |
---|
30 | function 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 WRITE_STEP ${SECHIBA_WRITE_STEP} |
---|
70 | |
---|
71 | ## if [ ${year} -eq 1950 ] ; then |
---|
72 | # ORCHIDEE_sed SECHIBA_HISTFILE2 y |
---|
73 | # ORCHIDEE_sed SECHIBA_HISTLEVEL2 10 |
---|
74 | # ORCHIDEE_sed WRITE_STEP2 86400.0 |
---|
75 | ## fi |
---|
76 | |
---|
77 | if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_SRF_Restart}" = "n" ] ) ; then |
---|
78 | ORCHIDEE_sed SECHIBA_reset_time y |
---|
79 | else |
---|
80 | ORCHIDEE_sed SECHIBA_restart_in start_sech.nc.nc |
---|
81 | ORCHIDEE_sed SECHIBA_reset_time y |
---|
82 | fi |
---|
83 | |
---|
84 | #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def |
---|
85 | #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def |
---|
86 | |
---|
87 | IGCM_debug_PopStack "SRF_Update" |
---|
88 | } |
---|
89 | |
---|
90 | #----------------------------------------------------------------- |
---|
91 | function SRF_Finalize |
---|
92 | { |
---|
93 | IGCM_debug_PushStack "SRF_Finalize" |
---|
94 | |
---|
95 | #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def |
---|
96 | |
---|
97 | echo FINALIZE SRF !!! |
---|
98 | |
---|
99 | IGCM_debug_PopStack "SRF_Finalize" |
---|
100 | } |
---|