Changeset 1237


Ignore:
Timestamp:
12/31/10 10:14:41 (14 years ago)
Author:
mmaipsl
Message:

First CO2 interactive historical scripts.
Please, see https://forge.ipsl.jussieu.fr/igcmg/wiki/IPSLCM5ACo2 for informations.
And follow links in https://forge.ipsl.jussieu.fr/igcmg/wiki/IPSLCM5ACo2#Testsetruns
for example of use.

Location:
CONFIG/IPSLCM/IPSLCM5A/Chistorical
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • CONFIG/IPSLCM/IPSLCM5A/Chistorical/COMP/lmdz.card

    r1223 r1237  
    2727LMDZ_NMC_daily=y 
    2828LMDZ_NMC_hf=y 
     29 
     30co2_init=284.725 
    2931 
    3032[InitialStateFiles] 
  • CONFIG/IPSLCM/IPSLCM5A/Chistorical/COMP/lmdz.driver

    r1172 r1237  
    9191{ 
    9292    IGCM_debug_PushStack "ATM_Update" 
     93 
     94    typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 
     95    typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX 
     96    typeset PathCO2log Date_r OUT_OCE OUT_SRF 
    9397 
    9498    case ${config_UserChoices_PeriodLength} in 
     
    151155    ##-- GHG forcing for the current year 
    152156    IPCC_SOLAR=`grep Annee_${year} SOLARANDVOLCANOES_1610_2008.txt | awk -F= '{print $2}'` 
    153     IPCC_CO2=`grep Annee_${year} CO2_1765_2005.txt | awk -F= '{print $2}'` 
     157#    IPCC_CO2=`grep Annee_${year} CO2_1765_2005.txt | awk -F= '{print $2}'` 
    154158    IPCC_CH4=`grep Annee_${year} CH4_1765_2005.txt | awk -F= '{print $2}'` 
    155159    IPCC_N2O=`grep Annee_${year} N2O_1765_2005.txt | awk -F= '{print $2}'` 
    156160    IPCC_CFC11=`grep Annee_${year} CFC11_1765_2005.txt | awk -F= '{print $2}'` 
    157161    IPCC_CFC12=`grep Annee_${year} CFC12_1765_2005.txt | awk -F= '{print $2}'` 
     162 
     163    if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then 
     164         
     165        fCO2_ff=0 
     166        CO2SRF=0 
     167        CO2LU=0 
     168        CO2MBG=0 
     169        CO2_ppm=${lmdz_UserChoices_co2_init} 
     170        CO2_ppm_prec=${lmdz_UserChoices_co2_init} 
     171         
     172        IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 
     173        IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 
     174 
     175        echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SRF} ${CO2LU}" |   \ 
     176             gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 
     177                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 
     178    else 
     179#       get the fossile fuel file : 
     180        fCO2_ff=$( gawk "{if (match(\$0,\"${year}\ *${month}\")) {print \$5}}" ${SUBMIT_DIR}/PARAM/CMIP5_gridcar_CO2_emissions_fossil_fuel_Andres_1751-2007_monthly_SC_grid1x1.txt ) 
     181        fCO2_ff=$( echo "${fCO2_ff} / 1000." | bc -l  ) 
     182        echo "Fossil Fuel for historical run  :" ${fCO2_ff} 
     183 
     184        # Get restart line in co2.log 
     185 
     186        # NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ): 
     187        # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2. 
     188        #SubmitRestartPath= 
     189        if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then 
     190            IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath 
     191            PathCO2log=${config_ATM_SubmitRestartPath} 
     192            Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} ) 
     193            PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log ) 
     194            OUT_OCE=${config_OCE_RestartPath}/${config_OCE_RestartJobName}/OCE 
     195            OUT_SRF=${config_SRF_RestartPath}/${config_SRF_RestartJobName}/SRF 
     196 
     197            IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 
     198            IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 
     199 
     200            # Save Last Line of control in new co2.log file 
     201            echo ${PreviousLinelog} >> ${SUBMIT_DIR}/co2.log 
     202        else 
     203            PathCO2log=${SUBMIT_DIR} 
     204            PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 
     205            OUT_OCE=${R_OUT_OCE} 
     206            OUT_SRF=${R_OUT_SRF} 
     207        fi 
     208 
     209        # Get Previous period output PREFIX 
     210        LastPeriodDateBegin=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' ) 
     211        LastPeriodDateEnd=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' ) 
     212        eval LastDatesPeriod=${LastPeriodDateBegin}_${LastPeriodDateEnd} > /dev/null 2>&1 
     213        # Prefix for save files of this period 
     214        if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then 
     215            eval LastPREFIX=${config_ATM_RestartJobName}_${LastDatesPeriod}  > /dev/null 2>&1 
     216        else 
     217            eval LastPREFIX=${config_UserChoices_JobName}_${LastDatesPeriod}  > /dev/null 2>&1 
     218        fi 
     219 
     220        # Ocean  
     221        IGCM_sys_TestFileArchive ${OUT_OCE}/Debug/${LastPREFIX}_ocean.output 
     222        if [ $? = 0 ] ; then 
     223 
     224            if [ $DRYRUN -gt 1 ]; then 
     225                IGCM_sys_Cp ${OUT_OCE}/Debug/${LastPREFIX}_ocean.output ./ 
     226            else 
     227                IGCM_sys_Get ${OUT_OCE}/Debug/${LastPREFIX}_ocean.output ./ 
     228            fi 
     229            IGCM_comp_PrepareDeletedFiles ./${LastPREFIX}_ocean.output 
     230            CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ${LastPREFIX}_ocean.output ) 
     231            CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 
     232        else 
     233            echo "Error : file ${OUT_OCE}/Debug/${LastPREFIX}_ocean.output not found." 
     234            exit 1 
     235        fi 
     236 
     237        # Surface 
     238        IGCM_sys_TestFileArchive ${OUT_SRF}/Debug/${LastPREFIX}_out_orchidee_0000 
     239        if [ $? = 0 ] ; then 
     240            if [ $DRYRUN -gt 1 ]; then 
     241                IGCM_sys_Cp ${OUT_SRF}/Debug/${LastPREFIX}_out_orchidee_0000 ./ 
     242            else 
     243                IGCM_sys_Get ${OUT_SRF}/Debug/${LastPREFIX}_out_orchidee_0000 ./ 
     244            fi 
     245            IGCM_comp_PrepareDeletedFiles ./${LastPREFIX}_out_orchidee_0000 
     246            set +A CO2SBG -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk ${LastPREFIX}_out_orchidee_0000 ) 
     247        else 
     248            echo "Error : file ${OUT_SRF}/Debug/${LastPREFIX}_ocean.output not found." 
     249            exit 1 
     250        fi 
     251        CO2SRF=$( echo ${CO2SBG[0]} | sed -e "s/ *//" ) 
     252        CO2LU=$( echo ${CO2SBG[1]} | sed -e "s/ *//" ) 
     253 
     254        # Previous CO2 
     255        CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 
     256 
     257        # Formula 
     258        CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SRF} + ${CO2LU}) / 2.12" | bc -l ) 
     259 
     260        # Save CO2 values in ExeCpuLog variable contents 5 fields 
     261        echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SRF} ${CO2LU}" |   \ 
     262             gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 
     263                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 
     264 
     265    fi 
    158266 
    159267    ##-- For historical daily cosp must be output during 1979-2005 period 
     
    174282    LMDZ_sed physiq.def ok_histNMC  "${LMDZ_NMC_monthly}, ${LMDZ_NMC_daily}, ${LMDZ_NMC_hf}" 
    175283    LMDZ_sed physiq.def solaire     ${IPCC_SOLAR} 
    176     LMDZ_sed physiq.def co2_ppm     ${IPCC_CO2} 
     284#    LMDZ_sed physiq.def co2_ppm     ${IPCC_CO2} 
     285    LMDZ_sed physiq.def co2_ppm     ${CO2_ppm} 
    177286    LMDZ_sed physiq.def CH4_ppb     ${IPCC_CH4} 
    178287    LMDZ_sed physiq.def N2O_ppb     ${IPCC_N2O} 
  • CONFIG/IPSLCM/IPSLCM5A/Chistorical/config.card

    r1171 r1237  
    7575RestartJobName=EXP00 
    7676RestartPath=${ARCHIVE}/IGCM_OUT/IPSLCM5A/DEVT/piControl 
     77# !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2. 
     78SubmitRestartPath=${SUBMIT_DIR}/../CpiControl 
    7779# Old component name for restart (if empty, use new name) 
    7880OldName= 
Note: See TracChangeset for help on using the changeset viewer.