Changeset 1537 for CONFIG/IPSLCM
- Timestamp:
- 08/19/11 17:10:40 (13 years ago)
- Location:
- CONFIG/IPSLCM/IPSLCM5-2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.card
r1535 r1537 28 28 LMDZ_NMC_hf=y 29 29 30 # CARBON_CYCLE=NONE/control/historical 31 CARBON_CYCLE=historical 30 32 co2_init=284.725 31 33 -
CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.driver
r1535 r1537 92 92 IGCM_debug_PushStack "ATM_Update" 93 93 94 typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo295 typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff96 typeset PathCO2log97 94 98 95 case ${config_UserChoices_PeriodLength} in … … 120 117 fi 121 118 122 ## To have more variables in output files for aerosols. Parameters are set in lmdz.card123 #if [ ${CumulPeriod}%${LMDZ_Freq_aero} -le ${LMDZ_Length_aero} ]; then124 # if [ ${CumulPeriod}%${LMDZ_Freq_aero} -ne 0 ]; then125 # lev_histmth=4126 # else127 # lev_histmth=2128 # fi129 #else130 # lev_histmth=2131 #fi132 133 119 ## algo : For CumulPeriod=1 ; 134 120 ## IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix … … 180 166 fi 181 167 182 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then 168 169 # Add special treatement for CARBON CYCLE 170 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 171 172 typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2 173 typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 174 typeset PathCO2log 175 typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX 176 177 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then 183 178 ##--Initialization of fluxes to an undefined value at the first run 184 185 186 187 188 189 190 191 192 193 179 UndefinedValueCo2=-9999 180 InitPeriodCo2=0 181 InitDateBeginCo2=${UndefinedValueCo2} 182 InitYearCo2=$(( ${year} - 1 )) 183 InitDateEndCo2=${InitYearCo2}1231 184 fCO2_ff=${UndefinedValueCo2} 185 CO2SBG=${UndefinedValueCo2} 186 CO2LU=${UndefinedValueCo2} 187 CO2MBG=${UndefinedValueCo2} 188 CO2_ppm_prec=${UndefinedValueCo2} 194 189 # Get the initial value of atmosp. pco2 195 196 197 198 199 190 CO2_ppm=${lmdz_UserChoices_co2_init} 191 192 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 193 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 194 200 195 # Save CO2 values in ExeCpuLog variable contents 5 fields 201 202 196 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 197 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 203 198 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 204 199 205 200 # Get the path where the log file co2.log is 206 201 PathCO2log=${SUBMIT_DIR} 207 202 # Get Previous line in co2.log 208 209 210 211 203 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 204 205 else 206 212 207 # NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ): 213 208 # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2. 214 209 #SubmitRestartPath= 215 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then216 217 218 219 220 221 222 223 210 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then 211 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath 212 PathCO2log=${config_ATM_SubmitRestartPath} 213 Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} ) 214 PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log ) 215 216 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 217 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 218 224 219 # Save Last Line of control in new co2.log file 225 226 227 228 229 230 231 232 233 234 235 236 220 InitPeriodCo2=0 221 InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' ) 222 InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' ) 223 fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' ) 224 CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' ) 225 CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' ) 226 CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' ) 227 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' ) 228 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 229 230 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 231 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 237 232 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 238 else233 else 239 234 # Get restart line in co2.log 240 241 235 PathCO2log=${SUBMIT_DIR} 236 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 242 237 # Get the value of atmosp. pco2 in co2.log 243 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 238 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 239 fi 240 244 241 fi 245 242 246 fi 243 if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 244 # Modify co2_ppm in physiq.def only for historical run 245 LMDZ_sed physiq.def co2_ppm ${CO2_ppm} 246 fi 247 fi 248 # end CARBON_CYCLE 247 249 248 250 ##-- For historical daily cosp must be output during 1979-2005 period … … 253 255 LMDZ_sed physiq.def OK_journe ${OK_journe} 254 256 LMDZ_sed physiq.def OK_mensuel ${OK_mensuel} 255 #LMDZ_sed physiq.def lev_histmth ${lev_histmth}256 257 LMDZ_sed physiq.def ok_hf ${ok_hf} 257 258 LMDZ_sed physiq.def ecrit_mth ${LMDZ_ecrit_mth} … … 262 263 LMDZ_sed physiq.def ok_hfCOSP ${LMDZ_COSP_hf} 263 264 LMDZ_sed physiq.def ok_histNMC "${LMDZ_NMC_monthly}, ${LMDZ_NMC_daily}, ${LMDZ_NMC_hf}" 264 LMDZ_sed physiq.def co2_ppm ${CO2_ppm}265 265 266 266 ## gcm.def parameters : no change since gcm.def_${RESOL_ATM_3D} is used and already modified … … 335 335 [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod} 336 336 337 typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 338 339 # get the fossile fuel file : 340 fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt ) 341 echo "Fossil Fuel for historical run :" ${fCO2_ff} 342 343 # Get the value of ocean carbon flux 344 CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output ) 345 CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 346 echo "Ocean carbon flux :" ${CO2MBG} 347 348 # Get the value of land fluxes 349 set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 ) 350 CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" ) 351 CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" ) 352 CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" ) 353 echo "Land carbon flux (NEP) :" ${CO2SRF} 354 echo "LU flux (FLUC) :" ${CO2LU} 355 echo "Total Land carbon flux (NBP) :" ${CO2SBG} 356 357 # Previous CO2 358 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 359 echo "Previous CO2 :" ${CO2_ppm_prec} 360 361 # Formula 362 CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l ) 363 echo "New CO2 :" ${CO2_ppm} 364 365 # Save CO2 values in ExeCpuLog variable contents 5 fields 366 echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 367 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 337 338 # Add special treatement for CARBON CYCLE 339 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 340 typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 341 342 # Fossil fuel emission 343 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then 344 # For Control, no fossil fuel emission : 345 fCO2_ff=0 346 echo "Fossil Fuel for control run :" ${fCO2_ff} 347 else 348 # For historical, get the fossile fuel file : 349 fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt ) 350 echo "Fossil Fuel for historical run :" ${fCO2_ff} 351 fi 352 353 # Get the value of ocean carbon flux 354 CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output ) 355 CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 356 echo "Ocean carbon flux :" ${CO2MBG} 357 358 # Get the value of land fluxes 359 set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 ) 360 CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" ) 361 CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" ) 362 CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" ) 363 echo "Land carbon flux (NEP) :" ${CO2SRF} 364 echo "LU flux (FLUC) :" ${CO2LU} 365 echo "Total Land carbon flux (NBP) :" ${CO2SBG} 366 367 # Previous CO2 368 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 369 echo "Previous CO2 :" ${CO2_ppm_prec} 370 371 # Formula 372 CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l ) 373 echo "New CO2 :" ${CO2_ppm} 374 375 # Save CO2 values in ExeCpuLog variable contents 5 fields 376 echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 377 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 368 378 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 379 380 fi 381 369 382 echo FINALIZE ATM ! 370 383 -
CONFIG/IPSLCM/IPSLCM5-2/CpiControl/COMP/lmdz.card
r1507 r1537 28 28 LMDZ_NMC_hf=y 29 29 30 # CARBON_CYCLE=NONE/control/historical 31 CARBON_CYCLE=control 30 32 # CO2_ppm init 31 33 co2_init=284.725 -
CONFIG/IPSLCM/IPSLCM5-2/CpiControl/COMP/lmdz.driver
r1535 r1537 89 89 IGCM_debug_PushStack "ATM_Update" 90 90 91 typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff92 typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX93 91 94 92 case ${config_UserChoices_PeriodLength} in … … 166 164 fi 167 165 168 if ( ${FirstInitialize} ) ; then 166 167 # Add special treatement for CARBON CYCLE 168 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 169 170 typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2 171 typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 172 typeset PathCO2log 173 typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX 174 175 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then 169 176 ##--Initialization of fluxes to an undefined value at the first run 170 171 172 173 174 175 176 177 178 179 177 UndefinedValueCo2=-9999 178 InitPeriodCo2=0 179 InitDateBeginCo2=${UndefinedValueCo2} 180 InitYearCo2=$(( ${year} - 1 )) 181 InitDateEndCo2=${InitYearCo2}1231 182 fCO2_ff=${UndefinedValueCo2} 183 CO2SBG=${UndefinedValueCo2} 184 CO2LU=${UndefinedValueCo2} 185 CO2MBG=${UndefinedValueCo2} 186 CO2_ppm_prec=${UndefinedValueCo2} 180 187 # Get the initial value of atmosp. pco2 181 182 183 184 185 186 187 188 188 CO2_ppm=${lmdz_UserChoices_co2_init} 189 190 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 191 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 192 193 # Save CO2 values in ExeCpuLog variable contents 5 fields 194 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 195 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 189 196 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 190 191 # Get the path where the log file co2.log is 192 PathCO2log=${SUBMIT_DIR} 193 # Get Previous line in co2.log 194 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 195 196 else 197 # Get restart line in co2.log 198 PathCO2log=${SUBMIT_DIR} 199 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 200 # Get the value of atmosp. pco2 in co2.log 201 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 202 203 fi 197 198 # Get the path where the log file co2.log is 199 PathCO2log=${SUBMIT_DIR} 200 # Get Previous line in co2.log 201 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 202 203 else 204 205 # NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ): 206 # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2. 207 #SubmitRestartPath= 208 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then 209 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath 210 PathCO2log=${config_ATM_SubmitRestartPath} 211 Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} ) 212 PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log ) 213 214 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 215 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 216 217 # Save Last Line of control in new co2.log file 218 InitPeriodCo2=0 219 InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' ) 220 InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' ) 221 fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' ) 222 CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' ) 223 CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' ) 224 CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' ) 225 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' ) 226 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 227 228 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 229 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 230 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 231 else 232 # Get restart line in co2.log 233 PathCO2log=${SUBMIT_DIR} 234 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 235 # Get the value of atmosp. pco2 in co2.log 236 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 237 fi 238 239 fi 240 241 if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 242 # Modify co2_ppm in physiq.def only for historical run 243 LMDZ_sed physiq.def co2_ppm ${CO2_ppm} 244 fi 245 fi 246 # end CARBON_CYCLE 247 204 248 205 249 ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z} … … 215 259 LMDZ_sed physiq.def ok_hfCOSP ${LMDZ_COSP_hf} 216 260 LMDZ_sed physiq.def ok_histNMC "${LMDZ_NMC_monthly}, ${LMDZ_NMC_daily}, ${LMDZ_NMC_hf}" 217 # For Control, we won't modify ATM CO2 :218 # LMDZ_sed physiq.def co2_ppm ${CO2_ppm}219 261 220 262 ## gcm.def parameters : no change since gcm.def_${RESOL_ATM_3D} is used and already modified … … 289 331 [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod} 290 332 291 typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 292 293 # For Control, no fossil fuel emission : 294 fCO2_ff=0 295 echo "Fossil Fuel for control run :" ${fCO2_ff} 296 297 # Get the value of ocean carbon flux 298 CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output ) 299 CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 300 echo "Ocean carbon flux :" ${CO2MBG} 301 302 # Get the value of land fluxes 303 set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 ) 304 CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" ) 305 CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" ) 306 CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" ) 307 echo "Land carbon flux (NEP) :" ${CO2SRF} 308 echo "LU flux (FLUC) :" ${CO2LU} 309 echo "Total Land carbon flux (NBP) :" ${CO2SBG} 310 311 # Previous CO2 312 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 313 echo "Previous CO2 :" ${CO2_ppm_prec} 314 315 # Formula 316 CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l ) 317 echo "New CO2 :" ${CO2_ppm} 318 319 # Save CO2 values in ExeCpuLog variable contents 5 fields 320 echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 321 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 333 334 # Add special treatement for CARBON CYCLE 335 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 336 typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 337 338 # Fossil fuel emission 339 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then 340 # For Control, no fossil fuel emission : 341 fCO2_ff=0 342 echo "Fossil Fuel for control run :" ${fCO2_ff} 343 else 344 # For historical, get the fossile fuel file : 345 fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt ) 346 echo "Fossil Fuel for historical run :" ${fCO2_ff} 347 fi 348 349 # Get the value of ocean carbon flux 350 CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output ) 351 CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 352 echo "Ocean carbon flux :" ${CO2MBG} 353 354 # Get the value of land fluxes 355 set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 ) 356 CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" ) 357 CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" ) 358 CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" ) 359 echo "Land carbon flux (NEP) :" ${CO2SRF} 360 echo "LU flux (FLUC) :" ${CO2LU} 361 echo "Total Land carbon flux (NBP) :" ${CO2SBG} 362 363 # Previous CO2 364 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 365 echo "Previous CO2 :" ${CO2_ppm_prec} 366 367 # Formula 368 CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l ) 369 echo "New CO2 :" ${CO2_ppm} 370 371 # Save CO2 values in ExeCpuLog variable contents 5 fields 372 echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 373 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 322 374 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 375 376 fi 323 377 324 378 echo FINALIZE ATM ! -
CONFIG/IPSLCM/IPSLCM5-2/EXP00/COMP/lmdz.driver
r1535 r1537 88 88 { 89 89 IGCM_debug_PushStack "ATM_Update" 90 90 91 91 92 case ${config_UserChoices_PeriodLength} in … … 135 136 [ ${CumulPeriod} -gt 1 ] && ( IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ; IGCM_sys_Chmod u+w Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ) 136 137 138 137 139 ##-- GHG forcing : 138 140 ## If forcing file exist in run directory, read values for the current year and modify physiq.def … … 161 163 LMDZ_sed physiq.def CFC12_ppt ${IPCC_CFC12} 162 164 fi 165 166 167 # Add special treatement for CARBON CYCLE 168 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 169 170 typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2 171 typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 172 typeset PathCO2log 173 typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX 174 175 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then 176 ##--Initialization of fluxes to an undefined value at the first run 177 UndefinedValueCo2=-9999 178 InitPeriodCo2=0 179 InitDateBeginCo2=${UndefinedValueCo2} 180 InitYearCo2=$(( ${year} - 1 )) 181 InitDateEndCo2=${InitYearCo2}1231 182 fCO2_ff=${UndefinedValueCo2} 183 CO2SBG=${UndefinedValueCo2} 184 CO2LU=${UndefinedValueCo2} 185 CO2MBG=${UndefinedValueCo2} 186 CO2_ppm_prec=${UndefinedValueCo2} 187 # Get the initial value of atmosp. pco2 188 CO2_ppm=${lmdz_UserChoices_co2_init} 189 190 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 191 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 192 193 # Save CO2 values in ExeCpuLog variable contents 5 fields 194 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 195 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 196 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 197 198 # Get the path where the log file co2.log is 199 PathCO2log=${SUBMIT_DIR} 200 # Get Previous line in co2.log 201 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 202 203 else 204 205 # NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ): 206 # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2. 207 #SubmitRestartPath= 208 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then 209 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath 210 PathCO2log=${config_ATM_SubmitRestartPath} 211 Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} ) 212 PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log ) 213 214 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 215 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 216 217 # Save Last Line of control in new co2.log file 218 InitPeriodCo2=0 219 InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' ) 220 InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' ) 221 fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' ) 222 CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' ) 223 CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' ) 224 CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' ) 225 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' ) 226 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 227 228 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 229 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 230 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 231 else 232 # Get restart line in co2.log 233 PathCO2log=${SUBMIT_DIR} 234 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 235 # Get the value of atmosp. pco2 in co2.log 236 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 237 fi 238 239 fi 240 241 if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 242 # Modify co2_ppm in physiq.def only for historical run 243 LMDZ_sed physiq.def co2_ppm ${CO2_ppm} 244 fi 245 fi 246 # end CARBON_CYCLE 247 163 248 164 249 ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z} … … 246 331 [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod} 247 332 333 334 # Add special treatement for CARBON CYCLE 335 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 336 typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 337 338 # Fossil fuel emission 339 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then 340 # For Control, no fossil fuel emission : 341 fCO2_ff=0 342 echo "Fossil Fuel for control run :" ${fCO2_ff} 343 else 344 # For historical, get the fossile fuel file : 345 fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt ) 346 echo "Fossil Fuel for historical run :" ${fCO2_ff} 347 fi 348 349 # Get the value of ocean carbon flux 350 CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output ) 351 CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 352 echo "Ocean carbon flux :" ${CO2MBG} 353 354 # Get the value of land fluxes 355 set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 ) 356 CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" ) 357 CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" ) 358 CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" ) 359 echo "Land carbon flux (NEP) :" ${CO2SRF} 360 echo "LU flux (FLUC) :" ${CO2LU} 361 echo "Total Land carbon flux (NBP) :" ${CO2SBG} 362 363 # Previous CO2 364 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 365 echo "Previous CO2 :" ${CO2_ppm_prec} 366 367 # Formula 368 CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l ) 369 echo "New CO2 :" ${CO2_ppm} 370 371 # Save CO2 values in ExeCpuLog variable contents 5 fields 372 echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 373 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 374 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 375 376 fi 377 248 378 echo FINALIZE ATM ! 249 379 -
CONFIG/IPSLCM/IPSLCM5-2/historical/COMP/lmdz.driver
r1535 r1537 91 91 { 92 92 IGCM_debug_PushStack "ATM_Update" 93 93 94 94 95 case ${config_UserChoices_PeriodLength} in … … 116 117 fi 117 118 118 ## To have more variables in output files for aerosols. Parameters are set in lmdz.card119 #if [ ${CumulPeriod}%${LMDZ_Freq_aero} -le ${LMDZ_Length_aero} ]; then120 # if [ ${CumulPeriod}%${LMDZ_Freq_aero} -ne 0 ]; then121 # lev_histmth=4122 # else123 # lev_histmth=2124 # fi125 #else126 # lev_histmth=2127 #fi128 129 119 ## algo : For CumulPeriod=1 ; 130 120 ## IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix … … 176 166 fi 177 167 168 169 # Add special treatement for CARBON CYCLE 170 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 171 172 typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2 173 typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 174 typeset PathCO2log 175 typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX 176 177 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then 178 ##--Initialization of fluxes to an undefined value at the first run 179 UndefinedValueCo2=-9999 180 InitPeriodCo2=0 181 InitDateBeginCo2=${UndefinedValueCo2} 182 InitYearCo2=$(( ${year} - 1 )) 183 InitDateEndCo2=${InitYearCo2}1231 184 fCO2_ff=${UndefinedValueCo2} 185 CO2SBG=${UndefinedValueCo2} 186 CO2LU=${UndefinedValueCo2} 187 CO2MBG=${UndefinedValueCo2} 188 CO2_ppm_prec=${UndefinedValueCo2} 189 # Get the initial value of atmosp. pco2 190 CO2_ppm=${lmdz_UserChoices_co2_init} 191 192 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 193 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 194 195 # Save CO2 values in ExeCpuLog variable contents 5 fields 196 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 197 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 198 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 199 200 # Get the path where the log file co2.log is 201 PathCO2log=${SUBMIT_DIR} 202 # Get Previous line in co2.log 203 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 204 205 else 206 207 # NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ): 208 # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2. 209 #SubmitRestartPath= 210 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then 211 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath 212 PathCO2log=${config_ATM_SubmitRestartPath} 213 Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} ) 214 PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log ) 215 216 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 217 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 218 219 # Save Last Line of control in new co2.log file 220 InitPeriodCo2=0 221 InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' ) 222 InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' ) 223 fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' ) 224 CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' ) 225 CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' ) 226 CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' ) 227 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' ) 228 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 229 230 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 231 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 232 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 233 else 234 # Get restart line in co2.log 235 PathCO2log=${SUBMIT_DIR} 236 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 237 # Get the value of atmosp. pco2 in co2.log 238 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 239 fi 240 241 fi 242 243 if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 244 # Modify co2_ppm in physiq.def only for historical run 245 LMDZ_sed physiq.def co2_ppm ${CO2_ppm} 246 fi 247 fi 248 # end CARBON_CYCLE 249 178 250 ##-- For historical daily cosp must be output during 1979-2005 period 179 251 [ ${year} -ge 1979 ] && LMDZ_COSP_daily=y … … 183 255 LMDZ_sed physiq.def OK_journe ${OK_journe} 184 256 LMDZ_sed physiq.def OK_mensuel ${OK_mensuel} 185 #LMDZ_sed physiq.def lev_histmth ${lev_histmth}186 257 LMDZ_sed physiq.def ok_hf ${ok_hf} 187 258 LMDZ_sed physiq.def ecrit_mth ${LMDZ_ecrit_mth} … … 264 335 [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod} 265 336 337 338 # Add special treatement for CARBON CYCLE 339 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 340 typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 341 342 # Fossil fuel emission 343 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then 344 # For Control, no fossil fuel emission : 345 fCO2_ff=0 346 echo "Fossil Fuel for control run :" ${fCO2_ff} 347 else 348 # For historical, get the fossile fuel file : 349 fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt ) 350 echo "Fossil Fuel for historical run :" ${fCO2_ff} 351 fi 352 353 # Get the value of ocean carbon flux 354 CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output ) 355 CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 356 echo "Ocean carbon flux :" ${CO2MBG} 357 358 # Get the value of land fluxes 359 set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 ) 360 CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" ) 361 CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" ) 362 CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" ) 363 echo "Land carbon flux (NEP) :" ${CO2SRF} 364 echo "LU flux (FLUC) :" ${CO2LU} 365 echo "Total Land carbon flux (NBP) :" ${CO2SBG} 366 367 # Previous CO2 368 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 369 echo "Previous CO2 :" ${CO2_ppm_prec} 370 371 # Formula 372 CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l ) 373 echo "New CO2 :" ${CO2_ppm} 374 375 # Save CO2 values in ExeCpuLog variable contents 5 fields 376 echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 377 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 378 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 379 380 fi 381 266 382 echo FINALIZE ATM ! 267 383 -
CONFIG/IPSLCM/IPSLCM5-2/piControl/COMP/lmdz.driver
r1535 r1537 88 88 { 89 89 IGCM_debug_PushStack "ATM_Update" 90 90 91 91 92 case ${config_UserChoices_PeriodLength} in … … 135 136 [ ${CumulPeriod} -gt 1 ] && ( IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ; IGCM_sys_Chmod u+w Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ) 136 137 138 137 139 ##-- GHG forcing : 138 140 ## If forcing file exist in run directory, read values for the current year and modify physiq.def … … 161 163 LMDZ_sed physiq.def CFC12_ppt ${IPCC_CFC12} 162 164 fi 165 166 167 # Add special treatement for CARBON CYCLE 168 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 169 170 typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2 171 typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 172 typeset PathCO2log 173 typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX 174 175 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then 176 ##--Initialization of fluxes to an undefined value at the first run 177 UndefinedValueCo2=-9999 178 InitPeriodCo2=0 179 InitDateBeginCo2=${UndefinedValueCo2} 180 InitYearCo2=$(( ${year} - 1 )) 181 InitDateEndCo2=${InitYearCo2}1231 182 fCO2_ff=${UndefinedValueCo2} 183 CO2SBG=${UndefinedValueCo2} 184 CO2LU=${UndefinedValueCo2} 185 CO2MBG=${UndefinedValueCo2} 186 CO2_ppm_prec=${UndefinedValueCo2} 187 # Get the initial value of atmosp. pco2 188 CO2_ppm=${lmdz_UserChoices_co2_init} 189 190 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 191 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 192 193 # Save CO2 values in ExeCpuLog variable contents 5 fields 194 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 195 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 196 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 197 198 # Get the path where the log file co2.log is 199 PathCO2log=${SUBMIT_DIR} 200 # Get Previous line in co2.log 201 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 202 203 else 204 205 # NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ): 206 # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2. 207 #SubmitRestartPath= 208 if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then 209 IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath 210 PathCO2log=${config_ATM_SubmitRestartPath} 211 Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} ) 212 PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log ) 213 214 IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 215 IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 216 217 # Save Last Line of control in new co2.log file 218 InitPeriodCo2=0 219 InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' ) 220 InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' ) 221 fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' ) 222 CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' ) 223 CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' ) 224 CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' ) 225 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' ) 226 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 227 228 echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 229 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 230 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 231 else 232 # Get restart line in co2.log 233 PathCO2log=${SUBMIT_DIR} 234 PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 235 # Get the value of atmosp. pco2 in co2.log 236 CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 237 fi 238 239 fi 240 241 if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 242 # Modify co2_ppm in physiq.def only for historical run 243 LMDZ_sed physiq.def co2_ppm ${CO2_ppm} 244 fi 245 fi 246 # end CARBON_CYCLE 247 163 248 164 249 ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z} … … 246 331 [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod} 247 332 333 334 # Add special treatement for CARBON CYCLE 335 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then 336 typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 337 338 # Fossil fuel emission 339 if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then 340 # For Control, no fossil fuel emission : 341 fCO2_ff=0 342 echo "Fossil Fuel for control run :" ${fCO2_ff} 343 else 344 # For historical, get the fossile fuel file : 345 fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$3}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC.txt ) 346 echo "Fossil Fuel for historical run :" ${fCO2_ff} 347 fi 348 349 # Get the value of ocean carbon flux 350 CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output ) 351 CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 352 echo "Ocean carbon flux :" ${CO2MBG} 353 354 # Get the value of land fluxes 355 set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 ) 356 CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" ) 357 CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" ) 358 CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" ) 359 echo "Land carbon flux (NEP) :" ${CO2SRF} 360 echo "LU flux (FLUC) :" ${CO2LU} 361 echo "Total Land carbon flux (NBP) :" ${CO2SBG} 362 363 # Previous CO2 364 CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 365 echo "Previous CO2 :" ${CO2_ppm_prec} 366 367 # Formula 368 CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l ) 369 echo "New CO2 :" ${CO2_ppm} 370 371 # Save CO2 values in ExeCpuLog variable contents 5 fields 372 echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" | \ 373 gawk '{printf(" %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 374 $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 375 376 fi 377 248 378 echo FINALIZE ATM ! 249 379
Note: See TracChangeset
for help on using the changeset viewer.