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

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

Set iflag_phys correctly even though it will not be used for the case create_etat0_limit=n

File size: 4.2 KB
RevLine 
[4180]1#!/bin/ksh
2#-----------------------------------------------------------------
[4281]3function ICO_Initialize
[4180]4{
[4281]5    IGCM_debug_PushStack "ICO_Initialize"
[4180]6
[4281]7    ##- Horizontal resolution read from dynamic.card
8    if [ ! X${dynamico_UserChoices_RESOL_NBP} = X ] ; then
9        RESOL_NBP=${dynamico_UserChoices_RESOL_NBP}
[4180]10    else
11        # Set default resolution
12        RESOL_NBP=20
13    fi
14
[4281]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}
[4180]18    else
[4281]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
[4180]22    fi
23
[4281]24    IGCM_debug_PopStack "ICO_Initialize"
[4180]25}
26
27#-----------------------------------------------------------------
[4281]28function ICO_Update
[4180]29{
[4281]30    IGCM_debug_PushStack "ICO_Update"
[4180]31
32    IGCM_comp_modifyDefFile blocker run_icosa.def run_length $(( ${PeriodLengthInDays} * 86400 ))
33
[4288]34    # Change run_dynamico.def according to UserChoices options set in dynmaico.card
35   
[4290]36    # Set create_etat0_limit=y or n and
[4288]37    if [ X${dynamico_UserChoices_create_etat0_limit} = Xy ] ; then 
38        # create_etat0_limit is set in dynamcio.card to y
[4290]39        # Activate create_etat0_limit=y in run_dynamico.def
[4288]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
[4290]53        # Deactivate create_etat0_limit to run a the GCM (aquaplanet or not)
[4288]54        IGCM_comp_modifyDefFile nonblocker run_dynamico.def create_etat0_limit   n
55        IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0                start_file
[4290]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
[4288]64    fi 
65
66
[4281]67    # Add include of context xml files for DYNAMICO in iodef.xml
[4190]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
[4281]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
[4190]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
[4281]89      listfile=$(ls file_def*dynamico.xml)
[4190]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
[4281]100    IGCM_debug_PopStack "ICO_Update"
[4180]101}
102
103#-----------------------------------
[4281]104function ICO_Finalize
[4180]105{
[4281]106    IGCM_debug_PushStack "ICO_Finalize"
[4180]107
[4281]108    IGCM_debug_PopStack "ICO_Finalize"
[4180]109}
110
Note: See TracBrowser for help on using the repository browser.