1 | #!/bin/ksh |
---|
2 | |
---|
3 | #D- Driver du script pour INCA |
---|
4 | #----------------------------------------------------------------- |
---|
5 | function 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 | #----------------------------------------------------------------- |
---|
18 | function CHT_Initialize |
---|
19 | { |
---|
20 | IGCM_debug_PushStack "CHT_Initialize" |
---|
21 | |
---|
22 | RESOL_CHT=$( 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_CHT_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' | awk "-F-" '{print $1}') |
---|
26 | echo 'resol chimie', $RESOL_CHT |
---|
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 | |
---|
42 | for frequency in ${config_CHT_WriteFrequency} ; do |
---|
43 | case ${frequency} in |
---|
44 | 1M|1m) freq_output=1mo ;; |
---|
45 | esac |
---|
46 | case ${frequency} in |
---|
47 | 1D|1d) freq_output=1d ;; |
---|
48 | esac |
---|
49 | done |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | IGCM_debug_PopStack "CHT_Initialize" |
---|
54 | } |
---|
55 | |
---|
56 | #----------------------------------------------------------------- |
---|
57 | function CHT_Update |
---|
58 | { |
---|
59 | IGCM_debug_PushStack "CHT_Update" |
---|
60 | |
---|
61 | case ${CHEM} in |
---|
62 | AER) |
---|
63 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml forcage output_freq ${freq_output} |
---|
64 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml aero output_freq ${freq_output} |
---|
65 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml chemistry output_freq ${freq_output} |
---|
66 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml emissions output_freq ${freq_output} |
---|
67 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml species output_freq ${freq_output} |
---|
68 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml dvel output_freq ${freq_output} |
---|
69 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml washout output_freq ${freq_output} |
---|
70 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml reacflux output_freq ${freq_output} |
---|
71 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml invariants output_freq ${freq_output} |
---|
72 | |
---|
73 | if [ X${LMDZ_Physics} = X"AP" ] ; then |
---|
74 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
75 | else |
---|
76 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP |
---|
77 | fi |
---|
78 | ;; |
---|
79 | DUSS) |
---|
80 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml forcage output_freq ${freq_output} |
---|
81 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml aero output_freq ${freq_output} |
---|
82 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml emissions output_freq ${freq_output} |
---|
83 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml species output_freq ${freq_output} |
---|
84 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml vegetation output_freq ${freq_output} |
---|
85 | if [ X${LMDZ_Physics} = X"AP" ] ; then |
---|
86 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
87 | else |
---|
88 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP |
---|
89 | fi |
---|
90 | ;; |
---|
91 | NMHC) |
---|
92 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml reacflux output_freq ${freq_output} |
---|
93 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml emissions output_freq ${freq_output} |
---|
94 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml species output_freq ${freq_output} |
---|
95 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml chemistry output_freq ${freq_output} |
---|
96 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml dvel output_freq ${freq_output} |
---|
97 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml washout output_freq ${freq_output} |
---|
98 | IGCM_comp_modifyDefFile nonblocker run.def config_inca chem |
---|
99 | ;; |
---|
100 | NMHC_AER) |
---|
101 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml forcage output_freq ${freq_output} |
---|
102 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml aero output_freq ${freq_output} |
---|
103 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml species output_freq ${freq_output} |
---|
104 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml chemistry output_freq ${freq_output} |
---|
105 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml emissions output_freq ${freq_output} |
---|
106 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml dvel output_freq ${freq_output} |
---|
107 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml washout output_freq ${freq_output} |
---|
108 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml reacflux output_freq ${freq_output} |
---|
109 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml vegetation output_freq ${freq_output} |
---|
110 | if [ X${LMDZ_Physics} = X"AP" ] ; then |
---|
111 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
112 | else |
---|
113 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP |
---|
114 | fi |
---|
115 | ;; |
---|
116 | GES) |
---|
117 | IGCM_comp_modifyXmlFile nonblocker file_def_inca.xml emissions output_freq ${freq_output} |
---|
118 | IGCM_comp_modifyDefFile nonblocker run.def config_inca chem |
---|
119 | esac |
---|
120 | |
---|
121 | |
---|
122 | |
---|
123 | |
---|
124 | # inca.def : Activate reading of 10m wind in files if LMDZ_10m_winds=n in inca.card |
---|
125 | if [ ! X${inca_UserChoices_LMDZ_10m_winds} = X ] ; then |
---|
126 | IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds ${inca_UserChoices_LMDZ_10m_winds} |
---|
127 | else |
---|
128 | IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds n |
---|
129 | fi |
---|
130 | |
---|
131 | # inca.def : choose write frequency for inca_avgr in inca.card |
---|
132 | if [ ! X${inca_UserChoices_freq_write_chem} = X ] ; then |
---|
133 | IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem ${inca_UserChoices_freq_write_chem} |
---|
134 | else |
---|
135 | IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem 86400 |
---|
136 | fi |
---|
137 | |
---|
138 | #inca.def : choose aerosol effect with feedback variable |
---|
139 | if [ ! X${inca_UserChoices_feedb} = X ] ; then |
---|
140 | IGCM_comp_modifyDefFile nonblocker inca.def feedb ${inca_UserChoices_feedb} |
---|
141 | else |
---|
142 | IGCM_comp_modifyDefFile nonblocker inca.def feedb 0 |
---|
143 | fi |
---|
144 | |
---|
145 | #inca.def : choose coupled model with orchidee |
---|
146 | if [ ! X${inca_UserChoices_CoupOrchInca} = X ]; then |
---|
147 | IGCM_comp_modifyDefFile nonblocker inca.def CoupOrchInca ${inca_UserChoices_CoupOrchInca} |
---|
148 | else |
---|
149 | IGCM_comp_modifyDefFile nonblocker inca.def CoupOrchInca n |
---|
150 | fi |
---|
151 | |
---|
152 | #inca.def : choose sedimentation schema |
---|
153 | if [ ! X${inca_UserChoices_multilayer_sedim} = X ]; then |
---|
154 | IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment ${inca_UserChoices_multilayer_sedim} |
---|
155 | else |
---|
156 | IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment y |
---|
157 | fi |
---|
158 | |
---|
159 | #inca.def : choose calcul interactif des diagnostiques flux chimique ou non |
---|
160 | if [ ! X${inca_UserChoices_calcul_flux} = X ]; then |
---|
161 | IGCM_comp_modifyDefFile nonblocker inca.def calcul_flux ${inca_UserChoices_calcul_flux} |
---|
162 | else |
---|
163 | IGCM_comp_modifyDefFile nonblocker inca.def calcul_flux n |
---|
164 | fi |
---|
165 | |
---|
166 | #inca.def : choose output library |
---|
167 | if [ X${inca_UserChoices_XIOS} = Xy ] ; then |
---|
168 | IGCM_comp_modifyDefFile nonblocker inca.def XIOS_INCA_OK y |
---|
169 | else |
---|
170 | IGCM_comp_modifyDefFile nonblocker inca.def XIOS_INCA_OK n |
---|
171 | fi |
---|
172 | |
---|
173 | if [ X${inca_UserChoices_IOIPSL} = Xy ] ; then |
---|
174 | IGCM_comp_modifyDefFile nonblocker inca.def IOIPSL_INCA_OK y |
---|
175 | else |
---|
176 | IGCM_comp_modifyDefFile nonblocker inca.def IOIPSL_INCA_OK n |
---|
177 | fi |
---|
178 | |
---|
179 | |
---|
180 | if [ X${inca_UserChoices_10m_winds_method} = X ] ; then |
---|
181 | IGCM_comp_modifyDefFile nonblocker inca.def 10m_winds_method threshold |
---|
182 | else |
---|
183 | IGCM_comp_modifyDefFile nonblocker inca.def 10m_winds_method ${inca_UserChoices_10m_winds_method} |
---|
184 | fi |
---|
185 | |
---|
186 | |
---|
187 | |
---|
188 | if [ X${inca_UserChoices_XIOS} = Xy ] ; then |
---|
189 | # Add include of INCA context in iodef.xml |
---|
190 | # In iodef.xml add on next line after "COMPONENT CONTEXT" |
---|
191 | # <context id="inca" src="./context_inca.xml"/> |
---|
192 | echo '<context id="inca" src="./context_inca.xml"/>' > add.tmp |
---|
193 | cp iodef.xml iodef.xml.tmp |
---|
194 | sed -e "/COMPONENT CONTEXT/r add.tmp" \ |
---|
195 | iodef.xml.tmp > iodef.xml |
---|
196 | rm iodef.xml.tmp add.tmp |
---|
197 | fi |
---|
198 | |
---|
199 | # Add LongName as global attribute in XIOS output files (if LongName is not empty) |
---|
200 | if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then |
---|
201 | listfile=$(ls file_def*inca.xml) |
---|
202 | echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp |
---|
203 | for file in ${listfile} |
---|
204 | do |
---|
205 | cp ${file} ${file}.tmp |
---|
206 | sed -e "/<file id/r add.tmp" \ |
---|
207 | ${file}.tmp > ${file} |
---|
208 | rm ${file}.tmp |
---|
209 | done |
---|
210 | rm add.tmp |
---|
211 | fi |
---|
212 | |
---|
213 | IGCM_debug_PopStack "CHT_Update" |
---|
214 | } |
---|
215 | |
---|
216 | #----------------------------------------------------------------- |
---|
217 | function CHT_Finalize |
---|
218 | { |
---|
219 | IGCM_debug_PushStack "CHT_Finalize" |
---|
220 | |
---|
221 | echo FINALIZE CHT !!! |
---|
222 | # |
---|
223 | # IGCM_sys_Mkdir ${R_OUT_EXE} |
---|
224 | # cd ${MODIPSL} |
---|
225 | # tar cf src_${config_UserChoices_JobName}.tar modeles |
---|
226 | # IGCM_sys_Mv src_${config_UserChoices_JobName}.tar ${R_OUT_EXE}/. |
---|
227 | # cd - |
---|
228 | # |
---|
229 | |
---|
230 | IGCM_debug_PopStack "CHT_Finalize" |
---|
231 | } |
---|