1 | #!/bin/ksh |
---|
2 | #----------------------------------------------------------------- |
---|
3 | function ATM_Initialize |
---|
4 | { |
---|
5 | IGCM_debug_PushStack "ATM_Initialize" |
---|
6 | |
---|
7 | |
---|
8 | # Define the resolution only if the composant ICO for DYNAMICO is not set in config.card |
---|
9 | if [ X${config_ListOfComponents_ICO} = X ] ; then |
---|
10 | |
---|
11 | # Read the resolution from the variables ResolAtm set in config.card UserChoices section or from .resol file |
---|
12 | if [ X$ResolAtm != X ] ; then |
---|
13 | # ResolAtm is set in config.card |
---|
14 | RESOL_ATM_3D=${ResolAtm} |
---|
15 | elif [ -f ${SUBMIT_DIR}/../.resol ] ; then |
---|
16 | # ResolAtm was not set in config.card, try to read .resol file |
---|
17 | eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x39 |
---|
18 | else |
---|
19 | IGCM_debug_Exit "ResolAtm is not set in config.card and the .resol file does not exist." |
---|
20 | IGCM_debug_Verif_Exit |
---|
21 | fi |
---|
22 | |
---|
23 | RESOL_ATM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' ) |
---|
24 | RESOL_ATM_X=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $1}' ) |
---|
25 | RESOL_ATM_Y=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $2}' ) |
---|
26 | RESOL_ATM_XY="${RESOL_ATM_X}x${RESOL_ATM_Y}" |
---|
27 | RESOL_ATM=LMD${RESOL_ATM_X}${RESOL_ATM_Y} |
---|
28 | |
---|
29 | IGCM_debug_Print 1 "The atomsopheric resolution is ${RESOL_ATM_3D} " |
---|
30 | else |
---|
31 | RESOL_ATM_Z=${dynamico_UserChoices_RESOL_ATM_Z} |
---|
32 | RESOL_NBP=${dynamico_UserChoices_RESOL_NBP} |
---|
33 | RESOL_ATM="nbp${RESOL_NBP}" |
---|
34 | fi |
---|
35 | |
---|
36 | ##- LMDZ physics version |
---|
37 | ## Read LMDZ_Physics option in lmdz.card, if not present take default value AP (old physics) |
---|
38 | if [ ! X${lmdz_UserChoices_LMDZ_Physics} = X ] ; then |
---|
39 | LMDZ_Physics=${lmdz_UserChoices_LMDZ_Physics} |
---|
40 | else |
---|
41 | LMDZ_Physics=AP |
---|
42 | fi |
---|
43 | echo LMDZ physics version : ${LMDZ_Physics} |
---|
44 | |
---|
45 | ##- Create_etat0_limit version |
---|
46 | ## Define variable CREATE only if it is set in lmdz.card section UserChoices. |
---|
47 | ## This variable is only used in lmdz.card to choose input files. |
---|
48 | if [ ! X${lmdz_UserChoices_CREATE} = X ] ; then |
---|
49 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices CREATE |
---|
50 | CREATE=${lmdz_UserChoices_CREATE} |
---|
51 | echo create_etat0_limit version : ${CREATE} |
---|
52 | fi |
---|
53 | |
---|
54 | |
---|
55 | ## - LMDZ choice of config.def file |
---|
56 | ## ConfType must be set in lmdz.card |
---|
57 | ConfType=${lmdz_UserChoices_ConfType} |
---|
58 | |
---|
59 | IGCM_debug_PopStack "ATM_Initialize" |
---|
60 | } |
---|
61 | |
---|
62 | #----------------------------------------------------------------- |
---|
63 | function ATM_Update |
---|
64 | { |
---|
65 | IGCM_debug_PushStack "ATM_Update" |
---|
66 | |
---|
67 | ##-- GHG forcing : |
---|
68 | ## If forcing file exist in run directory, read values for the current year |
---|
69 | ## and set in config.def. If not use the default value set in config.def |
---|
70 | |
---|
71 | # Read value for solaire from file SOLARANDVOLCANOES.txt. If file not existing, take DEFAULT value from file. |
---|
72 | IGCM_debug_Print 1 "Note that the solaire parameter is here below changed but it is only used by LMDZ for old physics(AP and NPv3.2)" |
---|
73 | IGCM_debug_Print 1 "For newer physics with iflag_rrtm=1 and ok_suntime_rrtm=y, the solar constant is instead taken from solarforcing.nc file" |
---|
74 | if [ -f SOLARANDVOLCANOES.txt ] ; then |
---|
75 | value=`grep Annee_${year} SOLARANDVOLCANOES.txt | awk -F= '{print $2}'` |
---|
76 | if [ X"${value}" = X ] ; then |
---|
77 | # The grep returned empty variable, stop execution |
---|
78 | IGCM_debug_Exit "The file SOLARANDVOLCANOES.txt do not contain the current year." |
---|
79 | IGCM_debug_Verif_Exit |
---|
80 | fi |
---|
81 | else |
---|
82 | value=DEFAULT |
---|
83 | fi |
---|
84 | IGCM_comp_modifyDefFile nonblocker config.def solaire $value |
---|
85 | |
---|
86 | # Read value for eccentricity from file Eccentricity.txt. If file not existing, take DEFAULT value from file. |
---|
87 | if [ -f Eccentricity.txt ] ; then |
---|
88 | value=`grep Annee_${year} Eccentricity.txt | awk -F= '{print $2}'` |
---|
89 | if [ X"${value}" = X ] ; then |
---|
90 | # The grep returned empty variable, stop execution |
---|
91 | IGCM_debug_Exit "The file Eccentricity.txt do not contain the current year." |
---|
92 | IGCM_debug_Verif_Exit |
---|
93 | fi |
---|
94 | else |
---|
95 | value=DEFAULT |
---|
96 | fi |
---|
97 | IGCM_comp_modifyDefFile nonblocker config.def R_ecc $value |
---|
98 | |
---|
99 | # Read value for obliquity from file Obliquity.txt. If file not existing, take DEFAULT value from file. |
---|
100 | if [ -f Obliquity.txt ] ; then |
---|
101 | value=`grep Annee_${year} Obliquity.txt | awk -F= '{print $2}'` |
---|
102 | if [ X"${value}" = X ] ; then |
---|
103 | # The grep returned empty variable, stop execution |
---|
104 | IGCM_debug_Exit "The file Obliquity.txt do not contain the current year." |
---|
105 | IGCM_debug_Verif_Exit |
---|
106 | fi |
---|
107 | else |
---|
108 | value=DEFAULT |
---|
109 | fi |
---|
110 | IGCM_comp_modifyDefFile nonblocker config.def R_incl $value |
---|
111 | |
---|
112 | # Read value for perihelie from file Perihelie.txt. If file not existing, take DEFAULT value from file. |
---|
113 | if [ -f Perihelie.txt ] ; then |
---|
114 | value=`grep Annee_${year} Perihelie.txt | awk -F= '{print $2}'` |
---|
115 | if [ X"${value}" = X ] ; then |
---|
116 | # The grep returned empty variable, stop execution |
---|
117 | IGCM_debug_Exit "The file Perihelie.txt do not contain the current year." |
---|
118 | IGCM_debug_Verif_Exit |
---|
119 | fi |
---|
120 | else |
---|
121 | value=DEFAULT |
---|
122 | fi |
---|
123 | IGCM_comp_modifyDefFile nonblocker config.def R_peri $value |
---|
124 | |
---|
125 | # Read value for co2_ppm from file CO2.txt. If file not existing, take DEFAULT value from file. |
---|
126 | # Calculate co2_ppm_per as co2_ppm*4. |
---|
127 | if [ -f CO2.txt ] ; then |
---|
128 | value=`grep Annee_${year} CO2.txt | awk -F= '{print $2}'` |
---|
129 | if [ X"${value}" = X ] ; then |
---|
130 | # The grep returned empty variable, stop execution |
---|
131 | IGCM_debug_Exit "The file CO2.txt do not contain the current year." |
---|
132 | IGCM_debug_Verif_Exit |
---|
133 | fi |
---|
134 | value4=`grep Annee_${year} CO2.txt | awk -F= '{print $2 * 4}'` |
---|
135 | else |
---|
136 | value=DEFAULT |
---|
137 | value4=DEFAULT |
---|
138 | fi |
---|
139 | IGCM_comp_modifyDefFile nonblocker config.def co2_ppm $value |
---|
140 | IGCM_comp_modifyDefFile nonblocker config.def co2_ppm_per $value4 |
---|
141 | |
---|
142 | |
---|
143 | # Read value for CH4_ppb from file CH4.txt. If file not existing, take DEFAULT value from file. |
---|
144 | if [ -f CH4.txt ] ; then |
---|
145 | value=`grep Annee_${year} CH4.txt | awk -F= '{print $2}'` |
---|
146 | if [ X"${value}" = X ] ; then |
---|
147 | # The grep returned empty variable, stop execution |
---|
148 | IGCM_debug_Exit "The file CH4.txt do not contain the current year." |
---|
149 | IGCM_debug_Verif_Exit |
---|
150 | fi |
---|
151 | else |
---|
152 | value=DEFAULT |
---|
153 | fi |
---|
154 | IGCM_comp_modifyDefFile nonblocker config.def CH4_ppb $value |
---|
155 | |
---|
156 | |
---|
157 | # Read value for N2O_ppb from file N2O.txt. If file not existing, take DEFAULT value from file. |
---|
158 | if [ -f N2O.txt ] ; then |
---|
159 | value=`grep Annee_${year} N2O.txt | awk -F= '{print $2}'` |
---|
160 | if [ X"${value}" = X ] ; then |
---|
161 | # The grep returned empty variable, stop execution |
---|
162 | IGCM_debug_Exit "The file N2O.txt do not contain the current year." |
---|
163 | IGCM_debug_Verif_Exit |
---|
164 | fi |
---|
165 | else |
---|
166 | value=DEFAULT |
---|
167 | fi |
---|
168 | IGCM_comp_modifyDefFile nonblocker config.def N2O_ppb $value |
---|
169 | |
---|
170 | # Read value for CFC11_ppt from file CFC11.txt. If file not existing, take DEFAULT value from file. |
---|
171 | if [ -f CFC11.txt ] ; then |
---|
172 | value=`grep Annee_${year} CFC11.txt | awk -F= '{print $2}'` |
---|
173 | if [ X"${value}" = X ] ; then |
---|
174 | # The grep returned empty variable, stop execution |
---|
175 | IGCM_debug_Exit "The file CFC11.txt do not contain the current year." |
---|
176 | IGCM_debug_Verif_Exit |
---|
177 | fi |
---|
178 | else |
---|
179 | value=DEFAULT |
---|
180 | fi |
---|
181 | IGCM_comp_modifyDefFile nonblocker config.def CFC11_ppt $value |
---|
182 | |
---|
183 | |
---|
184 | # Read value for CFC12_ppt from file CFC12.txt. If file not existing, take DEFAULT value from file. |
---|
185 | if [ -f CFC12.txt ] ; then |
---|
186 | value=`grep Annee_${year} CFC12.txt | awk -F= '{print $2}'` |
---|
187 | if [ X"${value}" = X ] ; then |
---|
188 | # The grep returned empty variable, stop execution |
---|
189 | IGCM_debug_Exit "The file CFC12.txt do not contain the current year." |
---|
190 | IGCM_debug_Verif_Exit |
---|
191 | fi |
---|
192 | else |
---|
193 | value=DEFAULT |
---|
194 | fi |
---|
195 | IGCM_comp_modifyDefFile nonblocker config.def CFC12_ppt $value |
---|
196 | |
---|
197 | |
---|
198 | ## Coupling Time Step : Take value of FreqCoupling set in oasis.card or if it is not set, take default value 86400 |
---|
199 | LMDZ_t_coupl=${oasis_UserChoices_FreqCoupling:-86400} |
---|
200 | IGCM_debug_Print 3 "LMDZ_t_coupl " ${LMDZ_t_coupl} |
---|
201 | IGCM_comp_modifyDefFile nonblocker config.def t_coupl ${LMDZ_t_coupl} |
---|
202 | |
---|
203 | |
---|
204 | |
---|
205 | ## Activate diagnostic output files and set output_level for each file |
---|
206 | |
---|
207 | # histmth |
---|
208 | if [ X${lmdz_UserChoices_output_level_histmth} = X ] || [ X${lmdz_UserChoices_output_level_histmth} = XNONE ] ; then |
---|
209 | IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth enabled FALSE |
---|
210 | IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth output_level 0 |
---|
211 | else |
---|
212 | IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth enabled TRUE |
---|
213 | IGCM_comp_modifyXmlFile nonblocker file_def_histmth_lmdz.xml histmth output_level ${lmdz_UserChoices_output_level_histmth} |
---|
214 | fi |
---|
215 | |
---|
216 | # histday |
---|
217 | if [ X${lmdz_UserChoices_output_level_histday} = X ] || [ X${lmdz_UserChoices_output_level_histday} = XNONE ] ; then |
---|
218 | IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday enabled FALSE |
---|
219 | IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday output_level 0 |
---|
220 | else |
---|
221 | IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday enabled TRUE |
---|
222 | IGCM_comp_modifyXmlFile nonblocker file_def_histday_lmdz.xml histday output_level ${lmdz_UserChoices_output_level_histday} |
---|
223 | fi |
---|
224 | |
---|
225 | # histhf |
---|
226 | if [ X${lmdz_UserChoices_output_level_histhf} = X ] || [ X${lmdz_UserChoices_output_level_histhf} = XNONE ] ; then |
---|
227 | IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf enabled FALSE |
---|
228 | IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf output_level 0 |
---|
229 | else |
---|
230 | IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf enabled TRUE |
---|
231 | IGCM_comp_modifyXmlFile nonblocker file_def_histhf_lmdz.xml histhf output_level ${lmdz_UserChoices_output_level_histhf} |
---|
232 | fi |
---|
233 | |
---|
234 | # histmthNMC |
---|
235 | if [ X${lmdz_UserChoices_output_level_histmthNMC} = X ] || [ X${lmdz_UserChoices_output_level_histmthNMC} = XNONE ] ; then |
---|
236 | IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC enabled FALSE |
---|
237 | IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC output_level 0 |
---|
238 | else |
---|
239 | IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC enabled TRUE |
---|
240 | IGCM_comp_modifyXmlFile nonblocker file_def_histmthNMC_lmdz.xml histmthNMC output_level ${lmdz_UserChoices_output_level_histmthNMC} |
---|
241 | fi |
---|
242 | |
---|
243 | # histdayNMC |
---|
244 | if [ X${lmdz_UserChoices_output_level_histdayNMC} = X ] || [ X${lmdz_UserChoices_output_level_histdayNMC} = XNONE ] ; then |
---|
245 | IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC enabled FALSE |
---|
246 | IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC output_level 0 |
---|
247 | else |
---|
248 | IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC enabled TRUE |
---|
249 | IGCM_comp_modifyXmlFile nonblocker file_def_histdayNMC_lmdz.xml histdayNMC output_level ${lmdz_UserChoices_output_level_histdayNMC} |
---|
250 | fi |
---|
251 | |
---|
252 | # histhfNMC |
---|
253 | if [ X${lmdz_UserChoices_output_level_histhfNMC} = X ] || [ X${lmdz_UserChoices_output_level_histhfNMC} = XNONE ] ; then |
---|
254 | IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC enabled FALSE |
---|
255 | IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC output_level 0 |
---|
256 | else |
---|
257 | IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC enabled TRUE |
---|
258 | IGCM_comp_modifyXmlFile nonblocker file_def_histhfNMC_lmdz.xml histhfNMC output_level ${lmdz_UserChoices_output_level_histhfNMC} |
---|
259 | fi |
---|
260 | |
---|
261 | # histstrataer |
---|
262 | if [ X${lmdz_UserChoices_output_level_histstrataer} = X ] || [ X${lmdz_UserChoices_output_level_histstrataer} = XNONE ] ; then |
---|
263 | IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer enabled FALSE |
---|
264 | IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer output_level 0 |
---|
265 | else |
---|
266 | IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer enabled TRUE |
---|
267 | IGCM_comp_modifyXmlFile nonblocker file_def_histstrataer_lmdz.xml histstrataer output_level ${lmdz_UserChoices_output_level_histstrataer} |
---|
268 | fi |
---|
269 | |
---|
270 | # histdaystrataer |
---|
271 | if [ X${lmdz_UserChoices_output_level_histdaystrataer} = X ] || [ X${lmdz_UserChoices_output_level_histdaystrataer} = XNONE ] ; then |
---|
272 | IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled FALSE |
---|
273 | IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer output_level 0 |
---|
274 | else |
---|
275 | IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer enabled TRUE |
---|
276 | IGCM_comp_modifyXmlFile nonblocker file_def_histdaystrataer_lmdz.xml histdaystrataer output_level ${lmdz_UserChoices_output_level_histstrataer} |
---|
277 | fi |
---|
278 | |
---|
279 | # histstn |
---|
280 | if [ X${lmdz_UserChoices_output_level_histstn} = X ] || [ X${lmdz_UserChoices_output_level_histstn} = XNONE ] ; then |
---|
281 | IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn enabled FALSE |
---|
282 | IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn output_level 0 |
---|
283 | else |
---|
284 | IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn enabled TRUE |
---|
285 | IGCM_comp_modifyXmlFile nonblocker file_def_histstn_lmdz.xml histstn output_level ${lmdz_UserChoices_output_level_histstn} |
---|
286 | fi |
---|
287 | |
---|
288 | |
---|
289 | # histmthCOSP |
---|
290 | if [ X${lmdz_UserChoices_output_level_histmthCOSP} = X ] || [ X${lmdz_UserChoices_output_level_histmthCOSP} = XNONE ] ; then |
---|
291 | IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP enabled FALSE |
---|
292 | IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP output_level 0 |
---|
293 | else |
---|
294 | IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP enabled TRUE |
---|
295 | IGCM_comp_modifyXmlFile nonblocker file_def_histmthCOSP_lmdz.xml histmthCOSP output_level ${lmdz_UserChoices_output_level_histmthCOSP} |
---|
296 | fi |
---|
297 | |
---|
298 | |
---|
299 | # histdayCOSP |
---|
300 | if [ X${lmdz_UserChoices_output_level_histdayCOSP} = X ] || [ X${lmdz_UserChoices_output_level_histdayCOSP} = XNONE ] ; then |
---|
301 | IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP enabled FALSE |
---|
302 | IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP output_level 0 |
---|
303 | else |
---|
304 | IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP enabled TRUE |
---|
305 | IGCM_comp_modifyXmlFile nonblocker file_def_histdayCOSP_lmdz.xml histdayCOSP output_level ${lmdz_UserChoices_output_level_histdayCOSP} |
---|
306 | fi |
---|
307 | |
---|
308 | |
---|
309 | # histhfCOSP |
---|
310 | if [ X${lmdz_UserChoices_output_level_histhfCOSP} = X ] || [ X${lmdz_UserChoices_output_level_histhfCOSP} = XNONE ] ; then |
---|
311 | IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP enabled FALSE |
---|
312 | IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP output_level 0 |
---|
313 | else |
---|
314 | IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP enabled TRUE |
---|
315 | IGCM_comp_modifyXmlFile nonblocker file_def_histhfCOSP_lmdz.xml histhfCOSP output_level ${lmdz_UserChoices_output_level_histhfCOSP} |
---|
316 | fi |
---|
317 | |
---|
318 | |
---|
319 | ## run.def parameters |
---|
320 | |
---|
321 | |
---|
322 | ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def |
---|
323 | if [ ${CumulPeriod} -eq 1 ] ; then |
---|
324 | IGCM_comp_modifyDefFile blocker run.def raz_date 1 |
---|
325 | else |
---|
326 | IGCM_comp_modifyDefFile blocker run.def raz_date 0 |
---|
327 | fi |
---|
328 | |
---|
329 | ##-- Calendar type for LMDZ and create_etat0_limit |
---|
330 | # calend is read from both LMDZ dynamics and physics parts of the model |
---|
331 | case ${config_UserChoices_CalendarType} in |
---|
332 | leap|gregorian) |
---|
333 | IGCM_comp_modifyDefFile blocker run.def calend gregorian ;; |
---|
334 | noleap) |
---|
335 | IGCM_comp_modifyDefFile blocker run.def calend earth_365d ;; |
---|
336 | 360d) |
---|
337 | IGCM_comp_modifyDefFile blocker run.def calend earth_360d ;; |
---|
338 | *) |
---|
339 | IGCM_comp_modifyDefFile blocker run.def calend earth_360d ;; |
---|
340 | esac |
---|
341 | |
---|
342 | |
---|
343 | ## -- Modify more calendar related variables. |
---|
344 | IGCM_comp_modifyDefFile blocker run.def dayref ${InitDay} |
---|
345 | # Following variables are read by LMDZ dynamics |
---|
346 | IGCM_comp_modifyDefFile blocker run.def nday ${PeriodLengthInDays} |
---|
347 | |
---|
348 | # Set anneeref different for gcm and create_etat0_limit mode |
---|
349 | # Test if keyword create_etat0_limit=y is set in dynamico.card or in lmdz.card |
---|
350 | if [ X${lmdz_UserChoices_create_etat0_limit} = Xy ] || [ X${dynamico_UserChoices_create_etat0_limit} = Xy ] ; then |
---|
351 | # for case create_etat0_limit : always take current year |
---|
352 | IGCM_comp_modifyDefFile blocker run.def anneeref ${year} |
---|
353 | |
---|
354 | # Temporary, set use_filtre_fft=n because we now use dyn3d for ce0l version where fft is not implemented. |
---|
355 | # In more recent versions of LMDZ, this will not be needed. |
---|
356 | IGCM_comp_modifyDefFile force run.def use_filtre_fft n |
---|
357 | else |
---|
358 | # for case gcm : take first year of simulation |
---|
359 | IGCM_comp_modifyDefFile blocker run.def anneeref ${InitYear} |
---|
360 | fi |
---|
361 | |
---|
362 | ## Determine from the variable ListOfComponents in config.card coupling to external models |
---|
363 | ## and set corresponding parameters in run.def |
---|
364 | echo ListOfComponents now running : ${config_ListOfComponents[*]} |
---|
365 | |
---|
366 | if [ X${config_ListOfComponents_SRF} = Xorchidee ] ; then |
---|
367 | echo "Activate ORCHIDEE, set VEGET=y in run.def" |
---|
368 | IGCM_comp_modifyDefFile blocker run.def VEGET y |
---|
369 | else |
---|
370 | echo "No ORCHIDEE, set VEGET=n in run.def" |
---|
371 | IGCM_comp_modifyDefFile blocker run.def VEGET n |
---|
372 | fi |
---|
373 | |
---|
374 | if [ X${config_ListOfComponents_CPL} = Xoasis ] ; then |
---|
375 | echo "Activate coupling to ocean, set type_ocean=couple in run.def" |
---|
376 | IGCM_comp_modifyDefFile blocker run.def type_ocean couple |
---|
377 | else |
---|
378 | echo "LMDZ is running in forced mode without ocean model, set type_ocean=force in run.def" |
---|
379 | IGCM_comp_modifyDefFile nonblocker run.def type_ocean force |
---|
380 | fi |
---|
381 | |
---|
382 | if [ X${config_UserChoices_ConfigType} = XESMCO2AER ] ; then |
---|
383 | echo "ESM config, with INCA and CO2i, set type_trac=inco in run.def" |
---|
384 | IGCM_comp_modifyDefFile blocker run.def type_trac inco |
---|
385 | IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1 |
---|
386 | elif [ X${config_ListOfComponents_CHM} = Xinca ] ; then |
---|
387 | echo "Activate coupling to INCA, set type_trac=inca in run.def" |
---|
388 | IGCM_comp_modifyDefFile blocker run.def type_trac inca |
---|
389 | IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1 |
---|
390 | elif [ X${config_ListOfComponents_CHM} = Xreprobus ] ; then |
---|
391 | echo "Activate coupling to REPROBUS, set type_trac=repr in run.def" |
---|
392 | IGCM_comp_modifyDefFile blocker run.def type_trac repr |
---|
393 | IGCM_comp_modifyDefFile blocker run.def config_inca none |
---|
394 | IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1 |
---|
395 | elif [ X${config_UserChoices_ConfigType} = XESMCO2 ] ; then |
---|
396 | echo "ESM config, set type_trac=co2i in run.def" |
---|
397 | IGCM_comp_modifyDefFile blocker run.def type_trac co2i |
---|
398 | IGCM_comp_modifyDefFile blocker run.def config_inca none |
---|
399 | IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1 |
---|
400 | elif [ X${lmdz_UserChoices_LMDZ_strataero} = Xy ] ; then |
---|
401 | echo "No coupling to chemistry model but it is a LMDZ STRATAER configuration, set type_trac=coag in run.def" |
---|
402 | IGCM_comp_modifyDefFile blocker run.def type_trac coag |
---|
403 | IGCM_comp_modifyDefFile blocker run.def config_inca none |
---|
404 | IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 1 |
---|
405 | else |
---|
406 | echo "No coupling to chemistry model, set type_trac=lmdz in run.def" |
---|
407 | IGCM_comp_modifyDefFile blocker run.def type_trac lmdz |
---|
408 | IGCM_comp_modifyDefFile blocker run.def config_inca none |
---|
409 | IGCM_comp_modifyDefFile blocker run.def iflag_phytrac 0 |
---|
410 | fi |
---|
411 | |
---|
412 | # run.def : Activate the new calving |
---|
413 | if [ ! X${lmdz_UserChoices_cpl_old_calving} = X ]; then |
---|
414 | IGCM_comp_modifyDefFile nonblocker run.def cpl_old_calving ${lmdz_UserChoices_cpl_old_calving} |
---|
415 | else |
---|
416 | IGCM_comp_modifyDefFile nonblocker run.def cpl_old_calving y |
---|
417 | fi |
---|
418 | |
---|
419 | # physiq.def : Activate the call to phytrac |
---|
420 | if [ ! X${lmdz_UserChoices_ok_bug_cv_trac} = X ]; then |
---|
421 | IGCM_comp_modifyDefFile nonblocker physiq.def ok_bug_cv_trac ${lmdz_UserChoices_ok_bug_cv_trac} |
---|
422 | else |
---|
423 | IGCM_comp_modifyDefFile nonblocker physiq.def ok_bug_cv_trac n |
---|
424 | fi |
---|
425 | |
---|
426 | # config.def : Activate aerosol strato |
---|
427 | if [ ! X${lmdz_UserChoices_flag_aerosol_strat} = X ]; then |
---|
428 | IGCM_comp_modifyDefFile nonblocker config.def flag_aerosol_strat ${lmdz_UserChoices_flag_aerosol_strat} |
---|
429 | else |
---|
430 | IGCM_comp_modifyDefFile nonblocker config.def flag_aerosol_strat DEFAULT |
---|
431 | fi |
---|
432 | |
---|
433 | # config.def : Activate direct radiative effect if ok_ade=y |
---|
434 | if [ ! X${lmdz_UserChoices_ok_ade} = X ]; then |
---|
435 | IGCM_comp_modifyDefFile nonblocker config.def ok_ade ${lmdz_UserChoices_ok_ade} |
---|
436 | else |
---|
437 | IGCM_comp_modifyDefFile nonblocker config.def ok_ade n |
---|
438 | fi |
---|
439 | |
---|
440 | # config.def : Activate indirect radiative effect if ok_aie=y |
---|
441 | if [ ! X${lmdz_UserChoices_ok_aie} = X ]; then |
---|
442 | IGCM_comp_modifyDefFile nonblocker config.def ok_aie ${lmdz_UserChoices_ok_aie} |
---|
443 | else |
---|
444 | IGCM_comp_modifyDefFile nonblocker config.def ok_aie n |
---|
445 | fi |
---|
446 | |
---|
447 | # config.def : Activate online aerosol coupled model if aerosol_couple=y |
---|
448 | if [ ! X${lmdz_UserChoices_aerosol_couple} = X ]; then |
---|
449 | IGCM_comp_modifyDefFile nonblocker config.def aerosol_couple ${lmdz_UserChoices_aerosol_couple} |
---|
450 | else |
---|
451 | IGCM_comp_modifyDefFile nonblocker config.def aerosol_couple n |
---|
452 | fi |
---|
453 | |
---|
454 | # config.def : Activate online Ozone chemistry coupled model if chemistry_couple=y |
---|
455 | if [ ! X${lmdz_UserChoices_chemistry_couple} = X ]; then |
---|
456 | IGCM_comp_modifyDefFile nonblocker config.def chemistry_couple ${lmdz_UserChoices_chemistry_couple} |
---|
457 | else |
---|
458 | IGCM_comp_modifyDefFile nonblocker config.def chemistry_couple n |
---|
459 | fi |
---|
460 | |
---|
461 | # config.def : Activate reading of ozone in climatology if read_climoz=2 |
---|
462 | if [ ! X${lmdz_UserChoices_read_climoz} = X ]; then |
---|
463 | IGCM_comp_modifyDefFile nonblocker config.def read_climoz ${lmdz_UserChoices_read_climoz} |
---|
464 | else |
---|
465 | IGCM_comp_modifyDefFile nonblocker config.def read_climoz 0 |
---|
466 | fi |
---|
467 | |
---|
468 | # config.def : Choose aerosol use in radiative effect |
---|
469 | # type of coupled aerosol =1 (default) =2 => bc only =3 => pom only =4 => seasalt only |
---|
470 | # =5 => dust only =6 => all aerosol |
---|
471 | if [ ! X${lmdz_UserChoices_flag_aerosol} = X ]; then |
---|
472 | IGCM_comp_modifyDefFile nonblocker config.def flag_aerosol ${lmdz_UserChoices_flag_aerosol} |
---|
473 | else |
---|
474 | IGCM_comp_modifyDefFile nonblocker config.def flag_aerosol 0 |
---|
475 | fi |
---|
476 | |
---|
477 | # config.def : Activate calcul of Cloud droplet number concentration if ok_cdnc=y |
---|
478 | if [ ! X${lmdz_UserChoices_ok_cdnc} = X ]; then |
---|
479 | IGCM_comp_modifyDefFile nonblocker config.def ok_cdnc ${lmdz_UserChoices_ok_cdnc} |
---|
480 | else |
---|
481 | IGCM_comp_modifyDefFile nonblocker config.def ok_cdnc n |
---|
482 | fi |
---|
483 | |
---|
484 | # config.def : Activate COSP |
---|
485 | if [ ! X${lmdz_UserChoices_LMDZ_COSP_OK} = X ]; then |
---|
486 | IGCM_comp_modifyDefFile nonblocker config.def ok_cosp ${lmdz_UserChoices_LMDZ_COSP_OK} |
---|
487 | else |
---|
488 | IGCM_comp_modifyDefFile nonblocker config.def ok_cosp n |
---|
489 | fi |
---|
490 | |
---|
491 | # config.def : Modify parameter pmagic if it is set in lmdz.card |
---|
492 | if [ ! X${lmdz_UserChoices_pmagic} = X ]; then |
---|
493 | IGCM_comp_modifyDefFile nonblocker config.def pmagic ${lmdz_UserChoices_pmagic} |
---|
494 | else |
---|
495 | # Take default value set in config.def |
---|
496 | IGCM_comp_modifyDefFile nonblocker config.def pmagic DEFAULT |
---|
497 | fi |
---|
498 | |
---|
499 | if ( [ X${config_UserChoices_ConfigType} = XESMCO2 ] || [ X${config_UserChoices_ConfigType} = XESMCO2AER ] ) ; then |
---|
500 | # Set carbon cycle parameters according to parmeters in lmdz.card |
---|
501 | IGCM_comp_modifyDefFile blocker config.def level_coupling_esm 2 |
---|
502 | IGCM_comp_modifyDefFile blocker config.def carbon_cycle_cpl ${lmdz_UserChoices_carbon_cycle_cpl} |
---|
503 | IGCM_comp_modifyDefFile blocker config.def carbon_cycle_tr ${lmdz_UserChoices_carbon_cycle_tr} |
---|
504 | IGCM_comp_modifyDefFile blocker config.def carbon_cycle_rad ${lmdz_UserChoices_carbon_cycle_rad} |
---|
505 | IGCM_comp_modifyDefFile nonblocker config.def co2_ppm0 ${lmdz_UserChoices_co2_ppm0} |
---|
506 | else |
---|
507 | # Take default value set in config.def |
---|
508 | IGCM_comp_modifyDefFile nonblocker config.def level_coupling_esm DEFAULT |
---|
509 | IGCM_comp_modifyDefFile nonblocker config.def carbon_cycle_cpl DEFAULT |
---|
510 | IGCM_comp_modifyDefFile nonblocker config.def carbon_cycle_tr DEFAULT |
---|
511 | IGCM_comp_modifyDefFile nonblocker config.def carbon_cycle_rad DEFAULT |
---|
512 | IGCM_comp_modifyDefFile nonblocker config.def co2_ppm0 DEFAULT |
---|
513 | fi |
---|
514 | |
---|
515 | if ( [ X${config_UserChoices_ConfigType} = XESMCO2 ] ) ; then |
---|
516 | # Set carbon cycle parameters according to parmeters in lmdz.card |
---|
517 | IGCM_comp_modifyDefFile nonblocker config.def read_fco2_ocean_cor ${lmdz_UserChoices_read_fco2_ocean_cor} |
---|
518 | IGCM_comp_modifyDefFile nonblocker config.def var_fco2_ocean_cor ${lmdz_UserChoices_var_fco2_ocean_cor} |
---|
519 | IGCM_comp_modifyDefFile nonblocker config.def read_fco2_land_cor ${lmdz_UserChoices_read_fco2_land_cor} |
---|
520 | IGCM_comp_modifyDefFile nonblocker config.def var_fco2_land_cor ${lmdz_UserChoices_var_fco2_land_cor} |
---|
521 | else |
---|
522 | IGCM_comp_modifyDefFile nonblocker config.def read_fco2_ocean_cor DEFAULT |
---|
523 | IGCM_comp_modifyDefFile nonblocker config.def var_fco2_ocean_cor DEFAULT |
---|
524 | IGCM_comp_modifyDefFile nonblocker config.def read_fco2_land_cor DEFAULT |
---|
525 | IGCM_comp_modifyDefFile nonblocker config.def var_fco2_land_cor DEFAULT |
---|
526 | fi |
---|
527 | |
---|
528 | # config.def : Modify parameter ok_volcan if ok_volcan=y or LMDZ_strataero=y in lmdz.card |
---|
529 | # Note: ok_volcan is a flag allowing a double-call with/without natural forcing (instead of with/without anthro forcing). |
---|
530 | if [ ! X${lmdz_UserChoices_ok_volcan} = X ] || [ X${lmdz_UserChoices_LMDZ_strataero} = Xy ] ; then |
---|
531 | IGCM_comp_modifyDefFile nonblocker config.def ok_volcan ${lmdz_UserChoices_ok_volcan} |
---|
532 | else |
---|
533 | # Take default value set in config.def |
---|
534 | IGCM_comp_modifyDefFile nonblocker config.def ok_volcan DEFAULT |
---|
535 | fi |
---|
536 | |
---|
537 | # physiq.def : Modify parameter tau_gl if it is set in lmdz.card |
---|
538 | if [ ! X${lmdz_UserChoices_tau_gl} = X ]; then |
---|
539 | IGCM_comp_modifyDefFile nonblocker physiq.def tau_gl ${lmdz_UserChoices_tau_gl} |
---|
540 | else |
---|
541 | # Take default value set in physiq.def |
---|
542 | IGCM_comp_modifyDefFile nonblocker physiq.def tau_gl DEFAULT |
---|
543 | fi |
---|
544 | |
---|
545 | |
---|
546 | # guide.def : Activate nudging if ok_guide=y set in lmdz.card |
---|
547 | if [ ! X${lmdz_UserChoices_ok_guide} = X ] ; then |
---|
548 | IGCM_comp_modifyDefFile nonblocker guide.def ok_guide ${lmdz_UserChoices_ok_guide} |
---|
549 | else |
---|
550 | IGCM_comp_modifyDefFile nonblocker guide.def ok_guide n |
---|
551 | fi |
---|
552 | |
---|
553 | |
---|
554 | # Specific ByPass option only used with LMDZ dynamcis (without DYNMAICO) |
---|
555 | if [ X${config_ListOfComponents_ICO} = X ] ; then |
---|
556 | |
---|
557 | ## Read ByPass_hgardfou_teta option in lmdz.card --> divide teta* by 2 if [ $ByPass_hgardfou_teta = 1 ] |
---|
558 | ByPass_hgardfou_teta=${lmdz_UserChoices_ByPass_hgardfou_teta} |
---|
559 | if [ X"${ByPass_hgardfou_teta}" = X"y" ] ; then |
---|
560 | awk '{ if ($0 ~ /^teta.*=/) {split($0,a,"=") ; print a[1]"="a[2]/2"."} else print $0}' gcm.def > gcm.def.tmp |
---|
561 | IGCM_sys_Mv gcm.def.tmp gcm.def |
---|
562 | echo |
---|
563 | IGCM_debug_Print 1 "ByPass_hgardfou_teta : ^teta*/2 in gcm.def" |
---|
564 | echo |
---|
565 | cat gcm.def |
---|
566 | ByPass_hgardfou_teta=n |
---|
567 | export lmdz_UserChoices_ByPass_hgardfou_teta=n |
---|
568 | IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta "${ByPass_hgardfou_teta}" |
---|
569 | fi |
---|
570 | |
---|
571 | ## Read ByPass_hgardfou_mats option in lmdz.card --> purmats=y 2 if [ $ByPass_hgardfou_mats = 1 ] |
---|
572 | ByPass_hgardfou_mats=${lmdz_UserChoices_ByPass_hgardfou_mats} |
---|
573 | if [ X"${ByPass_hgardfou_mats}" = X"y" ] ; then |
---|
574 | sed -e "s/^purmats=.*/purmats=y/" gcm.def > gcm.def.tmp |
---|
575 | IGCM_sys_Mv gcm.def.tmp gcm.def |
---|
576 | echo |
---|
577 | IGCM_debug_Print 1 "ByPass_hgardfou_mats : purmats=y in gcm.def" |
---|
578 | echo |
---|
579 | cat gcm.def |
---|
580 | ByPass_hgardfou_mats=n |
---|
581 | export lmdz_UserChoices_ByPass_hgardfou_mats=n |
---|
582 | IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats "${ByPass_hgardfou_mats}" |
---|
583 | fi |
---|
584 | fi |
---|
585 | |
---|
586 | # Add include of LMDZ context in iodef.xml |
---|
587 | # In iodef.xml add on the next line after "COMPONENT CONTEXT" |
---|
588 | echo '<context id="LMDZ" src="./context_lmdz.xml"/>' > add.tmp |
---|
589 | # Add inclusion of file context_input_lmdz.xml if this file exists |
---|
590 | if [ -f context_input_lmdz.xml ] ; then |
---|
591 | echo '<context id="LMDZ" src="./context_input_lmdz.xml"/>' >> add.tmp |
---|
592 | fi |
---|
593 | # Include xml files for output configuration if running with workflow CMIP6 |
---|
594 | if ( [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] || [ X${config_Post_dr2xmlIPSL} = XTRUE ] ) ; then |
---|
595 | echo '<context id="LMDZ" src="./ping_lmdz.xml"/>' >> add.tmp |
---|
596 | echo '<context id="LMDZ" src="./dr2xml_lmdz.xml"/>' >> add.tmp |
---|
597 | fi |
---|
598 | cp iodef.xml iodef.xml.tmp |
---|
599 | sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml |
---|
600 | rm iodef.xml.tmp add.tmp |
---|
601 | |
---|
602 | #Long Name as global attribute (if LongName is not empty) |
---|
603 | if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then |
---|
604 | listfile=$(ls file_def*lmdz.xml) |
---|
605 | echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp |
---|
606 | for file in ${listfile} |
---|
607 | do |
---|
608 | cp ${file} ${file}.tmp |
---|
609 | sed -e "/<file id/r add.tmp" \ |
---|
610 | ${file}.tmp > ${file} |
---|
611 | rm ${file}.tmp |
---|
612 | done |
---|
613 | rm add.tmp |
---|
614 | fi |
---|
615 | |
---|
616 | # Compression level (if CompressionLevel is not empty) |
---|
617 | if [ ! "X${config_UserChoices_CompressionLevel}" = "X" ] ; then |
---|
618 | echo "NetCDF output files compression level is " ${config_UserChoices_CompressionLevel} |
---|
619 | listfile=$(ls file_def*lmdz.xml) |
---|
620 | for file in ${listfile} ; do |
---|
621 | sed -i -e "s/\(compression_level=\"\)[^\"]*\(\"\)/\1${config_UserChoices_CompressionLevel}\2/" ${file} |
---|
622 | done |
---|
623 | fi |
---|
624 | |
---|
625 | |
---|
626 | # Set interpolated output grid depending on resoultion, only if ICO component is set in config.card |
---|
627 | if [ ! "X${config_ListOfComponents_ICO}" = "X" ] ; then |
---|
628 | if [ ${RESOL_NBP} == 40 ] ; then |
---|
629 | valuei=144 |
---|
630 | valuej=143 |
---|
631 | elif [ ${RESOL_NBP} == 80 ] ; then |
---|
632 | valuei=360 |
---|
633 | valuej=180 |
---|
634 | elif [ ${RESOL_NBP} == 160 ] ; then |
---|
635 | valuei=720 |
---|
636 | valuej=360 |
---|
637 | elif [ ${RESOL_NBP} == 320 ] ; then |
---|
638 | valuei=1440 |
---|
639 | valuej=720 |
---|
640 | else |
---|
641 | IGCM_debug_Exit "RESOL_NBP=${RESOL_NBP} is not yet implemented in drivers" |
---|
642 | IGCM_debug_Verif_Exit |
---|
643 | fi |
---|
644 | |
---|
645 | IGCM_debug_Print 1 "Modify output grid parameters for current resolution in context_lmdz.xml" |
---|
646 | cp context_lmdz.xml context_lmdz.xml.init |
---|
647 | sed -e "s/ni_glo.*=.*\"144\"/ni_glo=\"${valuei}\"/" \ |
---|
648 | -e "s/nj_glo.*=.*\"143\"/nj_glo=\"${valuej}\"/" \ |
---|
649 | context_lmdz.xml.init > context_lmdz.xml |
---|
650 | fi |
---|
651 | |
---|
652 | |
---|
653 | IGCM_debug_PopStack "ATM_Update" |
---|
654 | } |
---|
655 | |
---|
656 | #----------------------------------- |
---|
657 | function ATM_Finalize |
---|
658 | { |
---|
659 | IGCM_debug_PushStack "ATM_Finalize" |
---|
660 | |
---|
661 | IGCM_debug_Print 1 "FINALIZE ATM !" |
---|
662 | |
---|
663 | IGCM_debug_PopStack "ATM_Finalize" |
---|
664 | } |
---|
665 | |
---|