source: CONFIG/UNIFORM/v7/ICOLMDZOR_v7/GENERAL/DRIVER/dynamico.driver @ 4318

Last change on this file since 4318 was 4318, checked in by jgipsl, 5 years ago

Correction: file run_icosa.def changed name to run_dynamico.def in one of the previous commit.

File size: 4.2 KB
Line 
1#!/bin/ksh
2#-----------------------------------------------------------------
3function ICO_Initialize
4{
5    IGCM_debug_PushStack "ICO_Initialize"
6
7    ##- Horizontal resolution read from dynamic.card
8    if [ ! X${dynamico_UserChoices_RESOL_NBP} = X ] ; then
9        RESOL_NBP=${dynamico_UserChoices_RESOL_NBP}
10    else
11        # Set default resolution
12        RESOL_NBP=20
13    fi
14
15    ##- Horizontal resolution read from dynamico.card
16    if [ ! X${dynamico_UserChoices_RESOL_ATM_Z} = X ] ; then
17        RESOL_ATM_Z=${dynamico_UserChoices_RESOL_ATM_Z}
18    else
19        # RESOL_ATM_Z is not set in dynamico.card but this is needed
20        IGCM_debug_Exit "RESOL_ATM_Z must be set in dynamico.card UserSection"
21        IGCM_debug_Verif_Exit
22    fi
23
24    IGCM_debug_PopStack "ICO_Initialize"
25}
26
27#-----------------------------------------------------------------
28function ICO_Update
29{
30    IGCM_debug_PushStack "ICO_Update"
31
32    IGCM_comp_modifyDefFile blocker run_dynamico.def run_length $(( ${PeriodLengthInDays} * 86400 ))
33
34    # Change run_dynamico.def according to UserChoices options set in dynmaico.card
35   
36    # Set create_etat0_limit=y or n and
37    if [ X${dynamico_UserChoices_create_etat0_limit} = Xy ] ; then 
38        # create_etat0_limit is set in dynamcio.card to y
39        # Activate create_etat0_limit=y in run_dynamico.def
40        IGCM_comp_modifyDefFile nonblocker run_dynamico.def create_etat0_limit y
41
42        # Use iflag_phys=101 or higher to activate aquaplanet mode
43        if [ X${dynamico_UserChoices_iflag_phys} = X ] ||  X${dynamico_UserChoices_iflag_phys} = X1 ]; then 
44            # iflag_phys is not set or iflag_phys=1 => run is not an aquaplanet
45            IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0              database
46            IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys         1
47        else
48            # This is an aquaplanet
49            IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0              held_suarez
50            IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys         ${dynamico_UserChoices_iflag_phys}
51        fi
52    else
53        # Deactivate create_etat0_limit to run a the GCM (aquaplanet or not)
54        IGCM_comp_modifyDefFile nonblocker run_dynamico.def create_etat0_limit   n
55        IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0                start_file
56
57        # Set iflag_phys even though it only will be read but not used for the case create_etat0_limit=n
58        if [ X${dynamico_UserChoices_iflag_phys} = X ] ||  X${dynamico_UserChoices_iflag_phys} = X1 ]; then 
59            # iflag_phys is not set or iflag_phys=1 => run is not an aquaplanet
60            IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys           1
61        else
62            IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys         ${dynamico_UserChoices_iflag_phys}
63        fi
64    fi 
65
66
67    # Add include of context xml files for DYNAMICO in iodef.xml
68    # In iodef.xml add on the next line after "COMPONENT CONTEXT"
69    echo '<context id="icosagcm" src="./context_dynamico.xml"/>' >> add.tmp
70
71    # Add inclusion of file context_input_dynamico.xml if this file exists
72    if [ -f context_input_dynamico.xml ] ; then
73        echo '<context id="icosagcm" src="./context_input_dynamico.xml"/>' >> add.tmp
74    fi
75
76    # Include xml files for output configuration if running with workflow CMIP6
77    if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then
78      if [ -f ping_dynamico.xml ] ; then
79        echo '<context id="icosagcm" src="./ping_dynamico.xml"/>' >> add.tmp
80        echo '<context id="icosagcm" src="./dr2xml_dynamico.xml"/>' >> add.tmp
81      fi
82    fi
83    cp iodef.xml iodef.xml.tmp
84    sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml
85    rm iodef.xml.tmp add.tmp
86
87    # Add a Long Name as global attribute in output files if LongName is set in config.card
88    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then
89      listfile=$(ls file_def*dynamico.xml)
90      echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
91      for file in ${listfile} ; do
92          cp ${file} ${file}.tmp
93          sed -e "/<file id/r add.tmp" \
94          ${file}.tmp > ${file}
95          rm ${file}.tmp
96      done
97      rm add.tmp
98    fi
99
100    IGCM_debug_PopStack "ICO_Update"
101}
102
103#-----------------------------------
104function ICO_Finalize
105{
106    IGCM_debug_PushStack "ICO_Finalize"
107
108    IGCM_debug_PopStack "ICO_Finalize"
109}
110
Note: See TracBrowser for help on using the repository browser.