source: CONFIG/LMDZORINCA/branches/LMDZORINCA_v2/EXP_AER/COMP/stomate.driver @ 1119

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

New version of LMDZORINCA ---> same configuration than IPSLCM5A/EXP00 for
Orchidee

  • add stomate.card
  • add stomate.driver
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    else
74        ORCHIDEE_sed STOMATE_RESTART_FILEIN stomate_rest_in.nc
75    fi
76
77    IGCM_debug_PopStack "SBG_Update"
78}
79
80#-----------------------------------------------------------------
81function SBG_Finalize
82{
83#set -vx
84    IGCM_debug_PushStack "SBG_Finalize"
85
86    if [ $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${year}1230 ) -ge 0 ] ; then
87        IGCM_sys_Put_Out stomate_Cforcing.nc ${R_OUT_SBG_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_Cforcing.nc
88        IGCM_sys_Put_Out stomate_forcing.nc  ${R_OUT_SBG_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_stomate_forcing.nc
89#       rm -f stomate_Cforcing.nc
90#       rm -f stomate_forcing.nc
91    fi
92
93    IGCM_debug_PopStack "SBG_Finalize"
94}
Note: See TracBrowser for help on using the repository browser.