source: branches/ORCHIDEE_2_2/ORCHIDEE_OL/OOL_SEC_STO_FG3nd/COMP/orchideedriver.driver @ 7253

Last change on this file since 7253 was 7253, checked in by agnes.ducharne, 10 months ago

Mise à jour de la config OOL_SEC_STO_FG3nd, avec inclusion de context_input_orchidee.xml. Fait avec Laurent Fairhead.

  • Property svn:executable set to *
File size: 3.9 KB
Line 
1#!/bin/ksh
2
3#-----------------------------------------------------------------
4function OOL_Initialize
5{
6    IGCM_debug_PushStack "OOL_Initialize"
7
8    IGCM_debug_PopStack "OOL_Initialize"
9}
10
11#-----------------------------------------------------------------
12function OOL_Update
13{
14    IGCM_debug_PushStack "OOL_Update"
15
16    # Set start and end date based on information from config.card
17    HumanDateBegin=$(   IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} )
18    IGCM_comp_modifyDefFile nonblocker run.def START_DATE ${HumanDateBegin}" 00:00:00"
19    HumanDateEnd=$(     IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} )
20    IGCM_comp_modifyDefFile nonblocker run.def END_DATE ${HumanDateEnd}" 24:00:00"
21   
22    # Set RESTART_FILEIN in run.def
23    if ( ${FirstInitialize} && [ "${config_OOL_Restart}" = "n" ] ) ; then
24        # Set RESTART_FILEIN=NONE in run.def
25        IGCM_comp_modifyDefFile blocker run.def RESTART_FILEIN NONE
26    else
27        # Default option using restart file, set RESTART_FILEIN=driver_rest_in.nc in orchidee.def
28        IGCM_comp_modifyDefFile blocker run.def RESTART_FILEIN driver_rest_in.nc
29    fi
30
31    if [ -f CO2.txt ] ; then
32        # If this file exist, then read CO2 value and set ATM_CO2 in run.def
33        IPCC_CO2=`grep Annee_${year} CO2.txt | awk -F= '{print $2}'`
34        if [ X"${IPCC_CO2}" = X ] ; then
35            # The grep returned empty variable: stop execution
36            IGCM_debug_Exit "The file CO2.txt do not contain the current year."
37            IGCM_debug_Verif_Exit
38        fi
39        IGCM_comp_modifyDefFile nonblocker run.def ATM_CO2 ${IPCC_CO2}
40    else
41        # The file is not available: take the default value from run.def.
42        # The syntax in run.def must be respected, for example:
43        # ATM_CO2 = _AUTO_: DEFAULT = 350.
44        IGCM_comp_modifyDefFile nonblocker run.def ATM_CO2 DEFAULT
45    fi
46
47
48    # Activation of XIOS
49    if [ X${orchideedriver_UserChoices_XIOS} = Xy ] ; then
50      # Add include of orchidee context in iodef.xml
51      # In iodef.xml add on next line after "COMPONENT CONTEXT"
52      #  <context id="orchidee" src="./context_orchidee.xml"/>
53      echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp
54      # Add inclusion of file context_input_orchidee.xml if this file exists
55      if [ -f context_input_orchidee.xml ] ; then
56          echo '<context id="orchidee" src="./context_input_orchidee.xml"/>' >> add.tmp
57      fi
58      cp iodef.xml iodef.xml.tmp
59      sed -e "/COMPONENT CONTEXT/r add.tmp" \
60        iodef.xml.tmp > iodef.xml
61      rm iodef.xml.tmp add.tmp
62
63
64      # Special case if SBG component is not activated: deactivate stomate output files from file_def_orchidee.xml
65      # If SBG is activated, then the stomate.driver will take care of these variables
66      if [ X${config_ListOfComponents_SBG} = X ] ; then
67          # Stomate is not activated
68          IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .FALSE.
69          IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq 1mo
70          IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .FALSE.
71          IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq 1mo     
72      fi
73    fi
74
75
76    # Add LongName as global attribute in all files produced by XIOS (if LongName is not empty)
77    # Remove file_def_input_orchidee.xml from the list.
78    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then
79        listfile=$(ls file_def*orchidee.xml | grep -v input)
80        echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
81        for file in ${listfile} ; do
82            cp ${file} ${file}.tmp
83            sed -e "/<file id/r add.tmp" \
84                ${file}.tmp > ${file}
85            rm ${file}.tmp
86        done
87        rm add.tmp
88    fi
89         
90    IGCM_debug_PopStack "OOL_Update"
91}
92
93#-----------------------------------------------------------------
94function OOL_Finalize
95{
96    IGCM_debug_PushStack "OOL_Finalize"
97   
98    IGCM_debug_PopStack "OOL_Finalize"
99}
Note: See TracBrowser for help on using the repository browser.