source: CONFIG/UNIFORM/v6/IPSLCM6CHT/GENERAL/DRIVER/inca.driver @ 3688

Last change on this file since 3688 was 3688, checked in by acosce, 3 years ago

remove these configuration not use anymore

File size: 15.5 KB
Line 
1#!/bin/ksh
2
3#D- Driver du script pour INCA
4#-----------------------------------------------------------------
5function INCA_sed_replace
6{
7    IGCM_debug_PushStack "INCA_sed_replace"
8
9    sed -e "s/${2}/${3}/" ${1} > ${1}.tmp
10    RET=$?
11    echo "INCA_sed : ${1} ${2} ${3}"
12    \mv ${1}.tmp ${1}
13
14    IGCM_debug_PopStack "INCA_sed_replace"
15    return $RET
16}
17#-----------------------------------------------------------------
18function CHM_Initialize
19{
20    IGCM_debug_PushStack "CHM_Initialize"
21
22    RESOL_CHM=$( echo $RESOL | awk "-Fx" '{print $2}' | awk "-FD" '{print $2}')
23
24    [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19
25    RESOL_CHM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' | awk "-F-" '{print $1}')
26    echo 'resol chimie', $RESOL_CHM
27
28    [ -f ${SUBMIT_DIR}/../.chimie ] && eval $(grep CHEM ${SUBMIT_DIR}/../.chimie) 
29    INCA_sed_replace ${SUBMIT_DIR}/config.card \${CHEM} ${CHEM}
30    echo "INCA Tag : LMDZ-INCA" ${config_UserChoices_TagName}
31
32    ##- LMDZ physics version
33    ##  Read LMDZ_Physics option in lmdz.card, if not present take default value AP (old physics)
34    if [ ! X${lmdz_UserChoices_LMDZ_Physics} = X ] ; then
35        LMDZ_Physics=${lmdz_UserChoices_LMDZ_Physics}
36    else
37        LMDZ_Physics=AP
38    fi
39    echo LMDZ physics version : ${LMDZ_Physics}
40
41    enable1=.FALSE.
42    enable2=.FALSE.
43
44    for frequency in ${config_CHM_WriteFrequency} ; do
45        case ${frequency} in
46            1D|1d) enable1=.TRUE. ;;
47        esac
48        case ${frequency} in
49            1M|1m) enable2=.TRUE. ;;
50        esac
51    done
52
53
54
55    IGCM_debug_PopStack "CHM_Initialize"
56}
57
58#-----------------------------------------------------------------
59function CHM_Update
60{
61    IGCM_debug_PushStack "CHM_Update"
62
63    case ${CHEM} in
64        AER)
65            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   forcage1     enabled ${enable1}
66            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml forcage2     enabled ${enable2}
67            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   aero1        enabled ${enable1}
68            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml aero2        enabled ${enable2}
69            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   chemistry1   enabled ${enable1}
70            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml chemistry2   enabled ${enable2}
71            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   emissions1   enabled ${enable1}
72            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2   enabled ${enable2}
73            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   species1     enabled ${enable1}
74            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2     enabled ${enable2}
75            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   dvel1        enabled ${enable1}
76            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml dvel2        enabled ${enable2}
77            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   washout1     enabled ${enable1}
78            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml washout2     enabled ${enable2}
79            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   reacflux1    enabled ${enable1}
80            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml reacflux2    enabled ${enable2}
81            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml   invariants1  enabled ${enable1}
82            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml invariants2  enabled ${enable2}
83
84            if [ X${LMDZ_Physics} = X"AP" ] ; then
85                IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
86            else
87                IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
88            fi
89        ;;
90        DUSS)
91            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml forcage1     enabled ${enable1}
92            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml aero1        enabled ${enable1}
93            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1   enabled ${enable1}
94            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml species1     enabled ${enable1}
95            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml vegetation1  enabled ${enable1}
96
97            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml forcage2     enabled ${enable2}
98            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml aero2        enabled ${enable2}
99            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2   enabled ${enable2}
100            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2     enabled ${enable2}
101            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml vegetation2  enabled ${enable2}
102
103            if [ X${LMDZ_Physics} = X"AP" ] ; then
104                IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
105            else
106                IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
107            fi
108        ;;
109        NMHC) 
110            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml reacflux1    enabled ${enable1}
111            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1   enabled ${enable1}
112            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml species1     enabled ${enable1}
113            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml chemistry1   enabled ${enable1}
114            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml dvel1        enabled ${enable1}
115            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml washout1     enabled ${enable1}
116
117            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml reacflux2  enabled ${enable2} 
118            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2 enabled ${enable2} 
119            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2   enabled ${enable2} 
120            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml chemistry2 enabled ${enable2} 
121            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml dvel2      enabled ${enable2} 
122            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml washout2   enabled ${enable2} 
123
124            IGCM_comp_modifyDefFile nonblocker run.def config_inca chem
125            ;;
126        NMHC_AER)
127            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml forcage1     enabled ${enable1}
128            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml aero1        enabled ${enable1}
129            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml species1     enabled ${enable1}
130            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml chemistry1   enabled ${enable1}
131            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1   enabled ${enable1}
132            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml dvel1        enabled ${enable1}
133            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml phtrate1     enabled ${enable1}
134            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml washout1     enabled ${enable1}
135            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml reacflux1    enabled ${enable1}
136            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml vegetation1  enabled ${enable1}
137
138            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml forcage2    enabled ${enable2} 
139            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml aero2       enabled ${enable2} 
140            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2    enabled ${enable2} 
141            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml chemistry2  enabled ${enable2} 
142            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2  enabled ${enable2} 
143            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml dvel2       enabled ${enable2} 
144            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml phtrate2    enabled ${enable2} 
145            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml washout2    enabled ${enable2} 
146            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml reacflux2   enabled ${enable2} 
147            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml vegetation2 enabled ${enable2} 
148
149            if [ X${LMDZ_Physics} = X"AP" ] ; then
150                IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
151            else
152                IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
153            fi
154        ;;
155
156        NMHC_AER_S)
157            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml forcage1     enabled ${enable1}
158            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml aero1        enabled ${enable1}
159            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml species1     enabled ${enable1}
160            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml chemistry1   enabled ${enable1}
161            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1   enabled ${enable1}
162            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml dvel1        enabled ${enable1}
163            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml phtrate1     enabled ${enable1}
164            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml washout1     enabled ${enable1}
165            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml reacflux1    enabled ${enable1}
166            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml vegetation1  enabled ${enable1}
167
168            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml forcage2    enabled ${enable2} 
169            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml aero2       enabled ${enable2} 
170            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml species2    enabled ${enable2} 
171            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml chemistry2  enabled ${enable2} 
172            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2  enabled ${enable2} 
173            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml phtrate2    enabled ${enable2} 
174            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml dvel2       enabled ${enable2} 
175            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml washout2    enabled ${enable2} 
176            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml reacflux2   enabled ${enable2} 
177            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml vegetation2 enabled ${enable2} 
178
179            if [ X${LMDZ_Physics} = X"AP" ] ; then
180                IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
181            else
182                IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
183            fi
184        ;;
185        GES)
186            IGCM_comp_modifyXmlFile nonblocker file_def_inca_daily.xml emissions1    enabled ${enable1}
187
188            IGCM_comp_modifyXmlFile nonblocker file_def_inca_monthly.xml emissions2    enabled ${enable2}
189
190            IGCM_comp_modifyDefFile nonblocker run.def config_inca chem
191        esac
192
193
194    # inca.def : Activate reading of 10m wind in files if LMDZ_10m_winds=n in inca.card
195    if [ ! X${inca_UserChoices_LMDZ_10m_winds} = X ] ; then
196        IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds  ${inca_UserChoices_LMDZ_10m_winds}
197    else
198        IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds  n
199    fi
200
201    if [  X${inca_UserChoices_10m_winds_method} = X ] ; then
202    IGCM_comp_modifyDefFile nonblocker inca.def  10m_winds_method  threshold
203    else
204    IGCM_comp_modifyDefFile nonblocker inca.def  10m_winds_method ${inca_UserChoices_10m_winds_method}
205    fi
206
207
208    if [ ! X${inca_UserChoices_wind_parameter} = X ] ; then
209        if [  X${inca_UserChoices_10m_winds_method} = Xthreshold ] ; then
210            IGCM_comp_modifyDefFile nonblocker inca.def  tref ${inca_UserChoices_wind_parameter}
211            IGCM_comp_modifyDefFile nonblocker inca.def  kref DEFAULT
212        else
213            IGCM_comp_modifyDefFile nonblocker inca.def  kref ${inca_UserChoices_wind_parameter}
214            IGCM_comp_modifyDefFile nonblocker inca.def  tref DEFAULT
215        fi
216    else
217            IGCM_comp_modifyDefFile nonblocker inca.def  kref DEFAULT
218            IGCM_comp_modifyDefFile nonblocker inca.def  tref DEFAULT
219    fi
220
221    if [  X${inca_UserChoices_seasalt_corr} = X ] ; then
222    IGCM_comp_modifyDefFile nonblocker inca.def  ss_corr  DEFAULT
223    else
224    IGCM_comp_modifyDefFile nonblocker inca.def  ss_corr ${inca_UserChoices_seasalt_corr}
225    fi
226
227
228
229    # inca.def : choose write frequency for inca_avgr in inca.card
230    if [ ! X${inca_UserChoices_freq_write_chem} = X ] ; then
231        IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem  ${inca_UserChoices_freq_write_chem}
232    else
233        IGCM_comp_modifyDefFile nonblocker inca.def  freq_write_chem  86400
234    fi
235
236    #inca.def : choose aerosol effect with feedback variable
237    if [ ! X${inca_UserChoices_feedb} = X ] ; then
238        IGCM_comp_modifyDefFile nonblocker inca.def  feedb  ${inca_UserChoices_feedb}
239    else
240        IGCM_comp_modifyDefFile nonblocker inca.def feedb  0
241    fi
242   
243    #inca.def : choose coupled model with orchidee 
244    if [ ! X${inca_UserChoices_CoupOrchInca} = X ]; then
245        IGCM_comp_modifyDefFile nonblocker inca.def CoupOrchInca ${inca_UserChoices_CoupOrchInca}
246    else
247        IGCM_comp_modifyDefFile nonblocker inca.def CoupOrchInca n
248    fi
249
250    #inca.def : choose sedimentation schema
251    if [ ! X${inca_UserChoices_multilayer_sedim} = X ]; then
252        IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment ${inca_UserChoices_multilayer_sedim}
253    else
254        IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment y
255    fi
256
257    #inca.def : choose calcul interactif des diagnostiques flux chimique ou non 
258    if [ ! X${inca_UserChoices_calcul_flux} = X ]; then
259        IGCM_comp_modifyDefFile nonblocker inca.def calcul_flux ${inca_UserChoices_calcul_flux}
260    else
261        IGCM_comp_modifyDefFile nonblocker inca.def calcul_flux n
262    fi
263
264    #inca.def : choose aircraft emission
265    if [ ! X${inca_UserChoices_flag_plane} = X ]; then
266        IGCM_comp_modifyDefFile nonblocker inca.def flag_plane ${inca_UserChoices_flag_plane}
267    else
268        IGCM_comp_modifyDefFile nonblocker inca.def flag_plane 0
269    fi
270   
271    #inca.def : choose time interpolation for sflx.nc
272    if [ ! X${inca_UserChoices_emi_interp_time} = X ]; then
273        IGCM_comp_modifyDefFile nonblocker inca.def emi_interp_time ${inca_UserChoices_emi_interp_time}
274    else
275        IGCM_comp_modifyDefFile nonblocker inca.def emi_interp_time 1
276    fi
277
278    #inca.def : choose output library
279    if [  X${inca_UserChoices_XIOS} = Xy ] ; then
280        IGCM_comp_modifyDefFile nonblocker inca.def  XIOS_INCA_OK  y
281    else
282        IGCM_comp_modifyDefFile nonblocker inca.def  XIOS_INCA_OK n
283    fi
284
285    if [  X${inca_UserChoices_IOIPSL} = Xy ] ; then
286        IGCM_comp_modifyDefFile nonblocker inca.def  IOIPSL_INCA_OK  y
287    else
288        IGCM_comp_modifyDefFile nonblocker inca.def  IOIPSL_INCA_OK n
289    fi
290
291
292
293
294    if [ X${inca_UserChoices_XIOS}  = Xy ] ; then
295    # Add include of INCA context in iodef.xml
296    # In iodef.xml add on next line after "COMPONENT CONTEXT"
297    #  <context id="inca" src="./context_inca.xml"/>
298        echo '<context id="inca" src="./context_inca.xml"/>' > add.tmp
299        cp iodef.xml iodef.xml.tmp
300        sed -e "/COMPONENT CONTEXT/r add.tmp" \
301            iodef.xml.tmp > iodef.xml
302        rm iodef.xml.tmp add.tmp
303    fi
304
305    # Add LongName as global attribute in XIOS output files (if LongName is not empty)
306    if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then
307        listfile=$(ls file_def*inca.xml)
308        echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp
309        for file in ${listfile}
310        do
311            cp ${file} ${file}.tmp
312            sed -e "/<file id/r add.tmp" \
313                ${file}.tmp > ${file}
314            rm ${file}.tmp
315        done
316        rm add.tmp
317    fi
318
319    IGCM_debug_PopStack "CHM_Update"
320}
321
322#-----------------------------------------------------------------
323function CHM_Finalize
324{
325    IGCM_debug_PushStack "CHM_Finalize"
326
327    echo FINALIZE CHM !!!
328#
329#    IGCM_sys_Mkdir ${R_OUT_EXE}
330#    cd ${MODIPSL}
331#    tar cf src_${config_UserChoices_JobName}.tar  modeles
332#    IGCM_sys_Mv src_${config_UserChoices_JobName}.tar ${R_OUT_EXE}/.
333#    cd -
334#
335
336    IGCM_debug_PopStack "CHM_Finalize"
337}
Note: See TracBrowser for help on using the repository browser.