source: CONFIG/UNIFORM/v6/LMDZOR_v6/GENERAL/DRIVER/orchidee.driver @ 2587

Last change on this file since 2587 was 2582, checked in by jgipsl, 9 years ago

Update with changes done on v6_rc0 (sdipsl) :

  • remove IOIPSL
  • clean

This is done only for IPSLCM6 and LMDZOR_v6 configurations and only for the part LMDZ and ORCHIDEE.

File size: 5.7 KB
Line 
1#!/bin/ksh
2#D- Driver du script pour ORCHIDEE
3#-----------------------------------------------------------------
4function SRF_Initialize
5{
6    IGCM_debug_PushStack "SRF_Initialize"
7
8    RESOL_SRF=ALL
9
10    for frequency in ${config_SRF_WriteFrequency} ; do
11        case ${frequency} in
12            HF|hf) SRF_ok_hf=y ;;
13        esac
14    done
15
16    ##- Define variable DefSuffix set in orchidee.card
17    ##  This variable is used in orchidee.card to choose
18    ##  parameter file(orchidee.def_DefSuffix).
19    if [ ! X${orchidee_UserChoices_DefSuffix} = X ] ; then
20        DefSuffix=${orchidee_UserChoices_DefSuffix}
21    else
22        DefSuffix=Choi
23    fi
24
25    IGCM_debug_PopStack "SRF_Initialize"
26}
27
28#-----------------------------------------------------------------
29function SRF_Update
30{
31    IGCM_debug_PushStack "SRF_Update"
32
33    # Activate STOMATE if the compontent SBG=stomate is set in config.card
34    if [ X${config_ListOfComponents_SBG} = Xstomate ] ; then
35        IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE y
36    else
37        IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE n
38    fi
39
40    # Default init : files are desactivated
41    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .FALSE.
42    IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .FALSE.
43
44    SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' )
45    case ${SRF_WriteFrequency} in
46        *Y|*y)
47            WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' )
48            PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
49            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
50            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInYears}y
51            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
52            ;;
53        *M|*m)
54            WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' )
55            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
56            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInMonths}mo
57            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
58            ;;
59        5D|5d)
60            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
61            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 5d
62            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
63            ;;
64        1D|1d)
65            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
66            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 1d
67            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
68            ;;
69        *s)
70            WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' )
71            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE.
72            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInSeconds}s
73            IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history
74            ;;
75        *)
76            IGCM_debug_Exit "SRF_Update " ${SRF_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D."
77            IGCM_debug_Verif_Exit ;;
78    esac
79
80    # Outputs HF in HISTFILE2 if required. Output frequency is 3 hours by default.
81    if [ X${SRF_ok_hf} = Xy ] ; then
82        IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .TRUE.
83        IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 output_freq 10800s
84        IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 name sechiba_out_2
85    fi
86
87    if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then
88        IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in sechiba_rest_in.nc
89    else
90        IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in NONE
91    fi
92
93    # Modify in orchidee.def VEGET_UPDATE and LAND_COVER_CHANGE if they are set in orchidee.card section UserChoices
94    if [ ! X${orchidee_UserChoices_VEGET_UPDATE} = X ] ; then
95        IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE   ${orchidee_UserChoices_VEGET_UPDATE}
96    else
97        IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE 0Y
98    fi
99    if [ ! X${orchidee_UserChoices_LAND_COVER_CHANGE} = X ] ; then
100        IGCM_comp_modifyDefFile nonblocker orchidee.def LAND_COVER_CHANGE ${orchidee_UserChoices_LAND_COVER_CHANGE}
101    else
102        IGCM_comp_modifyDefFile nonblocker orchidee.def LAND_COVER_CHANGE n
103    fi
104
105    #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def
106    #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def
107
108    #Temporary way to fix bug on cimean variable
109    IGCM_comp_modifyXmlFile force field_def_orchidee.xml cimean enabled .FALSE.
110
111    # Add include of orchidee context in iodef.xml
112    # In iodef.xml add on next line after "COMPONENT CONTEXT"
113    #  <context id="orchidee" src="./context_orchidee.xml"/>
114    echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp
115    cp iodef.xml iodef.xml.tmp
116    sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml
117    rm iodef.xml.tmp add.tmp
118
119    IGCM_debug_PopStack "SRF_Update"
120}
121
122#-----------------------------------------------------------------
123function SRF_Finalize
124{
125    IGCM_debug_PushStack "SRF_Finalize"
126
127    #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def
128
129    echo FINALIZE SRF !!!
130
131    IGCM_debug_PopStack "SRF_Finalize"
132}
Note: See TracBrowser for help on using the repository browser.