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

Last change on this file was 6362, checked in by aclsce, 15 months ago

Modified sponge parameters ICOLMDZ to use same treatment as LMDZ (iflag_sponge=2, mode_sponge=3).
Remind :
iflag_sponge !0 --> for no sponge

!1 --> for sponge over 4 topmost layers
!2 --> for sponge from top to ~1% of top layer pressure

mode_sponge !1 --> u and v relax towards 0

!2 --> u and v relax towards their zonal mean
!3 --> u,v and pot. temp. relax towards their zonal mean

File size: 7.7 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_${OptMode}_${ConfChem}.dat ]then
27        eval $(grep nbtrac ${SUBMIT_DIR}/../../../bin/inca_${OptMode}_${ConfChem}.dat) || nbtrac=1
28    else
29        nbtrac=1
30    fi
31    ((nbtrac=nbtrac+3))
32
33
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_ok_guide} = Xy ] ; then
62        IGCM_comp_modifyDefFile nonblocker run_dynamico.def guided_type  nudging
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              database
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_ok_guide} = Xy ] ; 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 ok_guide=y 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
140    # Include xml files for output configuration if running with workflow CMIP6
141    if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then
142      if [ -f ping_dynamico.xml ] ; then
143        echo '<context id="icosagcm" src="./ping_dynamico.xml"/>' >> add.tmp
144        echo '<context id="icosagcm" src="./dr2xml_dynamico.xml"/>' >> add.tmp
145      fi
146    fi
147    cp iodef.xml iodef.xml.tmp
148    sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml
149    rm iodef.xml.tmp add.tmp
150
151    # Add a Long Name as global attribute in output files if LongName is set in config.card
152    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then
153      listfile=$(ls file_def*dynamico.xml)
154      echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
155      for file in ${listfile} ; do
156          cp ${file} ${file}.tmp
157          sed -e "/<file id/r add.tmp" \
158          ${file}.tmp > ${file}
159          rm ${file}.tmp
160      done
161      rm add.tmp
162    fi
163
164    #remove unlimited time axis on winds files
165    if [ -f u.nc ] ; then
166        nccopy -u u.nc tmp.nc
167        mv tmp.nc u.nc
168    fi
169    if [ -f v.nc ] ; then
170        nccopy -u v.nc tmp.nc
171        mv tmp.nc v.nc
172    fi
173
174
175    if [ X${config_ListOfComponents_CPL} = Xoasis ] ; then
176    echo "Coupling mode using oasis, set using_oasis=y in run_dynamico.def"
177    IGCM_comp_modifyDefFile nonblocker run_dynamico.def using_oasis y
178    else
179    echo "DYNAMICO is running in forced mode without ocean model, set using_oasis=y in run_dynamico.def"
180    IGCM_comp_modifyDefFile nonblocker run_dynamico.def using_oasis n
181    fi
182
183
184    # Compression level (if CompressionLevel is not empty)
185    if [ ! "X${config_UserChoices_CompressionLevel}" = "X" ] ; then
186        echo "NetCDF output files compression level is " ${config_UserChoices_CompressionLevel}
187        listfile=$(ls file_def*dynamico.xml)
188        for file in ${listfile} ; do
189            sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file}
190        done
191    fi
192
193    IGCM_debug_PopStack "ICO_Update"
194}
195
196#-----------------------------------
197function ICO_Finalize
198{
199    IGCM_debug_PushStack "ICO_Finalize"
200
201    IGCM_debug_PopStack "ICO_Finalize"
202}
203
Note: See TracBrowser for help on using the repository browser.