source: CONFIG/LMDZOR/branches/LMDZOR_v4/LMDZOR/COMP/lmdz.driver @ 1512

Last change on this file since 1512 was 1512, checked in by jgipsl, 13 years ago
  • Added switch between old and new physics in LMDZ :

In lmdz.card, put LMDZ_Physics=AP for old physics or LMDZ_Physics=NPv3.0
to new physics. If LMDZ_Physics is not present in lmdz.card, default
value AP will be used. NB : new physics is still under work and the
parameters may change.

Added suffix _AP for old physiq.def files
Added physiq.def_L39_NPv3.0 : the beginning of this file correspond to
config.def and the end to physiq.def_L39_NPv3.0 in IPSLCM5B
configuration

  • Changed to ok_ade=ok_aie=y for very basse resolution 32x24x11 : the aerososls for Historical run now available at this resolution.
File size: 10.3 KB
Line 
1
2# $Id$
3#
4#!/bin/ksh
5#-----------------------------------------------------------------
6function LMDZ_sed
7{
8    IGCM_debug_PushStack "LMDZ_sed"
9
10    sed -e "s/^${2}\ *=.*/${2}= ${3}/" ${1} > ${1}.tmp
11    RET=$?
12    echo "LMDZ_sed : ${1} ${2} ${3}"
13    \mv ${1}.tmp ${1}
14
15    IGCM_debug_PopStack "LMDZ_sed"
16    return $RET
17}
18
19function ATM_Initialize
20{
21    IGCM_debug_PushStack "ATM_Initialize"
22
23    RESOL_ATM=$( echo $RESOL | awk "-F-L" '{print $1}')
24
25    [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19
26
27    RESOL_ATM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' | awk "-F-" '{print $1}')
28
29    ##-- Calendar type for LMDZ
30    case ${config_UserChoices_CalendarType} in
31        leap|gregorian)
32            CalendarTypeForLmdz=earth_366d;;
33        noleap)
34            CalendarTypeForLmdz=earth_365d;;
35        360d)
36            CalendarTypeForLmdz=earth_360d;;
37        *)
38            CalendarTypeForLmdz=earth_360d
39    esac
40
41
42       
43    ##- LMDZ physics version
44    ##  Read LMDZ_Physics option in lmdz.card, if not present take default value AP (old physics)
45    if [ ! X${lmdz_UserChoices_LMDZ_Physics} = X ] ; then
46        LMDZ_Physics=${lmdz_UserChoices_LMDZ_Physics}
47    else
48        LMDZ_Physics=AP
49    fi
50    echo LMDZ physics version : ${LMDZ_Physics}
51
52
53
54    ##- Create_etat0_limit version
55    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices CREATE
56    CREATE=${lmdz_UserChoices_CREATE}
57    echo create_etat0_limit version : ${CREATE}
58
59    ##- Default number of processor for lmdz
60    NUM_PROC_ATM=4
61    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
62        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
63    fi
64 
65    ##--Frequency purpose ....
66    ##--  Initialisation  ....
67    OK_instan=n
68    OK_journe=n
69    OK_mensuel=n
70    ok_hf=n
71    OK_les=y
72
73    case ${config_UserChoices_PeriodLength} in
74        1Y|1y|1M|1m) OK_mensuel=y ;;
75        5D|5d|1D|1d) OK_journe=y ;;
76    esac
77
78    for frequency in ${config_ATM_WriteFrequency} ; do
79        case ${frequency} in
80            5D|5d|1D|1d) OK_journe=y ;;
81        esac
82        case ${frequency} in
83            HF|hf) 
84                ok_hf=y
85                OK_instan=y
86                ;;
87        esac
88    done
89
90    ## Read LMDZ_NbPeriod_adjust option in lmdz.card
91    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_NbPeriod_adjust
92    eval LMDZ_NbPeriod_adjust=\${lmdz_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
93
94    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
95        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_Bands_file_name
96        eval LMDZ_Bands_file_name=\${lmdz_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
97    fi
98
99    ##  Read LMDZ_COSP_monthly  LMDZ_COSP_daily and LMDZ_COSP_hf in lmdz.card
100    eval LMDZ_COSP_OK=\${lmdz_UserChoices_LMDZ_COSP_OK} > /dev/null 2>&1
101    eval LMDZ_COSP_monthly=\${lmdz_UserChoices_LMDZ_COSP_monthly} > /dev/null 2>&1
102    eval LMDZ_COSP_daily=\${lmdz_UserChoices_LMDZ_COSP_daily} > /dev/null 2>&1
103    eval LMDZ_COSP_hf=\${lmdz_UserChoices_LMDZ_COSP_hf} > /dev/null 2>&1
104
105    ##  Read LMDZ_NMC_monthly  LMDZ_NMC_daily and LMDZ_NMC_hf in lmdz.card
106    eval LMDZ_NMC_monthly=\${lmdz_UserChoices_LMDZ_NMC_monthly} > /dev/null 2>&1
107    eval LMDZ_NMC_daily=\${lmdz_UserChoices_LMDZ_NMC_daily} > /dev/null 2>&1
108    eval LMDZ_NMC_hf=\${lmdz_UserChoices_LMDZ_NMC_hf} > /dev/null 2>&1
109
110    IGCM_debug_PopStack "ATM_Initialize"
111}
112
113#-----------------------------------------------------------------
114function ATM_Update
115{
116    IGCM_debug_PushStack "ATM_Update"
117
118    case ${config_UserChoices_PeriodLength} in
119        *Y|*y) 
120               LMDZ_ecrit_mth=30.
121               LMDZ_ecrit_ISCCP=30.
122               LMDZ_periodav=30.
123               if [ "${config_UserChoices_CalendarType}" != "360d" ] ; then
124                  echo Change calendartype in config.card. PeriodLength=1Y allowed only for CalendarType=360d
125                  exit
126               fi
127               ;;
128        *)
129               LMDZ_ecrit_mth=${PeriodLengthInDays}.
130               LMDZ_ecrit_ISCCP=${PeriodLengthInDays}.
131               LMDZ_periodav=${PeriodLengthInDays}.
132               ;;
133    esac
134
135    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
136    if [ ${CumulPeriod} -eq 1 ] ; then
137        RAZ_DATE=1
138    else
139        RAZ_DATE=0
140    fi
141
142
143    ## algo : For CumulPeriod=1 ;
144    ##        IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix
145    ##        ELSE LMDZ_adjust=y ; save Bands file on file server ;
146    ##        For CumulPeriod=2 to LMDZ_NbPeriod_adjust ; Get Bands file from server (CumulPeriod-1) ; LMDZ_adjust=y ; save Bands file on file server ;
147    ##        For CumulPeriod > LMDZ_NbPeriod_adjust ; LMDZ_adjust=n ; Get Bands file from server (CumulPeriod=LMDZ_NbPeriod_adjust 0 to force it) ; Use Bands ;
148
149    if [ ${CumulPeriod} -eq 1 ] ; then
150        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
151            if [ ! X${LMDZ_Bands_file_name} = X] ; then
152                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
153                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
154                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"
155            fi
156        fi
157    fi
158
159    LMDZ_adjust=n
160    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
161
162    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
163    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
164
165    [ ${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 )
166
167    ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z}
168    LMDZ_sed physiq.def phys_out_filekeys "${OK_mensuel} ${OK_journe} ${ok_hf} ${OK_instan} ${OK_les}"
169    LMDZ_sed physiq.def ecrit_mth   ${LMDZ_ecrit_mth}
170    LMDZ_sed physiq.def ecrit_ISCCP ${LMDZ_ecrit_ISCCP}
171    LMDZ_sed physiq.def ok_cosp     ${LMDZ_COSP_OK}
172    LMDZ_sed physiq.def ok_mensuelCOSP  ${LMDZ_COSP_monthly}
173    LMDZ_sed physiq.def ok_journeCOSP   ${LMDZ_COSP_daily}
174    LMDZ_sed physiq.def ok_hfCOSP   ${LMDZ_COSP_hf}
175    LMDZ_sed physiq.def ok_histNMC  "${LMDZ_NMC_monthly}, ${LMDZ_NMC_daily}, ${LMDZ_NMC_hf}"
176
177    ##-- GHG forcing for the current year if forcing file is availible
178    if [ -f SOLARANDVOLCANOES.txt ] ; then
179        IPCC_SOLAR=`grep Annee_${year} SOLARANDVOLCANOES.txt | awk -F= '{print $2}'`
180        LMDZ_sed physiq.def solaire     ${IPCC_SOLAR}
181    fi
182    if [ -f CO2.txt ] ; then
183        IPCC_CO2=`grep Annee_${year} CO2.txt | awk -F= '{print $2}'`
184        LMDZ_sed physiq.def co2_ppm     ${IPCC_CO2}
185    fi
186    if [ -f CH4.txt ] ; then
187        IPCC_CH4=`grep Annee_${year} CH4.txt | awk -F= '{print $2}'`
188        LMDZ_sed physiq.def CH4_ppb     ${IPCC_CH4}
189    fi
190    if [ -f N2O.txt ] ; then
191        IPCC_N2O=`grep Annee_${year} N2O.txt | awk -F= '{print $2}'`
192        LMDZ_sed physiq.def N2O_ppb     ${IPCC_N2O}
193    fi
194    if [ -f CFC11.txt ] ; then
195        IPCC_CFC11=`grep Annee_${year} CFC11.txt | awk -F= '{print $2}'`
196        LMDZ_sed physiq.def CFC11_ppt   ${IPCC_CFC11}
197    fi
198    if [ -f CFC12.txt ] ; then
199        IPCC_CFC12=`grep Annee_${year} CFC12.txt | awk -F= '{print $2}'`
200        LMDZ_sed physiq.def CFC12_ppt   ${IPCC_CFC12}
201    fi
202
203    ## Other specific parameters to this experience
204    if [ ! X${lmdz_UserChoices_aer_type} = X ] ; then
205        LMDZ_sed physiq.def aer_type ${lmdz_UserChoices_aer_type}
206    fi
207    if [ ! X${lmdz_UserChoices_pmagic} = X ] ; then
208        LMDZ_sed physiq.def pmagic   ${lmdz_UserChoices_pmagic}
209    fi
210
211    if [ ! X${lmdz_UserChoices_ok_guide} = X ] ; then
212        LMDZ_sed guide.def ok_guide  ${lmdz_UserChoices_ok_guide}
213    fi
214
215    ## gcm.def parameters :
216    # Modification only for new physics
217    if [ X${LMDZ_Physics} = X"NPv3.0" ] ; then
218        LMDZ_sed gcm.def iphysiq     5
219    fi
220
221    ## run.def parameters
222    LMDZ_sed run.def dayref   ${InitDay}
223    LMDZ_sed run.def anneeref ${InitYear}
224    LMDZ_sed run.def calend   ${CalendarTypeForLmdz}
225    LMDZ_sed run.def nday     ${PeriodLengthInDays}
226    LMDZ_sed run.def raz_date ${RAZ_DATE}
227    LMDZ_sed run.def periodav ${LMDZ_periodav}
228    LMDZ_sed run.def adjust   ${LMDZ_adjust}
229
230# No filtre fft in case of zoom, 280x280x39-ZAf contains zoom
231    if [ ${RESOL_ATM_3D} = "280x280x39-ZAf" ] || [ ${RESOL_ATM_3D} = "360x180x19-ZIn" ] ; then
232         LMDZ_sed run.def use_filtre_fft n
233    fi
234
235    ## Read ByPass_hgardfou_teta option in lmdz.card --> divide teta* by 2 if [ $ByPass_hgardfou_teta = 1 ]
236    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta
237    eval ByPass_hgardfou_teta=\${lmdz_UserChoices_ByPass_hgardfou_teta} > /dev/null 2>&1
238    if [ ${ByPass_hgardfou_teta} = y ] ; then
239        awk '{ if ($0 ~ /^teta.*=/) {split($0,a,"=") ; print a[1]"="a[2]/2"."} else print $0}' gcm.def > gcm.def.tmp
240        IGCM_sys_Mv gcm.def.tmp gcm.def
241        echo
242        IGCM_debug_Print 1 "ByPass_hgardfou_teta : ^teta*/2 in gcm.def"
243        echo
244        cat gcm.def
245        ByPass_hgardfou_teta=n
246        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta "${ByPass_hgardfou_teta}"
247    fi
248
249    ## Read ByPass_hgardfou_mats option in lmdz.card --> purmats=y 2 if [ $ByPass_hgardfou_mats = 1 ]
250    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats
251    eval ByPass_hgardfou_mats=\${lmdz_UserChoices_ByPass_hgardfou_mats} > /dev/null 2>&1
252    if [ ${ByPass_hgardfou_mats} = y ] ; then
253        sed -e "s/^purmats=.*/purmats=y/" gcm.def > gcm.def.tmp
254        IGCM_sys_Mv gcm.def.tmp gcm.def
255        echo
256        IGCM_debug_Print 1 "ByPass_hgardfou_mats : purmats=y in gcm.def"
257        echo
258        cat gcm.def
259        ByPass_hgardfou_mats=n
260        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats "${ByPass_hgardfou_mats}"
261    fi
262
263    IGCM_debug_PopStack "ATM_Update"
264}
265
266#-----------------------------------
267function ATM_Finalize
268{
269    IGCM_debug_PushStack "ATM_Finalize"
270
271    [ ${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}
272
273    echo FINALIZE ATM !
274
275    IGCM_debug_PopStack "ATM_Finalize"
276}
Note: See TracBrowser for help on using the repository browser.