Ignore:
Timestamp:
02/22/11 10:36:38 (13 years ago)
Author:
cetlod
Message:

Improvment of interactive scripts for IPSLCM5A_C configuration

Location:
CONFIG/IPSLCM/IPSLCM5A/CpiControl/COMP
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CONFIG/IPSLCM/IPSLCM5A/CpiControl/COMP/lmdz.driver

    r1235 r1316  
    141141 
    142142    if ( ${FirstInitialize} ) ; then 
    143          
    144         fCO2_ff=0 
    145         CO2SRF=0 
    146         CO2LU=0 
    147         CO2MBG=0 
    148         CO2_ppm=${lmdz_UserChoices_co2_init} 
    149         CO2_ppm_prec=${lmdz_UserChoices_co2_init} 
    150          
    151         IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 
    152         IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 
    153  
    154         echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SRF} ${CO2LU}" |   \ 
    155              gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 
     143        ##--Initialization of fluxes to an undefined value at the first run 
     144        UndefinedValueCo2=-9999 
     145        InitPeriodCo2=0 
     146        InitDateBeginCo2=${UndefinedValueCo2} 
     147        InitYearCo2=$(( ${year} - 1 ))  
     148        InitDateEndCo2=${InitYearCo2}1231 
     149        fCO2_ff=${UndefinedValueCo2}  
     150        CO2SBG=${UndefinedValueCo2} 
     151        CO2LU=${UndefinedValueCo2} 
     152        CO2MBG=${UndefinedValueCo2} 
     153        CO2_ppm_prec=${UndefinedValueCo2} 
     154        # Get the initial value of atmosp. pco2  
     155        CO2_ppm=${lmdz_UserChoices_co2_init} 
     156 
     157        IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log 
     158        IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log 
     159     
     160        # Save CO2 values in ExeCpuLog variable contents 5 fields 
     161        echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \ 
     162             gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 
    156163                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 
     164     
     165        # Get the path where the log file co2.log is 
     166        PathCO2log=${SUBMIT_DIR}  
     167        # Get Previous line in co2.log 
     168        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 
    157169 
    158170    else 
    159  
    160 #       For Control, no fossil fuel emission : 
    161         fCO2_ff=0 
    162         echo "Fossil Fuel for control run  :" ${fCO2_ff} 
    163  
    164         # Get Previous line in co2.log 
    165         PreviousLinelog=$( tail -1 ${SUBMIT_DIR}/co2.log ) 
    166  
    167         # Get Previous period output PREFIX 
    168         LastPeriodDateBegin=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' ) 
    169         LastPeriodDateEnd=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' ) 
    170         eval LastDatesPeriod=${LastPeriodDateBegin}_${LastPeriodDateEnd} > /dev/null 2>&1 
    171         # Prefix for save files of this period 
    172         eval LastPREFIX=${config_UserChoices_JobName}_${LastDatesPeriod}  > /dev/null 2>&1 
    173  
    174         # Ocean 
    175          
    176         IGCM_sys_TestFileArchive ${R_OUT_OCE}/Debug/${LastPREFIX}_ocean.output 
    177         if [ $? = 0 ] ; then 
    178  
    179             if [ $DRYRUN -gt 1 ]; then 
    180                 IGCM_sys_Cp ${R_OUT_OCE}/Debug/${LastPREFIX}_ocean.output ./ 
    181             else 
    182                 IGCM_sys_Get ${R_OUT_OCE}/Debug/${LastPREFIX}_ocean.output ./ 
    183             fi 
    184             IGCM_comp_PrepareDeletedFiles ./${LastPREFIX}_ocean.output 
    185             CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ${LastPREFIX}_ocean.output ) 
    186             CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 
    187         else 
    188             echo "Error : file ${R_OUT_OCE}/Debug/${LastPREFIX}_ocean.output not found." 
    189             exit 1 
    190         fi 
    191  
    192         # Surface 
    193         IGCM_sys_TestFileArchive ${R_OUT_SRF}/Debug/${LastPREFIX}_out_orchidee_0000 
    194         if [ $? = 0 ] ; then 
    195             if [ $DRYRUN -gt 1 ]; then 
    196                 IGCM_sys_Cp ${R_OUT_SRF}/Debug/${LastPREFIX}_out_orchidee_0000 ./ 
    197             else 
    198                 IGCM_sys_Get ${R_OUT_SRF}/Debug/${LastPREFIX}_out_orchidee_0000 ./ 
    199             fi 
    200             IGCM_comp_PrepareDeletedFiles ./${LastPREFIX}_out_orchidee_0000 
    201             set +A CO2SBG -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk ${LastPREFIX}_out_orchidee_0000 ) 
    202         else 
    203             echo "Error : file ${R_OUT_OCE}/Debug/${LastPREFIX}_ocean.output not found." 
    204             exit 1 
    205         fi 
    206         CO2SRF=$( echo ${CO2SBG[0]} | sed -e "s/ *//" ) 
    207         CO2LU=$( echo ${CO2SBG[1]} | sed -e "s/ *//" ) 
    208  
    209         # Previous CO2 
    210         CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 
    211  
    212         # Formula 
    213         CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SRF} + ${CO2LU}) / 2.12" | bc -l ) 
    214  
    215         # Save CO2 values in ExeCpuLog variable contents 5 fields 
    216         echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SRF} ${CO2LU}" |   \ 
    217              gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 
    218                               $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 
     171        # Get restart line in co2.log 
     172        PathCO2log=${SUBMIT_DIR} 
     173        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )  
     174        # Get the value of atmosp. pco2 in co2.log 
     175        CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 
    219176 
    220177    fi 
     
    306263    [ ${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} 
    307264 
     265    typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff 
     266 
     267    # For Control, no fossil fuel emission : 
     268    fCO2_ff=0 
     269    echo "Fossil Fuel for control run  :" ${fCO2_ff} 
     270 
     271    # Get the value of ocean carbon flux 
     272    CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output ) 
     273    CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" ) 
     274    echo "Ocean carbon flux  :" ${CO2MBG} 
     275 
     276    # Get the value of land fluxes 
     277    set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 ) 
     278    CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" ) 
     279    CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" ) 
     280    CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" ) 
     281    echo "Land carbon flux (NEP)         :" ${CO2SRF} 
     282    echo "LU flux          (FLUC)        :" ${CO2LU} 
     283    echo "Total Land carbon flux (NBP)   :" ${CO2SBG} 
     284 
     285    # Previous CO2 
     286    CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 
     287    echo "Previous CO2  :" ${CO2_ppm_prec} 
     288     
     289    # Formula 
     290    CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l ) 
     291    echo "New CO2  :" ${CO2_ppm} 
     292 
     293    # Save CO2 values in ExeCpuLog variable contents 5 fields 
     294    echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \ 
     295         gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \ 
     296                           $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log 
     297 
    308298    echo FINALIZE ATM ! 
    309299 
  • CONFIG/IPSLCM/IPSLCM5A/CpiControl/COMP/lmdz_analyse_stomate_out.awk

    r1234 r1316  
    2525#========================== 
    2626BEGIN { 
    27 # print "traitement de " ARGV[1] 
     27 # print "traitement de " ARGV[1] 
    2828 
    2929  nbarg=ARGC 
     
    5454  counterLU=0 
    5555 
     56  fluxNBP_found=0 
     57  counterNBP=0 
     58 
    5659  CO2file[1]="" 
    5760  LUfile[1]="" 
     61  NBPfile[1]="" 
    5862} 
    5963 
     
    7983    CO2file[counterCO2]=felts[2] 
    8084  } 
    81   else if (match($0, ".*GLOBAL net cflux_prod_total_sum.*")) { 
     85  else if (match($0, ".*GLOBAL net_cflux_prod_monthly.*")) { 
    8286    myprint("fluxLU_found = 1") 
    8387    fluxLU_found=1 
     
    8791    myprint("nb  :" nb) 
    8892    for (elt in felts) { 
     93        myprint(elt "- elt  :" felts[elt]) 
     94    } 
     95    myprint("elts_co2  :" felts[2]) 
     96 
     97    LUfile[counterLU]=felts[2] 
     98  } 
     99 
     100  else if (match($0, ".*GLOBAL net_biosp_prod_monthly.*")) { 
     101    myprint("fluxNBP_found = 1") 
     102    fluxNBP_found=1 
     103    counterNBP=counterNBP+1 
     104 
     105    nb=split($0,felts, "=") 
     106    myprint("nb  :" nb) 
     107    for (elt in felts) { 
    89108        myprint(elt "- elt  :" felts[elt]) 
    90109    } 
    91     myprint("elts_lu  :" felts[2]) 
     110    myprint("elts_nbp  :" felts[2]) 
    92111 
    93     LUfile[counterLU]=felts[2] 
     112    NBPfile[counterNBP]=felts[2] 
    94113  } 
    95114} 
     
    106125            myprint("value  :" CO2file[i]) 
    107126        } 
    108          
    109         if ( fluxLU_found == 1 ) { 
    110             myprint("LU value for " file) 
    111             myprint("counterLU  :" counterLU) 
    112             for (i=1; i<=counterLU; i++) {   
    113                 print LUfile[i] 
    114                 myprint("value  :" LUfile[i]) 
     127 
     128        if ( fluxLU_found == 1 ) { 
     129            myprint("LU value for " file) 
     130            myprint("counterLU  :" counterLU) 
     131            for (i=1; i<=counterLU; i++) { 
     132                print LUfile[i] 
     133                myprint("value  :" LUfile[i]) 
     134            } 
     135 
     136            if ( fluxNBP_found == 1 ) { 
     137               myprint("NBP value for " file) 
     138               myprint("counterNBP  :" counterNBP) 
     139               for (i=1; i<=counterNBP; i++) {   
     140                    print NBPfile[i] 
     141                    myprint("value  :" NBPfile[i]) 
     142               } 
     143             
     144               exit_value=0 
     145               exit 0 
    115146            } 
    116              
     147            else { 
     148                 myprint("ERROR : NO NBP value for " file) 
     149                 print "0003" 
     150                 exit 1 
     151            } 
     152 
    117153            exit_value=0 
    118154            exit 0 
    119         } 
    120         else { 
    121             myprint("ERROR : NO LU value for " file) 
    122             print "0002" 
    123             exit 1 
    124         } 
    125  
    126         exit_value=0 
    127         exit 0 
     155        } 
     156        else { 
     157            myprint("ERROR : NO LU value for " file) 
     158            print "0002" 
     159            print "0003" 
     160            exit 1 
     161        } 
    128162    } 
    129163    else { 
    130         myprint("ERROR : NO CO2 value for " file) 
    131         print "0001" 
    132         print "0002" 
    133         exit 1 
    134     } 
    135      
     164         myprint("ERROR : NO CO2 value for " file) 
     165         print "0001" 
     166         print "0002" 
     167         print "0003" 
     168         exit 1 
     169       } 
    136170  } 
    137171  else { 
  • CONFIG/IPSLCM/IPSLCM5A/CpiControl/COMP/pisces.driver

    r972 r1316  
    2323    PAT_TOP_LRSTTR=$( supergrep ln_rsttr          ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} ) 
    2424    PAT_TOP_NRSTTR=$( supergrep nrsttr            ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} ) 
     25    PAT_PIS_ATCCO2=$( supergrep atcco2            ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} ) 
    2526    PAT_PIS_LRIVER=$( supergrep ln_river          ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} ) 
    2627 
     
    6061    fi 
    6162 
     63    ##-- GHG forcing for the current year. Normally constant 
     64    PathCO2log=${SUBMIT_DIR} 
     65    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) 
     66    IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) 
     67 
    6268    ##-- Update namelist_top and namelist_pisces  
    6369 
     
    6874    IGCM_sys_Mv namelist_top.tmp namelist_top 
    6975 
    70     sed -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \ 
     76    sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${IPCC_PIS_CO2}%"                \ 
     77        -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \ 
    7178        namelist_pisces > namelist_pisces.tmp 
    7279 
Note: See TracChangeset for help on using the changeset viewer.