1 | #- $Id: lmdz.driver 841 2009-12-08 09:48:13Z acosce $ |
---|
2 | #!/bin/ksh |
---|
3 | |
---|
4 | #----------------------------------------------------------------- |
---|
5 | function LMDZ_sed |
---|
6 | { |
---|
7 | IGCM_debug_PushStack "LMDZ_sed" |
---|
8 | |
---|
9 | sed -e "s/^${2}\ *=.*/${2}= ${3}/" ${1} > ${1}.tmp |
---|
10 | RET=$? |
---|
11 | echo "LMDZ_sed : ${1} ${2} ${3}" |
---|
12 | \mv ${1}.tmp ${1} |
---|
13 | |
---|
14 | IGCM_debug_PopStack "LMDZ_sed" |
---|
15 | return $RET |
---|
16 | } |
---|
17 | |
---|
18 | #----------------------------------------------------------------- |
---|
19 | |
---|
20 | function ATM_Initialize |
---|
21 | { |
---|
22 | IGCM_debug_PushStack "ATM_Initialize" |
---|
23 | |
---|
24 | RESOL_ATM=$( echo $RESOL | awk "-Fx" '{print $2}' ) |
---|
25 | case ${RESOL_ATM} in |
---|
26 | LMD7245) BandsResol=72x45x19 ;; |
---|
27 | LMD9671) BandsResol=96x71x19 ;; |
---|
28 | LMD9672) BandsResol=96x72x19 ;; |
---|
29 | LMD9695) BandsResol=96x95x19 ;; |
---|
30 | LMD14496) BandsResol=144x96x19 ;; |
---|
31 | LMD144142) BandsResol=144x142x19 ;; |
---|
32 | esac |
---|
33 | |
---|
34 | |
---|
35 | ##-- Calendar type for LMDZ |
---|
36 | case ${config_UserChoices_CalendarType} in |
---|
37 | leap|gregorian) |
---|
38 | CalendarTypeForLmdz=earth_366d;; |
---|
39 | noleap) |
---|
40 | CalendarTypeForLmdz=earth_365d;; |
---|
41 | 360d) |
---|
42 | CalendarTypeForLmdz=earth_360d;; |
---|
43 | *) |
---|
44 | CalendarTypeForLmdz=earth_360d |
---|
45 | esac |
---|
46 | |
---|
47 | ##- Default number of processor for lmdz |
---|
48 | NUM_PROC_ATM=1 |
---|
49 | if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then |
---|
50 | NUM_PROC_ATM=${BATCH_NUM_PROC_TOT} |
---|
51 | fi |
---|
52 | |
---|
53 | |
---|
54 | ##-- Output frequency purpose .... |
---|
55 | ##-- Initialisation .... |
---|
56 | ok_mensuel=y |
---|
57 | ok_journe=n |
---|
58 | ok_hf=n |
---|
59 | ok_hf3h=n |
---|
60 | ok_hf3hm=n |
---|
61 | ok_stn=n |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | ## Read LMDZ_NbPeriod_adjust option in lmdz.card |
---|
66 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_NbPeriod_adjust |
---|
67 | eval LMDZ_NbPeriod_adjust=\${lmdz_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1 |
---|
68 | |
---|
69 | if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then |
---|
70 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_Bands_file_name |
---|
71 | eval LMDZ_Bands_file_name=\${lmdz_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1 |
---|
72 | fi |
---|
73 | |
---|
74 | |
---|
75 | IGCM_debug_PopStack "ATM_Initialize" |
---|
76 | } |
---|
77 | |
---|
78 | #----------------------------------------------------------------- |
---|
79 | function ATM_Update |
---|
80 | { |
---|
81 | IGCM_debug_PushStack "ATM_Update" |
---|
82 | |
---|
83 | ecritphy=${PeriodLengthInDays} |
---|
84 | LMDZ_ecrit_ISCCP=${PeriodLengthInDays}. |
---|
85 | LMDZ_periodav=${PeriodLengthInDays}. |
---|
86 | |
---|
87 | ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def |
---|
88 | if [ ${CumulPeriod} -eq 1 ] ; then |
---|
89 | RAZ_DATE=1 |
---|
90 | else |
---|
91 | RAZ_DATE=0 |
---|
92 | fi |
---|
93 | |
---|
94 | |
---|
95 | ## algo : For CumulPeriod=1 ; |
---|
96 | ## IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix |
---|
97 | ## ELSE LMDZ_adjust=y ; save Bands file on file server ; |
---|
98 | ## For CumulPeriod=2 to LMDZ_NbPeriod_adjust ; Get Bands file from server (CumulPeriod-1) ; LMDZ_adjust=y ; save Bands file on file server ; |
---|
99 | ## For CumulPeriod > LMDZ_NbPeriod_adjust ; LMDZ_adjust=n ; Get Bands file from server (CumulPeriod=LMDZ_NbPeriod_adjust 0 to force it) ; Use Bands ; |
---|
100 | |
---|
101 | if [ ${CumulPeriod} -eq 1 ] ; then |
---|
102 | if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then |
---|
103 | IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat |
---|
104 | IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0 |
---|
105 | IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0" |
---|
106 | IGCM_sys_Chmod u+w Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat |
---|
107 | fi |
---|
108 | fi |
---|
109 | |
---|
110 | LMDZ_adjust=n |
---|
111 | [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y |
---|
112 | |
---|
113 | RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart |
---|
114 | [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) |
---|
115 | |
---|
116 | [ ${CumulPeriod} -gt 1 ] && ( IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat; IGCM_sys_Chmod u+w Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ) |
---|
117 | |
---|
118 | |
---|
119 | ## physiq.def parameters modified from initial physiq.def |
---|
120 | # columns in phys_output_filekeys refer to the filenames given in phys_out_filenames in output.def : |
---|
121 | # histmth histday histhf histfh3h histhf3hm histstn |
---|
122 | LMDZ_sed physiq.def phys_out_filekeys "${ok_mensuel} ${ok_journe} ${ok_hf} ${ok_hf3h} ${ok_hf3hm} ${ok_stn}" |
---|
123 | LMDZ_sed physiq.def ecrit_ISCCP ${LMDZ_ecrit_ISCCP} |
---|
124 | |
---|
125 | if [ ! X${lmdz_UserChoices_ok_guide} = X ] ; then |
---|
126 | LMDZ_sed guide.def ok_guide ${lmdz_UserChoices_ok_guide} |
---|
127 | fi |
---|
128 | |
---|
129 | ## run.def parameters |
---|
130 | LMDZ_sed run.def dayref ${InitDay} |
---|
131 | LMDZ_sed run.def anneeref ${InitYear} |
---|
132 | LMDZ_sed run.def calend ${CalendarTypeForLmdz} |
---|
133 | LMDZ_sed run.def nday ${PeriodLengthInDays} |
---|
134 | LMDZ_sed run.def raz_date ${RAZ_DATE} |
---|
135 | LMDZ_sed run.def periodav ${LMDZ_periodav} |
---|
136 | LMDZ_sed run.def adjust ${LMDZ_adjust} |
---|
137 | |
---|
138 | ## Other specific parameters to this experience |
---|
139 | if [ ! X${lmdz_UserChoices_aer_type} = X ] ; then |
---|
140 | LMDZ_sed physiq.def aer_type ${lmdz_UserChoices_aer_type} |
---|
141 | fi |
---|
142 | if [ ! X${lmdz_UserChoices_pmagic} = X ] ; then |
---|
143 | LMDZ_sed physiq.def pmagic ${lmdz_UserChoices_pmagic} |
---|
144 | fi |
---|
145 | |
---|
146 | IGCM_debug_PopStack "ATM_Update" |
---|
147 | } |
---|
148 | |
---|
149 | #----------------------------------- |
---|
150 | function ATM_Finalize |
---|
151 | { |
---|
152 | IGCM_debug_PushStack "ATM_Finalize" |
---|
153 | |
---|
154 | [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${CumulPeriod} |
---|
155 | echo FINALIZE ATM ! |
---|
156 | |
---|
157 | IGCM_debug_PopStack "ATM_Finalize" |
---|
158 | } |
---|