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