source: tags/ORCHIDEE_2_1/ORCHIDEE_OL/OOL_SEC_STO_FG3nd/COMP/orchideedriver.driver @ 5631

Last change on this file since 5631 was 5227, checked in by jan.polcher, 6 years ago

Adding the offline configuration OOL_SEC_STO_FG3 run with the new driver.
This will serve as an exemple to move other configurations to the new driver.

  • Property svn:executable set to *
File size: 3.7 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      cp iodef.xml iodef.xml.tmp
55      sed -e "/COMPONENT CONTEXT/r add.tmp" \
56        iodef.xml.tmp > iodef.xml
57      rm iodef.xml.tmp add.tmp
58
59
60      # Special case if SBG component is not activated: deactivate stomate output files from file_def_orchidee.xml
61      # If SBG is activated, then the stomate.driver will take care of these variables
62      if [ X${config_ListOfComponents_SBG} = X ] ; then
63          # Stomate is not activated
64          IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .FALSE.
65          IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq 1mo
66          IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .FALSE.
67          IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq 1mo     
68      fi
69    fi
70
71
72    # Add LongName as global attribute in all files produced by XIOS (if LongName is not empty)
73    # Remove file_def_input_orchidee.xml from the list.
74    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then
75        listfile=$(ls file_def*orchidee.xml | grep -v input)
76        echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
77        for file in ${listfile} ; do
78            cp ${file} ${file}.tmp
79            sed -e "/<file id/r add.tmp" \
80                ${file}.tmp > ${file}
81            rm ${file}.tmp
82        done
83        rm add.tmp
84    fi
85         
86    IGCM_debug_PopStack "OOL_Update"
87}
88
89#-----------------------------------------------------------------
90function OOL_Finalize
91{
92    IGCM_debug_PushStack "OOL_Finalize"
93   
94    IGCM_debug_PopStack "OOL_Finalize"
95}
Note: See TracBrowser for help on using the repository browser.