source: CONFIG/LMDZORINCA/branches/LMDZORINCA_BCOV/DRIVER/stomate.driver @ 1836

Last change on this file since 1836 was 1836, checked in by acosce, 12 years ago

Add new config for BCOV version of Orchidee and Inca

File size: 2.9 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    case ${config_SBG_WriteFrequency} in
23        *Y|*y) 
24            WriteInYears=$( echo ${config_SBG_WriteFrequency} | awk -F '[yY]' '{print $1}' )
25            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
26            (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears )) ;;
27        1M|1m) 
28            case ${config_UserChoices_PeriodLength} in
29            *Y|*y)
30                STOMATE_WRITE_STEP=-1.
31                ;;
32            *M|*m)
33                STOMATE_WRITE_STEP=-1.
34                ;;
35            *)
36                (( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) ;;
37            esac
38            ;;
39        *M|*m) 
40            WriteInMonths=$( echo ${config_SBG_WriteFrequency} | awk -F '[mM]' '{print $1}' )
41            case ${config_UserChoices_PeriodLength} in
42            *Y|*y)
43                PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
44                (( STOMATE_WRITE_STEP = 30 ))
45                ;;
46            *M|*m)
47                PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
48                (( STOMATE_WRITE_STEP = PeriodLengthInDays * WriteInMonths / PeriodLengthInMonths ))
49                ;;
50            *)
51                (( STOMATE_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) )) ;;
52            esac
53            ;;
54        5D|5d) 
55            (( STOMATE_WRITE_STEP = 5 )) ;;
56        1D|1d) 
57            (( STOMATE_WRITE_STEP = 1 )) ;;
58        *s)
59            WriteInSeconds=$( echo ${config_SBG_WriteFrequency} | awk -F '[s]' '{print $1}' )
60            (( STOMATE_WRITE_STEP = 1 )) ;;
61        *) 
62            IGCM_debug_Exit "SBG_Update " ${config_SBG_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 
63            IGCM_debug_Verif_Exit ;;
64    esac
65
66    ORCHIDEE_sed STOMATE_OK_STOMATE y
67
68    ORCHIDEE_sed STOMATE_HIST_DT ${STOMATE_WRITE_STEP}
69    ORCHIDEE_sed STOMATE_HISTLEVEL ${stomate_UserChoices_stomate_LEVEL}
70
71    if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_SBG_Restart}" = "n" ] ) ; then
72        echo "STOMATE : without restart"
73        ORCHIDEE_sed STOMATE_RESTART_FILEIN NONE
74    else
75        ORCHIDEE_sed STOMATE_RESTART_FILEIN stomate_rest_in.nc
76    fi
77
78    IGCM_debug_PopStack "SBG_Update"
79}
80
81#-----------------------------------------------------------------
82function SBG_Finalize
83{
84#set -vx
85    IGCM_debug_PushStack "SBG_Finalize"
86
87    if [ $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${year}1230 ) -ge 0 ] ; then
88        IGCM_sys_Put_Out stomate_Cforcing.nc ${R_OUT_SBG_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_Cforcing.nc
89        IGCM_sys_Put_Out stomate_forcing.nc  ${R_OUT_SBG_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_forcing.nc
90#       rm -f stomate_Cforcing.nc
91#       rm -f stomate_forcing.nc
92    fi
93
94    IGCM_debug_PopStack "SBG_Finalize"
95}
Note: See TracBrowser for help on using the repository browser.