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 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 | IGCM_debug_PopStack "CHM_Initialize" |
---|
42 | } |
---|
43 | |
---|
44 | #----------------------------------------------------------------- |
---|
45 | function CHM_Update |
---|
46 | { |
---|
47 | IGCM_debug_PushStack "CHM_Update" |
---|
48 | |
---|
49 | case ${CHEM} in |
---|
50 | AER) |
---|
51 | if [ X${LMDZ_Physics} = X"AP" ] ; then |
---|
52 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
53 | else |
---|
54 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP |
---|
55 | fi |
---|
56 | ;; |
---|
57 | DUSS) |
---|
58 | if [ X${LMDZ_Physics} = X"AP" ] ; then |
---|
59 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
60 | else |
---|
61 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP |
---|
62 | fi |
---|
63 | ;; |
---|
64 | NMHC) |
---|
65 | IGCM_comp_modifyDefFile nonblocker run.def config_inca chem |
---|
66 | ;; |
---|
67 | NMHC_AER) |
---|
68 | if [ X${LMDZ_Physics} = X"AP" ] ; then |
---|
69 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
70 | else |
---|
71 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP |
---|
72 | fi |
---|
73 | ;; |
---|
74 | GES) |
---|
75 | IGCM_comp_modifyDefFile nonblocker run.def config_inca chem |
---|
76 | esac |
---|
77 | |
---|
78 | # inca.def : Activate reading of 10m wind in files if LMDZ_10m_winds=n in inca.card |
---|
79 | if [ ! X${inca_UserChoices_LMDZ_10m_winds} = X ] ; then |
---|
80 | IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds ${inca_UserChoices_LMDZ_10m_winds} |
---|
81 | else |
---|
82 | IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds n |
---|
83 | fi |
---|
84 | |
---|
85 | # inca.def : choose write frequency for inca_avgr in inca.card |
---|
86 | if [ ! X${inca_UserChoices_freq_write_chem} = X ] ; then |
---|
87 | IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem ${inca_UserChoices_freq_write_chem} |
---|
88 | else |
---|
89 | IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem 86400 |
---|
90 | fi |
---|
91 | |
---|
92 | #inca.def : choose aerosol effect with feedback variable |
---|
93 | if [ ! X${inca_UserChoices_feedb} = X ] ; then |
---|
94 | IGCM_comp_modifyDefFile nonblocker inca.def feedb ${inca_UserChoices_feedb} |
---|
95 | else |
---|
96 | IGCM_comp_modifyDefFile nonblocker inca.def feedb 0 |
---|
97 | fi |
---|
98 | |
---|
99 | |
---|
100 | #inca.def : choose sedimentation schema |
---|
101 | if [ ! X${inca_UserChoices_multilayer_sedim} = X ]; then |
---|
102 | IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment ${inca_UserChoices_multilayer_sedim} |
---|
103 | else |
---|
104 | IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment y |
---|
105 | fi |
---|
106 | |
---|
107 | #inca.def : choose output library |
---|
108 | if [ X${inca_UserChoices_XIOS} = Xy ] ; then |
---|
109 | IGCM_comp_modifyDefFile nonblocker inca.def XIOS_INCA_OK y |
---|
110 | else |
---|
111 | IGCM_comp_modifyDefFile nonblocker inca.def XIOS_INCA_OK n |
---|
112 | fi |
---|
113 | |
---|
114 | if [ X${inca_UserChoices_IOIPSL} = Xy ] ; then |
---|
115 | IGCM_comp_modifyDefFile nonblocker inca.def IOIPSL_INCA_OK y |
---|
116 | else |
---|
117 | IGCM_comp_modifyDefFile nonblocker inca.def IOIPSL_INCA_OK n |
---|
118 | fi |
---|
119 | |
---|
120 | |
---|
121 | if [ X${inca_UserChoices_10m_winds_method} = X ] ; then |
---|
122 | IGCM_comp_modifyDefFile nonblocker inca.def 10m_winds_method threshold |
---|
123 | else |
---|
124 | IGCM_comp_modifyDefFile nonblocker inca.def 10m_winds_method ${inca_UserChoices_10m_winds_method} |
---|
125 | fi |
---|
126 | |
---|
127 | |
---|
128 | |
---|
129 | if [ X${inca_UserChoices_XIOS} = Xy ] ; then |
---|
130 | # Add include of INCA context in iodef.xml |
---|
131 | # In iodef.xml add on next line after "COMPONENT CONTEXT" |
---|
132 | # <context id="inca" src="./context_inca.xml"/> |
---|
133 | echo '<context id="inca" src="./context_inca.xml"/>' > add.tmp |
---|
134 | cp iodef.xml iodef.xml.tmp |
---|
135 | sed -e "/COMPONENT CONTEXT/r add.tmp" \ |
---|
136 | iodef.xml.tmp > iodef.xml |
---|
137 | rm iodef.xml.tmp add.tmp |
---|
138 | fi |
---|
139 | |
---|
140 | IGCM_debug_PopStack "CHM_Update" |
---|
141 | } |
---|
142 | |
---|
143 | #----------------------------------------------------------------- |
---|
144 | function CHM_Finalize |
---|
145 | { |
---|
146 | IGCM_debug_PushStack "CHM_Finalize" |
---|
147 | |
---|
148 | echo FINALIZE CHM !!! |
---|
149 | # |
---|
150 | # IGCM_sys_Mkdir ${R_OUT_EXE} |
---|
151 | # cd ${MODIPSL} |
---|
152 | # tar cf src_${config_UserChoices_JobName}.tar modeles |
---|
153 | # IGCM_sys_Mv src_${config_UserChoices_JobName}.tar ${R_OUT_EXE}/. |
---|
154 | # cd - |
---|
155 | # |
---|
156 | |
---|
157 | IGCM_debug_PopStack "CHM_Finalize" |
---|
158 | } |
---|