source: CONFIG/IPSLCM/IPSLCM5-2/Chistorical/COMP/lmdz.driver @ 1541

Last change on this file since 1541 was 1541, checked in by jgipsl, 13 years ago

Modifications in working configuration : Preparation for new physics in
LMDZ

  • Separated physiq.def_L39 into config.def and physiq.def_L39_AP
  • Added variable LMDZ_physic in lmdz.card. This variable has default value AP for old physics(current physics package). Later with this

variable the new physics package in LMDZ can be switch on.

19 level version on stand-by. Do not use this version for the moment!

  • Deleted physiq.def_L19 in all experience except EXP00. 19 level version has not been updated for these different experiences and all

files were a copy of EXP00/PARAM/physiq.def_L19. physiq.def_L19 is
seperated into physiq.def_L19 and config.def_L19. config.def_L19 is not
yet used.

File size: 16.6 KB
RevLine 
[396]1#!/bin/ksh
2#-----------------------------------------------------------------
[894]3function LMDZ_sed
4{
5    IGCM_debug_PushStack "LMDZ_sed"
6
[911]7    sed -e "s/^${2}\ *=.*/${2}= ${3}/" ${1} > ${1}.tmp
[894]8    RET=$?
9    echo "LMDZ_sed : ${1} ${2} ${3}"
10    \mv ${1}.tmp ${1}
11
12    IGCM_debug_PopStack "LMDZ_sed"
13    return $RET
14}
15
[396]16function ATM_Initialize
17{
18    IGCM_debug_PushStack "ATM_Initialize"
19
[671]20    RESOL_ATM=$( echo $RESOL | awk "-Fx" '{print $2}' | awk "-F-" '{print $1}')
[396]21
[659]22    [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19
[396]23
[659]24    RESOL_ATM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' )
[649]25
[697]26    ##-- Calendar type for LMDZ
27    case ${config_UserChoices_CalendarType} in
28        leap|gregorian)
29            CalendarTypeForLmdz=earth_366d;;
30        noleap)
31            CalendarTypeForLmdz=earth_365d;;
32        360d)
33            CalendarTypeForLmdz=earth_360d;;
34        *)
35            CalendarTypeForLmdz=earth_360d
36    esac
37
[1541]38       
39    ##- LMDZ physics version
40    ##  Read LMDZ_Physics option in lmdz.card, if not present take default value AP (old physics)
41    if [ ! X${lmdz_UserChoices_LMDZ_Physics} = X ] ; then
42        LMDZ_Physics=${lmdz_UserChoices_LMDZ_Physics}
43    else
44        LMDZ_Physics=AP
45    fi
46    echo LMDZ physics version : ${LMDZ_Physics}
47
48
[1539]49    ##-- Output frequency purpose ....
[396]50    ##--  Initialisation  ....
[1539]51    ok_mensuel=n
52    ok_journe=n
[396]53    ok_hf=n
[1539]54    ok_hf3h=n
55    ok_hf3hm=n
56    ok_stn=n
[396]57
58    case ${config_UserChoices_PeriodLength} in
[1539]59        1Y|1y|1M|1m) ok_mensuel=y ;;
60        5D|5d|1D|1d) ok_journe=y ;;
[396]61    esac
62
63    for frequency in ${config_ATM_WriteFrequency} ; do
64        case ${frequency} in
[1539]65            1M|1m) ok_mensuel=y ;;
[396]66        esac
67        case ${frequency} in
[1539]68            5D|5d|1D|1d) ok_journe=y ;;
69        esac
70        case ${frequency} in
[1538]71            HF|hf) ok_hf=y ;;
[396]72        esac
[1539]73        case ${frequency} in
74            HF3h|hf3h) ok_hf3h=y ;;
75        esac
76        case ${frequency} in
77            HF3hm|hf3hm) ok_hf3hm=y ;;
78        esac
79        case ${frequency} in
80            STN|stn) ok_stn=y ;;
81        esac
[396]82    done
83
[902]84    ## Read LMDZ_NbPeriod_adjust option in lmdz.card
85    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_NbPeriod_adjust
[1172]86    LMDZ_NbPeriod_adjust=${lmdz_UserChoices_LMDZ_NbPeriod_adjust}
[396]87
[815]88    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
[902]89        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_Bands_file_name
[1172]90        LMDZ_Bands_file_name=${lmdz_UserChoices_LMDZ_Bands_file_name}
[815]91    fi
92
[912]93    ##  Read LMDZ_Freq_aero and LMDZ_Length_aero in lmdz.card
[1172]94    LMDZ_Freq_aero=${lmdz_UserChoices_LMDZ_Freq_aero}
95    LMDZ_Length_aero=${lmdz_UserChoices_LMDZ_Length_aero}
[912]96
[1001]97    ##  Read LMDZ_COSP_monthly  LMDZ_COSP_daily and LMDZ_COSP_hf in lmdz.card
[1172]98    LMDZ_COSP_OK=${lmdz_UserChoices_LMDZ_COSP_OK}
99    LMDZ_COSP_monthly=${lmdz_UserChoices_LMDZ_COSP_monthly}
100    LMDZ_COSP_daily=${lmdz_UserChoices_LMDZ_COSP_daily}
101    LMDZ_COSP_hf=${lmdz_UserChoices_LMDZ_COSP_hf}
[1001]102
[1003]103    ##  Read LMDZ_NMC_monthly  LMDZ_NMC_daily and LMDZ_NMC_hf in lmdz.card
[1172]104    LMDZ_NMC_monthly=${lmdz_UserChoices_LMDZ_NMC_monthly}
105    LMDZ_NMC_daily=${lmdz_UserChoices_LMDZ_NMC_daily}
106    LMDZ_NMC_hf=${lmdz_UserChoices_LMDZ_NMC_hf}
[1003]107
[396]108    IGCM_debug_PopStack "ATM_Initialize"
109}
110
111#-----------------------------------------------------------------
112function ATM_Update
113{
114    IGCM_debug_PushStack "ATM_Update"
115
[1237]116
[749]117    case ${config_UserChoices_PeriodLength} in
118        *Y|*y) 
119               LMDZ_ecrit_ISCCP=30.
120               LMDZ_periodav=30.
[755]121               if [ "${config_UserChoices_CalendarType}" != "360d" ] ; then
[749]122                  echo Change calendartype in config.card. PeriodLength=1Y allowed only for CalendarType=360d
123                  exit
124               fi
125               ;;
126        *)
127               LMDZ_ecrit_ISCCP=${PeriodLengthInDays}.
128               LMDZ_periodav=${PeriodLengthInDays}.
129               ;;
130    esac
[396]131
132    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
133    if [ ${CumulPeriod} -eq 1 ] ; then
134        RAZ_DATE=1
135    else
136        RAZ_DATE=0
137    fi
138
[815]139    ## algo : For CumulPeriod=1 ;
140    ##        IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix
141    ##        ELSE LMDZ_adjust=y ; save Bands file on file server ;
142    ##        For CumulPeriod=2 to LMDZ_NbPeriod_adjust ; Get Bands file from server (CumulPeriod-1) ; LMDZ_adjust=y ; save Bands file on file server ;
143    ##        For CumulPeriod > LMDZ_NbPeriod_adjust ; LMDZ_adjust=n ; Get Bands file from server (CumulPeriod=LMDZ_NbPeriod_adjust 0 to force it) ; Use Bands ;
144
145    if [ ${CumulPeriod} -eq 1 ] ; then
146        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
[902]147            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ; IGCM_sys_Chmod u+w Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat
[815]148            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_0
149            IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_0"
150        fi
151    fi
152
[743]153    LMDZ_adjust=n
154    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
155
[815]156    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
157    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
[743]158
[902]159    [ ${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 )
[743]160
[1535]161    ##-- GHG forcing :
162    ##   If forcing file exist in run directory, read values for the current year and modify physiq.def
163    if [ -f SOLARANDVOLCANOES.txt ] ; then
164        IPCC_SOLAR=`grep Annee_${year} SOLARANDVOLCANOES.txt | awk -F= '{print $2}'`
165        LMDZ_sed physiq.def solaire     ${IPCC_SOLAR}
166    fi
167    if [ -f CO2.txt ] ; then
168        IPCC_CO2=`grep Annee_${year} CO2.txt | awk -F= '{print $2}'`
169        LMDZ_sed physiq.def co2_ppm     ${IPCC_CO2}
170    fi
171    if [ -f CH4.txt ] ; then
172        IPCC_CH4=`grep Annee_${year} CH4.txt | awk -F= '{print $2}'`
173        LMDZ_sed physiq.def CH4_ppb     ${IPCC_CH4}
174    fi
175    if [ -f N2O.txt ] ; then
176        IPCC_N2O=`grep Annee_${year} N2O.txt | awk -F= '{print $2}'`
177        LMDZ_sed physiq.def N2O_ppb     ${IPCC_N2O}
178    fi
179    if [ -f CFC11.txt ] ; then
180        IPCC_CFC11=`grep Annee_${year} CFC11.txt | awk -F= '{print $2}'`
181        LMDZ_sed physiq.def CFC11_ppt   ${IPCC_CFC11}
182    fi
183    if [ -f CFC12.txt ] ; then
184        IPCC_CFC12=`grep Annee_${year} CFC12.txt | awk -F= '{print $2}'`
185        LMDZ_sed physiq.def CFC12_ppt   ${IPCC_CFC12}
186    fi
[988]187
[1537]188
189    # Add special treatement for CARBON CYCLE
190    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
191
192        typeset InitPeriodCo2 InitDateBeginCo2 InitDateEndCo2
193        typeset CO2SBG CO2MBG CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
194        typeset PathCO2log
195        typeset PreviousLinelog LastPeriodDateBegin LastPeriodDateEnd LastDatesPeriod LastPREFIX
196
197        if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"n" ]) ; then
[1316]198        ##--Initialization of fluxes to an undefined value at the first run
[1537]199            UndefinedValueCo2=-9999
200            InitPeriodCo2=0
201            InitDateBeginCo2=${UndefinedValueCo2}
202            InitYearCo2=$(( ${year} - 1 )) 
203            InitDateEndCo2=${InitYearCo2}1231
204            fCO2_ff=${UndefinedValueCo2} 
205            CO2SBG=${UndefinedValueCo2}
206            CO2LU=${UndefinedValueCo2}
207            CO2MBG=${UndefinedValueCo2}
208            CO2_ppm_prec=${UndefinedValueCo2}
[1316]209        # Get the initial value of atmosp. pco2
[1537]210            CO2_ppm=${lmdz_UserChoices_co2_init}
211           
212            IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
213            IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
214           
[1316]215        # Save CO2 values in ExeCpuLog variable contents 5 fields
[1537]216            echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
217                gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
[1237]218                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
[1537]219           
[1316]220        # Get the path where the log file co2.log is
[1537]221            PathCO2log=${SUBMIT_DIR} 
[1316]222        # Get Previous line in co2.log
[1537]223            PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
224           
225        else
226           
[1237]227        # NEW parameter in config.card (even for Overule all restarts, you must modify the line after this comment ):
228        # !! NEW for Carbone cycle !! Path where to find old co2.log file for restart CO2.
229        #SubmitRestartPath=
[1537]230            if ( ${FirstInitialize} && [ X"${config_ATM_Restart}" = X"y" ]) ; then
231                IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ATM SubmitRestartPath
232                PathCO2log=${config_ATM_SubmitRestartPath}
233                Date_r=$( IGCM_date_ConvertFormatToGregorian ${config_ATM_RestartDate} )
234                PreviousLinelog=$( grep ${Date_r} ${PathCO2log}/co2.log )
235               
236                IGCM_sys_Cp ${SUBMIT_DIR}/co2.log.init ${SUBMIT_DIR}/co2.log
237                IGCM_sys_Chmod u+w ${SUBMIT_DIR}/co2.log
238               
[1316]239            # Save Last Line of control in new co2.log file
[1537]240                InitPeriodCo2=0   
241                InitDateBeginCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $2}' )
242                InitDateEndCo2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $3}' )
243                fCO2_ff=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $6}' )
244                CO2SBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $8}' )
245                CO2LU=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $9}' )
246                CO2MBG=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $7}' )
247                CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $5}' )
248                CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
249               
250                echo "${InitPeriodCo2} ${InitDateBeginCo2} ${InitDateEndCo2} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
251                    gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
[1316]252                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
[1537]253            else
[1316]254           # Get restart line in co2.log
[1537]255                PathCO2log=${SUBMIT_DIR}
256                PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
[1316]257           # Get the value of atmosp. pco2 in co2.log
[1537]258                CO2_ppm=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
259            fi
260           
[1237]261        fi
262
[1537]263        if [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
264            # Modify co2_ppm in physiq.def only for historical run
265            LMDZ_sed physiq.def co2_ppm     ${CO2_ppm}
266        fi
[1237]267    fi
[1537]268    # end CARBON_CYCLE
[1237]269
[1538]270    ##-- Set LMDZ_COSP_daily1979=y in section UserChoices in lmdz.card to activate
271    ##   COSP daily output for years 1979 and later (mandatory for historical CMIP5 run).
272    if ([ X"${lmdz_UserChoices_LMDZ_COSP_daily1979}" = X"y" ] &&  [ ${year} -ge 1979 ]) ; then
273        LMDZ_COSP_daily=y
274    fi
[1172]275
[1538]276
[1540]277    ## output.def parameters
[1539]278    #  columns in phys_output_filekeys refer to the filenames given in phys_out_filenames in physiq.def : 
279    #                                            histmth       histday        histhf    histfh3h   histhf3hm   histstn
[1540]280    LMDZ_sed output.def phys_out_filekeys        ${ok_mensuel} ${ok_journe}   ${ok_hf}  ${ok_hf3h} ${ok_hf3hm} ${ok_stn}
281    LMDZ_sed output.def ecrit_ISCCP ${LMDZ_ecrit_ISCCP}
282    LMDZ_sed output.def ok_cosp     ${LMDZ_COSP_OK}
283    LMDZ_sed output.def ok_mensuelCOSP  ${LMDZ_COSP_monthly}
284    LMDZ_sed output.def ok_journeCOSP   ${LMDZ_COSP_daily}
285    LMDZ_sed output.def ok_hfCOSP   ${LMDZ_COSP_hf}
286    LMDZ_sed output.def ok_histNMC  "${LMDZ_NMC_monthly}, ${LMDZ_NMC_daily}, ${LMDZ_NMC_hf}"
[396]287
[911]288    ## gcm.def parameters : no change since gcm.def_${RESOL_ATM_3D} is used and already modified
[396]289
[911]290    ## run.def parameters
291    LMDZ_sed run.def dayref   ${InitDay}
292    LMDZ_sed run.def anneeref ${InitYear}
293    LMDZ_sed run.def calend   ${CalendarTypeForLmdz}
294    LMDZ_sed run.def nday     ${PeriodLengthInDays}
295    LMDZ_sed run.def raz_date ${RAZ_DATE}
296    LMDZ_sed run.def periodav ${LMDZ_periodav}
297    LMDZ_sed run.def adjust   ${LMDZ_adjust}
[396]298
[902]299    ## Read ByPass_hgardfou_teta option in lmdz.card --> divide teta* by 2 if [ $ByPass_hgardfou_teta = 1 ]
300    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta
[1172]301    ByPass_hgardfou_teta=${lmdz_UserChoices_ByPass_hgardfou_teta}
[396]302    if [ ${ByPass_hgardfou_teta} = y ] ; then
303        awk '{ if ($0 ~ /^teta.*=/) {split($0,a,"=") ; print a[1]"="a[2]/2"."} else print $0}' gcm.def > gcm.def.tmp
304        IGCM_sys_Mv gcm.def.tmp gcm.def
305        echo
306        IGCM_debug_Print 1 "ByPass_hgardfou_teta : ^teta*/2 in gcm.def"
307        echo
308        cat gcm.def
309        ByPass_hgardfou_teta=n
[902]310        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta "${ByPass_hgardfou_teta}"
[396]311    fi
312
[902]313    ## Read ByPass_hgardfou_mats option in lmdz.card --> purmats=y 2 if [ $ByPass_hgardfou_mats = 1 ]
314    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats
[1172]315    ByPass_hgardfou_mats=${lmdz_UserChoices_ByPass_hgardfou_mats}
[396]316    if [ ${ByPass_hgardfou_mats} = y ] ; then
317        sed -e "s/^purmats=.*/purmats=y/" gcm.def > gcm.def.tmp
318        IGCM_sys_Mv gcm.def.tmp gcm.def
319        echo
320        IGCM_debug_Print 1 "ByPass_hgardfou_mats : purmats=y in gcm.def"
321        echo
322        cat gcm.def
323        ByPass_hgardfou_mats=n
[902]324        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats "${ByPass_hgardfou_mats}"
[396]325    fi
326
327    if ( ${FirstInitialize} ) ; then
328
329        if ( [ "${config_Restarts_OverRule}" = "n" ] && [ "${config_ATM_Restart}" = "n" ] ); then
330            if [ ${DRYRUN} -le 2 ] ; then
[894]331                ##-- suppression of ozone file construction --
332                cp physiq.def physiq.def.save
333                LMDZ_sed physiq.def read_climoz 0
[396]334                IGCM_sys_Cp ${R_EXE}/create_etat0_limit.e ${RUN_DIR}/.
335                if [ ${DRYRUN} -le 1 ] ; then
[908]336                    ${HOST_MPIRUN_COMMAND} -np 1 ./create_etat0_limit.e
[894]337                    IGCM_sys_Put_Out start.nc    ${R_OUT_ATM_R}/${config_UserChoices_JobName}_${PeriodDateBegin}_start.nc
338                    IGCM_sys_Put_Out startphy.nc ${R_OUT_ATM_R}/${config_UserChoices_JobName}_${PeriodDateBegin}_startphy.nc
[396]339                fi
[894]340                IGCM_sys_Mv physiq.def.save physiq.def
[396]341            else
[908]342                echo "EXECUTION of ${HOST_MPIRUN_COMMAND} -np 1 ./create_etat0_limit.e simulated"
343                echo "EXECUTION of ${HOST_MPIRUN_COMMAND} -np 1 ./create_etat0_limit.e simulated for DRYRUN = " $DRYRUN >> stack
[396]344            fi
345        fi
346
347    fi
348
349    IGCM_debug_PopStack "ATM_Update"
350}
351
352#-----------------------------------
353function ATM_Finalize
354{
355    IGCM_debug_PushStack "ATM_Finalize"
356
[743]357    [ ${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}
[396]358
[1316]359
[1537]360    # Add special treatement for CARBON CYCLE
361    if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] || [ ${lmdz_UserChoices_CARBON_CYCLE} = historical ] ; then
362        typeset CO2SBG_3V CO2SBG CO2MBG CO2SRF CO2LU CO2_ppm CO2_ppm_prec fCO2_ff
[1316]363
[1537]364        # Fossil fuel emission
365        if [ ${lmdz_UserChoices_CARBON_CYCLE} = control ] ; then
366            # For Control, no fossil fuel emission :
367            fCO2_ff=0
368            echo "Fossil Fuel for control run  :" ${fCO2_ff}
369        else
370            # For historical, get the fossile fuel file :
371            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 )
372            echo "Fossil Fuel for historical run  :" ${fCO2_ff}
373        fi
[1316]374
[1537]375        # Get the value of ocean carbon flux
376        CO2MBG=$( ${SUBMIT_DIR}/COMP/lmdz_analyse_pisces_out.awk ocean.output )
377        CO2MBG=$( echo ${CO2MBG} | sed -e "s/ *//" )
378        echo "Ocean carbon flux  :" ${CO2MBG}
[1316]379
[1537]380        # Get the value of land fluxes
381        set +A CO2SBG_3V -- $( ${SUBMIT_DIR}/COMP/lmdz_analyse_stomate_out.awk out_orchidee_0000 )
382        CO2SRF=$( echo ${CO2SBG_3V[0]} | sed -e "s/ *//" )
383        CO2LU=$( echo ${CO2SBG_3V[1]} | sed -e "s/ *//" )
384        CO2SBG=$( echo ${CO2SBG_3V[2]} | sed -e "s/ *//" )
385        echo "Land carbon flux (NEP)         :" ${CO2SRF}
386        echo "LU flux          (FLUC)        :" ${CO2LU}
387        echo "Total Land carbon flux (NBP)   :" ${CO2SBG}
[1316]388
[1537]389        # Previous CO2
390        CO2_ppm_prec=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
391        echo "Previous CO2  :" ${CO2_ppm_prec}
392
393        # Formula
394        CO2_ppm=$( echo "${CO2_ppm_prec} + (${fCO2_ff} + ${CO2MBG} + ${CO2SBG}) / 2.12" | bc -l )
395        echo "New CO2  :" ${CO2_ppm}
396
397        # Save CO2 values in ExeCpuLog variable contents 5 fields
398        echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${CO2_ppm} ${CO2_ppm_prec} ${fCO2_ff} ${CO2MBG} ${CO2SBG} ${CO2LU}" |   \
399            gawk '{printf("  %11d | %15s | %15s | %22.15g | %20.15g | %11.8g | %11.8g | %12.8g | %12.8g \n", \
[1316]400                           $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/co2.log
[1537]401
402    fi
403
[396]404    echo FINALIZE ATM !
405
406    IGCM_debug_PopStack "ATM_Finalize"
407}
Note: See TracBrowser for help on using the repository browser.