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