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