source: CONFIG/IPSLCM/IPSLCM5-2/piControl/COMP/lmdz.driver @ 1539

Last change on this file since 1539 was 1539, checked in by jgipsl, 11 years ago

Modifications in working configuration : Update to use new output
parameter names in LMDZ

In physiq.def

  • phys_out_filekeys now replaces OK_mensuel, OK_journe, OK_hf and OK_instan
  • phys_out_filelevels replaces lev_histmth, lev_histday, lev_histhf
  • phys_out_filetimesteps replaces ecrit_mth, ecrit_day, ecrit_ins
  • added phys_out_filenames

In config.card

  • in section ATM, WriteFrequency? can now switch on all files given by phys_out_filekeys and phys_out_filenames. For example, to activate

histmth.nc histday.nc histhf.nc histhf3h.nc and histhf3hm.nc put :
WriteFrequency?=1M 1D HF HF3h HF3hm

In lmdz.driver

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