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 | greg_dat=$( IGCM_date_ConvertFormatToGregorian $PeriodDateBegin ) |
---|
84 | jul_dat=$( IGCM_date_ConvertGregorianDateToJulian $greg_dat ) |
---|
85 | nbjour=$( expr \( $jul_dat \% 1000 \) ) |
---|
86 | echo $jul_dat,$greg_dat, "dayref = ------------------------ ", $nbjour |
---|
87 | |
---|
88 | ## Mise en forme du fichier run.def |
---|
89 | sed -e "s/_dayref_/${nbjour}/" \ |
---|
90 | -e "s/_anneeref_/${InitYear}/" \ |
---|
91 | -e "s/_nday_/${PeriodLengthInDays}/" \ |
---|
92 | -e "s/_raz_date_/${RAZ_DATE}/" \ |
---|
93 | run.def > run.def.tmp |
---|
94 | IGCM_sys_Mv run.def.tmp run.def |
---|
95 | |
---|
96 | if ( ${FirstInitialize} ) ; then |
---|
97 | |
---|
98 | if ( [ "${config_Restarts_OverRule}" = "n" ] && [ "${config_ATM_Restart}" = "n" ] ); then |
---|
99 | if [ ${DRYRUN} -le 2 ] ; then |
---|
100 | IGCM_sys_Cp ${R_EXE}/create_etat0_limit.e ${RUN_DIR}/. |
---|
101 | if [ ${DRYRUN} -le 1 ] ; then |
---|
102 | ./create_etat0_limit.e |
---|
103 | fi |
---|
104 | else |
---|
105 | echo "EXECUTION of ./create_etat0_limit.e simulated" |
---|
106 | echo "EXECUTION of ./create_etat0_limit.e simulated for DRYRUN = " $DRYRUN >> stack |
---|
107 | fi |
---|
108 | fi |
---|
109 | |
---|
110 | fi |
---|
111 | |
---|
112 | IGCM_debug_PopStack "ATM_Update" |
---|
113 | } |
---|
114 | |
---|
115 | #----------------------------------- |
---|
116 | function ATM_Finalize |
---|
117 | { |
---|
118 | IGCM_debug_PushStack "ATM_Finalize" |
---|
119 | |
---|
120 | echo FINALIZE ATM ! |
---|
121 | |
---|
122 | IGCM_debug_PopStack "ATM_Finalize" |
---|
123 | } |
---|