Changeset 1537 for CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.driver
- Timestamp:
- 08/19/11 17:10:40 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.