1 | #!/bin/ksh |
---|
2 | #----------------------------------------------------------------- |
---|
3 | function ATM_Initialize |
---|
4 | { |
---|
5 | IGCM_debug_PushStack "ATM_Initialize" |
---|
6 | |
---|
7 | RESOL_ATM=$( echo $RESOL | awk "-Fx" '{print $2}' ) |
---|
8 | |
---|
9 | case ${RESOL_ATM} in |
---|
10 | LMD7245) BandsResol=72x45x19 ;; |
---|
11 | LMD9671) BandsResol=96x71x19 ;; |
---|
12 | LMD14496) BandsResol=144x96x19 ;; |
---|
13 | LMD144142) BandsResol=144x142x19 ;; |
---|
14 | esac |
---|
15 | |
---|
16 | ##--Frequency purpose .... |
---|
17 | ##-- Initialisation .... |
---|
18 | OK_instan=n |
---|
19 | ##-- |
---|
20 | OK_journe=n |
---|
21 | OK_mensuel=n |
---|
22 | |
---|
23 | case ${config_UserChoices_PeriodLength} in |
---|
24 | 1Y|1y|1M|1m) OK_mensuel=y ;; |
---|
25 | 5D|5d|1D|1d) OK_journe=y ;; |
---|
26 | esac |
---|
27 | |
---|
28 | for frequency in ${config_ATM_WriteFrequency} ; do |
---|
29 | case ${frequency} in |
---|
30 | 5D|5d|1D|1d) OK_journe=y ;; |
---|
31 | esac |
---|
32 | done |
---|
33 | |
---|
34 | ##--Variables used by LMDZ -- |
---|
35 | PAT_INST=$( grep 'OK_instan' ${SUBMIT_DIR}/PARAM/physiq.def ) |
---|
36 | PAT_JOUR=$( grep 'OK_journe' ${SUBMIT_DIR}/PARAM/physiq.def ) |
---|
37 | PAT_MOIS=$( grep 'OK_mensuel' ${SUBMIT_DIR}/PARAM/physiq.def ) |
---|
38 | |
---|
39 | PAT_iphysiq=$( grep 'iphysiq' ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} ) |
---|
40 | PAT_iperiod=$( grep 'iperiod' ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | tail -1) |
---|
41 | PAT_day_step=$( grep 'day_step' ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} ) |
---|
42 | PAT_ecritphy=$( grep 'ecritphy' ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} ) |
---|
43 | |
---|
44 | ##-- This could be define in lmdz.card, inside section [UserChoices] |
---|
45 | ##-- Otherwise we get the value in *.def |
---|
46 | iperiod=$(grep iperiod ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | awk -F= '{print $2}' | tail -1) |
---|
47 | iphysiq=$(grep iphysiq ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | awk -F= '{print $2}') |
---|
48 | # day_step : number of steps per day (multiple of iperiod) |
---|
49 | (( day_step = 48 * iphysiq )) |
---|
50 | |
---|
51 | IGCM_debug_PopStack "ATM_Initialize" |
---|
52 | } |
---|
53 | |
---|
54 | #----------------------------------------------------------------- |
---|
55 | function ATM_Update |
---|
56 | { |
---|
57 | IGCM_debug_PushStack "ATM_Update" |
---|
58 | |
---|
59 | ecritphy=${PeriodLengthInDays} |
---|
60 | |
---|
61 | ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def |
---|
62 | if [ ${CumulPeriod} -eq 1 ] ; then |
---|
63 | RAZ_DATE=1 |
---|
64 | else |
---|
65 | RAZ_DATE=0 |
---|
66 | fi |
---|
67 | |
---|
68 | ## Mise en forme du fichier physiq.def |
---|
69 | sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/" \ |
---|
70 | -e "s/OK_journe=.*/OK_journe=${OK_journe}/" \ |
---|
71 | -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \ |
---|
72 | physiq.def > physiq.def.tmp |
---|
73 | IGCM_sys_Mv physiq.def.tmp physiq.def |
---|
74 | |
---|
75 | ## Mise en forme du fichier gcm.def |
---|
76 | sed -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \ |
---|
77 | -e "s/${PAT_day_step}/day_step=${day_step}/" \ |
---|
78 | -e "s/${PAT_iperiod}/iperiod=${iperiod}/" \ |
---|
79 | -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \ |
---|
80 | gcm.def > gcm.def.tmp |
---|
81 | IGCM_sys_Mv gcm.def.tmp gcm.def |
---|
82 | |
---|
83 | ## Mise en forme du fichier run.def |
---|
84 | sed -e "s/_dayref_/${InitDay}/" \ |
---|
85 | -e "s/_anneeref_/${InitYear}/" \ |
---|
86 | -e "s/_nday_/${PeriodLengthInDays}/" \ |
---|
87 | -e "s/_raz_date_/${RAZ_DATE}/" \ |
---|
88 | run.def > run.def.tmp |
---|
89 | IGCM_sys_Mv run.def.tmp run.def |
---|
90 | |
---|
91 | if ( ${FirstInitialize} ) ; then |
---|
92 | |
---|
93 | if ( [ "${config_Restarts_OverRule}" = "n" ] && [ "${config_ATM_Restart}" = "n" ] ); then |
---|
94 | if [ ${DRYRUN} -le 2 ] ; then |
---|
95 | IGCM_sys_Cp ${R_EXE}/create_etat0_limit.e ${RUN_DIR}/. |
---|
96 | if [ ${DRYRUN} -le 1 ] ; then |
---|
97 | ./create_etat0_limit.e |
---|
98 | fi |
---|
99 | else |
---|
100 | echo "EXECUTION of ./create_etat0_limit.e simulated" |
---|
101 | echo "EXECUTION of ./create_etat0_limit.e simulated for DRYRUN = " $DRYRUN >> stack |
---|
102 | fi |
---|
103 | fi |
---|
104 | |
---|
105 | fi |
---|
106 | |
---|
107 | IGCM_debug_PopStack "ATM_Update" |
---|
108 | } |
---|
109 | |
---|
110 | #----------------------------------- |
---|
111 | function ATM_Finalize |
---|
112 | { |
---|
113 | IGCM_debug_PushStack "ATM_Finalize" |
---|
114 | |
---|
115 | echo FINALIZE ATM ! |
---|
116 | |
---|
117 | IGCM_debug_PopStack "ATM_Finalize" |
---|
118 | } |
---|