source: CONFIG/UNIFORM/v7/IPSLCM7/GENERAL/DRIVER/dynamico.driver @ 6838

Last change on this file since 6838 was 6838, checked in by aclsce, 6 weeks ago

Modified IPSLCM7 configuration as follows :

  • added DYNAMICO_XML in DYNAMICO path for xml files
  • removed SOURCES/LMDZ not needed anymore (commited in LMDZ repository)
  • commented creation of file_def_dynamico.xml by using python script (now file_def_dynamico.xml exists in DYNAMICO_XML directory).
File size: 8.0 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        # Exit
12        IGCM_debug_Exit "RESOL_NBP must be set in dynamico.card UserSection"
13    IGCM_debug_Verif_Exit
14    fi
15
16    ##- Horizontal resolution read from dynamico.card
17    if [ ! X${dynamico_UserChoices_RESOL_ATM_Z} = X ] ; then
18        RESOL_ATM_Z=${dynamico_UserChoices_RESOL_ATM_Z}
19    else
20        # RESOL_ATM_Z is not set in dynamico.card but this is needed
21        IGCM_debug_Exit "RESOL_ATM_Z must be set in dynamico.card UserSection"
22        IGCM_debug_Verif_Exit
23    fi
24
25
26    if [ -f ${SUBMIT_DIR}/../../../bin/inca_${ConfChem}.dat ]then
27        eval $(grep nbtrac ${SUBMIT_DIR}/../../../bin/inca_${ConfChem}.dat) || nbtrac=1
28    else
29        nbtrac=1
30    fi
31    ((nbtrac=nbtrac+3))
32
33#    Commented because file_def_dynamico.xml.py is not used anymore
34#    if [ ! -f ${SUBMIT_DIR}/../../../modeles/DYNAMICO/xml/file_def_dynamico.xml ];  then
35#       module load python3
36#       python3 ${SUBMIT_DIR}/../../../modeles/DYNAMICO/xml/file_def_dynamico.xml.py > ${SUBMIT_DIR}/../../../modeles/DYNAMICO/xml/file_def_dynamico.xml
37#    fi
38
39    IGCM_debug_PopStack "ICO_Initialize"
40}
41
42#-----------------------------------------------------------------
43function ICO_Update
44{
45    IGCM_debug_PushStack "ICO_Update"
46
47    # Reset date from start.nc file on the first iteration in the simulation
48    if [ ${CumulPeriod} -eq 1 ] ; then
49        IGCM_comp_modifyDefFile blocker run_dynamico.def etat0_start_iteration_reset y
50    else
51        IGCM_comp_modifyDefFile blocker run_dynamico.def etat0_start_iteration_reset n
52    fi
53
54    # set number of tracer in run_dynamico.def
55    IGCM_comp_modifyDefFile nonblocker run_dynamico.def nqtot ${nbtrac}
56
57    # Set lenght for execution
58    IGCM_comp_modifyDefFile blocker run_dynamico.def run_length $(( ${PeriodLengthInDays} * 86400 ))
59
60    #  Activate nudging if ok_guide=y set in dynamico.card
61    if [ X${dynamico_UserChoices_guided_type} != X ] ; then
62        IGCM_comp_modifyDefFile nonblocker run_dynamico.def guided_type ${dynamico_UserChoices_guided_type} 
63    else
64        IGCM_comp_modifyDefFile nonblocker run_dynamico.def guided_type  none
65    fi
66
67    # Change run_dynamico.def according to UserChoices options set in dynmaico.card
68   
69    # Set create_etat0_limit=y or n and
70    if [ X${dynamico_UserChoices_create_etat0_limit} = Xy ] ; then 
71        # create_etat0_limit is set in dynamcio.card to y
72        # Activate create_etat0_limit=y in run_dynamico.def
73        IGCM_comp_modifyDefFile nonblocker run_dynamico.def create_etat0_limit y
74
75        # Use iflag_phys=101 or higher to activate aquaplanet mode
76        if [ X${dynamico_UserChoices_iflag_phys} = X ] || [ X${dynamico_UserChoices_iflag_phys} = X1 ]; then 
77            # iflag_phys is not set or iflag_phys=1 => run is not an aquaplanet
78            IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0              ${dynamico_UserChoices_etat0}
79            IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys         1
80        else
81            # This is an aquaplanet
82            IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0              held_suarez
83            IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys         ${dynamico_UserChoices_iflag_phys}
84        fi
85
86        # Optimize the grid: set read_metric=n and optim_it=100000     
87        IGCM_comp_modifyDefFile nonblocker   run_dynamico.def   read_metric  n
88        IGCM_comp_modifyDefFile nonblocker   run_dynamico.def   optim_it     100000
89    else
90        # Deactivate create_etat0_limit to run a the GCM (aquaplanet or not)
91        IGCM_comp_modifyDefFile nonblocker run_dynamico.def create_etat0_limit   n
92        IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0                start_file
93
94        # Set iflag_phys even though it only will be read but not used for the case create_etat0_limit=n
95        if [ X${dynamico_UserChoices_iflag_phys} = X ] ||  [ X${dynamico_UserChoices_iflag_phys} = X1 ]; then 
96            # iflag_phys is not set or iflag_phys=1 => run is not an aquaplanet
97            IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys           1
98        else
99            IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys         ${dynamico_UserChoices_iflag_phys}
100        fi     
101
102        # Read grid from start.nc file: set read_metric=y and optim_it=0       
103        IGCM_comp_modifyDefFile nonblocker   run_dynamico.def   read_metric  y
104        IGCM_comp_modifyDefFile nonblocker   run_dynamico.def   optim_it     0
105    fi 
106
107
108    # Add include of context xml files for DYNAMICO in iodef.xml
109    # In iodef.xml add on the next line after "COMPONENT CONTEXT"
110    echo '<context id="icosagcm" src="./context_dynamico.xml"/>' >> add.tmp
111
112   # Add inclusion of file sponge_dynamico.xml if this file exists
113   if [ -f sponge_dynamico.xml ] ; then
114        echo '<context id="icosagcm"        src="./sponge_dynamico.xml" />' >> add.tmp
115   fi
116
117    # Add inclusion of file context_input_dynamico.xml if this file exists
118    if [ -f context_input_dynamico.xml ] ; then
119        echo '<context id="icosagcm_input" src="./context_input_dynamico.xml"/>' >> add.tmp
120    fi
121
122    if [ -f tracers_dynamico.xml ] ; then
123        echo '<context id="icosagcm" src="./tracers_dynamico.xml" />'  >> add.tmp
124    fi
125
126    if [ X${dynamico_UserChoices_guided_type} = Xnudging_forcing ] || [ X${dynamico_UserChoices_guided_type} = Xnudging ] ; then
127        if [ -f nudging_dynamico.xml ] ; then
128            echo '<context id="icosagcm" src="./nudging_dynamico.xml" />'  >> add.tmp
129        else
130            IGCM_debug_Exit "you choose to activate guided mode and forget to add the copy of nudging_dynamico.xml file in dynamico.card"
131            IGCM_debug_Verif_Exit
132        fi
133    fi
134
135    if [ -f file_def_dynamico.xml ] ; then
136        echo '<context id="icosagcm" src="./file_def_dynamico.xml" />' >> add.tmp
137    fi
138
139    if [ -f param_gw.xml ] ; then
140        echo '<context id="icosagcm" src="./param_gw.xml"/>' >> add.tmp
141    fi
142
143
144
145    # Include xml files for output configuration if running with workflow CMIP6
146    if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then
147      if [ -f ping_dynamico.xml ] ; then
148        echo '<context id="icosagcm" src="./ping_dynamico.xml"/>' >> add.tmp
149        echo '<context id="icosagcm" src="./dr2xml_dynamico.xml"/>' >> add.tmp
150      fi
151    fi
152    cp iodef.xml iodef.xml.tmp
153    sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml
154    rm iodef.xml.tmp add.tmp
155
156    # Add a Long Name as global attribute in output files if LongName is set in config.card
157    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then
158      listfile=$(ls file_def*dynamico.xml)
159      echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
160      for file in ${listfile} ; do
161          cp ${file} ${file}.tmp
162          sed -e "/<file id/r add.tmp" \
163          ${file}.tmp > ${file}
164          rm ${file}.tmp
165      done
166      rm add.tmp
167    fi
168
169    #remove unlimited time axis on winds files
170    if [ -f u.nc ] ; then
171        nccopy -u u.nc tmp.nc
172        mv tmp.nc u.nc
173    fi
174    if [ -f v.nc ] ; then
175        nccopy -u v.nc tmp.nc
176        mv tmp.nc v.nc
177    fi
178
179
180    if [ X${config_ListOfComponents_CPL} = Xoasis ] ; then
181    echo "Coupling mode using oasis, set using_oasis=y in run_dynamico.def"
182    IGCM_comp_modifyDefFile nonblocker run_dynamico.def using_oasis y
183    else
184    echo "DYNAMICO is running in forced mode without ocean model, set using_oasis=y in run_dynamico.def"
185    IGCM_comp_modifyDefFile nonblocker run_dynamico.def using_oasis n
186    fi
187
188
189    # Compression level (if CompressionLevel is not empty)
190    if [ ! "X${config_UserChoices_CompressionLevel}" = "X" ] ; then
191        echo "NetCDF output files compression level is " ${config_UserChoices_CompressionLevel}
192        listfile=$(ls file_def*dynamico.xml)
193        for file in ${listfile} ; do
194            sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file}
195        done
196    fi
197
198    IGCM_debug_PopStack "ICO_Update"
199}
200
201#-----------------------------------
202function ICO_Finalize
203{
204    IGCM_debug_PushStack "ICO_Finalize"
205
206    IGCM_debug_PopStack "ICO_Finalize"
207}
208
Note: See TracBrowser for help on using the repository browser.